Backend Foundation

Advisor Strategy

Backend-specific advisor checkpoints: when to escalate to Opus for data model, migration, and API design decisions.

Why Backend Is Different

Backend mistakes are more expensive to reverse

In frontend work, a wrong component can be rebuilt in an hour. In backend work, a wrong data model choice can mean a painful migration weeks later. An incorrect API contract breaks every consumer. A missing index kills production performance at scale.

Backend advisor rule: The advisor pays off fastest on decisions that are hard to reverse. Data models, public APIs, and auth architecture are the three highest-value advisor checkpoints for backend work.

The advisor pattern for backend is the same tool as covered in Building Blocks — what changes is when and what to ask. This page covers those specifics.

Checkpoint 1

Before finalising a data model

Before writing any migration, call advisor with your proposed schema and ask these questions explicitly:

# Example advisor brief for data model review:
"I'm designing a schema for multi-tenant user permissions.
Proposed: users → roles (many-to-many) → permissions (many-to-many).
Open questions:
- Should permissions be role-level or user-level override?
- Do we need audit trail at the permission-assignment level?
- Any N+1 risks with this structure at 100k users?
Check for: normalisation issues, missing indexes, migration pain."
What to check: Normalisation, index coverage, migration difficulty, N+1 risks, future growth patterns. Advisor is better at spotting these than Sonnet because it reasons about trade-offs rather than just generating a valid schema.
Checkpoint 2

Before writing or modifying a public API

API contracts are the most expensive thing to change — every consumer breaks. Call advisor before finalising endpoint signatures, response shapes, and error formats.

TopicWhat to ask the advisor
VersioningBackward compatibility, versioning strategy, pagination approach
Error shapesError response shape consistency with existing endpoints
Auth scopeDoes this endpoint need granular permission checks?
Rate limitingShould this be subject to the global limiter or a separate budget?
If the advisor flags a breaking change risk, treat it as a blocker — not a "nice to fix later." Breaking changes found in review cost 5x more than breaking changes caught in design.
Checkpoint 3

After a migration is written, before applying

Never run a migration without an advisor review on staging-equivalent data volumes. The advisor prompt should include the migration SQL or Django migration code and ask specifically about:

Risk areaWhat to verify
Table lock riskWill this lock the table? At what row count does it become dangerous?
Rollback planIs this reversible? What's the down migration?
Zero-downtimeCan this run while the app is live or does it require maintenance mode?
Data integrityDoes this leave any existing rows in an invalid state?
55 Tech practice: Add a migration-review checklist to your project CLAUDE.md. When Claude writes a migration, it automatically runs through the checklist before marking the task complete.
Check your understanding
1. Why does backend work especially benefit from the advisor pattern?
Correct.Not quite. Backend decisions like data models, public API contracts, and migrations are hard to reverse. The advisor's cost is a fraction of the cost of a wrong-path migration.
2. When should you call advisor for a database migration?
Correct.Not quite. Review after writing, before applying. The advisor should check table lock risk, rollback plan, zero-downtime viability, and data integrity.
3. Which of these is NOT a question to ask the advisor when reviewing an API contract?
Correct.Not quite. JSON field naming is a stylistic concern, not an advisor-level architectural decision. The advisor is for breaking change risk, auth scope, pagination, and rate limiting.