self-audit-api

A command that checks the current Git diff against a checklist of API Platform 4.3 and Symfony 7.4 anti-patterns. A Git diff shows the code changed since the comparison point.

In plain words
What is it for?
Use it to review changed files for issues involving filters, serialization, deprecated code, MCP security, Symfony conventions, and tests.
Why use it?
It helps spot common design, security, compatibility, performance, and testing problems before changes are merged.

Command

Part of the gerard plugin — 25 skills, 25 commands, 7 agents, 1 hook shipped together

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/gerard-labs/superpowers-api-platform/self-audit-api
Clone the repo
git clone --depth 1 https://github.com/gerard-labs/superpowers-api-platform

Or install gerard, the plugin that ships this one along with the rest of its 25 skills, 25 commands, 7 agents, 1 hook.

Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 716 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 $0.00028 $0.00716
Opus 5 $0.00014 $0.00358
Sonnet 5 $0.00006 $0.00143
Haiku 4.5 $0.00003 $0.00072

Measured 2d ago against content hash b7d4b5a3e436, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

self-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 2d 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.

commands/self-audit-api.md · 75 lines

How it starts

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

/self-audit-api

Self-audit the current diff against the API Platform 4.3 + Symfony 7.4+ anti-patterns checklist.

Step 1 — Read the canonical checklist

Read docs/symfony/api-platform-anti-patterns.md

Step 2 — Identify changed files

git diff --name-only
git diff --stat

Step 3 — For each anti-pattern category, inspect the diff

Category Checks
Filters & queries #[ApiFilter] / extends AbstractFilter / legacy filter classes / filter without explicit property:
Operations & serialization openapiContext: / 'hydra:*' in tests / scalar ID in payload / free string for status / missing MaxDepth / auto-increment public ID
Namespaces & deprecated ApiPlatform\Core\… / SerializerAwareProviderInterface / SerializableProvider / event_listeners_backward_compatibility_layer / keep_legacy_inflector
Performance & security force_eager: true unjustified / MCP without rate limit / CORS * with credentials
Symfony 7.4+ // TODO / // FIXME / @phpstan-ignore without reason / mixed in public signature / Symfony 6.x referenced
Tests Test default page 20 / 'hydra:*' assertion / implementation-style names

Step 4 — Emit a Y/N checklist

For each item, answer:

  • Y — pattern absent from the diff (good)
  • N — pattern present in the diff (flag, with file:line)
  • N/A — pattern not applicable to this diff type

Step 5 — Output format

# API Platform 4.3 Self-Audit — <date>

Diff: <N> files, +<X>/-<Y> lines

## Anti-patterns checklist

| # | Item | Status | Details |
|---|---|---|---|
| 1 | No #[ApiFilter] | Y / N / N/A | <file:line if N> |
| 2 | No extends AbstractFilter | Y / N / N/A | ... |
| ... | ... | ... | ... |

## Summary
- Y: <N>/24
- N: <N>/24 — addressable before merge
- N/A: <N>/24 — skip (out of scope)

## Action items (N items only)
1. <file:line> — <rule> — <recommended fix>

When to run

  • Before manually committing a non-pipelined change
  • After a /dev to double-check the implementer's self-audit
  • In a CI step on every PR (optional — the lint script does this systematically)

Read the full file on GitHub · 75 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. 2d ago First seen · 75 lines · 28 tokens per session scan A b7d4b5a3e436

Subscribe to this mod's changes

self-audit-api is a command published in the GitHub repository gerard-labs/superpowers-api-platform (2 stars, last pushed 3mo ago), licensed MIT. It adds 28 tokens to every session and 716 once invoked, about $0.0001 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.