build-backend
Implement and verify the agreed backend slice, including contracts, authorization, persistence, failures, and operations.
SKILL.md.claude/skills/build-backend/SKILL.md
GitHub<!-- Generated by mstack from Misbah's Build Like This workflow. Regenerate instead of editing. -->
build-backend
Run Phase 7 with the backend-delivery skill. The backend-engineer leads and delegates database, security, and independent test/contract lanes, with ai-engineer included only when an AI boundary exists.
This prompt follows Misbah Khursheed's Build Like This workflow: establish the user outcome and reasoning before generating implementation, then preserve that reasoning in contracts, boundaries, tests, and documentation.
Project identity and sources of truth
The repository where this prompt is installed is the host project being built. Build Like This is the engineering method used to build it, while mstack only installs and reconciles the method's resources. Do not mistake mstack or Build Like This for the host product unless project-owned sources explicitly say this repository develops mstack itself.
Project-owned docs/, decisions, executable code, and tests are the sources of truth. .mstack/templates/ are reference scaffolds that may be copied and adapted into project-owned documents; they are not requirements and do not replace docs/.
Treat the invocation arguments and current repository state as task input. Discover local instructions and relevant product, architecture, decision, contract, and test context before making material assumptions.
Method
- Confirm agreed product/architecture behavior, actors, permissions, contracts, state transitions, errors, compatibility, and acceptance criteria.
- Resolve contract/document conflicts before coding and define runtime-validated schemas, authorization, invariants, transactions, idempotency, and stable errors.
- Implement the domain/application vertical slice behind cohesive module interfaces, then connect persistence and provider adapters with safe timeouts/recovery.
- Keep transport handlers thin, vendor/ORM types behind infrastructure boundaries, and logs/metrics useful but free of secrets and unnecessary personal data.
- Test success, validation bounds, authentication/authorization, tenant/resource isolation, duplicates/concurrency, dependency failure, and recovery at appropriate levels.
- Run relevant formatter, strict types, lint, tests, and production build; document migrations, configuration, rollout/recovery, and frontend contract examples.
Deliverables
- Working backend vertical slice with validated stable contracts, server-owned invariants, permissions, errors, and compatibility.
- Focused unit/integration/contract/security/recovery tests and exact verification results.
- Frontend handoff plus migration, observability, configuration, rollout, recovery, and residual-risk notes.
Constraints
- Do not place domain rules in routes, jobs, ORM models, callbacks, or UI clients.
- Do not expose secrets, stack traces, database internals, vendor payloads, or unnecessary personal data.
- Do not edit applied migration history or break existing consumers without a documented compatible path.
Delegation and parallel safety
- For a material lifecycle task, the active lead must delegate at least one bounded specialist lane when subagents are available; prefer two or more concurrent lanes only when their evidence or file ownership is independent.
- The active lead owns acceptance criteria and final integration. Supporting agents must not recursively delegate unless explicitly promoted to lead a named lane.
- Give each delegate distinct inputs, outputs, and ownership. Serialize shared documents, contracts, schemas, migrations, deployments, external writes, and overlapping file edits.
- If subagents are unavailable, perform the named specialist passes sequentially and report the limitation; do not imply parallel verification.
- Delegation does not authorize outreach, paid resources, destructive changes, consequential external writes, or production deployment.
Finish with what changed or was decided, exact verification evidence, remaining risks, and the next decision only if one is genuinely required.
User arguments: $ARGUMENTS