testing-pest
为 Laravel 项目生成全面的 Pest 测试套件,包括控制器、服务、Livewire 组件、命令、作业和模型的测试,并具有适当的组织描述块、模拟设置、快乐路径和故障场景、RefreshDatabase 特征以及所有公共方法的覆盖范围。在为新功能创建测试文件、为控制器或服务添加测试覆盖范围、为 API 端点编写测试、测试 Livewire 组件、确保使用 beforeEach 和描述块正确的测试结构、实施模拟策略或编写数据集驱动的测试时,请使用此技能。此技能适用于处理测试/功能/或测试/单元/目录中的文件、创建 Pest 测试文件或确保全面的测试覆盖率。
📖 中文导读:为 Laravel 项目生成全面的 Pest 测试套件,包括控制器、服务、Livewire 组件、命令、作业和模型的测试,并具有适当的组织描述块、模拟设置、快乐路径和故障场景、RefreshDatabase 特征以及所有公共方法的覆盖范围。在为新功能创建测试文件、为控制器或服务添加测试覆盖范围、为 API 端点编写测试、测试 Livewire 组件、确保使用 beforeEach 和描述块正确的测试结构、实施模拟策略或编写数据集驱动的测试时,请使用此技能。此技能适用于处理测试/功能/或测试/单元/目录中的文件、创建 Pest 测试文件或确保全面的测试覆盖率。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: Testing Pest description: Generate comprehensive Pest test suites for Laravel projects including tests for controllers, services, Livewire components, commands, jobs, and models with proper describe blocks for organization, mocking setup, happy path and failure scenarios, RefreshDatabase trait, and coverage for all public methods. Use this skill when creating test files for new features, adding test coverage for controllers or services, writing tests for API endpoints, testing Livewire components, ensuring proper test structure with beforeEach and describe blocks, implementing mocking strategies, or writing dataset-driven tests. This skill applies when working on files in tests/Feature/ or tests/Unit/ directories, creating Pest test files, or ensuring comprehensive test coverage.
Testing Pest
When to use this skill
- When creating test files for new Laravel features or classes
- When adding test coverage for controllers, services, or API endpoints
- When writing tests for Livewire components with user interactions
- When testing Artisan commands or queued jobs
- When ensuring proper test structure with describe blocks and beforeEach hooks
- When implementing mocking strategies for external dependencies
- When writing dataset-driven tests for multiple scenarios
- When testing model relationships and database interactions
- When working on files in tests/Feature/ directory (integration tests)
- When working on files in tests/Unit/ directory (isolated unit tests)
- When creating comprehensive test coverage including happy paths and failures
- When using RefreshDatabase trait for database tests
- When mocking HTTP requests with Saloon MockClient
This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle testing pest.
Instructions
For details, refer to the information provided in this file: testing pest