laravel-tdd
Skill1 starsChanged 7 months agoMITView on GitHub
Test-driven development for Laravel with PHPUnit and Pest, factories, database testing, fakes, and coverage targets.
13 other projects use a version of this, 3 of them edited.
Adopted by
Most recently taken up by
- renepf/claude-skillstheir own version, first seen Oct 25, 2026
- davidanthonyn/claude-skillsword for word, first seen Oct 20, 2026
- AlperGuven/TRAE-Skillsedited, first seen Oct 13, 2026
- gongyijie85/dsh-ecctheir own version, first seen Oct 13, 2026
- MohamedEssam0-0/claude-skillsword for word, first seen Oct 11, 2026
- Fmarzochi/EGCedited, first seen Sep 16, 2026
Other versions13 projects use a version of this.
Word for word · 7
- loulanyue/awesome-claude-notes★ 272100% same
- PUPT-Quantum-Leap/capstone-nlcom-volunteer-management-system★ 4100% same
- junimnjw/everything-claude-code★ 1100% same
- TironFox/everything-claude-code★ 1100% same
- davidanthonyn/claude-skills★ 0100% same
- MohamedEssam0-0/claude-skills★ 0100% same
- PeterYang888/claude-skills★ 0100% same
Edited · 3
- Fmarzochi/EGC★ 6199% same
- AlperGuven/TRAE-Skills★ 317% same
- ronmkr/PromptBook★ 299% same
Wrote their own version · 3
- gongyijie85/dsh-ecc★ 8same name
- SamuelNDCE/claude-super-skill-library★ 1same name
- renepf/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository269 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .codex/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- examples/CLAUDE.mdCLAUDE.md
- .cursor/rules/common-agents.mdCursor rule
- .cursor/rules/common-coding-style.mdCursor rule
- .cursor/rules/common-development-workflow.mdCursor rule
- .cursor/rules/common-git-workflow.mdCursor rule
- .cursor/rules/common-hooks.mdCursor rule
- .cursor/rules/common-patterns.mdCursor rule
- .cursor/rules/common-performance.mdCursor rule
- .cursor/rules/common-security.mdCursor rule
- .cursor/rules/common-testing.mdCursor rule
- .cursor/rules/golang-coding-style.mdCursor rule
- .cursor/rules/golang-hooks.mdCursor rule
- .cursor/rules/golang-patterns.mdCursor rule
- .cursor/rules/golang-security.mdCursor rule
- .cursor/rules/golang-testing.mdCursor rule
- .cursor/rules/kotlin-coding-style.mdCursor rule
- .cursor/rules/kotlin-hooks.mdCursor rule
- .cursor/rules/kotlin-patterns.mdCursor rule
- .cursor/rules/kotlin-security.mdCursor rule
- .cursor/rules/kotlin-testing.mdCursor rule
- .cursor/rules/php-coding-style.mdCursor rule
- .cursor/rules/php-hooks.mdCursor rule
- .cursor/rules/php-patterns.mdCursor rule
- .cursor/rules/php-security.mdCursor rule
- .cursor/rules/php-testing.mdCursor rule
- .cursor/rules/python-coding-style.mdCursor rule
- .cursor/rules/python-hooks.mdCursor rule
- .cursor/rules/python-patterns.mdCursor rule
- .cursor/rules/python-security.mdCursor rule
- .cursor/rules/python-testing.mdCursor rule
- .cursor/rules/swift-coding-style.mdCursor rule
- .cursor/rules/swift-hooks.mdCursor rule
- .cursor/rules/swift-patterns.mdCursor rule
- .cursor/rules/swift-security.mdCursor rule
- .cursor/rules/swift-testing.mdCursor rule
- .cursor/rules/typescript-coding-style.mdCursor rule
- .cursor/rules/typescript-hooks.mdCursor rule
- .cursor/rules/typescript-patterns.mdCursor rule
- .cursor/rules/typescript-security.mdCursor rule
- .cursor/rules/typescript-testing.mdCursor rule
- agent-introspection-debuggingSkill
- agent-sortSkill
- api-designSkill
- article-writingSkill
- backend-patternsSkill
- brand-voiceSkill
- bun-runtimeSkill
- claude-apiSkill
- coding-standardsSkill
- content-engineSkill
- crosspostSkill
- deep-researchSkill
- dmux-workflowsSkill
- documentation-lookupSkill
- e2e-testingSkill
- eval-harnessSkill
- everything-claude-code-conventionsSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. 0 are common, 10 are distinctive, and 8 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Test-driven development for Laravel applications using PHPUnit and Pest with 80%+ coverage (unit + feature).
- Distinctive: line 16
Prefer Pest for new tests unless the project already standardizes on PHPUnit
- Distinctive: line 22
Write a failing test
- Distinctive: line 34
Use Unit tests for pure business logic and services.
- Distinctive: line 35
Use Feature tests for HTTP, auth, validation, and response shape.
- Very specific: line 36
Use Integration tests when validating DB/queues/external services together.
- Distinctive: line 48
Default to Pest for new tests when available.
- Distinctive: line 49
Use PHPUnit only if the project already standardizes on it or requires PHPUnit-specific tooling.
- Distinctive: line 150
Use factories for test data
- Very specific: line 159
Use RefreshDatabase for clean state
- Distinctive: line 160
Keep tests isolated and deterministic
- Very specific: line 161
Prefer assertDatabaseHas over manual queries
- Very specific: line 225
Use Http::fake() to isolate external APIs
- Very specific: line 231
Use pcov or XDEBUG_MODE=coverage in CI
- Very specific: line 241
Use phpunit.xml to set DB_CONNECTION=sqlite and DB_DATABASE=:memory: for fast tests
- Distinctive: line 242
Keep separate env for tests to avoid touching dev/prod data
- Very specific: line 255
When using Inertia.js, assert on the component name and props with the Inertia testing helpers.
- Very specific: line 283
Prefer assertInertia over raw JSON assertions to keep tests aligned with Inertia responses.
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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
- Write a failing test
- Implement the minimal change to pass
- 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
RefreshDatabasefor 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)DatabaseTransactionswhen the schema is already migrated and you only need per-test rollbackDatabaseMigrationswhen 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
RefreshDatabasefor clean state - Keep tests isolated and deterministic
- Prefer
assertDatabaseHasover 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 jobsQueue::fake()for queued workMail::fake()andNotification::fake()for notificationsEvent::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
pcovorXDEBUG_MODE=coveragein CI
Test Commands
php artisan testvendor/bin/phpunitvendor/bin/pest
Test Configuration
- Use
phpunit.xmlto setDB_CONNECTION=sqliteandDB_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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

