Claude Skill

backend-engineering

Design and implement backend services and APIs — REST, gRPC, GraphQL,

LLM Mart · 0 points · 16 views 0 listing impressions 0 install-command copies
Download magnus919-agent-skills-backend-engineering-ade3385.zip · 52 KB

Install

skills CLI npx skills add https://github.com/magnus919/agent-skills/tree/main/backend-engineering
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install magnus919-agent-skills@llmmart
Git git clone https://github.com/magnus919/agent-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole magnus919/agent-skills collection as a plugin from our marketplace. Git is the plain clone.

README

Backend Engineering

Backend engineering methodology — API implementation patterns (REST, gRPC, GraphQL), service architecture (clean/hexagonal/layered), event-driven application flows, outbox/inbox coordination, migration coexistence seams, database access patterns, integration and middleware design, error handling, and service-level testing. Language and framework agnostic.

Why Install This Skill

Your agent gains structured patterns for API design, service architecture, database access, error handling, and integration — instead of improvising each time. Fillable templates turn service designs and error contracts into reviewable records, and the bundled N+1 query spotter catches a whole class of database performance bugs during review.

Implement Valkey/Redis state operations and stream consumers with explicit atomicity, partial-failure and acknowledgement boundaries.

What You Get

Directory Purpose
references/in-memory-state-and-messaging.md Implement Valkey/Redis state operations and stream consumers with explicit atomicity, partial-failure and acknowledgement boundaries.
SKILL.md Core methodology, trigger conditions, reference index
references/ Deep-dive reference files loaded on demand
templates/ Fillable records: service design, event flow/coexistence, and error-handling taxonomy
scripts/ n1-query-spotter.py — scans Python source for potential N+1 query patterns
evals/ Output-quality eval manifest for the skill's methodology cases

Triggers

Building or reviewing APIs, designing service layers, implementing database access patterns, adding error handling, integrating external services, publishing or consuming domain events, implementing outbox/inbox delivery, or keeping old and new service paths safe during a migration.

Do not load this skill as the owner of API/event contracts, service decomposition strategy, schema/pipeline operations, or cross-system migration lifecycle; route those decisions to the linked specialist skills.

Requirements

Platform-agnostic. Applicable to any language/framework stack. The bundled script needs only Python 3 (standard library).

Quick Start

Scan a service for potential N+1 query patterns before a performance review:

python3 backend-engineering/scripts/n1-query-spotter.py services/orders.py

Each finding points at the query call, the enclosing loop, and whether the loop variable is used in the query (high confidence vs possible). Add --json for machine-readable output, and run it from CI — the script exits 1 when findings exist.

Load SKILL.md for the methodology overview and reference table, then load specific references as needed for the task at hand.

Skill manifest

Backend Engineering Methodology

Backend engineering is the craft of building the server-side systems that power applications — APIs, services, data access, integrations, and the runtime behavior that makes the architecture real. This methodology covers implementation after target design in software-architecture and before quality validation in qa-methodology; use software-architecture-analysis when the current system must first be reverse-engineered. It makes runtime boundaries, transaction behavior, message handling, and coexistence seams executable without taking ownership of the surrounding architecture or migration decision.

The Backend Engineer's Domain

You own You don't own
API implementation — REST/gRPC/GraphQL endpoints, request validation, response formatting, error handling, middleware chains API contracts belong to api-design-and-evolution; service decomposition and target boundaries belong to software-architecture
Service logic — business rules, workflow orchestration, state management, background job processing Deployment pipeline and infrastructure — that's platform-engineering
Event-driven implementation — domain-event publication, outbox/inbox coordination, handler idempotency, replay and failure paths Event contract ownership and delivery semantics — that's the api-design-and-evolution
Migration seams inside a service — adapters, selectable paths, authority checks, and implementation handoffs Cross-system migration lifecycle and cutover authority — that's the migration-engineering
Database access patterns — query design, connection management, transaction boundaries, N+1 detection, pagination Data-platform and model strategy belong to data-architect; schema and pipeline operations belong to data-engineering
Integration code — third-party API clients, webhook handlers, message queue consumers/producers Code review and quality gates — that's qa-methodology
Observability instrumentation at the service level — structured logging, metrics, tracing hooks Observability infrastructure and reliability policy belong to platform-engineering and site-reliability-engineering
Service-level tests — unit tests for business logic, integration tests for API contracts Test strategy and automation — that's qa-methodology

Valkey and Redis decisions

For native data structures, atomic operations, Lua error boundaries and stream consumers, read the focused guide. For open-source-oriented choices, prefer Valkey's BSD licensing and community governance; preserve explicit engine requirements and verify version-specific compatibility. Redis's AGPL option does not erase licensing or trust preferences, and this guidance makes no claim about business-community preference.

Reference Files

Reference When to load
references/api-patterns.md Designing or implementing API endpoints — resource modeling, versioning, pagination, error response formats, request validation
references/service-patterns.md Structuring service logic — clean/hexagonal/layered architecture, dependency injection, middleware composition, request lifecycle, background jobs
references/event-driven-service-implementation.md Implementing event-driven application flows — domain events, unit of work, transactional outbox/inbox, idempotent handlers, retry/replay, observability, and failure handling
references/migration-coexistence-patterns.md Keeping old and new implementations safe to run together — adapters, strangler handoffs, anti-corruption boundaries, dual paths, authority, and removal conditions
references/database-testing.md Database access patterns (connection pooling, query optimization, N+1 detection, pagination strategies, transaction boundaries, read/write splitting, replication lag) and service-level testing (unit testing business logic, integration testing API contracts with test containers/WireMock, contract testing with Pact, test fixtures, CI integration)
references/integration-patterns.md Integrating with external systems — retry with backoff, circuit breakers, idempotency keys, webhook verification, message queue consumers
references/error-handling.md Handling errors systematically — classification (client vs server), structured responses, exception handling patterns, observability correlation
references/source-index.md Provenance and ownership notes for this original synthesis; load when reviewing scope or source boundaries

Templates

Template When to Use
templates/service-design-record.md Designing or restructuring a service — structure, API surface, data access, error handling, and testing plan in one reviewable record
templates/error-handling-taxonomy.md Defining or auditing a service's error contract — classification, response format, retry/idempotency policy, and error-path tests

Scripts

Script When to Use
scripts/n1-query-spotter.py Scanning Python source for potential N+1 query patterns (query-like calls inside loops); --json for CI-friendly output, exit 1 on findings

Related Skills

  • programming-principles — DDD owns bounded contexts, aggregates, domain language, repositories, and domain-modeling guidance. This skill applies those decisions at implementation seams rather than duplicating that catalog.
  • api-design-and-evolution — owns event/message contracts, delivery semantics, compatibility, and consumer-facing API decisions.
  • migration-engineering — owns cross-system migration classification, compatibility windows, reconciliation, cutover, recovery, deprecation, and cleanup. This skill only implements service-local coexistence seams.
  • software-architecture — owns service decomposition and target-boundary strategy; backend engineering implements an approved boundary.
  • data-engineering — owns schema migration and pipeline operations; application code may expose the repository or transaction interfaces those operations use.
  • secure-software-engineering — owns threat modeling, authorization, secrets, untrusted inputs, and security acceptance evidence.
  • release-engineering — owns progressive delivery, artifact promotion, release gates, and rollback mechanics.
  • postgres — diagnosing the PostgreSQL side of a database problem: configuration review, index and query-plan issues, vacuum/bloat, backups/PITR, replication and failover. Application-level data access patterns stay here; engine-level operations route there.
  • supabase — building on Supabase: migrations, RLS, Auth, Storage, and Edge Functions. To measure an agent's Supabase task competence, use its agent evals harness reference.

Core Principles

The interface is the contract — API boundaries are service-level contracts. Every endpoint signature, request schema, response format, and error code is a promise to consumers. Breaking changes are coordination problems, not version bumps.

Business logic is the center of gravity — Keep business rules isolated from framework concerns, transport protocols, and infrastructure details. A well-structured service can survive changes to its HTTP library, database driver, and deployment platform.

Handle errors where they make sense — Catch errors at the boundary where you have enough context to handle them meaningfully. Catch too early and you lose context. Catch too late and you can't recover.

Design for failure, not just success — Every external call can fail. Every database connection can drop. Every message can be duplicated. Idempotency, retry, and graceful degradation are not optimizations — they're requirements.

Test at the right level — Business logic gets unit tests. API contracts get integration tests. Service boundaries get contract tests. Each level catches a different class of failure.

Implementation Decision Path

  1. Name the bounded context, aggregate/invariant boundary, and source of truth. Use programming-principles for DDD choices rather than rebuilding its catalog here.
  2. Put transport, broker, database, clock, and vendor concerns behind ports owned by the application or domain-facing code. Let infrastructure implement those ports.
  3. For a command that changes durable state and emits a fact, load the aggregate, invoke domain behavior, and commit state plus outbox records in one unit of work. Do not hold that transaction open across network calls.
  4. For an incoming message, validate the envelope at the edge, deduplicate within the consumer's authority, apply the handler, and acknowledge only after its durable effects commit. Load the event reference for replay and poison-message decisions.
  5. If old and new paths coexist, record which path is authoritative for each operation, how outputs are compared, and what evidence permits handoff or removal. Load the migration reference for the implementation seam; route the migration lifecycle out.
  6. Add unit tests for domain/application behavior and boundary integration tests for transaction, outbox, inbox, duplicate, retry, replay, and recovery behavior.

Exit Criteria

This skill is complete when the implementation has explicit dependency direction, transaction and authority boundaries, classified failure/retry behavior, observable message or coexistence paths, focused tests for duplicate and failure cases, and clear links to the neighboring owner for every out-of-scope decision.

Files (agent-skills)
  • evals
    • evals.json 19.6 KB
      Loading…
    • in-memory-store-challenges.md 3.2 KB
      Loading…
  • references
    • api-patterns.md 2.2 KB
      Loading…
    • database-testing.md 41.5 KB
      Loading…
    • error-handling.md 1.9 KB
      Loading…
    • event-driven-service-implementation.md 7.6 KB
      Loading…
    • in-memory-state-and-messaging.md 6.3 KB
      Loading…
    • integration-patterns.md 1.9 KB
      Loading…
    • migration-coexistence-patterns.md 5.8 KB
      Loading…
    • service-patterns.md 3.3 KB
      Loading…
    • source-index.md 1.9 KB
      Loading…
  • scripts
    • n1-query-spotter.py 9.1 KB
      Loading…
    • test_n1_query_spotter.py 7.5 KB
      Loading…
  • templates
    • error-handling-taxonomy.md 3 KB
      Loading…
    • service-design-record.md 4.3 KB
      Loading…
  • README.md 2.7 KB
    # Backend Engineering
    
    Backend engineering methodology — API implementation patterns (REST, gRPC, GraphQL), service architecture (clean/hexagonal/layered), event-driven application flows, outbox/inbox coordination, migration coexistence seams, database access patterns, integration and middleware design, error handling, and service-level testing. Language and framework agnostic.
    
    ## Why Install This Skill
    
    Your agent gains structured patterns for API design, service architecture, database access, error handling, and integration — instead of improvising each time. Fillable templates turn service designs and error contracts into reviewable records, and the bundled N+1 query spotter catches a whole class of database performance bugs during review.
    
    Implement Valkey/Redis state operations and stream consumers with explicit atomicity, partial-failure and acknowledgement boundaries.
    
    ## What You Get
    
    | Directory | Purpose |
    |-----------|---------|
    | `references/in-memory-state-and-messaging.md` | Implement Valkey/Redis state operations and stream consumers with explicit atomicity, partial-failure and acknowledgement boundaries. |
    | `SKILL.md` | Core methodology, trigger conditions, reference index |
    | `references/` | Deep-dive reference files loaded on demand |
    | `templates/` | Fillable records: service design, event flow/coexistence, and error-handling taxonomy |
    | `scripts/` | `n1-query-spotter.py` — scans Python source for potential N+1 query patterns |
    | `evals/` | Output-quality eval manifest for the skill's methodology cases |
    
    ## Triggers
    
    Building or reviewing APIs, designing service layers, implementing database access patterns, adding error handling, integrating external services, publishing or consuming domain events, implementing outbox/inbox delivery, or keeping old and new service paths safe during a migration.
    
    Do not load this skill as the owner of API/event contracts, service decomposition strategy, schema/pipeline operations, or cross-system migration lifecycle; route those decisions to the linked specialist skills.
    
    ## Requirements
    
    Platform-agnostic. Applicable to any language/framework stack. The bundled script needs only Python 3 (standard library).
    
    ## Quick Start
    
    Scan a service for potential N+1 query patterns before a performance review:
    
    ```bash
    python3 backend-engineering/scripts/n1-query-spotter.py services/orders.py
    ```
    
    Each finding points at the query call, the enclosing loop, and whether the loop variable is used in the query (high confidence vs possible). Add `--json` for machine-readable output, and run it from CI — the script exits 1 when findings exist.
    
    Load SKILL.md for the methodology overview and reference table, then load specific references as needed for the task at hand.
    
  • SKILL.md 10.6 KB
    ---
    name: backend-engineering
    description: Design and implement backend services and APIs — REST, gRPC, GraphQL,
      event-driven handlers, transaction boundaries, outbox/inbox delivery, migration
      coexistence, database access, integration, error handling, and service-level testing.
      Use for application/domain/infrastructure implementation decisions. Language and
      framework agnostic. Do not use for frontend, data engineering, platform provisioning,
      API contract ownership, service decomposition strategy, or cross-system migration
      planning.
    license: MIT
    metadata:
      tags: backend, api, services, server, database, integration, middleware, events, outbox,
        inbox, idempotency, coexistence, query-optimization, testing
      source_repo: https://github.com/magnus919/hermes-profiles
    ---
    
    # Backend Engineering Methodology
    
    Backend engineering is the craft of building the server-side systems that power applications — APIs, services, data access, integrations, and the runtime behavior that makes the architecture real. This methodology covers implementation after target design in `software-architecture` and before quality validation in `qa-methodology`; use `software-architecture-analysis` when the current system must first be reverse-engineered. It makes runtime boundaries, transaction behavior, message handling, and coexistence seams executable without taking ownership of the surrounding architecture or migration decision.
    
    ## The Backend Engineer's Domain
    
    | You own | You don't own |
    |---------|--------------|
    | API implementation — REST/gRPC/GraphQL endpoints, request validation, response formatting, error handling, middleware chains | API contracts belong to `api-design-and-evolution`; service decomposition and target boundaries belong to `software-architecture` |
    | Service logic — business rules, workflow orchestration, state management, background job processing | Deployment pipeline and infrastructure — that's `platform-engineering` |
    | Event-driven implementation — domain-event publication, outbox/inbox coordination, handler idempotency, replay and failure paths | Event contract ownership and delivery semantics — that's the api-design-and-evolution |
    | Migration seams inside a service — adapters, selectable paths, authority checks, and implementation handoffs | Cross-system migration lifecycle and cutover authority — that's the migration-engineering |
    | Database access patterns — query design, connection management, transaction boundaries, N+1 detection, pagination | Data-platform and model strategy belong to `data-architect`; schema and pipeline operations belong to `data-engineering` |
    | Integration code — third-party API clients, webhook handlers, message queue consumers/producers | Code review and quality gates — that's `qa-methodology` |
    | Observability instrumentation at the service level — structured logging, metrics, tracing hooks | Observability infrastructure and reliability policy belong to `platform-engineering` and `site-reliability-engineering` |
    | Service-level tests — unit tests for business logic, integration tests for API contracts | Test strategy and automation — that's `qa-methodology` |
    
    ## Valkey and Redis decisions
    
    For native data structures, atomic operations, Lua error boundaries and stream consumers, read [the focused guide](references/in-memory-state-and-messaging.md). For open-source-oriented choices, prefer Valkey's BSD licensing and community governance; preserve explicit engine requirements and verify version-specific compatibility. Redis's AGPL option does not erase licensing or trust preferences, and this guidance makes no claim about business-community preference.
    
    ## Reference Files
    
    | Reference | When to load |
    |-----------|-------------|
    | `references/api-patterns.md` | Designing or implementing API endpoints — resource modeling, versioning, pagination, error response formats, request validation |
    | `references/service-patterns.md` | Structuring service logic — clean/hexagonal/layered architecture, dependency injection, middleware composition, request lifecycle, background jobs |
    | `references/event-driven-service-implementation.md` | Implementing event-driven application flows — domain events, unit of work, transactional outbox/inbox, idempotent handlers, retry/replay, observability, and failure handling |
    | `references/migration-coexistence-patterns.md` | Keeping old and new implementations safe to run together — adapters, strangler handoffs, anti-corruption boundaries, dual paths, authority, and removal conditions |
    | `references/database-testing.md` | Database access patterns (connection pooling, query optimization, N+1 detection, pagination strategies, transaction boundaries, read/write splitting, replication lag) and service-level testing (unit testing business logic, integration testing API contracts with test containers/WireMock, contract testing with Pact, test fixtures, CI integration) |
    | `references/integration-patterns.md` | Integrating with external systems — retry with backoff, circuit breakers, idempotency keys, webhook verification, message queue consumers |
    | `references/error-handling.md` | Handling errors systematically — classification (client vs server), structured responses, exception handling patterns, observability correlation |
    | `references/source-index.md` | Provenance and ownership notes for this original synthesis; load when reviewing scope or source boundaries |
    
    ## Templates
    
    | Template | When to Use |
    |-----------|-------------|
    | `templates/service-design-record.md` | Designing or restructuring a service — structure, API surface, data access, error handling, and testing plan in one reviewable record |
    | `templates/error-handling-taxonomy.md` | Defining or auditing a service's error contract — classification, response format, retry/idempotency policy, and error-path tests |
    
    ## Scripts
    
    | Script | When to Use |
    |-----------|-------------|
    | `scripts/n1-query-spotter.py` | Scanning Python source for potential N+1 query patterns (query-like calls inside loops); `--json` for CI-friendly output, exit 1 on findings |
    
    ## Related Skills
    
    - [programming-principles](../programming-principles/SKILL.md) — DDD owns bounded contexts, aggregates, domain language, repositories, and domain-modeling guidance. This skill applies those decisions at implementation seams rather than duplicating that catalog.
    - [api-design-and-evolution](../api-design-and-evolution/SKILL.md) — owns event/message contracts, delivery semantics, compatibility, and consumer-facing API decisions.
    - [migration-engineering](../migration-engineering/SKILL.md) — owns cross-system migration classification, compatibility windows, reconciliation, cutover, recovery, deprecation, and cleanup. This skill only implements service-local coexistence seams.
    - [software-architecture](../software-architecture/SKILL.md) — owns service decomposition and target-boundary strategy; backend engineering implements an approved boundary.
    - [data-engineering](../data-engineering/SKILL.md) — owns schema migration and pipeline operations; application code may expose the repository or transaction interfaces those operations use.
    - [secure-software-engineering](../secure-software-engineering/SKILL.md) — owns threat modeling, authorization, secrets, untrusted inputs, and security acceptance evidence.
    - [release-engineering](../release-engineering/SKILL.md) — owns progressive delivery, artifact promotion, release gates, and rollback mechanics.
    - [postgres](../postgres/SKILL.md) — diagnosing the PostgreSQL side of a database problem: configuration review, index and query-plan issues, vacuum/bloat, backups/PITR, replication and failover. Application-level data access patterns stay here; engine-level operations route there.
    - [supabase](../supabase/SKILL.md) — building on Supabase: migrations, RLS, Auth, Storage, and Edge Functions. To measure an agent's Supabase task competence, use its [agent evals harness reference](../supabase/references/agent-evals.md).
    
    ## Core Principles
    
    **The interface is the contract** — API boundaries are service-level contracts. Every endpoint signature, request schema, response format, and error code is a promise to consumers. Breaking changes are coordination problems, not version bumps.
    
    **Business logic is the center of gravity** — Keep business rules isolated from framework concerns, transport protocols, and infrastructure details. A well-structured service can survive changes to its HTTP library, database driver, and deployment platform.
    
    **Handle errors where they make sense** — Catch errors at the boundary where you have enough context to handle them meaningfully. Catch too early and you lose context. Catch too late and you can't recover.
    
    **Design for failure, not just success** — Every external call can fail. Every database connection can drop. Every message can be duplicated. Idempotency, retry, and graceful degradation are not optimizations — they're requirements.
    
    **Test at the right level** — Business logic gets unit tests. API contracts get integration tests. Service boundaries get contract tests. Each level catches a different class of failure.
    
    ## Implementation Decision Path
    
    1. Name the bounded context, aggregate/invariant boundary, and source of truth. Use
       [programming-principles](../programming-principles/SKILL.md) for DDD choices rather
       than rebuilding its catalog here.
    2. Put transport, broker, database, clock, and vendor concerns behind ports owned by
       the application or domain-facing code. Let infrastructure implement those ports.
    3. For a command that changes durable state and emits a fact, load the aggregate,
       invoke domain behavior, and commit state plus outbox records in one unit of work.
       Do not hold that transaction open across network calls.
    4. For an incoming message, validate the envelope at the edge, deduplicate within the
       consumer's authority, apply the handler, and acknowledge only after its durable
       effects commit. Load the event reference for replay and poison-message decisions.
    5. If old and new paths coexist, record which path is authoritative for each operation,
       how outputs are compared, and what evidence permits handoff or removal. Load the
       migration reference for the implementation seam; route the migration lifecycle out.
    6. Add unit tests for domain/application behavior and boundary integration tests for
       transaction, outbox, inbox, duplicate, retry, replay, and recovery behavior.
    
    ## Exit Criteria
    
    This skill is complete when the implementation has explicit dependency direction,
    transaction and authority boundaries, classified failure/retry behavior, observable
    message or coexistence paths, focused tests for duplicate and failure cases, and clear
    links to the neighboring owner for every out-of-scope decision.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.