api-platform-tests — Claude Code skill for API Platform tests
The api-platform-tests skill guides functional tests for Symfony API Platform resources, including response checks, filters, JSON schemas, and access control. Use it while building or changing API endpoints.
MIT ★ 234 updated 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill api-platform-tests -a claude-codeWhat api-platform-tests does
The skill lays out a testing flow for API Platform endpoints with ApiTestCase: prepare data with Foundry factories, send a request, then check its status, content type, and JSON response. It covers collections and individual resources, CRUD operations, validation failures, and access control.
Tests can reset state with #[ResetDatabase] and use Factories. Authentication checks use auth_bearer; filter and pagination assertions inspect member and totalItems, while resource JSON schema assertions check response shape. A PATCH request needs the application/merge-patch+json content type.
There are version-specific details. #[ResetDatabase] requires PHPUnit 10+ and Foundry 2.9; on PHPUnit 9, use the ResetDatabase trait. A type error on a constrained property returns 422 in API Platform 5.0, but 400 in 4.4 and earlier. Match the expected status in the test to the version in the project.
What it helps with
- check collection and individual resource responses
- cover API resource creation, updates, and deletion
- test validation failures and access restrictions
- verify filters and pagination results
- match responses against resource JSON schemas
Example prompts for the agent
- Write
ApiTestCasefunctional tests for an API Platform collection and its individual resources. - Add filter and pagination tests that inspect
memberandtotalItems. - Cover anonymous access, the owner, and another user, including access failures.
How to install api-platform-tests
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-tests -a claude-code2Manually: put the files in place
~/.claude/skills/api-platform-tests/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/api-platform-tests/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-tests -a codex2Manually: put the files in place
.agents/skills/api-platform-tests/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-tests -a cursor2Manually: put the files in place
.cursor/skills/api-platform-tests/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/api-platform-tests2Manually: put the files in place
.github/skills/api-platform-tests/SKILL.md1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill api-platform-tests -a gemini-cli2Platform CLI
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/api-platform-testsManually: put the files in place
.devin/skills/api-platform-tests/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-tests
How do I install api-platform-tests in Claude Code?
Run npx skills add dev-toolings/superpowers-symfony --skill api-platform-tests -a claude-code. The skill is available at ~/.claude/skills/api-platform-tests/SKILL.md.
What does api-platform-tests do?
It guides functional tests for Symfony API Platform endpoints, with checks for filters, pagination, response schemas, authentication, and failure cases.
Which versions are required for #[ResetDatabase]?
The attribute requires PHPUnit 10+ and Foundry 2.9. For PHPUnit 9, use the ResetDatabase trait instead.
Source text
SKILL.md · MIT
--- name: api-platform-tests description: Test API Platform resources with ApiTestCase; assert collections, items, filters, JSON schema, and authentication capabilities: [read, search, edit, shell] tags: [api-platform, testing] # projected by `bun run build` — do not edit by hand allowed-tools: - Read - Glob - Grep - Write - Edit - Bash --- # Api Platform Tests (Symfony) ## Use when - Writing functional tests for API Platform endpoints: collection, item, create, update, delete. - Asserting validation errors (422) and access control (401, 403). - Checking filters, pagination, or the JSON schema of responses. - Setting up a clean database and test data for API tests. ## Default workflow 1. Extend `ApiTestCase` and seed data with Foundry factories (`createOne`, `createMany`). 2. Reset state with `#[ResetDatabase]` and the `Factories` trait, with DAMA rolling back each test. 3. Call `static::createClient()->request()` and assert the status code, content type, and `assertJsonContains()`. 4. Authenticate with `auth_bearer` and cover the anonymous, owner, and other-user cases. 5. Assert `member` and `totalItems` for filters and pagination (`hydra:`-prefixed only with `hydra_prefix: true`). 6. Assert the shape with `assertMatchesResourceItemJsonSchema()` and `assertMatchesResourceCollectionJsonSchema()`. ## Guardrails - Send `PATCH` with the `application/merge-patch+json` content type. - `#[ResetDatabase]` needs PHPUnit 10+ and Foundry 2.9: use the `ResetDatabase` trait on PHPUnit 9. - Cover the failure paths too: 404, 422, 401, 403. A type error on a constrained property is 422 in 5.0 but 400 in 4.4 and earlier. - Read the configured items per page rather than hardcoding a page size in assertions. ## Progressive disclosure - Use this file for execution posture and risk controls. - Open references when deep implementation details are needed. ## Output contract - The test classes added and the endpoints they cover. - Factories and reset strategy used. - Test run output, including the failure paths. ## References - `reference.md`
© dev-toolings · MIT · dev-toolings/superpowers-symfony