home / skills / makfly / superpowers-symfony / tdd-with-phpunit
This skill accelerates Symfony development with deterministic TDD using PHPUnit, turning bugs into failing tests and ensuring regression protection.
npx playbooks add skill makfly/superpowers-symfony --skill tdd-with-phpunitReview the files below or copy the command above to add this skill to your agents.
---
name: symfony:tdd-with-phpunit
allowed-tools:
- Read
- Write
- Edit
- Bash
- Glob
- Grep
description: Drive Symfony delivery with deterministic tests and strong regression protection. Use for tdd with phpunit tasks.
---
# Tdd With Phpunit (Symfony)
## Use when
- Building regression-safe behavior with TDD/functional/e2e tests.
- Converting bug reports into executable failing tests.
## Default workflow
1. Write failing test for target behavior and one boundary case.
2. Implement minimal code to pass.
2. Refactor while preserving green suite.
2. Broaden coverage for invalid/unauthorized/not-found paths.
## Guardrails
- Prefer deterministic fixtures/builders.
- Assert observable behavior, not internal implementation.
- Keep tests isolated and stable in CI.
## Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.
## Output contract
- RED/GREEN/REFACTOR trace.
- Test files changed and executed commands.
- Coverage and confidence notes.
## References
- `reference.md`
- `docs/complexity-tiers.md`
This skill drives Symfony delivery using Test-Driven Development with PHPUnit to produce deterministic tests and strong regression protection. It focuses on creating failing tests first, implementing minimal code to pass, and iterating through refactor and coverage broadening. The goal is a stable CI suite that documents intended behavior and prevents regressions.
I guide a default red/green/refactor workflow: write a failing PHPUnit test targeting behavior, implement the smallest change to make it pass, then refactor while keeping the suite green. I emphasize deterministic fixtures and builders, isolating tests from external flakiness, and asserting observable outcomes rather than internal implementation. After the core behavior is green, I expand tests for boundary cases, invalid inputs, authorization, and not-found scenarios. I report the trace (RED/GREEN/REFACTOR), changed test files and executed commands, and include coverage and confidence notes.
What output do I get from the skill?
A RED/GREEN/REFACTOR trace, list of test files changed, the PHPUnit commands executed, and notes on coverage and confidence.
How do I keep tests deterministic?
Use fixtures/builders, avoid time-dependent assertions, mock external services, and seed known DB states for each test.