home / skills / makfly / superpowers-symfony / tdd-with-pest

tdd-with-pest skill

/skills/tdd-with-pest

This skill helps you drive Symfony development with deterministic tests using pest, enabling regression protection and efficient TDD workflows.

npx playbooks add skill makfly/superpowers-symfony --skill tdd-with-pest

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.1 KB
---

name: symfony:tdd-with-pest
allowed-tools:
  - Read
  - Write
  - Edit
  - Bash
  - Glob
  - Grep
description: Drive Symfony delivery with deterministic tests and strong regression protection. Use for tdd with pest tasks.
---

# Tdd With Pest (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`

Overview

This skill drives Symfony delivery through deterministic tests and strong regression protection using Pest. It codifies a RED/GREEN/REFACTOR workflow tailored to TDD, functional, and end-to-end scenarios. The focus is on turning bug reports into executable failing tests and delivering minimal, safe changes to production.

How this skill works

You write a failing Pest test that captures the target behavior and at least one boundary case, then implement the smallest change to make the test pass. The skill records the RED/GREEN/REFACTOR trace, lists changed test files and executed commands, and reports coverage and confidence notes. It enforces deterministic fixtures and isolated tests to keep CI stability high.

When to use it

  • Driving feature development with test-first discipline in Symfony projects
  • Converting bug reports into reproducible failing tests before fixing
  • Adding regression protection around critical business flows
  • Implementing functional or end-to-end scenarios with Pest
  • Hardening CI pipelines against flaky or implementation-dependent tests

Best practices

  • Write a single failing assertion per new test to keep the RED step focused
  • Include a boundary case alongside the happy path for each new behavior
  • Prefer deterministic fixtures and builders instead of heavy mocking or time-dependent data
  • Assert observable outcomes (responses, DB state, side effects) rather than internal implementation details
  • Keep tests isolated and avoid shared mutable global state to reduce flakiness

Example use cases

  • Turn a customer-reported API error into a failing Pest test, then implement the minimal fix and add regression tests
  • Drive a new form submission flow by writing failing functional tests first, then implement controllers and services iteratively
  • Add e2e protection for an authentication flow with Pest to prevent regressions after refactors
  • Broaden coverage for error paths (invalid input, unauthorized access, not-found) after the initial feature ships

FAQ

What output should I expect after a TDD session?

You get a RED/GREEN/REFACTOR trace, a list of changed test files, the exact commands executed, and notes about coverage and confidence.

How do I keep tests deterministic?

Use fixture builders, fixed timestamps or time fakes, seeded data, and avoid reliance on external flaky services; prefer in-memory doubles for slow or unstable dependencies.

When should I broaden coverage beyond the initial passing tests?

After the first green cycle and any refactor, add tests for invalid inputs, authorization checks, and not-found cases to protect the behavior surface from regressions.