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.
npx skills add nonlinear-xyz/factory-kit --skill factory-data-layergit clone --depth 1 https://github.com/nonlinear-xyz/factory-kitWrote 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.
[](https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-data-layer)<a href="https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-data-layer"><img src="https://agentmods.dev/badge/skills/nonlinear-xyz/factory-kit/factory-data-layer/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.
<a href="https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-data-layer"><img src="https://agentmods.dev/badge/skills/nonlinear-xyz/factory-kit/factory-data-layer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00084 | $0.03085 |
| Opus 5.5 | $0.00034 | $0.01234 |
| Sonnet 5.5 | $0.00017 | $0.00617 |
| Haiku 4.5 | $0.00008 | $0.00309 |
Grade A, and why
factory-data-layer 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 1mo 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.
How it starts
The opening of the file, as written. The whole thing — 264 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Factory data layer
Each section leads with Principle (one sentence, stack-agnostic), then Why (constraint → option → tradeoff), then Recipe (the Drizzle / Postgres shape we use), and Failure mode when there's one to name. Sections that are pure style with no deeper truth are marked Recipe only.
ORM pick — match the data shape, not the comfort
Principle. Use the ORM whose abstractions match your schema's shape; don't escape to raw SQL by default.
Why. Raw SQL with hand-mapped row-to-object code is verbose, error-prone, and gives the type system nothing to check. An ORM with $inferSelect-style derivation means the schema is the type — one source of truth, one place to refactor. The cost of an ORM is one query DSL to learn; the cost of raw SQL is every hand-written mapper and every silent type drift.
Recipe.
| ORM | Pick when |
|---|---|
| Drizzle | Default. Postgres + TypeScript. Type-safe queries. Pairs with Better Auth's drizzleAdapter. |
| Supabase auto-generated types | Project commits to Supabase Auth + RLS heavily. RLS does real work. |
| SQLAlchemy (Python) | Python service with relational data. Use with soft-delete mixin. |
Raw pg |
Never for new projects. Migrate if encountered. |
Failure mode. Encode/monorepo used raw pg with hand-mapped row-to-object code. Every new query meant another mapper, and the types drifted from the schema on every migration.
Domain-partitioned schema modules
Principle. Partition schema files by domain; one mega-schema file ages worse than one file per domain.
Why. A 2,000-line schema.ts is unreadable, ungreppable, and a merge-conflict factory. Domain partitioning means a feature change touches one file, a domain audit reads one file, and the import paths name the domain. The cost is one extra directory and one re-export index; the benefit is linear in the schema's growth.
Recipe.
src/server/db/schemas/
├── _shared.ts # timestamps helper, pgTableCreator
├── auth.ts # users, sessions, accounts, verifications
├── <domain>.ts # e.g. fleet.ts, payments.ts, analytics.ts
├── reference.ts # lookup tables (countries, states)
└── index.ts # re-exports all
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.
- 1mo ago First seen · 264 lines · 84 tokens per session scan A 59e2424716d4
factory-data-layer is a skill published in the GitHub repository nonlinear-xyz/factory-kit (9 stars, last pushed 12d ago), licensed MIT. It adds 84 tokens to every session and 3,085 once invoked, about $0.0003 per session on Opus 5.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.
Other skills, from other repositories
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.
postgres-database-migration
Use this skill for planning, testing, and safely executing PostgreSQL schema migrations — especially when working with production data or shared databases. Trigger when user asks to: Test a schema migration before applying it to production Add, remove, or rename columns safely on a live table Change a column's data…
timescaledb-hyperfunctions
Use this skill when writing analytical SQL over time-series data with the TimescaleDB Toolkit (timescaledbtoolkit extension) hyperfunctions: approximate percentiles, statistical summaries, time-weighted averages, counter/gauge rates, uptime/heartbeat tracking, state durations, OHLC candlesticks, approximate distinct…
design-postgis-tables
Comprehensive PostGIS spatial table design reference covering geometry types, coordinate systems, spatial indexing, and performance patterns for location-based applications.
setup-timescaledb-hypertables
Use this skill when creating database schemas or tables for Timescale, TimescaleDB, TigerData, or Tiger Cloud, especially for time-series, IoT, metrics, events, or log data. Use this to improve the performance of any insert-heavy table. Trigger when user asks to: Create or design SQL schemas/tables AND…
migrate-postgres-tables-to-hypertables
Use this skill to migrate identified PostgreSQL tables to Timescale/TimescaleDB hypertables with optimal configuration and validation. Trigger when user asks to: Migrate or convert PostgreSQL tables to hypertables Execute hypertable migration with minimal downtime Plan blue-green migration for large tables Validate…