pn-audit-data

pn-audit-data is a command for Claude Code from perniemann/pnCore. It costs 42 tokens per session (919 once invoked), scanned A, original, MIT.

A database-schema design and review command. It examines how data is organized into tables or records, how those parts connect, and how changes should be introduced.

In plain words
What is it for?
Use it to design or review tables, relationships, indexes, migration plans, and data-integrity rules for databases such as PostgreSQL, MySQL, SQLite, or MongoDB.
Why use it?
It helps prevent duplicated or inconsistent data and catches design problems before they become costly migrations or application bugs.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Install

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.

agentmods
npx agentmods add commands/perniemann/pncore/pn-audit-data
Clone the repo
git clone --depth 1 https://github.com/perniemann/pnCore

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 pn-audit-data

README.md
[![agentmods](https://agentmods.dev/badge/commands/perniemann/pncore/pn-audit-data.svg)](https://agentmods.dev/commands/perniemann/pncore/pn-audit-data)
Your own site
<a href="https://agentmods.dev/commands/perniemann/pncore/pn-audit-data"><img src="https://agentmods.dev/badge/commands/perniemann/pncore/pn-audit-data.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 919 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00042 $0.00919
Opus 5 $0.00021 $0.00460
Sonnet 5 $0.00008 $0.00184
Haiku 4.5 $0.00004 $0.00092

Measured 5d ago against content hash 885b022acbe0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

pn-audit-data 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.

packages/pn-core-mcp/content/commands/pn-audit-data.md · 98 lines

How it starts

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

pn-audit-data

Start every response with: [pn-command] 🔺

Advanced (palette-hidden). Not in the / slash palette. Invoked by the /pn-backend-audit umbrella, or directly via get_command("pn-audit-data").

Focused data model pass: design or review database schema, indexing strategy, migration approach, and data integrity constraints. No API design changes (use pn-audit-api), no query optimization (use pn-audit-performance) — data model only.

Flow

1. Context

Check .pncore-stack.md for ORM, database type, and existing schema info. If not found, ask:

  • "What database? (PostgreSQL / MySQL / SQLite / MongoDB / other)"
  • "What ORM? (Prisma / Drizzle / Sequelize / SQLAlchemy / ActiveRecord / sqlx / none)"
  • "Designing from scratch or reviewing existing schema?"

2. Scope

If reviewing existing: "Which tables or domains should I focus on? Or reply 'all' for full schema review." If designing: "Describe the domain in 2–3 sentences — what entities need to be stored and how do they relate?"

3. Audit or Design

Consult pn-core://skills/backend/reference/database-patterns.md and load get_skill("pn-database-migrations").

For reviewing existing schema:

Normalization:

  • Tables beyond 20 columns? Candidate for splitting?
  • Repeating groups of columns (tag1, tag2, tag3)? → Normalize to junction table.
  • Denormalized fields that drift from source? → Document the sync strategy.

Constraints:

  • Foreign keys declared as DB constraints (not just app-level)?
  • NOT NULL defaults where appropriate?
  • CHECK constraints for enum-like columns?
  • Money stored as float? → Should be integer cents.

Indexing:

  • Foreign key columns missing indexes?
  • High-traffic WHERE columns missing indexes?
  • Composite indexes for multi-column filter patterns?
  • Unused indexes slowing writes? (Check pg_stat_user_indexes)

Soft deletes:

  • deleted_at without partial index? → Add WHERE deleted_at IS NULL partial index.
  • Queries missing WHERE deleted_at IS NULL?

Read the full file on GitHub · 98 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. 5d ago First seen · 98 lines · 42 tokens per session scan A 885b022acbe0

Subscribe to this mod's changes

pn-audit-data is a command published in the GitHub repository perniemann/pnCore (0 stars, last pushed 3d ago), licensed MIT. It adds 42 tokens to every session and 919 once invoked, about $0.0002 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.