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 agentmods add skills/jamestorrevillas/dev-skills/database-designnpx skills add jamestorrevillas/dev-skills --skill database-designgit clone --depth 1 https://github.com/jamestorrevillas/dev-skillsWrote 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/jamestorrevillas/dev-skills/database-design)<a href="https://agentmods.dev/skills/jamestorrevillas/dev-skills/database-design"><img src="https://agentmods.dev/badge/skills/jamestorrevillas/dev-skills/database-design.svg" alt="Measured on agentmods" 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.00077 | $0.00922 |
| Opus 5 | $0.00039 | $0.00461 |
| Sonnet 5 | $0.00015 | $0.00184 |
| Haiku 4.5 | $0.00008 | $0.00092 |
Grade A, and why
database-design 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 5d 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 — 125 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Database Design
Schema Design Principles
- Normalize first — eliminate redundancy, then denormalize only for proven performance needs
- Name clearly —
user_idnotuid,created_atnotts - Every table needs — a primary key,
created_at,updated_at - Soft deletes — add
deleted_atinstead of hard deleting rows you might need to recover
Relationship Patterns
| Relationship | Implementation |
|---|---|
| One-to-One | Foreign key on either table + UNIQUE constraint |
| One-to-Many | Foreign key on the "many" side |
| Many-to-Many | Junction/pivot table with two foreign keys |
Indexing Strategy
Rule: Index columns you filter, sort, or join on frequently.
-- Index for common query patterns
CREATE INDEX idx_orders_user_status ON orders(user_id, status);
CREATE INDEX idx_posts_created ON posts(created_at DESC);
-- Partial index for active records only
CREATE INDEX idx_active_users ON users(email) WHERE deleted_at IS NULL;
When NOT to Over-Index
- Every index slows down writes
- Index columns with low cardinality (boolean, status with 3 values) only if queries are very frequent
- Monitor query performance, add indexes based on actual slow queries
Query Optimization
N+1 Query Problem
// BAD — N+1: 1 query for posts + N queries for each author
const posts = await Post.findAll()
for (const post of posts) {
const author = await User.findById(post.userId) // N queries!
}
// GOOD — 2 queries total using JOIN or eager loading
const posts = await Post.findAll({ include: [{ model: User }] })
Pagination
-- Offset pagination (simple but slow for large offsets)
SELECT * FROM posts ORDER BY created_at DESC LIMIT 20 OFFSET 100;
-- Cursor pagination (fast for large datasets)
SELECT * FROM posts WHERE created_at < :cursor ORDER BY created_at DESC LIMIT 20;
Use cursor pagination for large tables or infinite scroll.
SQL vs NoSQL Cheatsheet
| SQL | NoSQL |
|---|---|
| ACID transactions | High write throughput |
| Complex queries, joins | Flexible/variable schema |
| Data integrity critical | Horizontal scale priority |
| Well-defined schema | Unstructured or nested data |
| PostgreSQL, MySQL | MongoDB, DynamoDB, Cassandra |
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.
- 5d ago First seen · 125 lines · 0 tokens per session scan A cfcc9e597add
database-design is a skill published in the GitHub repository jamestorrevillas/dev-skills (3 stars, last pushed 5mo ago), licensed MIT. It adds 77 tokens to every session and 922 once invoked, about $0.0004 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.
Other skills, from other repositories
prompt-2-data
Generate comprehensive synthetic relational data for any specified subject with multiple normalized CSV files maintaining referential integrity.
database-design
Schema design, normalization, query optimization, and data modeling patterns.
sql-review
Use when user needs SQL reviewed — queries for injection risks, performance, and index strategy, or DDL/DML migration scripts for rollback safety, data-loss risk, lock impact, and backward compatibility. Triggers on: review SQL, slow query, review migration, SQL 審查, 看 migration. Produces severity-classified findings…
jpa-patterns
Designs and diagnoses JPA/Hibernate persistence in Spring Boot services: entity boundaries, repository patterns, projections, relationships, transaction scope, N+1 and lazy-loading issues, persistence-side performance tuning, and dependency or migration checks that materially affect data access tests or runtime…
oracle-sql-diagnosis
Oracle SQL workflow for backend diagnosis, support analysis, and data validation. Use when the answer depends on proving behavior through queries, checking day-by-day availability or state, validating catalog/config rows, or separating code defects from data defects.
fabric-lakehouse
Use this skill to get context about Fabric Lakehouse and its features for software systems and AI-powered functions. It offers descriptions of Lakehouse data components, organization with schemas and shortcuts, access control, and code examples. This skill supports users in designing, building, and optimizing…