[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6X7CQ4G8R0PTM39JDFJC6NK":3,"skill-same:01M6X7CQ4G8R0PTM39JDFJC6NK":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":55,"commitSha":56,"skillDirectory":57,"forksCount":58,"repositoryHtmlUrl":59,"repositoryHomepageUrl":60,"ownerHtmlUrl":61,"ownerBlogUrl":60,"ownerDescription":62,"updatedAt":63,"install":64,"resources":76},"01M6X7CQ4G8R0PTM39JDFJC6NK","pest-testing",null,"Use when writing, generating, or improving Pest tests for Laravel — clear intent, good coverage, maintainable structure, and alignment with project testing conventions.","event4u-app\u002Fagent-config","event4u-app","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F199339632?v=4","01M6X5TWBNCQCE1VDKT4E9KF7N","event4u.app","01M6X5TWF4HRM266RG2Q5VVH1X",19,"MIT","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Fpest-testing\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"pest testing","testing","intent","when","for","project testing","professional","false","clear","tests","project","structure","alignment","good","use","coverage","quality","laravel","engineering","writing","2026-11-10 10:12:30",false,"---\nmodel_tier: medium\nname: pest-testing\ndescription: \"Use when writing, generating, or improving Pest tests for Laravel — clear intent, good coverage, maintainable structure, and alignment with project testing conventions.\"\ndomain: quality\nworkspaces:\n  - engineering\npacks:\n  - laravel\ntrust:\n  level: professional\ninstall:\n  default: false\n  removable: true\ntriggers:\n  - phrase: \"pest test\"\n  - phrase: \"pest suite\"\n---\n\n# pest-testing\n\n## When to use\n\nUse this skill for all Laravel testing tasks, especially when working with:\n\n- Feature tests\n- Unit tests\n- API endpoint tests\n- Model tests\n- Service tests\n- Authorization tests\n- Validation tests\n- Database interaction tests\n- Factories, fakes, mocks, and test setup\n\nThis skill extends `php-coder`, `laravel`, and `eloquent`.\n\nFor prevention layers that fire **before** writing a test — TDD\ndiscipline, mock-isolation gates, and the 12 process rationalizations\n(\"I'll add the test after\", \"patch first, test later\") — see\n[`test-driven-development`](..\u002Ftest-driven-development\u002FSKILL.md),\n[`testing-anti-patterns`](..\u002Ftesting-anti-patterns\u002FSKILL.md), and\n[`process-anti-patterns.md`](..\u002Ftesting-anti-patterns\u002Fprocess-anti-patterns.md).\n\n## Procedure: Write Pest tests\n\n1. **Read the base skills first** — apply `php-coder`, `laravel`, and `eloquent` where relevant.\n2. **Check the project's test framework** — confirm Pest is used and inspect existing tests.\n3. **Match the current test style** — naming, helpers, datasets, expectations, setup, traits, and folder structure.\n4. **Check available factories and seeders** — reuse existing test data patterns.\n5. **Understand the behavior under test** — inspect controllers, services, requests, policies, jobs, and models before writing tests.\n6. **Prefer existing helpers** — authentication helpers, custom assertions, base test classes, and shared setup.\n\n## Core testing principles\n\n- Test behavior, not implementation details.\n- Prefer clear, intention-revealing tests over overly clever abstractions.\n- One test should verify one meaningful behavior.\n- Keep setup minimal and relevant.\n- Favor confidence and maintainability over excessive mocking.\n- Cover happy path, validation failures, authorization failures, and important edge cases.\n- Enumerate the cases BEFORE writing — run the [`test-case-discovery`](..\u002Ftest-case-discovery\u002FSKILL.md) funnel; floor per behavior: 1 happy + 1 boundary + 1 error (+1 abuse on security paths).\n\n## TDD workflow (Red-Green-Refactor)\n\nFor bug fixes and new features, prefer test-driven development:\n\n1. **RED** — Write a failing test that describes the expected behavior.\n2. **Verify RED** — Run the test, confirm it fails for the expected reason (missing feature,\n   not a typo or syntax error). If the test passes immediately, it tests existing behavior — fix it.\n3. **GREEN** — Write the **minimal** code to make the test pass. No extras, no \"while I'm here\".\n4. **Verify GREEN** — Run all tests, confirm the new test passes and nothing else broke.\n5. **REFACTOR** — Clean up code while keeping tests green.\n\n### Why test-first matters\n\nTests written **after** implementation pass immediately. Passing immediately proves nothing:\n- The test might test the wrong thing.\n- The test might test implementation, not behavior.\n- You never saw it catch the bug — so you don't know if it would.\n\n### Bug fix TDD\n\nFor every bug fix: write a failing test that reproduces the bug FIRST, then fix it.\nThe test proves the fix works AND prevents regression.\n\n### TDD rationalization prevention\n\n| Excuse | Reality |\n|---|---|\n| \"Too simple to test\" | Simple code breaks. Test takes 30 seconds. |\n| \"I'll test after\" | Tests passing immediately prove nothing. |\n| \"Manual test is faster\" | Manual doesn't prevent regression. You'll re-test every change. |\n| \"Test is hard to write\" | Hard to test = hard to use. Simplify the design. |\n| \"Need to explore first\" | Fine — throw away exploration code, start fresh with TDD. |\n| \"Existing code has no tests\" | You're improving it. Add tests for what you touch. |\n\n## Laravel testing rules\n\n- Use **Feature tests** for HTTP endpoints, request validation, middleware behavior, authorization, and end-to-end application flow.\n- Use **Unit tests** for isolated services or pure logic when true isolation adds value.\n- Prefer Feature tests over Unit tests when framework integration is part of the behavior.\n- Use `RefreshDatabase` or the project's standard database reset strategy where appropriate.\n- Reuse factories instead of manually creating large fixture arrays.\n\n## Pest style rules\n\n- Write descriptive test names in plain language.\n- Use `it()` \u002F `test()` according to existing project conventions.\n- Group related tests logically.\n- Use datasets when they improve readability and reduce duplication.\n- Keep each test focused and concise.\n\n## Pest-specific PHP rules\n\n- Do NOT use `readonly` or `final` on Pest test classes.\n- Do NOT mark classes `final` if they need to be mocked via `Mockery::mock()`.\n- Pest test files (without a `namespace` declaration) treat all PHP built-in classes as global.\n  Do **NOT** add `use` statements for global classes like `DateTimeImmutable`, `Exception`,\n  `stdClass`, etc. — PHP will warn: *\"The use statement with non-compound name has no effect\"*.\n- Only `use` statements for **namespaced** classes (e.g., `use App\\Models\\...`) are needed.\n\n## Avoiding flaky tests\n\n- **Time-dependent tests:** Use `$this->travel(5)->seconds()` (Laravel's time travel) to create\n  a clear gap between \"before\" and \"after\" timestamps. Never rely on `now()` being different\n  between two lines of code — on fast hardware, they can be identical.\n- **Database-dependent tests:** Don't assume column values are `null` just because the seeder\n  doesn't set them — previous tests in parallel may have modified the same record.\n- **Parallel testing:** The project may use parallel testing (8+ processes). Avoid relying on\n  global state, specific row counts, or auto-increment IDs.\n\n## HTTP and API tests\n\n- Test:\n    - status codes\n    - response structure\n    - validation errors\n    - authorization behavior\n    - persistence side effects\n- For JSON APIs, assert:\n    - exact relevant fields\n    - error structure when applicable\n    - database state after the request\n- Do not only assert `200` — verify meaningful behavior.\n\n## Validation tests\n\n- Validate important request rules explicitly.\n- Cover required fields, invalid formats, boundary values, and business-critical constraints.\n- Prefer focused validation tests over giant \"all fields invalid\" tests unless the project already uses that pattern.\n\n## Authorization tests\n\n- Always test protected actions for:\n    - guest users\n    - unauthorized users\n    - authorized users\n- Match the project's auth setup and policy usage.\n- Do not assume authorization works just because a policy exists.\n\n## Database assertions\n\n- Assert persistence effects with:\n    - `assertDatabaseHas`\n    - `assertDatabaseMissing`\n    - relation checks where relevant\n- Keep assertions focused on meaningful fields.\n- Do not assert every column unless necessary.\n\n## Snapshot testing with `coduo\u002Fphp-matcher`\n\nThis project uses [`coduo\u002Fphp-matcher`](https:\u002F\u002Fgithub.com\u002Fcoduo\u002Fphp-matcher) for flexible snapshot assertions.\nPattern files live in `snapshots\u002F` directories next to the test files.\n\n### Pattern variables\n\nUse pattern variables instead of hardcoded values in snapshot files.\nThis makes snapshots resilient to data changes while still enforcing type correctness.\n\n| Pattern | Matches | Example |\n|---|---|---|\n| `@boolean@` | `true` or `false` | `'is_active' => '@boolean@'` |\n| `@integer@` | Any integer | `'id' => '@integer@'` |\n| `@string@` | Any string | `'name' => '@string@'` |\n| `@null@` | `null` | `'deleted_at' => '@null@'` |\n| `@datetime@` | ISO datetime string | `'created_at' => '@datetime@'` |\n| `@uuid@` | UUID string | `'uuid' => '@uuid@'` |\n| `@array@` | Any array | `'items' => '@array@'` |\n| `@double@` | Any float | `'amount' => '@double@'` |\n| `@wildcard@` | Anything | `'data' => '@wildcard@'` |\n\nCombine with `||` for nullable fields: `'deleted_at' => '@null@||@datetime@'`\n\n### Rules\n\n- **Never hardcode dynamic values** (IDs, timestamps, UUIDs) in snapshots — use pattern variables or `$replacements`.\n- **Never hardcode boolean defaults** (e.g., `false`) when other booleans in the same file use `@boolean@` — be consistent.\n- Use `$variable ?? '@pattern@'` syntax to allow test-specific overrides via `replacements` parameter.\n- Use `PhpMatcherHelper::ruleBackedEnum(EnumClass::class, 'string')` for enum fields.\n\n### Example snapshot file\n\n```php\n\u002F\u002F snapshots\u002Fuser-resource.php\nreturn [\n    'id' => $id ?? '@integer@',\n    'name' => $name ?? '@string@',\n    'email' => $email ?? '@string@',\n    'is_active' => $is_active ?? '@boolean@',\n    'created_at' => $created_at ?? '@datetime@',\n    'deleted_at' => $deleted_at ?? '@null@||@datetime@',\n];\n```\n\n### Example test usage\n\n```php\nexpect($response->json())\n    ->toMatchPhpPatternFile(\n        patternFile: __DIR__ . '\u002Fsnapshots\u002Fuser-resource.php',\n        replacements: ['id' => $user->getId()],\n    );\n```\n\n## Fakes, mocks, and external boundaries\n\n- Use Laravel fakes for framework integrations when appropriate:\n    - `Queue::fake()`\n    - `Bus::fake()`\n    - `Event::fake()`\n    - `Mail::fake()`\n    - `Notification::fake()`\n    - `Storage::fake()`\n- Mock only true external boundaries or expensive dependencies.\n- Avoid mocking internal application code unless isolation is necessary for the specific test.\n\n## Factories and fixtures\n\n- Prefer factories with explicit state over large inline setup.\n- Use named states for meaningful scenarios.\n- Keep test data realistic and minimal.\n- Do not create unnecessary records.\n\n## Test quality analysis\n\nWhen reviewing or auditing existing tests, check for these anti-patterns:\n\n### Test smells to detect\n\n| Smell | Description | Fix |\n|---|---|---|\n| **Overmocking** | Too many mocks disconnect the test from reality | Replace mocks with real implementations or fakes |\n| **Fragile tests** | Tests break with unrelated changes (e.g., asserting exact JSON structure) | Assert only meaningful fields |\n| **Flaky tests** | Non-deterministic results (time, ordering, parallel state) | Use time travel, explicit ordering, isolated data |\n| **Giant tests** | One test covers 5+ behaviors | Split into focused tests |\n| **Missing assertions** | Test runs code but doesn't verify outcomes | Add meaningful assertions |\n| **Test duplication** | Same scenario tested in multiple places | Consolidate or use datasets |\n| **Assertion roulette** | Many assertions without clear failure messages | Use named assertions or split tests |\n| **Eager test** | Tests too many things, making failures hard to diagnose | One behavior per test |\n\n### FIRST principles\n\n- **Fast** — Tests should run quickly. Avoid unnecessary DB operations.\n- **Isolated** — Tests should not depend on each other or shared state.\n- **Repeatable** — Same result every time, regardless of environment or order.\n- **Self-validating** — Pass or fail, no manual inspection needed.\n- **Timely** — Written close to the code they test.\n\n### Mock usage guidelines\n\n- Mock **external boundaries** (APIs, file systems, third-party services).\n- Use Laravel fakes (`Queue::fake()`, `Http::fake()`) over manual mocks.\n- Do NOT mock the class under test.\n- Do NOT mock value objects or DTOs.\n- If a test needs 3+ mocks, consider testing at a higher level (Feature test).\n\n## What NOT to do\n\n- Do not test private methods directly.\n- Do not over-mock Laravel internals.\n- Do not assert implementation details when behavior assertions are enough.\n- Do not write brittle tests tied to formatting or irrelevant response noise.\n- Do not create giant tests that cover many behaviors at once.\n- Do not skip authorization or validation coverage for important endpoints.\n\n## Output expectations\n\nWhen generating Pest tests:\n\n- follow the existing folder and naming conventions\n- test behavior clearly and directly\n- cover success, failure, and authorization paths\n- use factories and Laravel test helpers\n- assert both response and side effects where relevant\n- keep tests readable, isolated, and maintainable\n\n### Filter Pest output\n\nWhen triaging a verbose run, narrow the output with `--filter` (Pest)\nplus targeted `grep`\u002F`rg` instead of re-running the whole suite or\nechoing all logs:\n\n```bash\n# Only run failing tests in one file\nvendor\u002Fbin\u002Fpest tests\u002FFeature\u002FInvoiceTest.php --filter='creates invoice'\n\n# Scan the test log for failures only\nrg --color=never '^FAIL|Tests:' storage\u002Flogs\u002Fpest.log\n\n# Inspect JSON output from data-driven tests\nvendor\u002Fbin\u002Fpest --log-junit=pest.xml && rg '\u003Cfailure' pest.xml\n```\n\n\n## Output format\n\n1. Pest test file with descriptive test names and clear assertions\n2. Tests organized by happy path, validation, edge cases\n\n## Gotcha\n\n- Don't use `readonly` or `final` on Pest test helper classes — it breaks mocking.\n- Don't add `use` statements for global classes (`Exception`, `DateTimeImmutable`) in Pest files — they're auto-imported.\n- The model forgets `$this->travel(5)->seconds()` for time-dependent tests — never rely on `now()` differing between lines.\n- Parallel tests share the database — don't assume column values are null unless you explicitly set them.\n\n## Do NOT\n\n- Do NOT mark classes final if they need to be mocked via Mockery.\n- Do NOT use PHPUnit class-based syntax — use Pest syntax.\n\n## What to test (generation checklist)\n\nWhen generating new tests, focus on:\n- **Business logic**: calculations, status transitions, validation rules, data transformations\n- **Edge cases**: null, empty string, zero, negative numbers, boundary values, max length\n- **Error paths**: invalid input, missing dependencies, exception handling\n- **Different code branches**: if\u002Felse, early returns, fallback behavior\n\nWhat NOT to test:\n- Trivial getters\u002Fsetters without logic\n- Parameter counts, method existence, class names\n- Framework internals (Eloquent, routing)\n- Private methods directly — test through public API\n\n**Quality over quantity** — 5 meaningful tests beat 20 trivial ones.\n\n## Auto-trigger keywords\n\n- Pest test\n- PHPUnit\n- test writing\n- test quality\n- TDD\n- generate tests\n- write tests\n- test coverage\n- test scenarios\n","# pest-testing\n\n## When to use\n\nUse this skill for all Laravel testing tasks, especially when working with:\n\n- Feature tests\n- Unit tests\n- API endpoint tests\n- Model tests\n- Service tests\n- Authorization tests\n- Validation tests\n- Database interaction tests\n- Factories, fakes, mocks, and test setup\n\nThis skill extends `php-coder`, `laravel`, and `eloquent`.\n\nFor prevention layers that fire **before** writing a test — TDD\ndiscipline, mock-isolation gates, and the 12 process rationalizations\n(\"I'll add the test after\", \"patch first, test later\") — see\n[`test-driven-development`](..\u002Ftest-driven-development\u002FSKILL.md),\n[`testing-anti-patterns`](..\u002Ftesting-anti-patterns\u002FSKILL.md), and\n[`process-anti-patterns.md`](..\u002Ftesting-anti-patterns\u002Fprocess-anti-patterns.md).\n\n## Procedure: Write Pest tests\n\n1. **Read the base skills first** — apply `php-coder`, `laravel`, and `eloquent` where relevant.\n2. **Check the project's test framework** — confirm Pest is used and inspect existing tests.\n3. **Match the current test style** — naming, helpers, datasets, expectations, setup, traits, and folder structure.\n4. **Check available factories and seeders** — reuse existing test data patterns.\n5. **Understand the behavior under test** — inspect controllers, services, requests, policies, jobs, and models before writing tests.\n6. **Prefer existing helpers** — authentication helpers, custom assertions, base test classes, and shared setup.\n\n## Core testing principles\n\n- Test behavior, not implementation details.\n- Prefer clear, intention-revealing tests over overly clever abstractions.\n- One test should verify one meaningful behavior.\n- Keep setup minimal and relevant.\n- Favor confidence and maintainability over excessive mocking.\n- Cover happy path, validation failures, authorization failures, and important edge cases.\n- Enumerate the cases BEFORE writing — run the [`test-case-discovery`](..\u002Ftest-case-discovery\u002FSKILL.md) funnel; floor per behavior: 1 happy + 1 boundary + 1 error (+1 abuse on security paths).\n\n## TDD workflow (Red-Green-Refactor)\n\nFor bug fixes and new features, prefer test-driven development:\n\n1. **RED** — Write a failing test that describes the expected behavior.\n2. **Verify RED** — Run the test, confirm it fails for the expected reason (missing feature,\n   not a typo or syntax error). If the test passes immediately, it tests existing behavior — fix it.\n3. **GREEN** — Write the **minimal** code to make the test pass. No extras, no \"while I'm here\".\n4. **Verify GREEN** — Run all tests, confirm the new test passes and nothing else broke.\n5. **REFACTOR** — Clean up code while keeping tests green.\n\n### Why test-first matters\n\nTests written **after** implementation pass immediately. Passing immediately proves nothing:\n- The test might test the wrong thing.\n- The test might test implementation, not behavior.\n- You never saw it catch the bug — so you don't know if it would.\n\n### Bug fix TDD\n\nFor every bug fix: write a failing test that reproduces the bug FIRST, then fix it.\nThe test proves the fix works AND prevents regression.\n\n### TDD rationalization prevention\n\n| Excuse | Reality |\n|---|---|\n| \"Too simple to test\" | Simple code breaks. Test takes 30 seconds. |\n| \"I'll test after\" | Tests passing immediately prove nothing. |\n| \"Manual test is faster\" | Manual doesn't prevent regression. You'll re-test every change. |\n| \"Test is hard to write\" | Hard to test = hard to use. Simplify the design. |\n| \"Need to explore first\" | Fine — throw away exploration code, start fresh with TDD. |\n| \"Existing code has no tests\" | You're improving it. Add tests for what you touch. |\n\n## Laravel testing rules\n\n- Use **Feature tests** for HTTP endpoints, request validation, middleware behavior, authorization, and end-to-end application flow.\n- Use **Unit tests** for isolated services or pure logic when true isolation adds value.\n- Prefer Feature tests over Unit tests when framework integration is part of the behavior.\n- Use `RefreshDatabase` or the project's standard database reset strategy where appropriate.\n- Reuse factories instead of manually creating large fixture arrays.\n\n## Pest style rules\n\n- Write descriptive test names in plain language.\n- Use `it()` \u002F `test()` according to existing project conventions.\n- Group related tests logically.\n- Use datasets when they improve readability and reduce duplication.\n- Keep each test focused and concise.\n\n## Pest-specific PHP rules\n\n- Do NOT use `readonly` or `final` on Pest test classes.\n- Do NOT mark classes `final` if they need to be mocked via `Mockery::mock()`.\n- Pest test files (without a `namespace` declaration) treat all PHP built-in classes as global.\n  Do **NOT** add `use` statements for global classes like `DateTimeImmutable`, `Exception`,\n  `stdClass`, etc. — PHP will warn: *\"The use statement with non-compound name has no effect\"*.\n- Only `use` statements for **namespaced** classes (e.g., `use App\\Models\\...`) are needed.\n\n## Avoiding flaky tests\n\n- **Time-dependent tests:** Use `$this->travel(5)->seconds()` (Laravel's time travel) to create\n  a clear gap between \"before\" and \"after\" timestamps. Never rely on `now()` being different\n  between two lines of code — on fast hardware, they can be identical.\n- **Database-dependent tests:** Don't assume column values are `null` just because the seeder\n  doesn't set them — previous tests in parallel may have modified the same record.\n- **Parallel testing:** The project may use parallel testing (8+ processes). Avoid relying on\n  global state, specific row counts, or auto-increment IDs.\n\n## HTTP and API tests\n\n- Test:\n    - status codes\n    - response structure\n    - validation errors\n    - authorization behavior\n    - persistence side effects\n- For JSON APIs, assert:\n    - exact relevant fields\n    - error structure when applicable\n    - database state after the request\n- Do not only assert `200` — verify meaningful behavior.\n\n## Validation tests\n\n- Validate important request rules explicitly.\n- Cover required fields, invalid formats, boundary values, and business-critical constraints.\n- Prefer focused validation tests over giant \"all fields invalid\" tests unless the project already uses that pattern.\n\n## Authorization tests\n\n- Always test protected actions for:\n    - guest users\n    - unauthorized users\n    - authorized users\n- Match the project's auth setup and policy usage.\n- Do not assume authorization works just because a policy exists.\n\n## Database assertions\n\n- Assert persistence effects with:\n    - `assertDatabaseHas`\n    - `assertDatabaseMissing`\n    - relation checks where relevant\n- Keep assertions focused on meaningful fields.\n- Do not assert every column unless necessary.\n\n## Snapshot testing with `coduo\u002Fphp-matcher`\n\nThis project uses [`coduo\u002Fphp-matcher`](https:\u002F\u002Fgithub.com\u002Fcoduo\u002Fphp-matcher) for flexible snapshot assertions.\nPattern files live in `snapshots\u002F` directories next to the test files.\n\n### Pattern variables\n\nUse pattern variables instead of hardcoded values in snapshot files.\nThis makes snapshots resilient to data changes while still enforcing type correctness.\n\n| Pattern | Matches | Example |\n|---|---|---|\n| `@boolean@` | `true` or `false` | `'is_active' => '@boolean@'` |\n| `@integer@` | Any integer | `'id' => '@integer@'` |\n| `@string@` | Any string | `'name' => '@string@'` |\n| `@null@` | `null` | `'deleted_at' => '@null@'` |\n| `@datetime@` | ISO datetime string | `'created_at' => '@datetime@'` |\n| `@uuid@` | UUID string | `'uuid' => '@uuid@'` |\n| `@array@` | Any array | `'items' => '@array@'` |\n| `@double@` | Any float | `'amount' => '@double@'` |\n| `@wildcard@` | Anything | `'data' => '@wildcard@'` |\n\nCombine with `||` for nullable fields: `'deleted_at' => '@null@||@datetime@'`\n\n### Rules\n\n- **Never hardcode dynamic values** (IDs, timestamps, UUIDs) in snapshots — use pattern variables or `$replacements`.\n- **Never hardcode boolean defaults** (e.g., `false`) when other booleans in the same file use `@boolean@` — be consistent.\n- Use `$variable ?? '@pattern@'` syntax to allow test-specific overrides via `replacements` parameter.\n- Use `PhpMatcherHelper::ruleBackedEnum(EnumClass::class, 'string')` for enum fields.\n\n### Example snapshot file\n\n```php\n\u002F\u002F snapshots\u002Fuser-resource.php\nreturn [\n    'id' => $id ?? '@integer@',\n    'name' => $name ?? '@string@',\n    'email' => $email ?? '@string@',\n    'is_active' => $is_active ?? '@boolean@',\n    'created_at' => $created_at ?? '@datetime@',\n    'deleted_at' => $deleted_at ?? '@null@||@datetime@',\n];\n```\n\n### Example test usage\n\n```php\nexpect($response->json())\n    ->toMatchPhpPatternFile(\n        patternFile: __DIR__ . '\u002Fsnapshots\u002Fuser-resource.php',\n        replacements: ['id' => $user->getId()],\n    );\n```\n\n## Fakes, mocks, and external boundaries\n\n- Use Laravel fakes for framework integrations when appropriate:\n    - `Queue::fake()`\n    - `Bus::fake()`\n    - `Event::fake()`\n    - `Mail::fake()`\n    - `Notification::fake()`\n    - `Storage::fake()`\n- Mock only true external boundaries or expensive dependencies.\n- Avoid mocking internal application code unless isolation is necessary for the specific test.\n\n## Factories and fixtures\n\n- Prefer factories with explicit state over large inline setup.\n- Use named states for meaningful scenarios.\n- Keep test data realistic and minimal.\n- Do not create unnecessary records.\n\n## Test quality analysis\n\nWhen reviewing or auditing existing tests, check for these anti-patterns:\n\n### Test smells to detect\n\n| Smell | Description | Fix |\n|---|---|---|\n| **Overmocking** | Too many mocks disconnect the test from reality | Replace mocks with real implementations or fakes |\n| **Fragile tests** | Tests break with unrelated changes (e.g., asserting exact JSON structure) | Assert only meaningful fields |\n| **Flaky tests** | Non-deterministic results (time, ordering, parallel state) | Use time travel, explicit ordering, isolated data |\n| **Giant tests** | One test covers 5+ behaviors | Split into focused tests |\n| **Missing assertions** | Test runs code but doesn't verify outcomes | Add meaningful assertions |\n| **Test duplication** | Same scenario tested in multiple places | Consolidate or use datasets |\n| **Assertion roulette** | Many assertions without clear failure messages | Use named assertions or split tests |\n| **Eager test** | Tests too many things, making failures hard to diagnose | One behavior per test |\n\n### FIRST principles\n\n- **Fast** — Tests should run quickly. Avoid unnecessary DB operations.\n- **Isolated** — Tests should not depend on each other or shared state.\n- **Repeatable** — Same result every time, regardless of environment or order.\n- **Self-validating** — Pass or fail, no manual inspection needed.\n- **Timely** — Written close to the code they test.\n\n### Mock usage guidelines\n\n- Mock **external boundaries** (APIs, file systems, third-party services).\n- Use Laravel fakes (`Queue::fake()`, `Http::fake()`) over manual mocks.\n- Do NOT mock the class under test.\n- Do NOT mock value objects or DTOs.\n- If a test needs 3+ mocks, consider testing at a higher level (Feature test).\n\n## What NOT to do\n\n- Do not test private methods directly.\n- Do not over-mock Laravel internals.\n- Do not assert implementation details when behavior assertions are enough.\n- Do not write brittle tests tied to formatting or irrelevant response noise.\n- Do not create giant tests that cover many behaviors at once.\n- Do not skip authorization or validation coverage for important endpoints.\n\n## Output expectations\n\nWhen generating Pest tests:\n\n- follow the existing folder and naming conventions\n- test behavior clearly and directly\n- cover success, failure, and authorization paths\n- use factories and Laravel test helpers\n- assert both response and side effects where relevant\n- keep tests readable, isolated, and maintainable\n\n### Filter Pest output\n\nWhen triaging a verbose run, narrow the output with `--filter` (Pest)\nplus targeted `grep`\u002F`rg` instead of re-running the whole suite or\nechoing all logs:\n\n```bash\n# Only run failing tests in one file\nvendor\u002Fbin\u002Fpest tests\u002FFeature\u002FInvoiceTest.php --filter='creates invoice'\n\n# Scan the test log for failures only\nrg --color=never '^FAIL|Tests:' storage\u002Flogs\u002Fpest.log\n\n# Inspect JSON output from data-driven tests\nvendor\u002Fbin\u002Fpest --log-junit=pest.xml && rg '\u003Cfailure' pest.xml\n```\n\n\n## Output format\n\n1. Pest test file with descriptive test names and clear assertions\n2. Tests organized by happy path, validation, edge cases\n\n## Gotcha\n\n- Don't use `readonly` or `final` on Pest test helper classes — it breaks mocking.\n- Don't add `use` statements for global classes (`Exception`, `DateTimeImmutable`) in Pest files — they're auto-imported.\n- The model forgets `$this->travel(5)->seconds()` for time-dependent tests — never rely on `now()` differing between lines.\n- Parallel tests share the database — don't assume column values are null unless you explicitly set them.\n\n## Do NOT\n\n- Do NOT mark classes final if they need to be mocked via Mockery.\n- Do NOT use PHPUnit class-based syntax — use Pest syntax.\n\n## What to test (generation checklist)\n\nWhen generating new tests, focus on:\n- **Business logic**: calculations, status transitions, validation rules, data transformations\n- **Edge cases**: null, empty string, zero, negative numbers, boundary values, max length\n- **Error paths**: invalid input, missing dependencies, exception handling\n- **Different code branches**: if\u002Felse, early returns, fallback behavior\n\nWhat NOT to test:\n- Trivial getters\u002Fsetters without logic\n- Parameter counts, method existence, class names\n- Framework internals (Eloquent, routing)\n- Private methods directly — test through public API\n\n**Quality over quantity** — 5 meaningful tests beat 20 trivial ones.\n\n## Auto-trigger keywords\n\n- Pest test\n- PHPUnit\n- test writing\n- test quality\n- TDD\n- generate tests\n- write tests\n- test coverage\n- test scenarios\n",{"name":5,"packs":44,"trust":45,"domain":35,"install":46,"triggers":48,"model_tier":53,"workspaces":54,"description":7},[36],{"level":25},{"default":40,"removable":47},true,[49,51],{"phrase":50},"pest test",{"phrase":52},"pest suite","medium",[37],"main","12bd765ce1d800501d45dfb8232102793af01290","src\u002Fskills\u002Fpest-testing",1,"https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config","https:\u002F\u002Fevent4u.app","https:\u002F\u002Fgithub.com\u002Fevent4u-app","Your events in your hand","2026-11-14 02:29:41",{"source":8,"skillName":5,"commands":65,"prompt":75,"zipAvailable":47},[66,69,72],{"tool":67,"command":68},"npx","npx skills add event4u-app\u002Fagent-config --skill pest-testing",{"tool":70,"command":71},"bunx","bunx skills add event4u-app\u002Fagent-config --skill pest-testing",{"tool":73,"command":74},"pnpm","pnpm dlx skills add event4u-app\u002Fagent-config --skill pest-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Fpest-testing\u002FSKILL.md",[],[78,91,103,114,125,134],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":39},"01M6X84PK96XBPENXH66JCTSD1","unknown-key-fixture","Declares a key the schema does not know.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Fscripts\u002Ffixtures\u002Fbody-portable\u002Funknown-key\u002FSKILL.md",[],[85,86,87,88,89,90],"unknown key fixture","Unknown key","fixture","unknown","schema","package",{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":39},"01M6X84HW7NAHZ7GZMQ9RXK1XJ","portable-fixture","Declares only semantics the MCP-lite carrier transports whole.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Fscripts\u002Ffixtures\u002Fbody-portable\u002Fportable\u002FSKILL.md",[],[87,98,99,100,101,90,102],"portable","portable fixture","engineer","only","MCP",{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":39},"01M6X84F29FE0RGGZ1ZTFGZTX2","non-portable-fixture","Declares a runtime semantic the carrier drops.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Fscripts\u002Ffixtures\u002Fbody-portable\u002Fnon-portable\u002FSKILL.md",[],[99,110,98,87,111,112,113,90],"non portable fixture","semantic","high","runtime",{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":39},"01M6X848F706PT9MDCX75JKJ6B","candidate-zero-width","A candidate whose prose carries an invisible joiner.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskill-scout-candidates\u002Fzero-width-injection\u002FSKILL.md",[],[121,122,123,124],"candidate zero width","candidate","ZeRO","prose",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":39},"01M6X841SSC2T31VDF41SA6DG1","candidate-disclosure-suppression","A candidate whose prose tells the agent to withhold from the user.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskill-scout-candidates\u002Fdisclosure-suppression\u002FSKILL.md",[],[132,122,124,133],"candidate disclosure suppression","user",{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":140,"publishedAt":39},"01M6X83TFS5AGPBPVTQNWP0BB3","candidate-dangerous-frontmatter","A candidate claiming an unscoped tool grant and a permission bypass.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskill-scout-candidates\u002Fdangerous-frontmatter\u002FSKILL.md",[],[141,122,142,143,144,145],"candidate dangerous frontmatter","frontmatter","shell","permission","tool"]