pn-audit-api

pn-audit-api is a command for coding agents from perniemann/pnCore. It costs 44 tokens per session (989 once invoked), scanned A, original, MIT.

An API design review command for checking how software communicates with other software, especially through REST web endpoints. It reviews conventions, HTTP meanings, response formats, validation, and accidental exposure of internal data structures.

In plain words
What is it for?
Use it to review or fix routes and modules in REST or GraphQL APIs, including status codes, request validation, response shapes, and versioning decisions.
Why use it?
It helps remove inconsistent endpoints, unclear errors, weak input checks, and responses that make clients depend on internal implementation details.

Command

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-api
Clone the repo
git clone --depth 1 https://github.com/perniemann/pnCore

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-api

README.md
[![agentmods](https://agentmods.dev/badge/commands/perniemann/pncore/pn-audit-api.svg)](https://agentmods.dev/commands/perniemann/pncore/pn-audit-api)
Your own site
<a href="https://agentmods.dev/commands/perniemann/pncore/pn-audit-api"><img src="https://agentmods.dev/badge/commands/perniemann/pncore/pn-audit-api.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 989 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.00044 $0.00989
Opus 5 $0.00022 $0.00495
Sonnet 5 $0.00009 $0.00198
Haiku 4.5 $0.00004 $0.00099

Measured 4d ago against content hash 211d1e6bffb2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

pn-audit-api 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 4d 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-api.md · 102 lines

How it starts

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

pn-audit-api

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-api").

Progress: Before each numbered section in Flow, state one line:

  • "pn-audit-api: Step 1 of 5 — Context."
  • "pn-audit-api: Step 2 of 5 — Scope."
  • "pn-audit-api: Step 3 of 5 — Audit."
  • "pn-audit-api: Step 4 of 5 — Fix."
  • "pn-audit-api: Step 5 of 5 — Summary."

Focused API design pass: audit and fix REST conventions, HTTP semantics, response consistency, input validation, and schema leaks. No security posture changes (use pn-audit-security), no performance changes (use pn-audit-performance) — API design only.

Flow

1. Context

Check .pncore-stack.md for known stack, API style, and auth mechanism. If not found, ask:

  • "What API framework? (Express/Fastify/Hono/FastAPI/other)"
  • "REST or GraphQL? Versioned (/v1/) or unversioned?"

2. Scope

If not specified: "Which routes or modules should I audit? Or reply 'all' for full API."

3. Audit

Load get_skill("pn-openapi-design") and consult pn-core://skills/backend/reference/api-design.md.

For each route or endpoint group, audit:

Resource naming:

  • Are URLs noun-based? No verbs in paths (/createUser/users)?
  • Collections plural? (/user/users)
  • Sub-resources correctly nested? No nesting > 2 levels?

HTTP method usage:

  • GET is safe and idempotent? No state changes in GET handlers?
  • POST used for creation only? Not for generic "do something"?
  • PUT vs. PATCH: PUT for full replace, PATCH for partial update?
  • DELETE idempotent? Returns 204 or appropriate on success?

Status codes:

  • 200 for errors? → Fix to correct 4xx/5xx
  • 201 on creation? 204 when no body to return?
  • 401 vs. 403 confused? (401 = unauthenticated, 403 = forbidden)
  • 400 vs. 422 confused? (400 = malformed, 422 = valid but failed validation)

Response shapes:

  • Consistent envelope? ({ data: ... } or { data: ..., meta: ... })
  • Errors have code + message + requestId?
  • Raw DB rows returned? ORM model leaked with internal fields?
  • Consistent date format? (ISO 8601 UTC: 2026-03-27T12:00:00Z)

Read the full file on GitHub · 102 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. 4d ago First seen · 102 lines · 44 tokens per session scan A 211d1e6bffb2

Subscribe to this mod's changes

pn-audit-api is a command published in the GitHub repository perniemann/pnCore (0 stars, last pushed 2d ago), licensed MIT. It adds 44 tokens to every session and 989 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.