managarten/.claude/guidelines
Till JS 5ec1dfc747 chore(db): enforce pgSchema isolation with a lint script
The "every Drizzle table uses pgSchema" rule was documented in
.claude/guidelines/database.md (added yesterday as part of Concern 5)
but enforced only by convention. A new service could slip a raw
\`pgTable()\` past review and collide in the default \`public\` schema
of \`mana_platform\`, and nothing would surface the mistake until a
production migration failed.

- \`scripts/validate-pg-schema-isolation.mjs\` scans every tracked
  TypeScript file under services/, apps/api/, packages/ for call sites
  of \`pgTable(\` (not imports — imports can still be useful for types).
  Strips comments before matching so doc-examples like "use \`pgTable()\`"
  don't trigger false positives.
- Wired as \`pnpm run validate:pg-schema\` and a new CI step in the
  validate job (right after the turbo-recursion check). 721 files
  scan clean today.
- Removed an unused \`pgTable\` import in mana-subscriptions that would
  have been the only import of the symbol remaining after this change.
- Updated .claude/guidelines/database.md — the old verification blurb
  said "no automated lint rule yet", now points at the enforcer.

Drift verified: injecting a synthetic \`pgTable('bad', {})\` into
subscriptions.ts failed with a clear file:line violation pointing at
the database guideline.

Closes the "no automated lint rule" gap noted in the database guideline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 14:45:59 +02:00
..
ai-tools.md docs(ai-tools): add how-to guide for wiring module tools to the AI agent 2026-04-19 19:15:57 +02:00
authentication.md feat(auth): server-side tier gating via requireTier middleware 2026-04-19 17:38:06 +02:00
code-style.md chore: remove all NestJS backend references, replace with Hono/Bun 2026-03-31 16:52:25 +02:00
database.md chore(db): enforce pgSchema isolation with a lint script 2026-04-20 14:45:59 +02:00
design-ux.md chore(lint): audit:theme-tokens guard against bare --muted / --theme-* drift 2026-04-16 00:58:13 +02:00
error-handling.md 💄 style: apply prettier formatting across codebase 2025-12-03 02:02:09 +01:00
expo-mobile.md 💄 style: apply prettier formatting across codebase 2025-12-03 02:02:09 +01:00
hono-server.md refactor: rename nutriphi module to food (Essen) 2026-04-14 15:30:07 +02:00
sveltekit-web.md refactor: rename zitare -> quotes (Zitate) 2026-04-14 20:59:16 +02:00
testing.md chore(ci): add v8 test coverage tracking (non-blocking baseline) 2026-04-19 19:21:14 +02:00