skills/backend/api-engineer/SKILL.md
API Engineer
npx skillsauth add harshahosur81/ag-opencode-skills api-engineerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Incoming Dependencies (You cannot start until):
Outgoing Handshakes (You must sync before building):
Definition of Done (You cannot merge until):
You MUST complete each phase before proceeding to the next.
BEFORE writing API endpoints:
Schema Design
API Contract Design (API First)
/v1/. Breaking changes are expensive later.Capacity Planning
Beyond REST:
Choosing the Right API Pattern | Pattern | Use When | Don't Use When | Complexity | |---------|----------|----------------|------------| | REST | Public APIs, CRUD operations | Complex data aggregation | Low | | GraphQL | Mobile clients, flexible queries | Simple CRUD | Medium | | tRPC | TypeScript monorepos | Polyglot clients | Low | | gRPC | Microservice mesh, high throughput | Browser clients (needs proxy) | High | | WebSockets | Real-time bidirectional | Request-response pattern | Medium | | SSE | Server push, one-way streams | Bidirectional communication | Low |
GraphQL Considerations
tRPC (Type-Safe RPC)
// Server
const appRouter = t.router({
getUser: t.procedure.input(z.number()).query(({ input }) => db.user.find(input))
});
// Client (auto-complete!)
const user = await trpc.getUser.query(123);
gRPC for Internal Services
Logic ensuring integrity:
Authentication & Authorization
Business Logic Isolation
Defensive Coding
Optimizing the flow:
Database Query Optimization
EXPLAIN ANALYZE to check query cost.Caching Strategy
Asynchronous Processing
When you have multiple services:
Event Sourcing
// Instead of: UPDATE users SET balance = 100
// Store: UserDepositedMoney(userId, amount, timestamp)
CQRS (Command Query Responsibility Segregation)
Saga Pattern (Distributed Transactions)
Outbox Pattern (Reliable Events)
Keeping the lights on:
Structured Logging
{ "userId": 123, "error": "db_timeout" }.Health Checks & Metrics
/health endpoints for Load Balancers.Documentation
If you catch yourself thinking:
ALL of these mean: STOP. Return to Phase 1.
| Phase | Key Activities | Success Criteria | |-------|---------------|------------------| | 1. Design | ERD, OpenAPI, Versioning | Schema defined, Contract agreed | | 2. Logic | Auth, Validation, Transactions | Secure, atomic operations | | 3. Scale | Caching, Indexing, Queues | p99 Latency under SLA | | 4. Ops | Logging, Metrics, Docs | Observable & Maintainable |
-- B-tree index (default, equality/range)
CREATE INDEX idx_user_email ON users(email);
-- Covering index (includes SELECT columns)
CREATE INDEX idx_order_user_total ON orders(user_id) INCLUDE (total, created_at);
-- Partial index (filtered)
CREATE INDEX idx_active_users ON users(email) WHERE active = true;
-- GIN index (arrays, JSON, full-text)
CREATE INDEX idx_tags ON posts USING GIN(tags);
EXPLAIN ANALYZE on all querieswork_mem for complex queries-- Vector similarity search (AI embeddings)
CREATE EXTENSION vector;
SELECT * FROM documents ORDER BY embedding <=> '[0.1, 0.2, ...]' LIMIT 10;
-- JSON operations
SELECT data->>'name' FROM users WHERE data @> '{"active": true}';
-- Generated columns
ALTER TABLE orders ADD COLUMN total_with_tax DECIMAL GENERATED ALWAYS AS (total * 1.1) STORED;
devops
Optimize vector index performance for latency, recall, and memory. Use when tuning HNSW parameters, selecting quantization strategies, or scaling vector search infrastructure.
data-ai
Expert in vector databases, embedding strategies, and semantic search implementation. Masters Pinecone, Weaviate, Qdrant, Milvus, and pgvector for RAG applications, recommendation systems, and similar
development
Implement efficient similarity search with vector databases. Use when building semantic search, implementing nearest neighbor queries, or optimizing retrieval performance.
development
Expert web researcher using advanced search techniques and synthesis. Masters search operators, result filtering, and multi-source verification. Handles competitive analysis and fact-checking. Use PROACTIVELY for deep research, information gathering, or trend analysis.