nacre: Skill for Claude Code

.claude/skills/db-migration/SKILL.md

db-migration is a skill for Claude Code from nacre-work/nacre. It costs 76 tokens per session (1,135 once invoked), scanned A, original, Apache-2.0.

A guide for changing a PostgreSQL database structure safely. PostgreSQL is a relational database, and row-level security limits which rows each user or organisation can access.

In plain words
What is it for?
Use it when adding migrations, tables, columns, indexes, grants, tombstones, audit data, or row-level security rules.
Why use it?
It prevents changes from breaking tenant isolation, permissions, audit records, or already-applied database migrations.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is nacre-work/nacre's own configuration. It tells Claude Code how to work on nacre itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything nacre configures →

Reuse

Borrowing it

Nothing to install: this file belongs to nacre-work/nacre. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/nacre-work/nacre/main/.claude/skills/db-migration/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/nacre-work/nacre

Made for: Claude Code.

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 db-migration

README.md
[![agentmods](https://agentmods.dev/badge/skills/nacre-work/nacre/db-migration/github.svg)](https://agentmods.dev/skills/nacre-work/nacre/db-migration)
Your own site
<a href="https://agentmods.dev/skills/nacre-work/nacre/db-migration"><img src="https://agentmods.dev/badge/skills/nacre-work/nacre/db-migration/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 db-migration

Your own site · 80×15
<a href="https://agentmods.dev/skills/nacre-work/nacre/db-migration"><img src="https://agentmods.dev/badge/skills/nacre-work/nacre/db-migration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 76 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,135 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.00076 $0.01135
Opus 5.5 $0.00030 $0.00454
Sonnet 5.5 $0.00015 $0.00227
Haiku 4.5 $0.00008 $0.00113

Measured 17d ago against content hash 85365875ffd3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

db-migration 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 17d 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.

.claude/skills/db-migration/SKILL.md · 94 lines

How it starts

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

Changing the schema

Migrations live in packages/core/migrations, numbered and forward-only. Never edit a migration that has been applied anywhere; add another.

The schema is the source of truth for tenants, permissions, metadata, and audit. Vectors are in Qdrant, and originals in object storage where a deployment configured one (otherwise in documents.source_ref) — if a change would put content that needs a transaction into either of those, it belongs here instead.

Every table carrying tenant data

  1. org_id NOT NULL REFERENCES organizations(id) ON DELETE CASCADE, even when it is reachable through a parent. The duplication is the point: it lets RLS work on the table directly.

  2. Enable RLS, force it, and add the org_isolation policy in the same migration as the table:

    ALTER TABLE thing ENABLE ROW LEVEL SECURITY;
    ALTER TABLE thing FORCE  ROW LEVEL SECURITY;
    CREATE POLICY org_isolation ON thing
      USING (org_id = current_setting('app.current_org')::uuid);
    

    FORCE is not optional and its absence is silent. ENABLE alone does not apply to the role that owns the table, and migrations run as the owner — so any deployment that reuses that connection for the application gets policies that are switched on and inert. That was the state of this schema until migration 0002: a connection scoped to one organization could read another's documents, layers, and users, with every policy reporting enabled.

    Superusers bypass RLS regardless. The application must not connect as one, and withOrg's role option exists for deployments that cannot easily split the roles.

    RLS is the second line of defense, not the mechanism. The application still filters, and invariant 1 is still verified again at serialization. A table added without RLS is one forgotten WHERE away from a cross-tenant leak.

  3. A foreign key that crosses tenants needs a composite key. A plain REFERENCES groups(id) lets a row join an object in one organization to an object in another. group_members had exactly that shape: one row joining a foreign user to a group would have handed that user every grant the group holds. Reference (id, org_id) against a UNIQUE (id, org_id) so the database enforces it rather than the code that writes the insert.

  4. Indexes that the permission filter needs. A filter that falls back to a scan does not fail a test; it just gets slow enough to matter at a customer's volume, which is the worst way to find out.

Read the full file on GitHub · 94 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. 17d ago Changed · +10 lines 85365875ffd3
  2. 1mo ago First seen · 84 lines · 76 tokens per session scan A ae7a1249f0c2

Subscribe to this mod's changes

db-migration is a skill published in the GitHub repository nacre-work/nacre (2 stars, last pushed 18d ago), licensed Apache-2.0. It adds 76 tokens to every session and 1,135 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.

Related

Other skills, from other repositories

chroma

Open-source embedding database for AI applications. Store embeddings and metadata, perform vector and full-text search, filter by metadata. Simple 4-function API. Scales from notebooks to production clusters. Use for semantic search, RAG applications, or document retrieval. Best for local development and open-source…

Orchestra-Research/AI-Research-SKILLs · 63 tokens

chroma

Open-source embedding database for AI applications. Store embeddings and metadata, perform vector and full-text search, filter by metadata. Simple 4-function API. Scales from notebooks to production clusters. Use for semantic search, RAG applications, or document retrieval. Best for local development and open-source…

synthetic-sciences/openscience · 63 tokens

chroma

Open-source embedding database for AI applications. Store embeddings and metadata, perform vector and full-text search, filter by metadata. Simple 4-function API. Scales from notebooks to production clusters. Use for semantic search, RAG applications, or document retrieval. Best for local development and open-source…

OpenLAIR/dr-claw · 63 tokens

chroma

Open-source embedding database for AI applications. Store embeddings and metadata, perform vector and full-text search, filter by metadata. Simple 4-function API. Scales from notebooks to production clusters. Use for semantic search, RAG applications, or document retrieval. Best for local development and open-source…

liortesta/ClawdAgent · 63 tokens

chroma

Open-source embedding database for AI applications. Store embeddings and metadata, perform vector and full-text search, filter by metadata. Simple 4-function API. Scales from notebooks to production clusters. Use for semantic search, RAG applications, or document retrieval. Best for local development and open-source…

ovachiever/droid-tings · 63 tokens

chroma

Open-source embedding database for AI applications. Store embeddings and metadata, perform vector and full-text search, filter by metadata. Simple 4-function API. Scales from notebooks to production clusters. Use for semantic search, RAG applications, or document retrieval. Best for local development and open-source…

ihatesea69/HieuNghi-AI-Skills · 63 tokens