How this skill is triggered — by the user, by Claude, or both
Slash command
/backend-engineer:database-craftThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Treat the database as the source of truth, not a dumb store. Most data problems are decided at design time — the schema, the constraints, the indexes — long before the first slow query shows up. Make those decisions deliberately.
Treat the database as the source of truth, not a dumb store. Most data problems are decided at design time — the schema, the constraints, the indexes — long before the first slow query shows up. Make those decisions deliberately.
Design to 3NF: every non-key column depends on the key, the whole key, and nothing but the key. No repeating groups, no derived columns that can drift from their source, no values that belong in their own table.
Denormalize only on profiling evidence that reads are blocked by joins or aggregations a normalized model cannot serve fast enough. Never denormalize speculatively — every duplicated value is a future consistency bug you now own. When you do denormalize, document the source of truth and how the copy stays in sync.
Index the columns the query planner actually walks:
WHERE, JOIN, and ORDER BY clauses.Guardrails:
EXPLAIN before adding an index. A sequential scan on a hot path is the signal; the plan tells you the truth, guesses do not.INSERT/UPDATE/DELETE maintains it. Drop indexes no query uses.Enforce invariants where the data lives, not only in application code:
RESTRICT, CASCADE, or SET NULL — chosen, not defaulted).price >= 0, valid enum membership).Application validation is the second line of defense — fast feedback and good messages — never the only one. Two services, a script, or a future migration will all hit the same table; the database is the one gate they all pass through.
Pick the lowest isolation level that is correct for the operation — higher levels cost concurrency and invite deadlocks.
| Level | Prevents | Still allows |
|---|---|---|
READ COMMITTED | dirty reads | non-repeatable reads, phantoms |
REPEATABLE READ | dirty + non-repeatable reads | phantoms (in standard SQL) |
SERIALIZABLE | dirty, non-repeatable, phantoms | nothing — full isolation |
Reach for SERIALIZABLE only when an invariant spans multiple rows read then written (balance checks, inventory decrements). Keep transactions short — hold no locks across network calls or user think-time.
The classic killer: load N parents, then fire one query per parent for its children.
IN (...) over the collected keys) or a single JOIN. Fetch the set in one round trip, not one round trip per element.Opening a connection is expensive; never open one per request. Reuse a bounded pool:
Watch for pool exhaustion: requests blocking on connection acquisition usually means a leaked connection (not returned to the pool) or a transaction held open too long — not a pool that is too small.
Scale in this order, stopping as soon as the load is handled:
scalable-architecture skill.A tradeoff, not a religion:
Choose by access pattern and consistency need, not by hype. Mixing both (relational core + a cache or document store at the edge) is normal.
Use expand / contract so old and new code run side by side:
Never lock a large table in a single migration. Add constraints and indexes concurrently where the engine supports it.
-- Parameterized query: never interpolate user input into SQL.
-- (For injection-safe construction, defer to the secure-by-default skill.)
SELECT id, email FROM users WHERE org_id = $1 AND status = $2;
-- Batched backfill sketch: bounded chunks, one transaction each, loop until done.
UPDATE users
SET region = legacy_region
WHERE region IS NULL
AND id IN (
SELECT id FROM users WHERE region IS NULL ORDER BY id LIMIT 1000
);
-- Repeat until 0 rows affected. Sleep briefly between batches to spare replication.
ALTER or one-shot backfill that locks a hot table is an outage.npx claudepluginhub shoto290/shoto --plugin backend-engineerProvides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.