/house-style:howto-develop-with-postgresfrom house-style
Enforces PostgreSQL transaction safety, type safety for UUIDs/JSONB, read-write separation, and snake_case naming conventions to prevent data corruption and runtime errors.
Ships in house-style. 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.
Enforce transaction safety, type safety, and naming conventions to prevent data corruption and runtime errors.
Core principles:
Methods that START transactions:
Methods that PARTICIPATE in transactions:
What DOES NOT count as "starting a transaction":
onConflictDoUpdateDefault: ULID stored as UUID
Exceptions (context-dependent):
Rule: If unsure whether data will be user-visible, use ULID.
Use exact decimal types (numeric/decimal) for monetary values:
numeric(19, 4) for general financial dataWhy: Floating-point types accumulate rounding errors. Exact decimal types prevent financial discrepancies.
ALWAYS type JSONB columns in your ORM/schema:
Record<string, unknown> if truly schemalessWhy: Prevents runtime errors from accessing undefined properties or wrong types.
Maintain separate client types at compile time:
Why: Prevents accidental writes to replica, enforces deliberate mutation choices.
All database objects use snake_case:
user_preferences, order_itemscreated_at, user_id, is_activeidx_tablename_columns (e.g., idx_users_email)fk_tablename_reftable (e.g., fk_orders_users)Application code: Map to idiomatic case (camelCase in TypeScript, etc.)
Standard mixins:
created_at, updated_at timestamps on all tablesdeleted_at for soft deletion when neededtenant_id for multi-tenant tables (project-dependent)Proactive indexing:
Default isolation (Read Committed) for most operations.
Use stricter isolation when:
SELECT ... FOR UPDATE)Always use generate + migrate workflow:
Never use auto-push workflow in production.
| Mistake | Reality | Fix |
|---|---|---|
| "This is one operation, doesn't need transaction" | Multi-step operations without transactions cause partial updates and data corruption | Wrap in transaction with TX_ prefix |
| "Single atomic operation needs TX_ prefix" | TX_ is for explicit transaction blocks, not atomic operations | No TX_ for single INSERT/UPDATE/DELETE |
| "UUID is just a string" | Type confusion causes runtime errors (wrong ID formats, failed lookups) | Use strict UUID type in language |
| "I'll type JSONB later when schema stabilizes" | Untyped JSONB leads to undefined property access and type errors | Type immediately with known fields or Record<string, unknown> |
| "Read client vs write client doesn't matter" | Using wrong client bypasses separation, allows accidental mutations | Use read-only client by default, switch deliberately |
| "I'll add indexes when we see performance issues" | Missing indexes on foreign keys cause slow queries from day one | Add indexes proactively for FKs and common filters |
| "This table won't be user-visible, use serial" | Requirements change, IDs leak in logs/URLs/errors | Use ULID by default unless certain it's internal-only |
| "Float/double is fine for money, close enough" | Rounding errors accumulate, causing financial discrepancies (0.01 differences multiply) | Use numeric/decimal types for exact arithmetic |
Transaction management:
.transaction() but no TX_ prefixTX_ prefix but accepts executor parameterType safety:
Schema:
created_at/updated_at timestampsAll of these mean: Stop and fix immediately.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub pbdeuchler/llm-plugins --plugin house-style9 skills in this plugin
/authoring-issuesUse when asked to write, draft, file, or open a GitHub issue - mandates exploring the relevant code to understand the whole problem space, reasoning any proposed solution, and structuring the issue with summary, what/why, references, nuances, open questions, and acceptance criteria. Adds professionalism and no-sensitive-info discipline for public repos./coding-effectivelyALWAYS use before any implementation work, review, or planning: designing, writing, editing, refactoring, debugging, reviewing, or generating source code, tests, scripts, config-as-code, or behavior-affecting files. This is a baseline engineering skill and should be invoked even when a more specific language, framework, testing, or database skill also applies./defense-in-depthUse when invalid data causes failures deep in execution - validates at every layer data passes through to make bugs structurally impossible rather than temporarily fixed/holistic-reviewUse when reviewing a completed implementation holistically - a finished branch, a completed plan step, or a diff before PR. Reviews every changed line against the implementation plan (if one exists) and high engineering standards across seven dimensions, verifies tests by deliberately breaking crucial code, and emits severity-classified findings with a PASS/FAIL verdict./issue-hygieneUse when creating, editing, triaging, or cleaning up GitHub issues - a mechanical pass that verifies the title is accurate and current, labels/assignees/milestone are correct, and the body is valid, well-formed markdown, all via the gh CLI. Does not judge content quality./property-based-testingUse when writing tests for serialization, validation, normalization, or pure functions - provides property catalog, pattern detection, and library reference for property-based testingOther plugins' skills for the same job