Source profileQuality 94/100

Fmarzochi/EGC/skills/testing/laravel-tdd/SKILL.md

laravel-tdd

Test-driven development for Laravel with PHPUnit and Pest, factories, database testing, fakes, and coverage targets.

Source repository stars
45
Declared platforms
0
Static risk flags
0
Last source update
2026-08-19
Source checked
2026-08-25

Decision brief

What it does: where it fits

Test-driven development for Laravel applications using PHPUnit and Pest with 80%+ coverage (unit + feature).

Best for

  • New features or endpoints in Laravel
  • Bug fixes or refactors
  • Testing Eloquent models, policies, jobs, and notifications

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/Fmarzochi/EGC --skill "skills/testing/laravel-tdd"
Safe inspection promptEditorial

Inspect the Agent Skill "laravel-tdd" from https://github.com/Fmarzochi/EGC/blob/cf16e7b72256ae4edf06f82f4500c715586c6af1/skills/testing/laravel-tdd/SKILL.md at commit cf16e7b72256ae4edf06f82f4500c715586c6af1. 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

What the source asks the agent to do

  1. 01

    When to Use

    New features or endpoints in Laravel

    New features or endpoints in LaravelBug fixes or refactorsTesting Eloquent models, policies, jobs, and notifications
  2. 02

    How It Works

    1) Write a failing test 2) Implement the minimal change to pass 3) Refactor while keeping tests green

    Write a failing testImplement the minimal change to passRefactor while keeping tests green
  3. 03

    Red-Green-Refactor Cycle

    1) Write a failing test 2) Implement the minimal change to pass 3) Refactor while keeping tests green

    Write a failing testImplement the minimal change to passRefactor while keeping tests green
  4. 04

    Test Layers

    Choose layers based on scope:

    Unit: pure PHP classes, value objects, servicesFeature: HTTP endpoints, auth, validation, policiesIntegration: database + queue + external boundaries
  5. 05

    Database Strategy

    Use RefreshDatabase as the default for tests that touch the database: for databases with transaction support, it runs migrations once per test run (via a static flag) and wraps each test in a transaction; for :memory: SQLite or connections without transactions, it migrates befor…

    RefreshDatabase for most feature/integration tests (runs migrations once per test run, then wraps each test in a transaction when supported; in-memory databases may re-migrate per test)DatabaseTransactions when the schema is already migrated and you only need per-test rollbackDatabaseMigrations when you need a full migrate/fresh for every test and can afford the cost

Permission review

Static risk signals and limitations

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

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score94/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars45SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
Fmarzochi/EGC
Skill path
skills/testing/laravel-tdd/SKILL.md
Commit
cf16e7b72256ae4edf06f82f4500c715586c6af1
License
Apache-2.0
Collected
2026-08-25
Default branch
main
View the original SKILL.md

Laravel TDD Workflow

Test-driven development for Laravel applications using PHPUnit and Pest with 80%+ coverage (unit + feature).

When to Use

  • New features or endpoints in Laravel
  • Bug fixes or refactors
  • Testing Eloquent models, policies, jobs, and notifications
  • Prefer Pest for new tests unless the project already standardizes on PHPUnit

How It Works

Red-Green-Refactor Cycle

  1. Write a failing test
  2. Implement the minimal change to pass
  3. Refactor while keeping tests green

Test Layers

  • Unit: pure PHP classes, value objects, services
  • Feature: HTTP endpoints, auth, validation, policies
  • Integration: database + queue + external boundaries

Choose layers based on scope:

  • Use Unit tests for pure business logic and services.
  • Use Feature tests for HTTP, auth, validation, and response shape.
  • Use Integration tests when validating DB/queues/external services together.

Database Strategy

  • RefreshDatabase for most feature/integration tests (runs migrations once per test run, then wraps each test in a transaction when supported; in-memory databases may re-migrate per test)
  • DatabaseTransactions when the schema is already migrated and you only need per-test rollback
  • DatabaseMigrations when you need a full migrate/fresh for every test and can afford the cost

Use RefreshDatabase as the default for tests that touch the database: for databases with transaction support, it runs migrations once per test run (via a static flag) and wraps each test in a transaction; for :memory: SQLite or connections without transactions, it migrates before each test. Use DatabaseTransactions when the schema is already migrated and you only need per-test rollbacks.

Testing Framework Choice

  • Default to Pest for new tests when available.
  • Use PHPUnit only if the project already standardizes on it or requires PHPUnit-specific tooling.

Examples

PHPUnit Example

use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

final class ProjectControllerTest extends TestCase
{
    use RefreshDatabase;

    public function test_owner_can_create_project(): void
    {
        $user = User::factory()->create();

        $response = $this->actingAs($user)->postJson('/api/projects', [
            'name' => 'New Project',
        ]);

        $response->assertCreated();
        $this->assertDatabaseHas('projects', ['name' => 'New Project']);
    }
}

Feature Test Example (HTTP Layer)

use App\Models\Project;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

final class ProjectIndexTest extends TestCase
{
    use RefreshDatabase;

    public function test_projects_index_returns_paginated_results(): void
    {
        $user = User::factory()->create();
        Project::factory()->count(3)->for($user)->create();

        $response = $this->actingAs($user)->getJson('/api/projects');

        $response->assertOk();
        $response->assertJsonStructure(['success', 'data', 'error', 'meta']);
    }
}

Pest Example

use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;

use function Pest\Laravel\actingAs;
use function Pest\Laravel\assertDatabaseHas;

uses(RefreshDatabase::class);

test('owner can create project', function () {
    $user = User::factory()->create();

    $response = actingAs($user)->postJson('/api/projects', [
        'name' => 'New Project',
    ]);

    $response->assertCreated();
    assertDatabaseHas('projects', ['name' => 'New Project']);
});

Feature Test Pest Example (HTTP Layer)

use App\Models\Project;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;

use function Pest\Laravel\actingAs;

uses(RefreshDatabase::class);

test('projects index returns paginated results', function () {
    $user = User::factory()->create();
    Project::factory()->count(3)->for($user)->create();

    $response = actingAs($user)->getJson('/api/projects');

    $response->assertOk();
    $response->assertJsonStructure(['success', 'data', 'error', 'meta']);
});

Factories and States

  • Use factories for test data
  • Define states for edge cases (archived, admin, trial)
$user = User::factory()->state(['role' => 'admin'])->create();

Database Testing

  • Use RefreshDatabase for clean state
  • Keep tests isolated and deterministic
  • Prefer assertDatabaseHas over manual queries

Persistence Test Example

use App\Models\Project;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

final class ProjectRepositoryTest extends TestCase
{
    use RefreshDatabase;

    public function test_project_can_be_retrieved_by_slug(): void
    {
        $project = Project::factory()->create(['slug' => 'alpha']);

        $found = Project::query()->where('slug', 'alpha')->firstOrFail();

        $this->assertSame($project->id, $found->id);
    }
}

Fakes for Side Effects

  • Bus::fake() for jobs
  • Queue::fake() for queued work
  • Mail::fake() and Notification::fake() for notifications
  • Event::fake() for domain events
use Illuminate\Support\Facades\Queue;

Queue::fake();

dispatch(new SendOrderConfirmation($order->id));

Queue::assertPushed(SendOrderConfirmation::class);
use Illuminate\Support\Facades\Notification;

Notification::fake();

$user->notify(new InvoiceReady($invoice));

Notification::assertSentTo($user, InvoiceReady::class);

Auth Testing (Sanctum)

use Laravel\Sanctum\Sanctum;

Sanctum::actingAs($user);

$response = $this->getJson('/api/projects');
$response->assertOk();

HTTP and External Services

  • Use Http::fake() to isolate external APIs
  • Assert outbound payloads with Http::assertSent()

Coverage Targets

  • Enforce 80%+ coverage for unit + feature tests
  • Use pcov or XDEBUG_MODE=coverage in CI

Test Commands

  • php artisan test
  • vendor/bin/phpunit
  • vendor/bin/pest

Test Configuration

  • Use phpunit.xml to set DB_CONNECTION=sqlite and DB_DATABASE=:memory: for fast tests
  • Keep separate env for tests to avoid touching dev/prod data

Authorization Tests

use Illuminate\Support\Facades\Gate;

$this->assertTrue(Gate::forUser($user)->allows('update', $project));
$this->assertFalse(Gate::forUser($otherUser)->allows('update', $project));

Inertia Feature Tests

When using Inertia.js, assert on the component name and props with the Inertia testing helpers.

use App\Models\User;
use Inertia\Testing\AssertableInertia;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

final class DashboardInertiaTest extends TestCase
{
    use RefreshDatabase;

    public function test_dashboard_inertia_props(): void
    {
        $user = User::factory()->create();

        $response = $this->actingAs($user)->get('/dashboard');

        $response->assertOk();
        $response->assertInertia(fn (AssertableInertia $page) => $page
            ->component('Dashboard')
            ->where('user.id', $user->id)
            ->has('projects')
        );
    }
}

Prefer assertInertia over raw JSON assertions to keep tests aligned with Inertia responses.

Frequently asked questions

What to verify before installation and use

What does the laravel-tdd source document cover?

Test-driven development for Laravel applications using PHPUnit and Pest with 80%+ coverage (unit + feature).

How do I install laravel-tdd?

The source record exposes this install command: npx skills add https://github.com/Fmarzochi/EGC --skill "skills/testing/laravel-tdd". Inspect the command and pinned source before running it.

Alternatives

Compare before choosing

Computed 10029,034

garrytan/gbrain

bulk-ingestion

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.

Computed 10024,921

alirezarezvani/claude-skills

app-store-optimization

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

Computed 1005,241

dotnet/skills

migrate-vstest-to-mtp

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

Computed 991,257

vipshop/cache-dit

cache-dit-model-integration

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.