api-platform-security — Claude Code skill: setup and features
api-platform-security secures API Platform operations with security expressions, voters, and validation-phase access checks in Symfony.
MIT ★ 234 updated 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill api-platform-security -a claude-codeWhat api-platform-security does
This skill guides access control configuration on API Platform resources. It defines operation-level security via is_granted(), pairs expressions with clear denial messages, and moves custom authorization logic into dedicated Symfony voters.
The skill structures checks around the request lifecycle. Incoming data relies on securityPostDenormalize and securityPostValidation, while collection row scoping runs through QueryCollectionExtensionInterface or state providers rather than collection-level security flags.
Methods like getAccessDecision() and the Twig access_decision() function need Symfony 8.1 or higher: older versions will fail if these calls are used. Fields holding secrets are tagged with #[Ignore] by default.
What it helps with
- Restrict API Platform operations based on user roles and object ownership
- Scope collection rows with Doctrine query extensions instead of whole-endpoint blocks
- Hide sensitive resource attributes using serializer groups and context decorators
- Generate test suites verifying granted, forbidden, and anonymous API requests
Example prompts for the agent
- Add securityPostDenormalize checks to Article PATCH requests so only authors can change the status
- Create a QueryCollectionExtensionInterface to restrict Project collection queries to team members
- Extract resource security logic into a standalone Symfony voter
How to install api-platform-security
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-security -a claude-code2Manually: put the files in place
~/.claude/skills/api-platform-security/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/api-platform-security/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-security -a codex2Manually: put the files in place
.agents/skills/api-platform-security/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-security -a cursor2Manually: put the files in place
.cursor/skills/api-platform-security/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/api-platform-security2Manually: put the files in place
.github/skills/api-platform-security/SKILL.md1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-security -a gemini-cli2Platform CLI
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/api-platform-securityManually: put the files in place
.devin/skills/api-platform-security/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about api-platform-security
How to install api-platform-security in Claude Code?
Run npx skills add dev-toolings/superpowers-symfony --skill api-platform-security -a claude-code in your project terminal.
What does api-platform-security do?
It guides operation-level security setup in API Platform, covering voter creation, collection scoping, and post-validation checks.
Which Symfony version is required for access decision helpers?
The getAccessDecision() method and Twig access_decision() helper need Symfony 8.1 or newer to work.
Source text
SKILL.md · MIT
---
name: api-platform-security
description: Secure API Platform resources with security expressions, voters, securityPostValidation, and operation-level access control
capabilities: [read, search, edit, shell]
tags: [api-platform, security]
# projected by `bun run build` — do not edit by hand
allowed-tools:
- Read
- Glob
- Grep
- Write
- Edit
- Bash
---
# Api Platform Security (Symfony)
## Use when
- Restricting who may call each operation of an API Platform resource.
- Authorization depends on the object (owner) or on the submitted data.
- Users must see only a subset of a collection.
- Fields must be hidden depending on role or ownership.
## Default workflow
1. Set `security` per operation with `is_granted()`, `object`, and `user`, plus a `securityMessage`.
2. Move complex rules into voters: `is_granted('POST_EDIT', object)`.
3. When the rule depends on input, use `securityPostDenormalize`, or `securityPostValidation` to run after the Validator.
4. Scope rows with a `QueryCollectionExtensionInterface` (and `QueryItemExtensionInterface`) or a state provider.
5. Hide fields with serializer groups and a decorated context builder, and guard the firewall with `access_control`.
6. Test both the grant and the deny case for every protected operation.
## Guardrails
- Never filter rows with a `security` expression on a collection: it gates the whole collection, it does not scope it.
- Order of checks: `security`, denormalization, `securityPostDenormalize`, validation, `securityPostValidation`.
- `previous_object` exists only in `securityPostDenormalize`, and `request` only at resource level.
- Deny by default and mark secrets such as `password` with `#[Ignore]`.
- `getAccessDecision()` and the Twig `access_decision()` helper need Symfony 8.1 or later: verify before using them.
## Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.
## Output contract
- The security expression and message per operation, and the voters involved.
- How collections and fields are scoped per user.
- Tests covering allowed, forbidden, and anonymous access.
## References
- `reference.md`
© dev-toolings · MIT · dev-toolings/superpowers-symfony