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 san-npm/skills-ws --skill database-designgit clone --depth 1 https://github.com/san-npm/skills-wsWrote 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/san-npm/skills-ws/database-design)<a href="https://agentmods.dev/skills/san-npm/skills-ws/database-design"><img src="https://agentmods.dev/badge/skills/san-npm/skills-ws/database-design/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/san-npm/skills-ws/database-design"><img src="https://agentmods.dev/badge/skills/san-npm/skills-ws/database-design.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.00065 | $0.06059 |
| Opus 5.5 | $0.00026 | $0.02424 |
| Sonnet 5.5 | $0.00013 | $0.01212 |
| Haiku 4.5 | $0.00006 | $0.00606 |
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 2mo 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 — 400 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Database Design
Design-time decisions for relational schemas: how to model data, where to denormalize, which index to reach for, and how to evolve a live schema without downtime. Examples target PostgreSQL 18 (the current stable major branch as of Jun 2026; PG 19 is in beta, ~Sep 2026 — verify at postgresql.org/support/versioning). The migration/locking semantics below hold for PG 12+.
For the operational deep dives —
EXPLAIN ANALYZEinternals, partitioning automation, pgvector, PgBouncer tuning, replication, backup/PITR runbooks, config tuning — see the sibling skillpostgres-mastery. This skill covers the modeling and migration design that comes before those.
Schema Design Patterns
Normalization Quick Reference
| Form | Rule | When to break |
|---|---|---|
| 1NF | Atomic values, no repeating groups | JSONB arrays for tags/metadata |
| 2NF | No partial dependencies | Denormalized read models |
| 3NF | No transitive dependencies | Caching computed fields |
| BCNF | Every determinant is a candidate key | Rarely broken |
Denormalization Patterns
When to denormalize: read-heavy paths where the normalized query is provably hot (verified in pg_stat_statements), the derived value is read far more than written, and you can guarantee it stays consistent. Default to not denormalizing — a counter cache is permanent operational debt.
Counter cache done correctly. A naive +1/-1 trigger that only fires on INSERT/DELETE drifts: it misses rows that are re-parented (UPDATE of the FK), can go negative under concurrent deletes, and starts wrong if the column was added to a non-empty table. Handle all three.
-- 1. Add the column, then BACKFILL the true value (never trust DEFAULT 0 on existing rows)
ALTER TABLE posts ADD COLUMN comments_count INT NOT NULL DEFAULT 0;
UPDATE posts p
SET comments_count = sub.c
FROM (SELECT post_id, count(*) AS c FROM comments GROUP BY post_id) sub
WHERE p.id = sub.post_id;
-- 2. Trigger covering INSERT, DELETE, *and* re-parenting UPDATEs, with a non-negative floor
CREATE FUNCTION sync_comments_count() RETURNS TRIGGER AS $$
BEGIN
IF TG_OP = 'INSERT' THEN
UPDATE posts SET comments_count = comments_count + 1 WHERE id = NEW.post_id;
ELSIF TG_OP = 'DELETE' THEN
-- GREATEST guards against drift sending the count below zero
UPDATE posts SET comments_count = GREATEST(comments_count - 1, 0) WHERE id = OLD.post_id;
ELSIF TG_OP = 'UPDATE' AND NEW.post_id IS DISTINCT FROM OLD.post_id THEN
UPDATE posts SET comments_count = GREATEST(comments_count - 1, 0) WHERE id = OLD.post_id;
UPDATE posts SET comments_count = comments_count + 1 WHERE id = NEW.post_id;
END IF;
RETURN NULL;
END; $$ LANGUAGE plpgsql;
-- AFTER trigger so the count reflects committed rows; name the UPDATE columns to skip no-op updates
CREATE TRIGGER trg_comments_count
AFTER INSERT OR DELETE OR UPDATE OF post_id ON comments
FOR EACH ROW EXECUTE FUNCTION sync_comments_count();
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 2mo ago First seen · 400 lines · 65 tokens per session scan A 9817877d472c
database-design is a skill published in the GitHub repository san-npm/skills-ws (4 stars, last pushed 1mo ago), licensed MIT. It adds 65 tokens to every session and 6,059 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.
database-design compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| database-designsan-npm/skills-ws | Skill | 4 | 1mo ago | MIT | A | 65 | Codex |
| alloydb-basicsgoogle/skills | Skill | 22k | yesterday | Apache-2.0 | A | 72 | Claude Code, Codex |
| postgresql-table-designwshobson/agents | Skill | 42k | yesterday | MIT | A | 37 | Claude Code |
| db-repairgarrytan/gbrain | Skill | 32k | yesterday | MIT | A | 96 | Claude Code |
| volcengine-rds-postgresqlbytedance/agentkit-samples | Skill | 484 | today | Apache-2.0 | A | 63 | Claude Code, Codex |
| dsqlawslabs/agent-plugins | Skill | 937 | yesterday | Apache-2.0 | A | 246 | Claude Code |
| analyzing-insights-across-teamsPostHog/posthog-foss | Skill | 728 | yesterday | MIT | A | 115 | Claude Code, Codex |