api-platform-file-upload

api-platform-file-upload is a skill for Claude Code, Codex from gerard-labs/superpowers-api-platform. It costs 0 tokens per session (802 once invoked), scanned A, original, MIT.

A setup pattern for adding file uploads to an API Platform 4.3 application, including storing files locally or in cloud storage and exposing their URLs.

In plain words
What is it for?
Use it to let users upload images, documents, or exported files through a PHP API, attach them to resources such as books, and store them on services such as S3 or Cloudflare R2.
Why use it?
It provides the required pieces for accepting multipart form data while handling authentication, file checks, and storage details. It also avoids unsupported multipart uploads through PUT or PATCH.

Skill for Claude CodeCodex

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

Made for: Claude Code, Codex.

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

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 api-platform-file-upload

README.md
[![agentmods](https://agentmods.dev/badge/skills/gerard-labs/superpowers-api-platform/api-platform-file-upload.svg)](https://agentmods.dev/skills/gerard-labs/superpowers-api-platform/api-platform-file-upload)
Your own site
<a href="https://agentmods.dev/skills/gerard-labs/superpowers-api-platform/api-platform-file-upload"><img src="https://agentmods.dev/badge/skills/gerard-labs/superpowers-api-platform/api-platform-file-upload.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 802 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.00000 $0.00802
Opus 5 $0.00000 $0.00401
Sonnet 5 $0.00000 $0.00160
Haiku 4.5 $0.00000 $0.00080

Measured 4d ago against content hash a0fd91b4b412, 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-file-upload 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.

skills/api-platform-file-upload/SKILL.md · 50 lines

How it starts

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

API Platform 4.3 — File upload

Use when

  • The API needs to accept file uploads (images, documents, exports re-uploaded by users).
  • A resource has an image / file relation (e.g. Book::image).
  • Uploads must be authenticated and validated for size / MIME type.
  • Files need to live on S3 / R2 / Cloud storage instead of the local filesystem.

Default workflow

  1. composer require vich/uploader-bundle (+ vich/flysystem-bundle for cloud storage).
  2. Configure Vich mappings (uri_prefix, upload_destination, namer).
  3. Enable the multipart/form-data format on the Post operation only — never on PUT/PATCH (unsupported by API Platform for multipart).
  4. Model a MediaObject resource with #[Vich\Uploadable] + #[Vich\UploadableField(fileNameProperty: 'filePath')].
  5. Add a MediaObjectNormalizer that resolves contentUrl via Vich\Storage\StorageInterface::resolveUri().
  6. (Optional) Add a multipart DecoderInterface if you need JSON nested in a multipart part.
  7. Apply security: is_granted('ROLE_USER') minimum; consider antivirus and quota voters.

Guardrails

  • Uploads only via POST. PUT/PATCH multipart is not supported by API Platform.
  • Validate file size + MIME with #[Assert\File(maxSize: '5M', mimeTypes: ['image/jpeg', 'image/png'])].
  • Storage path must be public (/public/media/) or fronted by a CDN.
  • Antivirus for any app that accepts files from untrusted users — wire ClamAV via a Processor decorator.
  • No raw entity exposure — always normalize via contentUrl rather than the raw filePath.

Progressive disclosure

  • SKILL.md covers posture and rules.
  • reference.md carries the full pattern: prerequisites, configuration, the MediaObject resource, the MediaObjectNormalizer (ALREADY_CALLED pattern), optional multipart Decoder, linking to other resources, constraints, S3/R2 storage, antivirus integration, and the test recipe.

Output contract

  • A MediaObject resource accepting multipart/form-data on POST only.
  • A normalizer producing a contentUrl field (absolute, cacheable).
  • Validation on file (size, MIME).
  • Security on the upload operation.
  • Functional test using UploadedFile + schema assertion.

Read the full file on GitHub · 50 lines

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. 4d ago First seen · 50 lines · 0 tokens per session scan A a0fd91b4b412

Subscribe to this mod's changes

api-platform-file-upload is a skill published in the GitHub repository gerard-labs/superpowers-api-platform (2 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 802 tokens. 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.