Skip to main content
skill CX Codex

tdd-with-pest — Claude Code skill for Symfony TDD

tdd-with-pest guides RED-GREEN-REFACTOR in Symfony projects using Pest v4. Use it to write new tests, reproduce bugs before a fix, or move PHPUnit tests to Pest syntax.

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 tdd-with-pest -a claude-code
Open on GitHub

What tdd-with-pest does

The skill lays out a test-first loop: write an it() test with Foundry v2 factories, run it, and confirm the failure has the expected cause. Then make the smallest code change and run the tests again. It also covers configuring Pest in tests/Pest.php to use Symfony’s KernelTestCase and WebTestCase, including tests that need the HTTP client.

You need PHP 8.3+ and Pest v4. The setup uses uses() for integration and functional tests, and the skill recommends Factories and ResetDatabase traits for anonymous Pest test files. Symfony has no official Pest plugin, so bind KernelTestCase and WebTestCase through uses() instead of relying on one. The requested output includes the failed and passing test runs, changes to tests/Pest.php, edited test files, and the commands used.

What it helps with

  • check that a new test fails for the expected reason
  • write a regression test before fixing a bug
  • configure Pest tests to use Symfony’s kernel and HTTP client
  • convert PHPUnit class tests to Pest syntax

Example prompts for the agent

  • Write an it() test for this behavior, then confirm it fails for the right reason.
  • Configure tests/Pest.php for integration tests with KernelTestCase and Foundry factories.
  • Convert this PHPUnit test to Pest syntax and rerun the suite.

How to install tdd-with-pest

1Skills CLI (Vercel)

npx skills add dev-toolings/superpowers-symfony --skill tdd-with-pest -a claude-code

2Manually: put the files in place

~/.claude/skills/tdd-with-pest/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/tdd-with-pest/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about tdd-with-pest

How do I install tdd-with-pest in Claude Code?

Run npx skills add dev-toolings/superpowers-symfony --skill tdd-with-pest -a claude-code. The skill file is at ~/.claude/skills/tdd-with-pest/SKILL.md.

What does tdd-with-pest do?

It guides a RED-GREEN-REFACTOR workflow for Symfony projects using Pest, from checking a failing test to applying a change and running the suite again.

Which PHP and Pest versions does tdd-with-pest require?

It requires PHP 8.3+ and Pest v4. Symfony test classes are bound through uses() in tests/Pest.php.

Source text

SKILL.md · MIT
---
name: tdd-with-pest
description: Apply RED-GREEN-REFACTOR with Pest v4 (PHP 8.3+) for Symfony via the PHPUnit bridge; Foundry factories, WebTestCase, verify failures first
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 Pest (Symfony)

## Use when
- Driving a feature with RED-GREEN-REFACTOR in a project that runs Pest v4 (PHP 8.3+).
- Writing `it()` and `expect()` tests that need the Symfony kernel or an HTTP client.
- Converting existing PHPUnit class tests to Pest syntax with `pest-plugin-drift`.
- Adding a bug-reproducing test to a Pest suite before the fix.

## Default workflow
1. Confirm PHP 8.3+ and Pest v4, then generate `tests/Pest.php` with `./vendor/bin/pest --init`.
2. Bind the bridge classes in `tests/Pest.php`: `uses(KernelTestCase::class, Factories::class, ResetDatabase::class)->in('Integration')` and `uses(WebTestCase::class, ...)->in('Functional')`.
3. RED: write an `it()` test with Foundry v2 factories, run `./vendor/bin/pest --filter` and check it fails for the right reason.
4. GREEN: write the minimal code, then REFACTOR and re-run `./vendor/bin/pest`.
5. Gate the suite with `--parallel` and `--coverage --min=80`.

## Guardrails
- There is no official Symfony Pest plugin: never reference `pestphp/pest-plugin-symfony`, bind `KernelTestCase` or `WebTestCase` through `uses()`.
- Foundry v2 factories return real objects: no `->object()` call.
- Pest test files are anonymous, so use the `Factories` and `ResetDatabase` traits rather than the `#[ResetDatabase]` attribute.
- Chain related checks with `expect()->and()`; keep one concept per test.

## Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.

## Output contract
- The failing `./vendor/bin/pest` output (RED), then the passing run.
- `tests/Pest.php` bindings added or changed.
- Test files changed and the commands executed.

## References
- `reference.md`

© dev-toolings · MIT · dev-toolings/superpowers-symfony

Similar skills

All skills for Testing and QA →

From the same set51

The whole set →
rate-limiting rate-limiting guides Claude Code through setting up Symfony RateLimiter policies, controller attributes, and 429 responses with Retry-After headers. CX Codex +1 ★ 234repo stars 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. CX Codex +1 ★ 234repo stars api-platform-serialization Skill configures API Platform serialization: field groups per operation, IRIs instead of nested objects, computed properties, and normalizer options. CX Codex +1 ★ 234repo stars symfony-scheduler Configures recurring tasks with the Symfony Scheduler component without system crontab entries. Useful for scheduled report generation, database cleanups, and Messenger syncs. CX Codex +1 ★ 234repo stars 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

Project sponsors

Companies that keep this analytics open