Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

kickoff-pest-testing

БесплатноБез исполняемых скриптовНе проверен

Comprehensive Pest PHP testing skill for Laravel projects on the Kickoff baseline — auto-detects models, controllers, services, and Livewire components then…

nasrulhazimот nasrulhazim★ 26 звёзд на GitHub

Об этом скилле

Pest Testing Skill (Kickoff baseline)

Auto-detect Laravel application components and scaffold production-quality Pest test files — feature tests, unit tests, Livewire component tests, API tests, and architecture rules. Designed for projects using the Kickoff baseline where Pest and arch testing are pre-configured.

Naming: this skill is kickoff-pest-testing, not pest-testing, because Laravel Boost's boost:install --skills writes its own pest-testing skill into .claude/skills/ and would silently overwrite this one. Boost's covers Pest 4 syntax generically; this one covers scaffolding, the Kickoff arch-test baseline and suite performance. They are complementary — load both.

Command Reference

Command Description
/test generate Auto-detect target (model/controller/service/component) and scaffold matching Pest tests
/test feature Generate feature tests with HTTP assertions, authentication, and database checks
/test unit Generate unit tests for isolated logic (services, actions, value objects)
/test coverage-check Analyse existing tests and report coverage gaps with suggested test stubs

1. /test generate — Auto-Detect & Scaffold

Step 1: Identify the Target

Scan the file or class the user references and classify it:

Signal Classification Test Location
extends Model Eloquent Model tests/Feature/Models/
extends Controller or route handler Controller tests/Feature/Http/Controllers/
Class in app/Services/ Service tests/Unit/Services/
Class in app/Actions/ Action tests/Unit/Actions/
extends Component (Livewire) Livewire Component tests/Feature/Livewire/
Route with api prefix or api.php API Endpoint tests/Feature/Api/
Class in app/Policies/ Policy tests/Feature/Policies/
Blade view only View tests/Feature/Views/
extends Mailable Mail tests/Feature/Mail/
extends Notification Notification tests/Feature/Notifications/
extends Job or implements ShouldQueue Job tests/Feature/Jobs/

Step 2: Read Related Source Files

Before generating tests, read:

  1. The target class itself
  2. Its factory (if model — check database/factories/)
  3. Related form requests (if controller — check app/Http/Requests/)
  4. Related policies (if controller — check app/Policies/)
  5. Route definitions (if controller — check routes/web.php or routes/api.php)
  6. Related Livewire component (if view references wire: directives)

Step 3: Generate Test File

Use the patterns from references/pest-patterns.md. Every generated test file must:

  • Use declare(strict_types=1); at the top
  • Import all classes explicitly (no inline class strings)
  • Use it() syntax, not test() — BDD style
  • Group related tests with describe() blocks
  • Include beforeEach() for shared setup
  • Use factories with states, not manual attribute arrays
  • Assert both happy path and error/validation cases

Step 4: Generate Missing Factories

If the model lacks a factory, generate one at database/factories/{Model}Factory.php with sensible defaults using Faker.


2. /test feature — Feature Tests

Authentication Patterns

use App\Models\User;

beforeEach(function () {
    $this->user = User::factory()->create();
});

it('requires authentication', function () {
    $this->get(route('dashboard'))
        ->assertRedirect(route('login'));
});

it('allows authenticated users to access the dashboard', function () {
    $this->actingAs($this->user)
        ->get(route('dashboard'))
        ->assertOk();
});

Database Assertions

it('creates a new project', function () {
    $this->actingAs($this->user)
        ->post(route('projects.store'), [
            'name' => 'New Project',
            'description' => 'A test project',
        ])
        ->assertRedirect(route('projects.index'));

    $this->assertDatabaseHas('projects', [
        'name' => 'New Project',
        'user_id' => $this->user->id,
    ]);
});

it('soft deletes a project', function () {
    $project = Project::factory()->for($this->user)->create();

    $this->actingAs($this->user)
        ->delete(route('projects.destroy', $project))
        ->assertRedirect();

    $this->assertSoftDeleted($project);
});

Spatie Permission Role-Based Tests

use Spatie\Permission\Models\Role;

beforeEach(function () {
    $this->admin = User::factory()->create();
    $this->admin->assignRole('admin');

    $this->member = User::factory()->create();
    $this->member->assignRole('member');
});

it('allows admins to access user management', function () {
    $this->actingAs($this->admin)
        ->get(route('admin.users.index'))
        ->assertOk();
});

it('denies members access to user management', function () {
    $this->actingAs($this->member)
        ->get(route('admin.users.index'))
        ->assertForbidden();
Полный SKILL.md на GitHub

Установить kickoff-pest-testing в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/arch-testing.mdreferences/livewire-testing.mdreferences/pest-patterns.md

FAQ

Что делает скилл kickoff-pest-testing?

Comprehensive Pest PHP testing skill for Laravel projects on the Kickoff baseline — auto-detects models, controllers, services, and Livewire components then scaffolds matching Pest test files with proper assertions, factories, and database testing patterns. Supports feature tests with actingAs(), API endpoint tests, Livewire::test() component testing, Spatie Permission role-based helpers, architecture testing (extending Kickoff baseline), suite performance (seeder placement, Xdebug/pcov, Test Impact Analysis) and coverage gap analysis. Use this skill whenever the user asks to write tests, generate test files, scaffold test suites, check test coverage, speed up a slow suite, or create architecture rules — including: "write tests for this model", "test this controller", "generate feature tests", "add Livewire tests", "scaffold Pest tests", "check test coverage", "the test suite is slow", "set up TIA", "add arch tests", "test this API endpoint", "tulis test untuk model ni", "buat feature test", "tambah test untuk controller", "scaffold test suite", "semak coverage", "buat arch test", "test suite lambat", or "test Livewire component ni". Assumes Pest is already installed with arch testing configured (Kickoff baseline).

Как установить скилл kickoff-pest-testing?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл kickoff-pest-testing запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить kickoff-pest-testing с