Backend api architecture
Skill ahtishamshahzad/agent_dev_flow/.ai/skills/backend/backend-api-architecture
Use to define the internal architecture of a backend API — layering (transport/controllers/services/data), domain boundaries, where cross-cutting concerns live, and how modules communicate. Framework-agnostic; foundations apply it per framework.From its SKILL.md
npx -y skills add ahtishamshahzad/agent_dev_flow --skill backend-api-architectureAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 26 days oldThe repository was created 26 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.1 KB, 770 tokens by cl100k_base, as published. Nobody here has run it
Backend API Architecture
Purpose
Define how the backend is organized internally — layers, domain boundaries, dependency direction, and homes for cross-cutting concerns — so every feature lands in a predictable place regardless of framework.
When to Use
- After the stack decision, before or alongside the foundation skill.
- When an existing backend's structure is being reworked (
../../refactor-planning). - Not for the external API shape — that's
rest-api-design/graphql-api-design.
Inputs
- Architecture design (
../../architecture-design) and domain list. - Chosen framework (
backend-stack-selection) and data layer (../../database/).
Discovery Questions
- What are the domains, and which depend on which?
- Where must transactions and authorization be enforced (service layer, typically)?
- What is shared across domains (auth context, errors, config, utilities)?
Responsibilities
- Define layers and dependency direction: transport (routes/controllers) → services (business rules) → data layer; lower layers never import upward.
- Draw domain boundaries; cross-domain calls go through service interfaces, not each other's tables.
- Place cross-cutting concerns: validation at the edge (
backend-validation), authorization at the edge + service (backend-authorization), transactions in services (../../database/transactions), errors centrally (backend-error-handling). - Define DTO/model separation: transport shapes ≠ database entities (
api-contracts).
Required Workflow
- List domains and their dependencies; break cycles by extracting shared concepts.
- Fix the layer rules and dependency direction.
- Assign each cross-cutting concern a single home.
- Define transport-vs-entity mapping rules.
- Record the architecture for the foundation skill to apply.
Decision Rules
- Business rules live in services — testable without HTTP.
- A domain owns its data access; other domains ask its service.
- Controllers stay thin: parse/validate → call service → map result to response.
- Start modular-monolith; extract services only under real scaling/ownership pressure (
../../architecture-design).
Rules
- One home per concern — no validation/authz scattered across layers ad hoc.
- Never return database entities directly from the transport layer.
- Record deviations explicitly; silent exceptions rot the architecture.
Anti-Patterns
- Fat controllers / anemic services.
- Domain A querying domain B's tables directly.
- Circular service dependencies.
- "Utils" folders accumulating business logic.
Validation Checklist
- Layers + dependency direction defined.
- Domain boundaries drawn; cross-domain access via services.
- Cross-cutting concerns each assigned one home.
- DTO/entity separation defined.
- Recorded for the foundation skill.
Definition of Done
A recorded internal architecture — layers, boundaries, concern placement, mapping rules — that the foundation skill can apply and reviewers can enforce.
Related Skills
../../architecture-design, express-foundation, nestjs-foundation, rest-api-design, api-contracts, backend-validation, backend-authorization, backend-error-handling, ../../database/transactions.
Related Knowledge
../../../knowledge/ (domain model, boundary decisions).
Related References
../../../references/backend/ (architecture notes, when populated).
Context Loading Guidance
- Requires: domain list, stack decision, architecture summary.
- Does not require: endpoint-level detail, framework docs, other packs.
- May load: one foundation skill,
api-contracts. - Stop when: the internal architecture is recorded.
Token Efficiency Guidance
Work at boundary altitude — a dependency table and layer rules, not code. Delegate endpoint shape to the API-design skills.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.