Existing Backend Audit
Purpose
Build an accurate picture of an existing backend — framework, layering, API surface, auth model, data access, async work, integrations, tests, and risks — before any change is planned. Read-only: it changes nothing.
When to Use
- Before enhancing, refactoring, or migrating an existing backend.
- When onboarding this system onto a backend it hasn't seen.
- Not for greenfield projects (use
backend-stack-selection).
Inputs
- Repository access (read-only) and any prior audit in
../../../projects/current/ or ../../../generated/.
- The request driving the audit (what change is coming).
Discovery Questions
- What framework/runtime and versions are in use? Any deprecated majors?
- How is the code layered (routes/controllers/services/data)? Is business logic in handlers?
- How are authentication and authorization enforced, and where?
- What data layer and database are used? Migrations tracked?
- What background jobs, queues, webhooks, and third-party integrations exist?
- What is tested, and does CI run it?
Responsibilities
- Inventory: framework, structure/layering, API surface (routes, versioning), validation approach, error handling, auth/authorization model, data layer + schema/migrations state, jobs/queues/schedulers, integrations/webhooks, config/secrets handling, logging/observability, tests + CI.
- Flag risks: missing authorization checks, unvalidated inputs, secrets in code, unbounded queries, missing rate limits on public endpoints, untested critical paths.
- Record findings where planning skills can consume them.
Required Workflow
- Map entry points and layering from the code (not from stale docs).
- Trace one representative request end-to-end (route → validation → authz → service → data).
- Inventory the areas above; note versions and drift.
- List risks with evidence (file:line), separated Confirmed vs Potential.
- Record findings for the planning skill that triggered the audit.
Decision Rules
- Evidence over assumption: every claim cites a file or config.
- Depth follows the upcoming change — audit deeply where the change lands, broadly elsewhere.
- Security findings route to
../../security-review; don't duplicate its assessment here.
Rules
- Read-only. No fixes, no dependency changes, no "quick cleanups."
- Never print secrets found during the audit; flag location + rotation need only.
- Mark unverified behavior "unverified until run" rather than asserting it.
Anti-Patterns
- Fixing issues mid-audit.
- Trusting README/docs over the actual code.
- Auditing every module at equal depth regardless of the planned change.
- Vague findings ("auth looks weak") without file references.
Validation Checklist
Definition of Done
A recorded backend inventory + risk list with evidence, scoped to the upcoming change, consumable by planning skills — and an untouched codebase.
Related Skills
../../existing-project-audit, backend-stack-selection, backend-api-architecture, ../../security-review, ../../dependency-audit, ../../environment-audit, ../../database/database-selection.
Related Knowledge
../../../knowledge/ (known architecture decisions, service history).
Related References
../../../references/backend/ (audit notes, when populated).
Context Loading Guidance
- Requires: repo read access, the driving request.
- Does not require: frontend/mobile code, full git history, all references.
- May load:
../../security-review (findings hand-off), ../../dependency-audit.
- Stop when: findings are recorded for the planning skill.
Token Efficiency Guidance
Sample representative files per layer instead of reading everything; trace one request deeply rather than all routes shallowly. Summarize findings — don't paste code bodies.
1---2name: existing-backend-audit3description: Use to inventory an existing backend before changing it — framework, structure, API surface, auth/authorization model, data layer, jobs, integrations, tests, security posture. Produces findings that feed planning; changes nothing.4---56# Existing Backend Audit78## Purpose910Build an accurate picture of an existing backend — framework, layering, API surface, auth model, data access, async work, integrations, tests, and risks — before any change is planned. Read-only: it changes nothing.1112## When to Use1314- Before enhancing, refactoring, or migrating an existing backend.15- When onboarding this system onto a backend it hasn't seen.16- **Not** for greenfield projects (use `backend-stack-selection`).1718## Inputs1920- Repository access (read-only) and any prior audit in `../../../projects/current/` or `../../../generated/`.21- The request driving the audit (what change is coming).2223## Discovery Questions2425- What framework/runtime and versions are in use? Any deprecated majors?26- How is the code layered (routes/controllers/services/data)? Is business logic in handlers?27- How are authentication and authorization enforced, and where?28- What data layer and database are used? Migrations tracked?29- What background jobs, queues, webhooks, and third-party integrations exist?30- What is tested, and does CI run it?3132## Responsibilities3334- Inventory: framework, structure/layering, API surface (routes, versioning), validation approach, error handling, auth/authorization model, data layer + schema/migrations state, jobs/queues/schedulers, integrations/webhooks, config/secrets handling, logging/observability, tests + CI.35- Flag risks: missing authorization checks, unvalidated inputs, secrets in code, unbounded queries, missing rate limits on public endpoints, untested critical paths.36- Record findings where planning skills can consume them.3738## Required Workflow39401. Map entry points and layering from the code (not from stale docs).412. Trace one representative request end-to-end (route → validation → authz → service → data).423. Inventory the areas above; note versions and drift.434. List risks with evidence (file:line), separated **Confirmed** vs **Potential**.445. Record findings for the planning skill that triggered the audit.4546## Decision Rules4748- Evidence over assumption: every claim cites a file or config.49- Depth follows the upcoming change — audit deeply where the change lands, broadly elsewhere.50- Security findings route to `../../security-review`; don't duplicate its assessment here.5152## Rules5354- Read-only. No fixes, no dependency changes, no "quick cleanups."55- Never print secrets found during the audit; flag location + rotation need only.56- Mark unverified behavior "unverified until run" rather than asserting it.5758## Anti-Patterns5960- Fixing issues mid-audit.61- Trusting README/docs over the actual code.62- Auditing every module at equal depth regardless of the planned change.63- Vague findings ("auth looks weak") without file references.6465## Validation Checklist6667- [ ] Framework, versions, layering mapped from code.68- [ ] One request traced end-to-end.69- [ ] API surface, auth model, data layer, async work, integrations inventoried.70- [ ] Tests + CI state recorded.71- [ ] Risks listed with evidence, Confirmed vs Potential.72- [ ] Nothing modified.7374## Definition of Done7576A recorded backend inventory + risk list with evidence, scoped to the upcoming change, consumable by planning skills — and an untouched codebase.7778## Related Skills7980`../../existing-project-audit`, `backend-stack-selection`, `backend-api-architecture`, `../../security-review`, `../../dependency-audit`, `../../environment-audit`, `../../database/database-selection`.8182## Related Knowledge8384`../../../knowledge/` (known architecture decisions, service history).8586## Related References8788`../../../references/backend/` (audit notes, when populated).8990## Context Loading Guidance9192- **Requires:** repo read access, the driving request.93- **Does not require:** frontend/mobile code, full git history, all references.94- **May load:** `../../security-review` (findings hand-off), `../../dependency-audit`.95- **Stop when:** findings are recorded for the planning skill.9697## Token Efficiency Guidance9899Sample representative files per layer instead of reading everything; trace one request deeply rather than all routes shallowly. Summarize findings — don't paste code bodies.