Best for
- Feature tests
- Unit tests
- API endpoint tests
event4u-app/agent-config/src/skills/pest-testing/SKILL.md
Use when writing, generating, or improving Pest tests for Laravel — clear intent, good coverage, maintainable structure, and alignment with project testing conventions.
Decision brief
Use when writing, generating, or improving Pest tests for Laravel — clear intent, good coverage, maintainable structure, and alignment with project testing conventions.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/pest-testing"Inspect the Agent Skill "pest-testing" from https://github.com/event4u-app/agent-config/blob/6a5670b7881a676c0da90d2afb950298087c4ccb/src/skills/pest-testing/SKILL.md at commit 6a5670b7881a676c0da90d2afb950298087c4ccb. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
1. Read the base skills first — apply php-coder, laravel, and eloquent where relevant. 2. Check the project's test framework — confirm Pest is used and inspect existing tests. 3. Match the current test style — naming, helpers, datasets, expectations, setup, traits, and folder st…
For bug fixes and new features, prefer test-driven development:
Review the “Example test usage” section in the pinned source before continuing.
Mock external boundaries (APIs, file systems, third-party services).
Use this skill for all Laravel testing tasks, especially when working with:
Permission review
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 98/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 9 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Use this skill for all Laravel testing tasks, especially when working with:
This skill extends php-coder, laravel, and eloquent.
For prevention layers that fire before writing a test — TDD
discipline, mock-isolation gates, and the 12 process rationalizations
("I'll add the test after", "patch first, test later") — see
test-driven-development,
testing-anti-patterns, and
process-anti-patterns.md.
php-coder, laravel, and eloquent where relevant.test-case-discovery funnel; floor per behavior: 1 happy + 1 boundary + 1 error (+1 abuse on security paths).For bug fixes and new features, prefer test-driven development:
Tests written after implementation pass immediately. Passing immediately proves nothing:
For every bug fix: write a failing test that reproduces the bug FIRST, then fix it. The test proves the fix works AND prevents regression.
| Excuse | Reality |
|---|---|
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
| "I'll test after" | Tests passing immediately prove nothing. |
| "Manual test is faster" | Manual doesn't prevent regression. You'll re-test every change. |
| "Test is hard to write" | Hard to test = hard to use. Simplify the design. |
| "Need to explore first" | Fine — throw away exploration code, start fresh with TDD. |
| "Existing code has no tests" | You're improving it. Add tests for what you touch. |
RefreshDatabase or the project's standard database reset strategy where appropriate.it() / test() according to existing project conventions.readonly or final on Pest test classes.final if they need to be mocked via Mockery::mock().namespace declaration) treat all PHP built-in classes as global.
Do NOT add use statements for global classes like DateTimeImmutable, Exception,
stdClass, etc. — PHP will warn: "The use statement with non-compound name has no effect".use statements for namespaced classes (e.g., use App\Models\...) are needed.$this->travel(5)->seconds() (Laravel's time travel) to create
a clear gap between "before" and "after" timestamps. Never rely on now() being different
between two lines of code — on fast hardware, they can be identical.null just because the seeder
doesn't set them — previous tests in parallel may have modified the same record.200 — verify meaningful behavior.assertDatabaseHasassertDatabaseMissingcoduo/php-matcherThis project uses coduo/php-matcher for flexible snapshot assertions.
Pattern files live in snapshots/ directories next to the test files.
Use pattern variables instead of hardcoded values in snapshot files. This makes snapshots resilient to data changes while still enforcing type correctness.
| Pattern | Matches | Example |
|---|---|---|
@boolean@ | true or false | 'is_active' => '@boolean@' |
@integer@ | Any integer | 'id' => '@integer@' |
@string@ | Any string | 'name' => '@string@' |
@null@ | null | 'deleted_at' => '@null@' |
@datetime@ | ISO datetime string | 'created_at' => '@datetime@' |
@uuid@ | UUID string | 'uuid' => '@uuid@' |
@array@ | Any array | 'items' => '@array@' |
@double@ | Any float | 'amount' => '@double@' |
@wildcard@ | Anything | 'data' => '@wildcard@' |
Combine with || for nullable fields: 'deleted_at' => '@null@||@datetime@'
$replacements.false) when other booleans in the same file use @boolean@ — be consistent.$variable ?? '@pattern@' syntax to allow test-specific overrides via replacements parameter.PhpMatcherHelper::ruleBackedEnum(EnumClass::class, 'string') for enum fields.// snapshots/user-resource.php
return [
'id' => $id ?? '@integer@',
'name' => $name ?? '@string@',
'email' => $email ?? '@string@',
'is_active' => $is_active ?? '@boolean@',
'created_at' => $created_at ?? '@datetime@',
'deleted_at' => $deleted_at ?? '@null@||@datetime@',
];
expect($response->json())
->toMatchPhpPatternFile(
patternFile: __DIR__ . '/snapshots/user-resource.php',
replacements: ['id' => $user->getId()],
);
Queue::fake()Bus::fake()Event::fake()Mail::fake()Notification::fake()Storage::fake()When reviewing or auditing existing tests, check for these anti-patterns:
| Smell | Description | Fix |
|---|---|---|
| Overmocking | Too many mocks disconnect the test from reality | Replace mocks with real implementations or fakes |
| Fragile tests | Tests break with unrelated changes (e.g., asserting exact JSON structure) | Assert only meaningful fields |
| Flaky tests | Non-deterministic results (time, ordering, parallel state) | Use time travel, explicit ordering, isolated data |
| Giant tests | One test covers 5+ behaviors | Split into focused tests |
| Missing assertions | Test runs code but doesn't verify outcomes | Add meaningful assertions |
| Test duplication | Same scenario tested in multiple places | Consolidate or use datasets |
| Assertion roulette | Many assertions without clear failure messages | Use named assertions or split tests |
| Eager test | Tests too many things, making failures hard to diagnose | One behavior per test |
Queue::fake(), Http::fake()) over manual mocks.When generating Pest tests:
When triaging a verbose run, narrow the output with --filter (Pest)
plus targeted grep/rg instead of re-running the whole suite or
echoing all logs:
# Only run failing tests in one file
vendor/bin/pest tests/Feature/InvoiceTest.php --filter='creates invoice'
# Scan the test log for failures only
rg --color=never '^FAIL|Tests:' storage/logs/pest.log
# Inspect JSON output from data-driven tests
vendor/bin/pest --log-junit=pest.xml && rg '<failure' pest.xml
readonly or final on Pest test helper classes — it breaks mocking.use statements for global classes (Exception, DateTimeImmutable) in Pest files — they're auto-imported.$this->travel(5)->seconds() for time-dependent tests — never rely on now() differing between lines.When generating new tests, focus on:
What NOT to test:
Quality over quantity — 5 meaningful tests beat 20 trivial ones.
Frequently asked questions
Use when writing, generating, or improving Pest tests for Laravel — clear intent, good coverage, maintainable structure, and alignment with project testing conventions.
The source record exposes this install command: npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/pest-testing". Inspect the command and pinned source before running it.
Alternatives
garrytan/gbrain
End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.
alirezarezvani/claude-skills
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
dotnet/skills
Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing
vipshop/cache-dit
High-level guide for integrating a new DiT model into cache-dit: Cache (BlockAdapter/ForwardPattern), Context Parallelism, Tensor Parallelism, Text Encoder Parallelism (TE-P), VAE Parallelism (VAE-P), generate CLI, installation, testing workflow, and detailed references. Use when adding support for a new diffusion transformer model in cache-dit.