AgentStack
SKILL verified MIT Self-run

Backend Patterns

skill-drag88-claude-dev-framework-backend-patterns · by drag88

Activates for API design, repository pattern, caching, auth middleware, and error handling conventions in backend code

No reviews yet
0 installs
2 views
0.0% view→install

Install

$ agentstack add skill-drag88-claude-dev-framework-backend-patterns

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Backend Patterns? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Backend Patterns Skill

Provide guidance on backend architecture patterns, API design, and server-side best practices.

When to Activate

  • During backend implementation tasks
  • When designing APIs or services
  • When working with databases and data layers
  • When implementing authentication, authorization, or security features

Pattern Index

API Design

| Pattern | When to Use | |---------|-------------| | RESTful conventions | Standard CRUD operations on resources | | Response format | Consistent success/error JSON structure | | Pagination | List endpoints returning multiple items |

> See references/api-design.md for REST conventions table, response formats, and pagination implementation.

Service Architecture

| Pattern | When to Use | |---------|-------------| | Repository | Separate data access from business logic | | Service Layer | Encapsulate business logic, coordinate side effects |

> See references/service-patterns.md for repository interface and service layer implementations.

Authentication & Authorization

| Pattern | When to Use | |---------|-------------| | Auth middleware | Protecting routes with Bearer token verification | | Authorization middleware | Role-based route protection | | JWT tokens | Access + refresh token generation and rotation | | RBAC | Permission checks with wildcard and ownership support |

> See references/auth-middleware.md for middleware, JWT, and RBAC implementations.

Database

| Pattern | When to Use | |---------|-------------| | N+1 prevention | Loading related data (eager load or batch) | | Transactions | Multi-step operations requiring atomicity | | Caching (decorator) | Frequently read, rarely written data |

> See references/database-patterns.md for N+1 fixes, transaction pattern, and cache-aside implementation.

Error Handling

| Pattern | When to Use | |---------|-------------| | Error class hierarchy | Typed errors with status codes (NotFound, Validation, etc.) | | Error middleware | Global Express error handler | | Retry with backoff | Transient failures (network, rate limits) |

> See references/error-handling.md for error classes, middleware, and retry implementation.

Observability

| Pattern | When to Use | |---------|-------------| | Rate limiting | API abuse prevention (general + auth-specific) | | Structured logging | Request logging, service-level audit trail |

> See references/observability.md for rate limiting config and Pino logging setup.


Key Principles

  • Separation of concerns -- Controllers handle HTTP, services handle logic, repositories handle data
  • Fail fast -- Validate at boundaries, throw typed errors early
  • Idempotency -- PUT/DELETE operations should be safely repeatable
  • Defense in depth -- Auth middleware + authorization + input validation

Related Routing

  • /cdf:design with backend-engineer framing -- API and service layer design
  • /cdf:analyze with security-focused role framing -- Secure auth and middleware audits
  • /cdf:analyze with performance-focused role framing -- Query optimization and caching reviews

Suggested Commands

  • /cdf:implement -- Implement backend features using these patterns
  • /cdf:design -- Design backend architecture with pattern guidance
  • /cdf:analyze --focus security -- Audit backend code against pattern standards

Reference Files

| File | Contents | |------|----------| | references/api-design.md | REST conventions, response format, pagination | | references/service-patterns.md | Repository pattern, service layer | | references/auth-middleware.md | Auth/authz middleware, JWT tokens, RBAC | | references/database-patterns.md | N+1 prevention, transactions, caching | | references/error-handling.md | Error classes, error middleware, retry with backoff | | references/observability.md | Rate limiting, structured logging |

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.