mcpField
S
senior-backend

senior-backend

github.com/pixel-process-ugDevelopment380 installsUpdated 34w ago
Repository

About senior-backend

senior-backend is a skill for designing and implementing backend services, aimed at developers working on APIs and service operations. It structures work across API design, implementation, and production hardening, including observability and event-driven patterns.

Key features

  1. 01REST, GraphQL, and gRPC API design
  2. 02Layered service and data-access structure
  3. 03Caching and rate-limiting strategies
  4. 04Health checks and OpenTelemetry observability
  5. 05Message-driven architecture patterns

Use cases

  1. 01Defining an API contract before implementation
  2. 02Structuring backend services and data access
  3. 03Preparing services with health checks and telemetry
  4. 04Designing asynchronous message workflows

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/pixel-process-ug/superkit-agents --skill senior-backend

After installing, type/senior-backendin Claude Code to confirm it loaded.

Details

From the project README

Senior Backend Engineer

Overview

Design and implement robust, scalable backend systems with a focus on API design, service architecture, data management, and operational excellence. This skill covers RESTful and GraphQL API patterns, message-driven architecture, caching strategies, rate limiting, health checks, and full observability with OpenTelemetry.

Announce at start: "I'm using the senior-backend skill for backend system design and implementation."


Phase 1: API Design

Goal: Define the contract before writing implementation code.

Actions
  1. Define resource models and relationships
  2. Design endpoint structure (REST) or schema (GraphQL)
  3. Establish authentication and authorization strategy
  4. Define rate limiting and throttling policies
  5. Create API documentation (OpenAPI/GraphQL schema)
API Style Decision Table
FactorRESTGraphQLgRPC
Multiple consumers with different data needsPoor fitStrong fitPoor fit
Simple CRUD operationsStrong fitOverkillOverkill
Real-time subscriptionsRequires WebSocket add-onBuilt-inBuilt-in (streaming)
Service-to-serviceGoodOverkillStrong fit
Public APIStrong fitGoodPoor fit (tooling)
Mobile with bandwidth constraintsOverfetching riskStrong fitStrong fit
STOP — Do NOT proceed to Phase 2 until:
  • Resource models are defined
  • Endpoint structure or schema is documented
  • Auth strategy is chosen
  • API contract is reviewable (OpenAPI/GraphQL schema)

Phase 2: Implementation

Goal: Build the service layer with clear separation of concerns.

Actions
  1. Set up project structure with clear layering
  2. Implement data access layer (repositories/DAOs)
  3. Build service layer with business logic
  4. Create API controllers/resolvers
  5. Add middleware (auth, logging, error handling, CORS)
  6. Implement caching strategy
RESTful URL Structure
GET    /api/v1/users              # List users (paginated)
GET    /api/v1/users/:id          # Get single user
POST   /api/v1/users              # Create user
PUT    /api/v1/users/:id          # Full update
PATCH  /api/v1/users/:id          # Partial update
DELETE /api/v1/users/:id          # Delete user
GET    /api/v1/users/:id/orders   # Nested resources
POST   /api/v1/users/:id/activate # State transitions
HTTP Status Code Decision Table
CodeMeaningWhen to Use
200OKSuccessful GET, PUT, PATCH
201CreatedSuccessful POST creating resource
204No ContentSuccessful DELETE
400Bad RequestValidation errors
401UnauthorizedMissing or invalid auth
403ForbiddenAuth valid but insufficient permissions
404Not FoundResource does not exist
409ConflictDuplicate or state conflict
422Unprocessable EntitySemantically invalid input
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnexpected server failure
Response Format
// Success (single)
{ "data": { "id": "123", "name": "Alice" }, "meta": { "requestId": "req_abc123" } }

// Success (collection)
{ "data": [...], "meta": { "page": 1, "pageSize": 20, "totalCount": 150, "totalPages": 8 } }

// Error
{ "error": { "code": "VALIDATION_ERROR", "message": "Invalid input", "details": [...] } }
Caching Strategy Decision Table
StrategyDescriptionUse Case
Cache-AsideApp checks cache, falls back to DBGeneral purpose
Write-ThroughWrite to cache and DB simultaneouslyStrong consistency
Write-BehindWrite to cache, async write to DBHigh write throughput
Read-ThroughCache loads from DB on missTransparent caching
STOP — Do NOT proceed to Phase 3 until:
  • Project structure follows layered architecture
  • Input validation is at the edge (Zod, Joi, class-validator)
  • Error handling returns structured error responses
  • Caching strategy is implemented with invalidation plan

Phase 3: Hardening

Goal: Prepare the service for production operation.

Actions
  1. Add comprehensive error handling
  2. Implement health checks and readiness probes
  3. Set up observability (traces, metrics, logs)
  4. Load test critical paths
  5. Document runbooks for operational scenarios
Health Check Endpoints
// GET /health — lightweight liveness check
{ "status": "healthy" }

// GET /health/ready — readiness with dependency checks
{
  "status": "healthy",
  "checks": {
    "database": { "status": "healthy", "latency": "5ms" },
    "redis": { "status": "healthy", "latency": "2ms" },
    "queue": { "status": "healthy", "latency": "8ms" }
  },
  "uptime": "72h15m",
  "version": "1.4.2"
}
Observability: RED Method Metrics
MetricDescriptionImplementation
RateRequests per secondCounter incremented per request
ErrorsError rate per secondCounter incremented per error
DurationLatency distributionHistogram (p50, p95, p99)
Structured Logging Format
{
  "timestamp": "2025-01-15T10:30:00.123Z",
  "level": "info",
  "message": "User created",
  "service": "user-service",
  "traceId": "abc123",
  "spanId": "def456",
  "userId": "usr_123",
  "duration": 45
}
Rate Limiting Algorithm Decision Table
AlgorithmProsConsBest For
Fixed WindowSimple, low memoryBurst at boundariesInternal APIs
Sliding WindowSmooth distributionMore memoryPublic APIs
Token BucketControlled burstsSlightly complexIndustry standard
Leaky BucketConstant outputNo burst allowedStrict rate control
STOP — Hardening complete when:
  • Health check endpoints respond correctly
  • Structured logging is configured
  • Metrics are exported (RED method)
  • Load test completed on critical paths
  • Error handling returns appropriate status codes

Event-Driven Architecture Patterns

Message Queue Pattern Decision Table
PatternUse CaseExample
Pub/SubBroadcast to multiple consumersUser registered -> email, analytics, CRM
Work QueueDistribute tasks across workersImage processing, PDF generation
Request/ReplyAsync request with responsePrice calculation service
Dead LetterHandle failed messagesRetry policy exceeded
Event Schema
{
  "eventId": "evt_abc123",
  "eventType": "user.created",
  "timestamp": "2025-01-15T10:30:00Z",
  "version": "1.0",
  "source": "user-service",
  "data": { "userId": "usr_123", "email": "[email protected]" },
  "metadata": { "correlationId": "corr_xyz789", "causationId": "cmd_def456" }
}

GraphQL Anti-Patterns

Anti-PatternProblemFix
N+1 queriesPerformance degradationDataLoader for batching
Unbounded queriesDoS vulnerabilityEnforce depth and complexity limits
Over-fetching in resolversWasted DB queriesSelect only requested fields

Anti-Patterns / Common Mistakes

Anti-PatternWhy It Is WrongCorrect Approach
Exposing database IDs directlySecurity risk, coupling to DBUse UUIDs or prefixed IDs
Synchronous external service calls in request pathSingle point of failure, latencyAsync with queues or circuit breaker
N+1 query patternsLinear performance degradationEager loading or DataLoader
Catching and swallowing errorsSilent failures, impossible debuggingLog and propagate with context
Shared mutable state across handlersRace conditions, unpredictable behaviorStateless request handling
Skipping input validationInjection, data corruptionValidate at the edge, always
Generic 500 for all errorsPoor developer experienceSpecific error codes and messages
No API versioningBreaking changes affect all consumersVersion from day one (/v1/)

Documentation Lookup (Context7)

Use mcp__context7__resolve-library-id then mcp__context7__query-docs for up-to-date docs. Returned docs override memorized knowledge.

  • express — for middleware patterns, routing, or request/response API
  • fastify — for plugin system, hooks, or schema validation
  • nestjs — for decorators, modules, providers, or guards
  • prisma — for schema syntax, client API, or migration commands

Integration Points

SkillRelationship
senior-architectArchitecture decisions guide backend service boundaries
security-reviewBackend security follows OWASP and auth patterns
performance-optimizationBackend performance uses caching and query tuning
testing-strategyBackend test strategy defines integration test approach
code-reviewReview verifies API design and error handling
acceptance-testingAPI behavior becomes acceptance criteria
senior-fullstackBackend serves the full-stack tRPC layer

Key Principles

  • API versioning from day one (/v1/)
  • Input validation at the edge (Zod, Joi, class-validator)
  • Idempotency keys for non-GET endpoints
  • Graceful shutdown (drain connections, finish in-flight requests)
  • Circuit breaker for external service calls
  • Database migrations versioned and reversible
  • Secrets in environment variables, never in code

Skill Type

FLEXIBLE — Adapt API style and architecture to the project context. The three-phase process (design, implement, harden) is strongly recommended. Health checks, structured logging, and error handling are non-negotiable for production services.

Comments

Markdown supported