tdd-with-phpunit — Claude Code skill: what it does, how to install
The tdd-with-phpunit skill guides PHPUnit-driven work on Symfony features, from checking a failing test to refactoring after it passes. Use it for command, form, and external-service tests.
MIT ★ 234 updated 2026-10-05
npx skills add dev-toolings/superpowers-symfony --skill tdd-with-phpunit -a claude-codeWhat tdd-with-phpunit does
The skill lays out a RED-GREEN-REFACTOR workflow for PHPUnit 10/11 and helps select TestCase, KernelTestCase, or WebTestCase. It covers console command checks, 422 responses from invalid forms, and replacing an external dependency through Symfony’s test container. The agent’s output should include the failing and passing test runs, changed test files, and commands it ran.
New tests use PHPUnit attributes such as #[Test] and #[DataProvider]; the skill rules out the older @test and @dataProvider annotations. It recommends keeping real services and the database in place, while substituting mocks only at external boundaries. runCommand() and closures passed to getContainer()->set() require Symfony 8.1+, so that approach won’t work on earlier versions.
What it helps with
- drive Symfony feature work with the RED-GREEN-REFACTOR cycle
- choose a base class for a PHPUnit test
- check a console command with
CommandTester - assert a 422 response for an invalid form
- replace an external HTTP client with a test double
Example prompts for the agent
- Write a PHPUnit test for this Symfony feature, then work through RED-GREEN-REFACTOR.
- Test this console command with
CommandTesterand show the test run. - Add a test expecting a 422 response for this invalid form, and replace the external service with a test double.
How to install tdd-with-phpunit
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill tdd-with-phpunit -a claude-code2Manually: put the files in place
~/.claude/skills/tdd-with-phpunit/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/tdd-with-phpunit/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill tdd-with-phpunit -a codex2Manually: put the files in place
.agents/skills/tdd-with-phpunit/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill tdd-with-phpunit -a cursor2Manually: put the files in place
.cursor/skills/tdd-with-phpunit/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dev-toolings/superpowers-symfony content/skills/tdd-with-phpunit2Manually: put the files in place
.github/skills/tdd-with-phpunit/SKILL.md1Skills CLI (Vercel)
npx skills add dev-toolings/superpowers-symfony --skill tdd-with-phpunit -a gemini-cli2Platform CLI
gemini skills install https://github.com/dev-toolings/superpowers-symfony --path content/skills/tdd-with-phpunitManually: put the files in place
.devin/skills/tdd-with-phpunit/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 tdd-with-phpunit
How do I install tdd-with-phpunit in Claude Code?
Run npx skills add dev-toolings/superpowers-symfony --skill tdd-with-phpunit -a claude-code. The skill file is at ~/.claude/skills/tdd-with-phpunit/SKILL.md.
What does tdd-with-phpunit do?
It guides Symfony testing with PHPUnit 10/11, including the RED-GREEN-REFACTOR cycle, test base-class selection, and external dependency substitution.
Which Symfony version supports runCommand() in this skill?
Use Symfony 8.1 or later for runCommand() and closures passed to getContainer()->set().
Source text
SKILL.md · MIT
--- name: tdd-with-phpunit description: Apply RED-GREEN-REFACTOR with PHPUnit 10/11 for Symfony; KernelTestCase/WebTestCase, attributes (#[Test]/#[DataProvider]), Foundry capabilities: [read, search, edit, shell] tags: [testing, tdd] # projected by `bun run build` — do not edit by hand allowed-tools: - Read - Glob - Grep - Write - Edit - Bash --- # Tdd With Phpunit (Symfony) ## Use when - Driving a feature with RED-GREEN-REFACTOR using PHPUnit 10/11 class-based tests. - Choosing between `TestCase`, `KernelTestCase` and `WebTestCase` for a new behavior. - Testing a console command, or an invalid form that must answer 422. - Swapping an external service for a double through the test container. ## Default workflow 1. RED: pick the base class, write the test with `#[Test]`, `#[DataProvider]` and `#[CoversClass]`, run it and check it fails for the right reason. 2. GREEN: write the minimum code that passes. 3. REFACTOR with the suite green, re-running it after each change. 4. Replace an external boundary with `static::getContainer()->set(Service::class, $mock)`. 5. Test commands with `CommandTester`, or with `runCommand()` and `assertCommandIsSuccessful()` on Symfony 8.1+. 6. Assert invalid form submissions with `assertResponseIsUnprocessable()`. ## Guardrails - Use PHPUnit 10+ attributes, not `@test` or `@dataProvider` annotations. - Fetch services with `static::getContainer()`, not the legacy `self::$container`. - Mock only true external boundaries (HTTP clients, third-party SDKs); keep real services and a real database elsewhere. - `runCommand()` and closures in `getContainer()->set()` need Symfony 8.1+. ## Progressive disclosure - Use this file for execution posture and risk controls. - Open references when deep implementation details are needed. ## Output contract - The failing PHPUnit output (RED), then the passing run. - Test files changed, with the base class and attributes used. - Commands executed. ## References - `reference.md`
© dev-toolings · MIT · dev-toolings/superpowers-symfony