Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dev-toolings/superpowers-symfony --skill api-platform-security -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/api-platform-security/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/api-platform-security/

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

Similar skills

All skills for Security →

From the same set51

The whole set →
api-platform-versioning api-platform-versioning keeps API Platform clients alive through renames and removals: deprecation with a sunset date first, parallel versions as the last resort. CX Codex +1 ★ 234repo stars functional-tests functional-tests guides Claude Code in writing functional Symfony tests using WebTestCase, KernelTestCase, loginUser, and DAMA rollback. CX Codex +1 ★ 234repo stars doctrine-migrations Create and review Doctrine migrations, prepare rollbacks, and check pending changes before deployment. Useful when a Symfony app’s entity mapping changes. CX Codex +1 ★ 234repo stars symfony-messenger A skill for async message handling with Symfony Messenger: configures transports, handlers, and retry strategies. CX Codex +1 ★ 234repo stars e2e-panther-playwright The e2e-panther-playwright skill guides Symfony E2E tests with Panther for browser flows and Playwright for more involved cases. Use it when JavaScript behavior is beyond what WebTestCase can observe. CX Codex +1 ★ 234repo stars doctrine-relations Skill guides you through defining Doctrine relationships (OneToMany, ManyToMany, ManyToOne) with correct owning and inverse sides, cascade strategies, and N+1 query prevention. CX Codex +1 ★ 234repo stars doctrine-fetch-modes doctrine-fetch-modes guides Doctrine ORM and DBAL 4 query optimization in Symfony. Fixes N+1 queries, configures lazy loading, and implements DTO hydration. CX Codex +1 ★ 234repo stars api-platform-resources api-platform-resources is a Claude Code skill for configuring API Platform resources for REST and GraphQL. It activates for resource creation and changes to operations, pagination, or OpenAPI docs. CX Codex +1 ★ 234repo stars

Project sponsors

Companies that keep this analytics open