$npx skillfedfor your agent

pest

Pest is a testing framework built on PHPUnit that replaces test classes with closures and assertion methods with a fluent expect() API. This skill covers test structure using test()/it()/describe(), the full expect() chain including modifiers and custom expectations, hooks for setup and teardown, datasets for parameterized testing, and advanced features like architecture rules and mutation testing.

Pest helps you write function-style tests with closures and expect() assertions instead of test classes and assertion methods.

AI-generated summary based on this skill's SKILL.md

18 0 MITupdated by xobotyi

Decision gist · record as of 2026-07-10

Pest helps you write function-style tests with closures and expect() assertions instead of test classes and assertion methods. Pest is a testing framework built on PHPUnit that replaces test classes with closures and assertion methods with a fluent expect() API. This skill covers test structure using test()/it()/describe(), the full expect() chain including modifiers and custom expectations, hooks for setup and teardown, datasets for parameterized testing, and advanced features like architecture rules and mutation testing.

manual: git clone https://github.com/xobotyi/cc-foundry → cp -r cc-foundry/plugins/php/skills/pest ~/.claude/skills/pest
plugins/php/skills/pest/SKILL.md · version 86627a61

Use it when

  • Pest datasets enable parameterized testing without repeating test code.
  • Pest hooks manage setup and teardown logic.

Verify before relying

Read SKILL.md below before installing (6 files). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

xobotyi/cc-foundry/pest · repository language: JavaScript

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I write pest tests using closures and the expect API?

Pest replaces PHPUnit class-based tests with function-style closures. Use test() or it() to define a test, then chain expect() with your assertion: test('adds numbers', function() { expect(1 + 1)->toBe(2); }). The expect() API provides fluent methods like toBe(), toEqual(), toContain(), and hundreds more, all chainable for readable assertions. Closures receive automatic dependency injection and access to $this for helper methods.

What are Pest datasets and how do data providers work?

Pest datasets enable parameterized testing without repeating test code. Use dataset() to define test cases, then reference them with ->with('datasetName'). Example: dataset('numbers', [1, 2, 3]) paired with test('is positive', fn($n) => expect($n)->toBeGreaterThan(0))->with('numbers'). Datasets replace PHPUnit's @dataProvider annotation and support inline arrays, external files, or database queries for flexible test data organization.

How do Pest hooks like beforeEach and afterEach work?

Pest hooks manage setup and teardown logic. Use beforeEach() to run code before each test—ideal for resetting state or creating fixtures. Use afterEach() for cleanup. Hooks can be scoped with describe() blocks: describe('auth', function() { beforeEach(fn() => login()); it('...'); }) ensures login runs only for tests in that block. Global hooks run for all tests; nested hooks inherit and stack.

What is Pest architecture testing and mutation testing?

Pest architecture testing enforces code structure rules without assertions. Use arch()->preset()->laravel() or custom rules like ->classes('App\Models')->shouldExtend(Model). Mutation testing verifies test quality by introducing code changes (mutations) and checking if tests catch them. Run pest --mutate to detect weak tests. Both features ensure code maintainability and test reliability beyond simple coverage metrics.

How do I run Pest CLI with filtering, coverage, and parallelization?

Pest CLI offers powerful execution control. Use --filter to run specific tests by name, --group to organize by tags, --coverage for code coverage reports, and --parallel to run tests concurrently. Example: pest --filter auth --coverage --parallel. Configure parallelization in pest.php with processes option. Combine flags for flexible test runs: pest --only, --skip, --profile for profiling slow tests.

How do I migrate from PHPUnit class-based tests to Pest?

Pest provides a migration path from PHPUnit. Replace class methods with test() closures: PHPUnit's public function testExample() becomes test('example', function() { ... }). Convert $this->assert*() calls to expect() chains. Use pest --convert to automatically transform existing PHPUnit tests. Hooks replace setUp/tearDown methods. Datasets replace @dataProvider. Most PHPUnit features map directly; Pest's syntax is more concise and readable.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

Pest

Tests are functions, not classes. Write the expectation, not the ceremony — expect($x)->toBe($y), and let the description say what the code does.

Pest is a testing framework built on the PHPUnit engine: closures instead of test-case methods, an expect() expectation API instead of $this->assert*, and first-class architecture, mutation, type-coverage, and browser testing. $this inside a test closure is a PHPUnit TestCase, so the full PHPUnit assertion and test-double API stays available. All patterns target Pest 4 on PHP 8.5+ (it runs on the PHPUnit 12 engine; its own floor is PHP 8.3).

This skill governs Pest-specific decisions. It does not restate universal testing philosophy (test behavior not implementation, arrange-act-assert, isolation, mock at boundaries), the PHPUnit assertion/double API,

(truncated - see the full file via the links below)

File tree — 6 files
plugins/php/skills/pest/.dev/reference-inventory.json
plugins/php/skills/pest/SKILL.md
plugins/php/skills/pest/references/advanced-features.md
plugins/php/skills/pest/references/architecture.md
plugins/php/skills/pest/references/configuration.md
plugins/php/skills/pest/references/expectations.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Write and structure Pest tests using closures, expect API, and best practices”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

laravel-testing
by AsyrafHussin · AsyrafHussin/agent-skills

This skill guides you through testing Laravel 13 applications with either Pest PHP 4 or PHPUnit 12, covering 24 rules across HTTP endpoints, model factories, database state verification, service mocking, and authentication patterns. It detects your project's testing framework automatically and provides syntax examples for both frameworks side-by-side, so you can write fast, readable tests regardless of which one you use.

MITupdated May 2026
★ 58repo stars
Pest Testing
by bagisto · bagisto/agent-skills

This skill teaches you to write and run Pest 3 tests across Bagisto's modular package structure. Learn to create unit and feature tests, use assertions and mocking, organize tests by package, and run specific test suites via command line.

no license declared → metadata onlyupdated Jul 2026
★ 11repo stars
laravel-tdd
by affaan-m · affaan-m/ECC

Laravel-TDD guides you through test-driven development for Laravel applications, covering PHPUnit and Pest frameworks alongside model factories, HTTP controller testing, and Sanctum authentication verification. Learn the red-green-refactor cycle with practical examples for unit tests, feature tests, and JSON API testing, plus techniques for mocking external services and validating authorization.

MITupdated Jul 2026
★ 234,207repo stars
Testing
by mwguerra · mwguerra/claude-code-plugins

Testing generates comprehensive Pest test suites for FilamentPHP v4 components including resources, forms, tables, and authorization. It provides ready-to-use test patterns for list, create, edit, and view pages with built-in validation and bulk action testing.

no license declared → metadata onlyupdated Apr 2026
★ 35repo stars
phpunit-skill
by LambdaTest · LambdaTest/agent-skills

phpunit-skill streamlines the creation of PHPUnit test suites by automating test case generation, assertion setup, and lifecycle method configuration. Designed for developers building robust PHP testing workflows, this skill reduces boilerplate code and accelerates test-driven development cycles.

MITupdated Jul 2026
★ 339repo stars
php-rules
by softspark · softspark/ai-toolkit

PHP Rules enforces coding standards covering style, frameworks, patterns, security, and testing. It guides PSR-12 compliance, modern PHP 8.1+ syntax, Laravel and Symfony conventions, Eloquent and Doctrine patterns, and error handling best practices.

Apache-2.0updated Jul 2026
★ 161repo stars

More skills php-pro (MIT) · Php Idioms (MIT) · pest-testing (MIT)

Tags
function-based-testingfluent-assertionsphp-testing-frameworkbehavioral-test-syntaxtest-data-providersstructural-code-validationbrowser-automation-testingmutation-score-analysistest-filtering-focusphpunit-abstraction