triad-drizzle

triad-drizzle is a skill for Claude Code from justhamade/triadjs. It costs 61 tokens per session (1,675 once invoked), scanned A, original, MIT.

A bridge between TriadJS models and Drizzle ORM, a TypeScript tool for describing and querying database tables. It reads storage hints from models and generates a Drizzle schema file.

In plain words
What is it for?
Generating SQLite, PostgreSQL, or MySQL schemas, marking primary keys and indexes, adding storage defaults, designing repositories, and detecting unique-constraint conflicts.
Why use it?
It connects application data definitions to database table definitions while making clear that generation is not the same as running database migrations.

Skill for Claude Code

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

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is triad db generate # default: sqlite → ./src/db/schema.generated.ts.

Part of the triadjs plugin — 10 skills, 8 commands shipped together

Good fit Generating SQLite, PostgreSQL, or MySQL schemas, marking primary keys and indexes, adding storage defaults, designing repositories, and detecting unique-constraint conflicts.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/justhamade/triadjs
agentmods
npx agentmods add skills/justhamade/triadjs/triad-drizzle

Made for: Claude Code.

Or install triadjs, the plugin that ships this one along with the rest of its 10 skills, 8 commands.

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 triad-drizzle

README.md
[![agentmods](https://agentmods.dev/badge/skills/justhamade/triadjs/triad-drizzle.svg)](https://agentmods.dev/skills/justhamade/triadjs/triad-drizzle)
Your own site
<a href="https://agentmods.dev/skills/justhamade/triadjs/triad-drizzle"><img src="https://agentmods.dev/badge/skills/justhamade/triadjs/triad-drizzle.svg" alt="Measured on agentmods" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,675 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.00061 $0.01675
Opus 5 $0.00030 $0.00838
Sonnet 5 $0.00012 $0.00335
Haiku 4.5 $0.00006 $0.00168

Measured 8d ago against content hash ef35dea95fa6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

triad-drizzle 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 8d 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.

plugin/skills/triad-drizzle/SKILL.md · 151 lines

How it starts

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

Drizzle bridge

The Drizzle bridge is not a migration tool. It reads .storage() hints on your models and emits a Drizzle schema file that you then check in. triad db generate regenerates the file when schemas change. You can hand-edit the generated file if you need features Triad doesn't model — but beware that running the generator again will overwrite it.

Marking a model as a table

Every field that should become a column must be on a t.model that has at least one field marked .storage({ primaryKey: true }). Models without a PK hint are not treated as tables and are skipped silently.

export const Pet = t.model('Pet', {
  id:        t.string().format('uuid').identity().storage({ primaryKey: true }),
  name:      t.string().minLength(1).maxLength(100).storage({ indexed: true }),
  species:   t.enum('dog', 'cat', 'bird', 'fish').storage({ indexed: true }),
  age:       t.int32().min(0).max(100),
  status:    t.enum('available', 'adopted', 'pending').default('available'),
  createdAt: t.datetime().storage({ defaultNow: true }),
});

.identity() is the DDD identity marker; .storage({ primaryKey: true }) is the persistence hint. They are different and most ID fields need both.

.storage() options

Option Effect
primaryKey: true Marks the field as the table's PK (required to become a table)
unique: true Unique constraint
indexed: true Secondary index
columnName: 'user_id' Override the SQL column name
defaultNow: true Default to CURRENT_TIMESTAMP
defaultRandom: true Default to a random UUID
references: 'projects.id' Foreign key reference
custom: { ... } Dialect-specific hints

.storage() accumulates across calls — you can chain multiple to layer hints.

Dialects

sqlite, postgres, mysql. All three emit valid Drizzle sqliteTable/pgTable/mysqlTable definitions. Type mapping is logical:

Triad type Drizzle (SQLite) Drizzle (Postgres) Drizzle (MySQL)
t.string() text text text
t.string().format('uuid') text uuid varchar(36)
t.datetime() text (ISO) text (ISO) text (ISO)
t.int32() integer integer int
t.int64() integer bigint bigint
t.float64() real doublePrecision double
t.boolean() integer (0/1) boolean tinyint
t.enum(...) text + CHECK text (or pgEnum if configured) text
t.array / t.record / ... text JSON jsonb json

Read the full file on GitHub · 151 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. 8d ago First seen · 151 lines · 61 tokens per session scan A ef35dea95fa6

Subscribe to this mod's changes

triad-drizzle is a skill published in the GitHub repository justhamade/triadjs (23 stars, last pushed 4mo ago), licensed MIT. It adds 61 tokens to every session and 1,675 once invoked, about $0.0003 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-30.

Related

Other skills, from other repositories

schema-exploration

Lists tables, describes columns and data types, identifies foreign key relationships, and maps entity relationships in a database. Use when the user asks about database schema, table structure, column types, what tables exist, ERD, foreign keys, or how entities relate.

langchain-ai/deepagents · 57 tokens

ha-data-stores

Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…

shiwenwen/hope-agent · 115 tokens

supabase

Supabase / PostgREST Row-Level-Security playbook — pull the anon (or leaked servicerole) key out of the frontend JS, map tables from the auto-generated OpenAPI spec, test anonymous RLS READ disclosures (PII/secret leaks), and anonymous RLS WRITE abuse (insert/update/delete — e.g. forging…

PentesterFlow/agent · 120 tokens

nornicdb-cypher-queries

Pick fast, predictable Cypher query shapes in NornicDB — point lookups, batch retrieval, pagination, search, traversal, batched UNWIND/MERGE writes, cleanup, multi-tenant isolation. Use when writing or reviewing Cypher whose latency or throughput matters; maps user intent to the executor's hot-path query templates.

orneryd/NornicDB · 79 tokens

dsql

Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed SQL database. Covers IAM auth, multi-tenant patterns, MySQL-to-DSQL and PostgreSQL-to-DSQL schema conversion, foreign key…

awslabs/agent-plugins · 229 tokens

volcengine-rds-postgresql

A tool for operating PostgreSQL databases hosted by Volcano Engine's managed database service. PostgreSQL is a relational database used to store structured application data.

bytedance/agentkit-samples · 63 tokens