factory-db-schema-architect

factory-db-schema-architect is a skill for Claude Code from nonlinear-xyz/factory-kit. It costs 127 tokens per session (1,430 once invoked), scanned A, original, MIT.

A database-design helper for creating or changing tables, migrations, tenant-aware data models, and tables whose records have different variants. It follows the project's conventions for Drizzle, PostgreSQL, relationships, and flexible JSON data.

In plain words
What is it for?
Use it when designing database tables, foreign keys, migrations, multi-tenant data, or models such as different vehicle or account types. It helps decide which information belongs in regular columns and which belongs in JSONB.
Why use it?
It helps prevent missing tenant links, unsafe deletion behavior, poorly structured variant data, and fields that are difficult to query. It turns the requested business entities and relationships into a consistent schema plan.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the factory-kit plugin — 37 skills, 8 commands, 12 agents, 1 MCP server shipped together

Good fit Use it when designing database tables, foreign keys, migrations, multi-tenant data, or models such as different vehicle or account types. It helps decide which information belongs in regular columns and which belongs in JSONB.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nonlinear-xyz/factory-kit/factory-db-schema-architect
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add nonlinear-xyz/factory-kit --skill factory-db-schema-architect
Clone the repo
git clone --depth 1 https://github.com/nonlinear-xyz/factory-kit

Made for: Claude Code.

Or install factory-kit, the plugin that ships this one along with the rest of its 37 skills, 8 commands, 12 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for factory-db-schema-architect

README.md
[![agentmods](https://agentmods.dev/badge/skills/nonlinear-xyz/factory-kit/factory-db-schema-architect/github.svg)](https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-db-schema-architect)
Your own site
<a href="https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-db-schema-architect"><img src="https://agentmods.dev/badge/skills/nonlinear-xyz/factory-kit/factory-db-schema-architect/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for factory-db-schema-architect

Your own site · 80×15
<a href="https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-db-schema-architect"><img src="https://agentmods.dev/badge/skills/nonlinear-xyz/factory-kit/factory-db-schema-architect.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 127 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,430 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00127 $0.01430
Opus 5 $0.00063 $0.00715
Sonnet 5 $0.00025 $0.00286
Haiku 4.5 $0.00013 $0.00143

Measured 9d ago against content hash 6955b5d21076, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

factory-db-schema-architect scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/factory-db-schema-architect/SKILL.md · 121 lines

How it starts

The opening of the file, as written. The whole thing — 121 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Apply the db-schema-architect specialist workflow. Design schemas grounded in the factory's data-layer conventions, not generic SQL. Load factory-data-layer and factory-stack through the host's skill capability when needed.

How to think (in order)

  1. What entities are in scope? Restate the request — name every entity, every relationship. If the user asks for "a customer model," check whether they mean (a) just customers, or (b) customers + addresses + contacts + .... Commit to the interpretation; flag the assumption.

  2. Multi-tenant key? Almost always yes. Every domain table gets orgId (or workspaceId / projectId) FK with onDelete: 'cascade'. If this is a shared-reference table (countries, states, vehicle types), call out that it's tenant-agnostic.

  3. Polymorphic? If entities share a base type but diverge significantly (ICE vs BEV vehicles, individual vs business accounts), use the shared-base + variant-tables pattern from factory-data-layer.md. Don't reach for nullable columns or discriminator: 'type'.

  4. JSONB or columns? For each field, ask: "Does anything query / sort / filter on this?"

    • Yes → real column
    • No, but it's structured → JSONB envelope (customAttributes, metadata, config)
    • No, and it's blob-shaped → external storage (S3) with a pointer column
  5. Partition by domain? Check src/server/db/schemas/:

    • If _shared.ts exists with timestamps and pgTableCreator, reuse them
    • If not, create them as part of this work
    • Pick / create the domain file (e.g. fleet.ts, payments.ts)
  6. Soft-delete or hard-delete? Default to hard-delete (with cascade). Use soft-delete when:

    • Regulatory requirement (audit history must persist)
    • User-facing "trash bin" UX
    • References across tenants where hard delete would break referential integrity
  7. Migration shape? drizzle-kit generate from the schema diff. Name the migration file:

    • Timestamps: <unix>_<verb_subject>.sql (preferred)
    • Or sequential: 000N_<verb_subject>.sql
    • Pick one convention per project and stick. Mixed naming is a factory-pitfalls.md entry.
  8. ESLint Drizzle rules? If eslint-plugin-drizzle isn't installed, recommend adding it for the WHERE enforcement on UPDATE/DELETE.

Read the full file on GitHub · 121 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 121 lines · 127 tokens per session scan A 6955b5d21076

Subscribe to this mod's changes

factory-db-schema-architect is a skill published in the GitHub repository nonlinear-xyz/factory-kit (9 stars, last pushed 1mo ago), licensed MIT. It adds 127 tokens to every session and 1,430 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

databases

· Configure/tune/migrate PostgreSQL, MongoDB, MySQL/MariaDB, MSSQL. Triggers: 'database', 'postgres', 'mysql', 'mongodb', 'database schema', 'database migration', 'pgbouncer', 'EXPLAIN'. Not for HTTP APIs (use backend-api).

iuliandita/skills · 66 tokens

database-schema-designer

A guide for designing schemas—the tables, fields, relationships, and indexes that define how application data is stored—in SQL or NoSQL databases.

Dannykkh/skill-olympus · 71 tokens

schema-evolve

This skill should be used when the user asks about 'schema drift', 'schema evolution', 'evolve schema', 'schema sync', 'sync schemas', 'update schema fields', 'schema field frequency', 'missing schema fields', 'unused schema fields', 'schema proposal', 'schema cardinality', 'check schema', 'schema audit', 'schema…

voxpelli/vp-claude · 139 tokens

docker-db-backup

A Docker Compose add-on that runs scheduled backups for PostgreSQL, MySQL, or MariaDB databases. It adds a backup container and the scripts and settings needed to run it.

Dannykkh/skill-olympus · 36 tokens

supabase-postgres-best-practices

Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.

Dannykkh/skill-olympus · 41 tokens

lark-base

A tool for managing Feishu Base, a cloud database made from tables, fields, records, and views. It also covers calculations, forms, dashboards, workflows, and access roles.

DropFan/claude-code-plugins · 84 tokens