api-platform-mutators

A set of API Platform 4.3 features for changing API resource and operation metadata during application build time. Resource metadata describes how API resources and their operations behave.

In plain words
What is it for?
Use it to apply shared metadata changes such as route prefixes or serialization groups to resources or individual operations.
Why use it?
It avoids repeating the same configuration across many resources or operations and keeps request-dependent logic separate from fixed build-time changes.

Skill for Claude CodeCodex

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 skills/gerard-labs/superpowers-api-platform/api-platform-mutators
Any agent
npx skills add gerard-labs/superpowers-api-platform --skill api-platform-mutators
Clone the repo
git clone --depth 1 https://github.com/gerard-labs/superpowers-api-platform

Made for: Claude Code, Codex.

Per session 175 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 663 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.00175 $0.00663
Opus 5 $0.00088 $0.00331
Sonnet 5 $0.00035 $0.00133
Haiku 4.5 $0.00017 $0.00066

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

Security

Grade A, and why

api-platform-mutators 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.

skills/api-platform-mutators/SKILL.md · 42 lines

What it actually says

API Platform 4.3 — Resource & Operation Mutators (NEW 4.3)

Use when

  • You want to apply a uniform metadata change to a resource (prefix routes, inject a group) without touching every operation by hand.
  • The change is decidable at build time (no runtime dependency on the request).
  • You're tempted to write a Context Builder for something that does not depend on the request — Mutator is cheaper.

Default workflow

  1. Decide: build-time (Mutator) or runtime (Context Builder)?
  2. For a resource-wide change, implement ResourceMutatorInterface and annotate with #[AsResourceMutator(resourceClass: Book::class)].
  3. For a single-operation change, implement OperationMutatorInterface and annotate with #[AsOperationMutator(operationName: '_api_Book_get_collection')].
  4. Return the modified ApiResource / Operation (these objects are immutable — use with*() mutators).

Guardrails

  • Mutator = build time, no access to the request / user / locale. If you need any of those, use a Context Builder.
  • Operation and ApiResource are immutable. Always use withOperations(), withNormalizationContext(), withRoutePrefix(), etc.
  • Operation names are stable (_api_<ShortName>_<operation> by convention). Pin them in a constant if you reference them in multiple mutators.

Progressive disclosure

  • SKILL.md covers posture and decision tree.
  • reference.md carries the full AsResourceMutator and AsOperationMutator recipes + the Context Builder vs Mutator comparison table.

Output contract

  • Mutators in src/ApiPlatform/Mutator/ with explicit #[AsResourceMutator] / #[AsOperationMutator] annotations.
  • Build-time metadata changes verified via php bin/console debug:router | grep api and php bin/console api:openapi:export --yaml.
  • A short comment in each mutator explaining what it changes and why.

References

  • reference.md
Files

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.

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 · 42 lines · 0 tokens per session scan A 7e774ab4dd3e

Subscribe to this mod's changes

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

Related

Other skills, from other repositories

nextjs-pages-router

Set up tRPC in Next.js Pages Router with createNextApiHandler, createTRPCNext, withTRPC HOC, SSR via ssr option and ssrPrepass, SSG via createServerSideHelpers with getStaticProps, and server-side helpers for getServerSideProps prefetching.

trpc/trpc · 67 tokens

react-query-setup

Set up @trpc/tanstack-react-query with createTRPCContext(), TRPCProvider, useTRPC() hook, queryOptions/mutationOptions factories, query invalidation via queryClient.invalidateQueries with queryFilter, and type inference with inferInput/inferOutput.

trpc/trpc · 60 tokens

non-json-content-types

Handle FormData, file uploads, Blob, Uint8Array, and ReadableStream inputs in tRPC mutations. Use octetInputParser from @trpc/server/http for binary data. Route non-JSON requests with splitLink and isNonJsonSerializable() from @trpc/client. FormData and binary inputs only work with mutations (POST).

trpc/trpc · 75 tokens

openapi-glossary

Use consistent OpenAPI terminology and definitions when writing documentation, educational material, and tooling guidance.

scalar/scalar · 24 tokens

scalar-docs

Skill for writing and updating scalar.config.json — Scalar Docs configuration reference for users and LLMs.

scalar/scalar · 24 tokens

create-tutorial

Scaffold a new Membrane API Gateway tutorial in the api-gateway repo — the numbered self-teaching YAML under distribution/tutorials/ /, its support files and README links, and the matching auto-discovered integration test. Use whenever the user asks to create, add, write, or scaffold a tutorial (or a tutorial step)…

membrane/api-gateway · 97 tokens