Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Backend Impl?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/sayeed1999-backend-impl)
---
name: backend-impl
description: Step-by-step rules for backend tasks, following the architecture layout and the API contract. Used by backend-engineer only.
---
# backend-impl
Examples use the default stack (FastAPI). If `docs/architecture.md` names another stack, use its folders and commands and keep the same rules.
## Steps
### 1. Read
- Read `docs/tasks/T-NN.md`. It names everything else you read.
- Read `docs/architecture.md`: layout, commands, error format, logging.
- Read only the endpoints the spec names in `contracts/api.md`.
- Read only the tables the spec names in `docs/schema.md`.
- If your endpoint calls AI, read the Backend integration interface in `contracts/ai.md`.
### 2. Plan the files
- Task title has `Foundation`: build `config.py`, `logger.py`, `errors.py`, `security.py`, and `GET /health` (several services: their `internal/` equivalents). Use the session from the data layer.
- Every task: the files listed under Build in the spec. Default: one folder per feature with `router.py`, `service.py`, `schemas.py`.
- Models, migrations, and seed belong to database-engineer. Import the models. Never write them.
- A third-party API call: build `external-services/<name>/` from its `contract.md`, per `skills/stack-defaults`, External services. Feature code takes the interface; the wiring passes the client.
### 3. Build in this order
- Schemas that mirror the contract exactly.
- Service with the logic. For AI endpoints, invoke the callable specified in `contracts/ai.md`.
- Router that only parses, validates, calls the service, and responds.
### 4. Test
- Target `prototype`: skip this step (`AGENTS.md`, Target).
- Per endpoint: one success test, one validation-failure test, and one auth-failure test if the endpoint is protected.
- One test per Acceptance line of the spec.
- Tests run on SQLite via the `DATABASE_URL` env var, with migrations applied. `go`: use the target's engine.
### 5. Check
- Run the lint and test commands from `docs/architecture.md`.
- Start the server and call `/health`.
- Tick the Done checklist.
- Never mark `built` with a failing command. Fix it, or raise a blocker (`skills/flow`).
## Endpoint rules
- Path, method, fields, response shape, and status codes match the contract.
- Validate every body, query, and path param. Reject unknown or invalid input with `400 VALIDATION_ERROR`.
- Use the shared error helper for every error.
- Protected routes use the auth dependency. Check ownership when reading user data.
- Use the ORM or parameterized queries.
- Log every request. Log errors at `error` level with context.
- All settings come from env through the config file in `docs/architecture.md` section 3. Add new variables to `.env.example`.
- Call third-party APIs only through `external-services/<name>/`. Tests use its fake.
## When something is wrong
- The frontend sends bad data: return the contract validation error. Send a handoff to frontend-engineer.
- The contract or the task spec is wrong or incomplete: send a handoff to architect.
- A table or column you need is missing or wrong in `docs/schema.md`: send a handoff to database-engineer.
- If it stops you, set the task `blocked` (`skills/flow`, Blockers).
## Done checklist
- Every Acceptance line of the spec passes.
- Endpoints match the contract.
- Validation and error format are correct.
- Config and logger are used through the config and logger files of the layout.
- `.env.example` is updated.
- Lint and tests pass (`prototype`: lint only). The server starts.
- Task is `built`.
## MUST
- Keep handlers thin.
- Apply migrations in tests.
## NEVER
- Change the contract or invent behavior.
- Return password hashes, internal IDs not in the contract, or stack traces.
- Read env vars outside the config file.
- Import `internal/` or service code from `external-services/`.
- Use string-built SQL.
- Import one feature folder from another.