/everything-backend:backend-db-designfrom everything-backend
Designs database schemas for backend features: tables, keys, indexes, constraints, transactions and multi-tenant isolation, with an ERD and migration plan.
Ships in everything-backend. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Design the target schema for a feature, review it, and hand an ordered migration plan to backend-migrate.
backend-implement or backend-auth reports missing persistence (loop-back).Not for: writing or applying migration files (backend-migrate), changing existing tables in place without a design question (backend-migrate), rendering or saving diagrams (backend-visualize), system-level architecture (backend-architect).
Boundary: this skill produces the target schema and a migration PLAN. It never writes or applies migration files.
backend-migrateis the only skill that writes and applies migrations.
_shared/ inside this skill's folder (bundled installs), then ../_shared/ next to it; other fallbacks are in <shared>/context-loading.md -> Resolving _shared/ Files. A missing shared doc is a warning, not a stop.<shared>/tool-rules.md (mode=auto contract, checkpoints), <shared>/principles.md (Database and Security sections) and <shared>/memory-schema.md (db-schema.md and decisions.md formats). Read <shared>/host-tools.md if the actions below don't map clearly to your host's tools.<shared>/context-loading.md: always project-overview.md, tech-stack.md, db-schema.md and decisions.md; api-patterns.md only if the design touches endpoints. If memory is missing or stale, suggest backend-scan and continue from the live code; create db-schema.md from the schema in <shared>/memory-schema.md when you save the design.<shared>/stacks/, read it (for PostgreSQL: <shared>/stacks/postgres.md).This skill writes only memory files. Start a checkpoint before the first memory write: node <shared>/scripts/checkpoint.js start --skill backend-db-design --feature <slug>. Record each memory file you change (checkpoint.js record --skill backend-db-design --feature <slug> --memory <file>) and close it when done (checkpoint.js close --skill backend-db-design --feature <slug>). If it exits with code 3, an open checkpoint exists: offer to resume or restart. If Node is unavailable, follow <shared>/tool-rules.md -> Concurrent & Partial Work by hand.
Memory is a summary; the live code wins (see <shared>/memory-schema.md -> conflict rules).
schema.prisma, Drizzle schema, model or entity classes, models.py, db/schema.rb), migration folders (migrations/, prisma/migrations/, db/migrate/, alembic/versions/, supabase/migrations/) and raw .sql files.db-schema.md. Note conflicts and log them as the conflict rules in <shared>/memory-schema.md say.Do not connect to a database to inspect it unless the user asks; if they do, use read-only queries and follow <shared>/tool-rules.md -> Production Targets.
Output: a short "Current schema and conventions" note. Greenfield projects: say so and skip.
Ask in small batches, and stop asking when answers are clear from the request or code:
Confirm: "Entities: [list]. Did I miss any?" If no entity can be identified, stop and ask.
Done when the entity list, relationships and top access patterns are confirmed.
tech-stack.md, decisions.md or the code already names the primary database, use it. backend-architect decisions take precedence. Do not propose a switch mid-feature; raise concerns as a question.references/database-selection.md and record the choice in decisions.md.For each table or collection define: name, columns with types and nullability, primary key, candidate and business keys, foreign keys with ON DELETE behavior, UNIQUE and CHECK constraints, and indexes tied to a query from Step 2.
Apply these rules (details in references/relational-rules.md):
decisions.md.NOT NULL by default; timestamps in UTC (timestamptz in PostgreSQL); a real mechanism for updated_at.ON DELETE deliberately.backend-auth and include the tables it asks for. Do not design a single role column here.references/multi-tenancy.md and record the tenancy model in decisions.md.references/database-security.md: a migration role that owns the objects and an application role with DML only (no DDL, no SUPERUSER/BYPASSRLS, no file or program privileges), statement_timeout per role, RLS on tenant-owned tables as a second layer, and SECURITY DEFINER functions with a fixed search_path. These back up <shared>/sql-safety.md (rules 8 and 11); they never replace bound parameters or the owner predicate in every query (rule 3).Use references/schema-templates.md for the canonical PostgreSQL, MySQL and MongoDB examples and the ORM schema mapping. Use references/domain-patterns.md when the feature is a common domain (users, content, e-commerce, messaging, audit).
Output: target DDL (or ORM schema, or collection validators) for every new or changed table.
backend-ops), concurrency strategy (unique constraint, version column, row lock or idempotency key).references/database-security.md.Fill the tables in references/review-templates.md.
Draft a Mermaid erDiagram with PK, FK and UK markers and every relationship, per references/erd.md. Hand it to backend-visualize for rendering conventions and saving if the user wants a rendered or stored diagram.
Produce a plan, not migration files. One row per schema change:
| # | Change | Kind | Data movement | Depends on | Rollback intent |
|---|---|---|---|---|---|
| 1 | Create users | additive | none | - | drop table (empty) |
| 2 | Create posts with FK to users, index user_id | additive | none | 1 | drop table (empty) |
| 3 | Add users.locale NOT NULL default 'en' | existing table, constant default | none | - | drop column |
| 4 | Rename users.name to full_name | existing table, expand/contract | dual-write + batched backfill | - | per phase |
additive (new tables, nullable columns, indexes on new tables) or existing table changes. Mark anything that rewrites, renames, retypes or drops existing columns, or sets NOT NULL on an existing column, as expand/contract. A new NOT NULL column with a constant default is not expand/contract, but backend-migrate still checks it for locks.backend-deploy.backend-migrate writes the files with the project's tool, applies its lock-safe and expand/contract rules (dual-write, safe NOT NULL, lock_timeout, CONCURRENTLY), and applies migrations only after Always Ask First (<shared>/tool-rules.md).
Present, in this order:
Ask: "Does this schema meet your needs? Any missing fields, relationships or access patterns?" Iterate until the user approves. In mode=auto, pause only for missing critical inputs or conflicting decisions (<shared>/tool-rules.md -> mode=auto Contract).
On approval, save without a further prompt (memory updates are part of this skill's stated output):
db-schema.md an entry ## [YYYY-MM-DD HH:MM] Planned: <feature> (not yet applied) with tables, relationships, indexes and invariants. backend-migrate marks it applied.decisions.md each new decision: database choice, PK strategy, tenancy model, retention policy, denormalization exceptions.backend-migrate: target schema and migration plan (always).backend-visualize: the ERD, if a rendered diagram is wanted.backend-api-design: next step in a feature workflow; pass the concurrency columns that need ETag or 409 handling.backend-test: cross-tenant and constraint tests, when relevant.In mode=interactive, show each memory diff and wait for approval before writing it.
backend-migrate.db-schema.md and new entries in decisions.md.ON DELETE choice; every index names its query.statement_timeout, and tenant-owned tables have RLS (PostgreSQL) or a recorded reason why not.mode=auto had no blocking question).db-schema.md and decisions.md are updated, the checkpoint is closed, and the handoff to backend-migrate is stated.backend-migrate.backend-migrate uses expand/contract and lock-safe steps.references/database-selection.md: read when no primary database is recorded, or the user asks which database to use.references/relational-rules.md: read in Step 4 for keys, columns, case and Unicode, FKs, soft delete, money, concurrency columns, sensitive data, audit and outbox tables.references/schema-templates.md: read when writing the target schema; canonical PostgreSQL, MySQL and MongoDB examples and the ORM mapping.references/multi-tenancy.md: read when data belongs to tenants (SaaS, organizations, workspaces).references/database-security.md: read in Steps 4, 5 and 7 for application vs migration roles, grants, per-role timeouts, RLS as defense in depth, SECURITY DEFINER functions and in-database dynamic SQL.references/domain-patterns.md: read when the feature is users, content, e-commerce, messaging, audit or another common domain.references/review-templates.md: read in Steps 5 and 8 for the normalization, index, key and transaction tables.references/erd.md: read in Step 6 for ERD rules and the template.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
schema-design, database-modeling, migrations, erd, multi-tenancy
npx claudepluginhub codeworksid/everything-backend --plugin everything-backend16 skills in this plugin
/backend-api-designDesigns API contracts before code is written: resources, endpoints, request and response schemas, error format, pagination, versioning and per-endpoint authorization rules. Writes the contract to an OpenAPI spec (docs/api/openapi.yaml by default, or the existing spec) and records conventions in api-patterns.md memory. REST is fully covered; GraphQL schemas and gRPC .proto contracts get basic guidance. Use when the user says 'design the API', 'what endpoints do I need', 'plan routes', 'write an OpenAPI spec', 'Swagger', 'define the API contract', 'design a GraphQL schema', 'write a proto file', 'add an endpoint to the spec', or 'version or deprecate an endpoint'. Not for writing handler code (backend-implement), choosing the login mechanism or auth endpoints (backend-auth), or reviewing API security (backend-security)./backend-architectDesigns backend architecture for new and existing systems, including architecture pattern (monolith, modular monolith, microservices, serverless), tech stack, module boundaries, consistency rules and non-functional targets, then records the result as docs/architecture/overview.md, numbered ADR files in docs/adr/ and project memory. Use when the user says "design the architecture", "plan the backend", "how should I structure this", "what tech stack should I use", "should we split into microservices", "write an ADR", "redesign this system", or is starting a new project or a major feature. Hands diagrams to backend-visualize and detailed schema and API work to backend-db-design and backend-api-design./backend-authDesigns, implements and hardens authentication and authorization for backend services, covering sessions, JWT and opaque tokens, OAuth 2.0/OIDC and SSO, API keys, password hashing, account recovery, MFA, RBAC/ABAC, tenant isolation, CSRF and session hardening. Writes the auth core (verifier, middleware, authorization gate), records the auth decision in project memory, and defines the negative tests that prove it. Use when the user says auth, authentication, authorization, login, sign up, sign in, logout, session, JWT, refresh token, OAuth, OIDC, SSO, SAML, SCIM, API key, MFA, 2FA, passkey, WebAuthn, password reset, CSRF, roles, permissions, RBAC, access control, multi-tenant access, or asks to review or harden an existing auth flow./backend-debugTriages and fixes backend bugs with a strict loop: capture the report, reproduce it locally, write a failing test, find the root cause with evidence, apply a minimal fix, prove the test passes and the suite is green, and record the root cause in project memory. Also diagnoses performance regressions and does read-only triage of production incidents. Use when the user says 'bug', 'fix this error', 'it is broken', 'a test fails because the code is wrong', 'regression', 'exception', 'stack trace', '500 error', 'why does X happen', 'why is X slow', or 'debug this'. Not for new features (backend-implement), behavior-preserving cleanup (backend-refactor), writing migrations (backend-migrate), or a security review (backend-security)./backend-deployPlans and generates deployment for backend services. Picks a target (PaaS, containers on a VM, Kubernetes, serverless), writes Dockerfiles for Node, Python, Go and Java, docker compose for local runs, CI/CD pipelines with a gated migration step, Kubernetes manifests or Helm values, and a release plan with rolling, blue-green or canary strategy, rollback and post-deploy checks. Validates the artifacts locally and records the setup in deployment memory and a deploy runbook. Use when the user says deploy, ship to production, Dockerfile, containerize, docker compose, CI/CD, GitHub Actions, GitLab CI, pipeline, Kubernetes, K8s, Helm, readiness or liveness probes, release strategy, canary, blue-green, rollback a release, or environment promotion. Not for writing migrations (backend-migrate), backup, DR and resilience (backend-ops), code health checks (backend-doctor) or security review (backend-security)./backend-doctorRuns execution-based health checks on an existing backend: build, tests, coverage, lint and type checks, dependency audits, a local smoke test, and a scan for obvious code anti-patterns, then reports evidence-backed findings with severities and the skill that should fix each one. Diagnose-only: it never edits code or installs packages. Use it when the user says check my backend, run doctor, health check, review my code, what's wrong with this service, or before a release or after a large change. Supports mode=review to check only the files changed against the base branch, for example a pull request. Not for a security review, threat model or OWASP audit (use backend-security), fixing a specific bug (backend-debug), or adding health endpoints (backend-ops).Other plugins' skills for the same job