Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use this skill for backend development — server logic, authentication, microservices, serverless functions, middleware, background jobs, caching strategies, and backend architecture patterns. Trigger on keywords: backend, server, API endpoint, middleware, authentication, authorization, microservice, serverless, background job, queue, caching, session.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -2% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 1% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 20% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 31% | 0% |
| case-20 | ✓→✗ | ▼ Worse | 70% | 0% |
textRequest → Rate Limiting → Authentication → Authorization → Validation → Business Logic → Response
Never skip this order. Auth before business logic. Validation before processing.
json// Success { "data": { ... }, "meta": { "page": 1, "total": 100 } } // Error { "error": { "code": "VALIDATION_ERROR", "message": "Human-readable description", "details": [{ "field": "email", "issue": "Invalid format" }] } }
typescript// Check authorization at the service layer, not just the route async function getOrder(userId: string, orderId: string) { const order = await db.orders.findById(orderId) if (!order) throw new NotFoundError() // Authorization check — user can only see their own orders if (order.userId !== userId) throw new ForbiddenError() return order }
Use queues for:
textFire-and-forget: Enqueue and return immediately Scheduled: Run at specific time (cron) Delayed: Run after X minutes/hours Retry: Re-attempt on failure with backoff
Always implement:
typescript// Structured error hierarchy class AppError extends Error { constructor( public message: string, public statusCode: number, public code: string ) { super(message) } } class ValidationError extends AppError { constructor(details: ValidationDetail[]) { super('Validation failed', 400, 'VALIDATION_ERROR') this.details = details } } // Global error handler app.use((err, req, res, next) => { if (err instanceof AppError) { return res.status(err.statusCode).json({ error: err }) } // Log unexpected errors logger.error('Unexpected error', { err, req }) res.status(500).json({ error: { code: 'INTERNAL_ERROR' } }) })
Every production API needs:
typescript// Never hardcode configuration — always from environment const config = { db: { url: process.env.DATABASE_URL, // required poolSize: parseInt(process.env.DB_POOL_SIZE ?? '10') }, jwt: { secret: process.env.JWT_SECRET, // required expiresIn: process.env.JWT_TTL ?? '15m' } } // Validate required config at startup — fail fast const required = ['DATABASE_URL', 'JWT_SECRET'] for (const key of required) { if (!process.env[key]) throw new Error(`Missing required env: ${key}`) }
Other measured skills in the registry, with their headline benchmark lift.