Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Designs and implements backend systems including REST APIs, microservices, database architectures, authentication flows, and security hardening. Use when the user asks to "design REST APIs", "optimize database queries", "implement authentication", "build microservices", "review backend code", "set up GraphQL", "handle database migrations", or "load test APIs". Covers Node.js/Express/Fastify development, PostgreSQL optimization, API security, and backend architecture patterns.
.claude/skills/alirezarezvani-senior-backend/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 1346% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 145% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 142% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 318% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 8% | 0% |
Backend development patterns, API design, database optimization, and security practices.
bash# Generate API routes from OpenAPI spec python scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/ # Analyze database schema and generate migrations python scripts/database_migration_tool.py --connection postgres://localhost/mydb --analyze # Load test an API endpoint python scripts/api_load_tester.py https://api.example.com/users --concurrency 50 --duration 30
Generates API route handlers, middleware, and OpenAPI specifications from schema definitions.
Input: OpenAPI spec (YAML/JSON) or database schema Output: Route handlers, validation middleware, TypeScript types
Usage:
bash# Generate Express routes from OpenAPI spec python scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/ # Output: Generated 12 route handlers, validation middleware, and TypeScript types # Generate from database schema python scripts/api_scaffolder.py --from-db postgres://localhost/mydb --output src/routes/ # Generate OpenAPI spec from existing routes python scripts/api_scaffolder.py src/routes/ --generate-spec --output openapi.yaml
Supported Frameworks:
--framework express)--framework fastify)--framework koa)Analyzes database schemas, detects changes, and generates migration files with rollback support.
Input: Database connection string or schema files Output: Migration files, schema diff report, optimization suggestions
Usage:
bash# Analyze current schema and suggest optimizations python scripts/database_migration_tool.py --connection postgres://localhost/mydb --analyze # Output: Missing indexes, N+1 query risks, and suggested migration files # Generate migration from schema diff python scripts/database_migration_tool.py --connection postgres://localhost/mydb \ --compare schema/v2.sql --output migrations/ # Dry-run a migration python scripts/database_migration_tool.py --connection postgres://localhost/mydb \ --migrate migrations/20240115_add_user_indexes.sql --dry-run
Performs HTTP load testing with configurable concurrency, measuring latency percentiles and throughput.
Input: API endpoint URL and test configuration Output: Performance report with latency distribution, error rates, throughput metrics
Usage:
bash# Basic load test python scripts/api_load_tester.py https://api.example.com/users --concurrency 50 --duration 30 # Output: Throughput (req/sec), latency percentiles (P50/P95/P99), error counts, and scaling recommendations # Test with custom headers and body python scripts/api_load_tester.py https://api.example.com/orders \ --method POST \ --header "Authorization: Bearer token123" \ --body '{"product_id": 1, "quantity": 2}' \ --concurrency 100 \ --duration 60 # Compare two endpoints python scripts/api_load_tester.py https://api.example.com/v1/users https://api.example.com/v2/users \ --compare --concurrency 50 --duration 30
Use when designing a new API or refactoring existing endpoints.
Step 1: Define resources and operations
yaml# openapi.yaml openapi: 3.0.3 info: title: User Service API version: 1.0.0 paths: /users: get: summary: List users parameters: - name: "limit" in: query schema: type: integer default: 20 post: summary: Create user requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateUser'
Step 2: Generate route scaffolding
bashpython scripts/api_scaffolder.py openapi.yaml --framework express --output src/routes/
Step 3: Implement business logic
typescript// src/routes/users.ts (generated, then customized) export const createUser = async (req: Request, res: Response) => { const { email, name } = req.body; // Add business logic const user = await userService.create({ email, name }); res.status(201).json(user); };
Step 4: Add validation middleware
bash# Validation is auto-generated from OpenAPI schema # src/middleware/validators.ts includes: # - Request body validation # - Query parameter validation # - Path parameter validation
Step 5: Generate updated OpenAPI spec
bashpython scripts/api_scaffolder.py src/routes/ --generate-spec --output openapi.yaml
Use when queries are slow or database performance needs improvement.
Step 1: Analyze current performance
bashpython scripts/database_migration_tool.py --connection $DATABASE_URL --analyze
Step 2: Identify slow queries
sql-- Check query execution plans EXPLAIN ANALYZE SELECT * FROM orders WHERE user_id = 123 ORDER BY created_at DESC LIMIT 10; -- Look for: Seq Scan (bad), Index Scan (good)
Step 3: Generate index migrations
bashpython scripts/database_migration_tool.py --connection $DATABASE_URL \ --suggest-indexes --output migrations/
Step 4: Test migration (dry-run)
bashpython scripts/database_migration_tool.py --connection $DATABASE_URL \ --migrate migrations/add_indexes.sql --dry-run
Step 5: Apply and verify
bash# Apply migration python scripts/database_migration_tool.py --connection $DATABASE_URL \ --migrate migrations/add_indexes.sql # Verify improvement python scripts/database_migration_tool.py --connection $DATABASE_URL --analyze
Use when preparing an API for production or after a security review.
Step 1: Review authentication setup
typescript// Verify JWT configuration const jwtConfig = { secret: process.env.JWT_SECRET, // Must be from env, never hardcoded expiresIn: '1h', // Short-lived tokens algorithm: 'RS256' // Prefer asymmetric };
Step 2: Add rate limiting
typescriptimport rateLimit from 'express-rate-limit'; const apiLimiter = rateLimit({ windowMs: 15 * 60 * 1000, // 15 minutes max: 100, // 100 requests per window standardHeaders: true, legacyHeaders: false, }); app.use('/api/', apiLimiter);
Step 3: Validate all inputs
typescriptimport { z } from 'zod'; const CreateUserSchema = z.object({ email: z.string().email().max(255), name: z.string().min(1).max(100), age: z.number().int().positive().optional() }); // Use in route handler const data = CreateUserSchema.parse(req.body);
Step 4: Load test with attack patterns
bash# Test rate limiting python scripts/api_load_tester.py https://api.example.com/login \ --concurrency 200 --duration 10 --expect-rate-limit # Test input validation python scripts/api_load_tester.py https://api.example.com/users \ --method POST \ --body '{"email": "not-an-email"}' \ --expect-status 400
Step 5: Review security headers
typescriptimport helmet from 'helmet'; app.use(helmet({ contentSecurityPolicy: true, crossOriginEmbedderPolicy: true, crossOriginOpenerPolicy: true, crossOriginResourcePolicy: true, hsts: { maxAge: 31536000, includeSubDomains: true }, }));
| File | Contains | Use When | |------|----------|----------| | references/api_design_patterns.md | REST vs GraphQL, versioning, error handling, pagination | Designing new APIs | | references/database_optimization_guide.md | Indexing strategies, query optimization, N+1 solutions | Fixing slow queries | | references/backend_security_practices.md | OWASP Top 10, auth patterns, input validation | Security hardening |
json{ "data": { "id": 1, "name": "John" }, "meta": { "requestId": "abc-123" } }
json{ "error": { "code": "VALIDATION_ERROR", "message": "Invalid email format", "details": [{ "field": "email", "message": "must be valid email" }] }, "meta": { "requestId": "abc-123" } }
| Code | Use Case | |------|----------| | 200 | Success (GET, PUT, PATCH) | | 201 | Created (POST) | | 204 | No Content (DELETE) | | 400 | Validation error | | 401 | Authentication required | | 403 | Permission denied | | 404 | Resource not found | | 429 | Rate limit exceeded | | 500 | Internal server error |
sql-- Single column (equality lookups) CREATE INDEX idx_users_email ON users(email); -- Composite (multi-column queries) CREATE INDEX idx_orders_user_status ON orders(user_id, status); -- Partial (filtered queries) CREATE INDEX idx_orders_active ON orders(created_at) WHERE status = 'active'; -- Covering (avoid table lookup) CREATE INDEX idx_users_email_name ON users(email) INCLUDE (name);
bash# API Development python scripts/api_scaffolder.py openapi.yaml --framework express python scripts/api_scaffolder.py src/routes/ --generate-spec # Database Operations python scripts/database_migration_tool.py --connection $DATABASE_URL --analyze python scripts/database_migration_tool.py --connection $DATABASE_URL --migrate file.sql # Performance Testing python scripts/api_load_tester.py https://api.example.com/endpoint --concurrency 50 python scripts/api_load_tester.py https://api.example.com/endpoint --compare baseline.json
Before this skill scaffolds, recommends a pattern, or modifies a schema, the following four assumptions MUST be surfaced. If any are unknown, the skill stops and walks the Forcing-question library instead.
Verifiable success criteria (Karpathy #4) — every recommendation this skill emits must include:
If any of those three is not stated, the recommendation is incomplete — return to Q7 of the forcing-question library.
The scripts/backend_decision_engine.py tool encodes these checks: it refuses to recommend a profile without read/write ratio + QPS + tenancy + data sensitivity + pattern preference.
Four built-in profiles in profiles/ calibrate every recommendation:
| Profile | When to pick | Pattern | Latency floor (p99) | |---|---|---|---| | node-express | TS team, < 15 eng, customer-facing SaaS | Modular monolith on Postgres | 600ms | | fastapi-python | Python team, < 20 eng, ML-adjacent | Modular monolith on Postgres (async) | 500ms | | django-monolith | Content-heavy CRUD + admin, < 25 eng | Modular monolith on Postgres | 800ms | | go-or-rust-microservice | Extracted service, ≥ 30 eng, platform team, QPS ≥ 1000 | Extracted service | 200ms |
Pick a profile via:
bashpython scripts/backend_decision_engine.py \ --team-size 8 --qps-p99 50 --read-write-ratio 20 \ --tenancy shared-multi-tenant --data-sensitivity pii \ --pattern modular-monolith --language-preference typescript
The tool returns the best-fit profile, runner-up tradeoff (if within 15%), stack picks, anti-patterns, named approvers, and SLO floor. This tool never auto-approves.
To add a custom profile: copy profiles/node-express.json to profiles/<your-org>.json and adjust constraints + success_thresholds + named_approver_chain.
This skill does NOT reimplement scope owned by the POWERFUL-tier specialists. It forks into them. See references/composition_map.md for the full routing table. Key forks:
| Concern | Fork into | |---|---| | API contract / breaking-change risk | engineering/skills/api-design-reviewer/ | | Schema design + ERD + indexing | engineering/skills/database-designer/ | | Zero-downtime schema migration | engineering/skills/migration-architect/ | | SLO + SLI + error-budget | engineering/slo-architect/ | | Observability / golden signals | engineering/skills/observability-designer/ | | CI/CD pipeline | engineering/skills/ci-cd-pipeline-builder/ | | Security / threat model | engineering-team/skills/senior-security/, adversarial-reviewer | | Compliance evidence (HIPAA / ISO 27001) | ra-qm-team/ | | Pre-commit Karpathy review | engineering/karpathy-coder/ | | Pre-flight architecture grill | engineering/grill-me/ |
The cs-backend-engineer agent orchestrates these forks via context: fork. Invoke it from another agent with Agent({subagent_type: "cs-backend-engineer", prompt: "..."}) or via /cs:backend-review <your problem>.
Before locking any backend decision, walk the seven forcing questions in references/forcing_questions.md. Discipline:
/tmp/backend-grill-<date>.md.backend_decision_engine.py with the seven answers.Summary:
Three surfaces:
/cs:backend-review <prompt> — full grill + decision engine + composition routing.Agent({subagent_type: "cs-backend-engineer", prompt: "..."}) — forks context, returns ≤ 200-word digest.python scripts/backend_decision_engine.py ... — deterministic profile match when inputs are known.See agents/engineering/cs-backend-engineer.md for the full invocation contract.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 2,698 | 4,180 | +55% | 1 | 1 | 0% | 338 | 4,886 | +1346% | 0 | 0 | — |
case-02 | fail→fail | 7,243 | 8,635 | +19% | 1 | 1 | 0% | 1,365 | 4,212 | +209% | 0 | 0 | — |
case-03 | fail→fail | 10,934 | 5,740 | -48% | 1 | 1 | 0% | 2,450 | 4,455 | +82% | 0 | 0 | — |
case-04 | fail→pass | 9,153 | 2,384 | -74% | 1 | 1 | 0% | 1,827 | 4,469 | +145% | 0 | 0 | — |
case-05 | fail→pass | 9,722 | 1,881 | -81% | 1 | 1 | 0% | 1,801 | 4,359 | +142% | 0 | 0 | — |
case-06 | fail→pass | 5,078 | 2,359 | -54% | 1 | 1 | 0% | 1,070 | 4,477 | +318% | 0 | 0 | — |
case-07 | fail→pass | 21,903 | 3,059 | -86% | 1 | 1 | 0% | 4,296 | 4,634 | +8% | 0 | 0 | — |
case-08 | fail→pass | 8,244 | 4,006 | -51% | 1 | 1 | 0% | 1,695 | 4,512 | +166% | 0 | 0 | — |
case-09 | fail→pass | 8,625 | 2,646 | -69% | 1 | 1 | 0% | 1,724 | 4,557 | +164% | 0 | 0 | — |
case-10 | fail→pass | 9,278 | 3,816 | -59% | 1 | 1 | 0% | 1,704 | 4,702 | +176% | 0 | 0 | — |
case-11 | pass→pass | 12,315 | 5,426 | -56% | 1 | 1 | 0% | 2,268 | 5,084 | +124% | 0 | 0 | — |
case-12 | fail→pass | 12,738 | 3,326 | -74% | 1 | 1 | 0% | 2,235 | 4,733 | +112% | 0 | 0 | — |
case-13 | fail→pass | 12,152 | 3,076 | -75% | 1 | 1 | 0% | 2,121 | 4,672 | +120% | 0 | 0 | — |
case-14 | fail→pass | 16,191 | 2,267 | -86% | 1 | 1 | 0% | 2,842 | 4,391 | +55% | 0 | 0 | — |
case-15 | pass→pass | 8,684 | 7,192 | -17% | 1 | 1 | 0% | 1,769 | 5,530 | +213% | 0 | 0 | — |
case-16 | pass→pass | 7,966 | 6,591 | -17% | 1 | 1 | 0% | 1,804 | 5,402 | +199% | 0 | 0 | — |
case-17 | pass→pass | 4,492 | 3,077 | -32% | 1 | 1 | 0% | 684 | 4,550 | +565% | 0 | 0 | — |
case-18 | pass→pass | 2,469 | 3,557 | +44% | 1 | 1 | 0% | 471 | 4,677 | +893% | 0 | 0 | — |
case-19 | fail→pass | 14,634 | 5,547 | -62% | 1 | 1 | 0% | 2,431 | 5,012 | +106% | 0 | 0 | — |
case-20 | fail→fail | 22,894 | 20,909 | -9% | 1 | 1 | 0% | 4,011 | 8,273 | +106% | 0 | 0 | — |
case-21 | fail→pass | 8,047 | 16,384 | +104% | 1 | 1 | 0% | 1,362 | 6,977 | +412% | 0 | 0 | — |
case-22 | fail→fail | 25,273 | 29,482 | +17% | 1 | 1 | 0% | 4,629 | 10,228 | +121% | 0 | 0 | — |
case-23 | fail→pass | 14,453 | 21,870 | +51% | 1 | 1 | 0% | 2,736 | 8,100 | +196% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 21 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +61 percentage points is the difference between those two pass rates over the 21 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.