db-schema — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited db-schema (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
<!-- target: tokens_target above. Run python tools/render_readme_table.py to update README. -->
Purpose: Prevent data-integrity bugs, race conditions, and irreversible migrations by enforcing database-level constraints and safe migration patterns before code reaches production.
snake_case for table names, column names, and index names; never use camelCase or PascalCase in SQL identifiers.users, orders, line_items); singular names cause inconsistency across ORMs and query builders.<referenced_table_singular>_id (e.g., user_id, order_id) so the reference is self-documenting.id) on every table; never rely on natural keys as the sole PK unless the domain guarantees immutability.uuid PKs for distributed systems or public-facing IDs; prefer bigserial / bigint GENERATED ALWAYS AS IDENTITY for high-insert internal tables where sort order matters.FOREIGN KEY constraints in the schema; never rely on application-layer join logic to enforce referential integrity.ON DELETE behaviour (CASCADE, SET NULL, or RESTRICT) on every FK; omitting it defaults to RESTRICT, which can cause surprising errors at runtime.SELECT) for read-heavy queries rather than adding redundant columns to the base table.NOT NULL unless NULL carries distinct semantic meaning (unknown vs. absent); nullable columns complicate query logic and ORM mapping.DEFAULT for columns that have a sensible zero-value (0, '', false, now()); avoid forcing callers to supply values the DB can compute.created_at TIMESTAMPTZ NOT NULL DEFAULT now() and updated_at TIMESTAMPTZ NOT NULL DEFAULT now() on every table; omitting them makes debugging and auditing impossible.deleted_at TIMESTAMPTZ over hard deletes for user-facing entities; ensure all queries filter WHERE deleted_at IS NULL or use a view/partial index.CHECK constraint or a native ENUM type; never store unconstrained strings and validate only in the application.up and a down migration; a rollback path is mandatory before any migration reaches production.IF NOT EXISTS / IF EXISTS so re-running a migration does not error; this is required for blue-green and multi-replica deployments.CREATE INDEX CONCURRENTLY (Postgres) or equivalent for indexes on large tables; blocking index creation causes downtime.price > 0, quantity >= 0) as CHECK constraints; application-layer validation is bypassed by direct DB writes, scripts, and migrations.skills/code-quality/SKILL.md — general code-quality rules that apply to migration scriptsskills/review-deployment/SKILL.md — deployment checklist that includes migration safety gates~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.