Db antipatterns

From Hainrixz/claude-db · View interactive version

Db antipatterns is an AI agent skill from the GitHub repository Hainrixz/claude-db. Unified cross-paradigm anti-pattern catalog (M19) — relational and NoSQL smells that no single structural module owns cleanly: EAV / generic key-value tables, the "god table" with hundreds of columns, comma-separated lists in a column, polymorphic associations without FK, boolean-flag soup, Mongo un

How to use this skill

Skill file

<!-- Copyright (c) 2026 Enrique Rocha (@soyenriquerocha) · tododeia.com · id er-f37b7121 -->

db-antipatterns (M19) — unified anti-pattern catalog

M19 is the catch-all for recognized anti-patterns that span paradigms and don't sit cleanly inside one

structural module. It does not own a weight of its own. **Findings inherit the category of the most

natural module**: an EAV smell is a modeling/normalization problem → it scores under M1 (Modelado,

design); a Mongo unbounded-array smell scores under document Crecimiento-doc (performance); polymorphic

associations without an FK score under M3 (Integridad referencial, both). The finding's module stays

M19 for provenance, but expected_impact.axis and the rule id's intent route it to the owning

category at scoring time. This avoids double-counting — a single smell contributes to exactly one

category per axis. See references/scoring-model.md for the category map per paradigm.

What it checks (catalog)

Relational / SQL:

re-homes to M1 (design). Defeats types, constraints, indexing.

NoSQL:

Crecimiento-doc (performance).

Access-pattern & embedding (design).

document Query (performance, directional/structural).

Durabilidad (perf). Sev-5 only with live evidence of durability config; else directional.

Tier-0 static checks

Parse the schema/ORM (scripts/parse-schema.mjs, parse-orm-python.py). Flag: a table whose columns

are literally (entity_id, attribute, value); column count above a high threshold with mostly-nullable

columns; string columns named tags/roles/csv; *_type + *_id pairs with no matching FK; ≥N

is_*/has_* booleans on one table; Mongoose schemas with array-of-subdocument fields and no cap.

Tier-1 verification query

JOIN pg_class ON relname=table_name GROUP BY relname ORDER BY cols DESC;`

and db.coll.stats() for avg doc size trending toward 16 MB.

Findings

Emit per schema/finding.schema.json. Example ids:

re-homes to Modelado/M1).

axis both, re-homes to M3).

re-homes to document Crecimiento-doc; sev-5 only with live size evidence).

Each finding: evidence.observed quotes the real DDL/Mongoose schema/query verbatim with secrets

redacted; verification.reproduce is one of the runnable commands above (referencing $DATABASE_URL);

verification.method is ddl_parse, schema_introspect, or manual_review;

expected_impact is {axis, confidence, magnitude (high|medium|low), rationale} — banded, never a naked %.

Honesty

and embedded arrays are legitimate in the right context. State the assumption.

score. Redis-undurable and unbounded-array sev-5 require live evidence; otherwise directional or

needs_api, never a silent pass.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.