| name | backend-change-planning |
| description | Use when backend work requires contract-first thinking, schema changes, permission checks, side-effect analysis, or test planning. |
Backend Change Planning
Use this skill before implementing non-trivial backend changes.
Check in this order
- Contract changes — are request/response shapes, status codes, or error formats changing? List every endpoint affected. If the API is public or consumed by other teams, flag it as a breaking change risk.
- Schema and migration changes — are tables, columns, indexes, or constraints being added, modified, or removed? Migrations must be:
- Reversible (or explicitly flagged as one-way)
- Safe under concurrent traffic (no locking whole tables in production)
- Applied before code that depends on them
- Query and repository impact — are queries changing? Check for N+1 patterns, missing indexes on new filter columns, and unbounded result sets.
- Validation and error flow — is input validation complete at the boundary? Are error types and messages consistent with the existing codebase?
- Permission and ownership checks — does the change enforce proper authorization? Can a user access or modify resources they don't own?
- Audit and other side effects — does the change need to emit events, logs, notifications, or update caches? Are these handled transactionally or eventually?
- Tests — for each item above, define the tests that verify correctness:
- Contract tests (request/response shape validation)
- Migration tests (up and down)
- Permission boundary tests (authorized vs. unauthorized)
- Error path tests (invalid input, dependency failure)
Expected output
Produce a structured checklist with findings for each item:
- contract impact — [endpoints affected, breaking changes]
- schema and migration impact — [tables, columns, reversibility]
- query impact — [new queries, indexes needed, performance notes]
- validation and error handling — [boundary checks, error types]
- permission and ownership impact — [auth rules, resource scoping]
- audit and side effects — [events, notifications, cache invalidation]
- required tests — [specific scenarios with expected outcomes]
Write "N/A — [reason]" for items that do not apply.
Implementation order for backend changes
- Migrations first — run and verify before deploying code that uses new schema
- Shared types and interfaces second — DTOs, error types, shared validators
- Repository/data layer third — new queries, updated repository methods
- Service/business logic fourth — core behavior
- Handlers/controllers fifth — wiring to HTTP or event triggers
- Tests alongside each step — do not batch all tests to the end
Common backend mistakes to verify against
- Missing database index on a new WHERE clause or JOIN column
- Nullable column added without handling NULL in existing queries
- Migration that locks a large table under traffic
- Error response format inconsistent with existing API conventions
- Transaction boundary too wide (holding locks longer than necessary) or too narrow (partial updates on failure)
- Missing rate limiting or pagination on new list endpoints
Maintain this checklist consistently with the repository guidance in docs/agent-playbook.md, and update any related agent/template docs together when intentional workflow changes are made.
Conformance self-check
Before marking backend planning as complete, verify: