laravel-tdd
Skill48 starsChanged 9 months agoMITView on GitHub
Test-Driven Development specifically for Laravel applications using Pest PHP. Use when implementing any Laravel feature or bugfix - write the test first, watch it fail, write minimal code to pass.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- AlperGuven/TRAE-Skillstheir own version, first seen Oct 5, 2026
- templetongroup/radianttheir own version, first seen Sep 17, 2026
- SamuelNDCE/claude-super-skill-librarytheir own version, first seen Aug 1, 2026
- PUPT-Quantum-Leap/capstone-nlcom-volunteer-management-systemtheir own version, first seen May 25, 2026
- Jamkris/everything-gemini-codetheir own version, first seen Apr 27, 2026
- loulanyue/awesome-claude-notestheir own version, first seen Mar 24, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- loulanyue/awesome-claude-notes★ 272same name
- tpavanipradeep/everything-claude-code★ 134same name
- templetongroup/radiant★ 113same name
- Jamkris/everything-gemini-code★ 87same name
- PUPT-Quantum-Leap/capstone-nlcom-volunteer-management-system★ 4same name
- AlperGuven/TRAE-Skills★ 3same name
- SamuelNDCE/claude-super-skill-library★ 1same name
- mryeastcode/ClaudeCode★ 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 repository16 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .cursor/rules/conventional-commits.mdcCursor rule
- eloquent-best-practicesSkill
- laravel-api-resource-patternsSkill
- laravel-authorization-patternsSkill
- laravel-blade-component-patternsSkill
- laravel-brainstormingSkill
- laravel-caching-strategiesSkill
- laravel-event-driven-architectureSkill
- laravel-feature-flagsSkill
- laravel-middleware-patternsSkill
- laravel-notification-patternsSkill
- laravel-queue-patternsSkill
- laravel-systematic-debuggingSkill
- laravel-task-schedulingSkill
- laravel-validation-patternsSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 6 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Write the test first. Watch it fail.
- Distinctive: line 40
Write one minimal test showing what the Laravel feature should do.
- Distinctive: line 72
Write simplest Laravel code to pass the test.
- Distinctive: line 84
Create policies for authorization
- Distinctive: line 85
Add query scopes for reusability
- Distinctive: line 86
Use events for side effects
“Common” is measured: kept by at least 6 in 10 of the 8 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
Test-Driven Development for Laravel
Overview
Write the test first. Watch it fail. Write minimal code to pass.
This skill adapts TDD principles specifically for Laravel applications using Pest PHP, Laravel's testing features, and framework-specific patterns.
When to Use
Always for Laravel:
- New features (controllers, models, services)
- Bug fixes
- API endpoints
- Database migrations and models
- Form validation
- Authorization policies
- Queue jobs
- Artisan commands
- Middleware
Exceptions (ask your human partner):
- Throwaway prototypes
- Configuration files
- View-only changes (no logic)
The Laravel TDD Cycle
RED → Verify RED → GREEN → Verify GREEN → REFACTOR → RepeatRED - Write Failing Test
Write one minimal test showing what the Laravel feature should do.
Feature Test Example:
<?php
use App\Models\User;
use App\Models\Post;
test('authenticated user can create post', function () {
$user = User::factory()->create();
$this->actingAs($user)
->post('/posts', [
'title' => 'My First Post',
'content' => 'Post content here',
])
->assertRedirect('/posts');
expect(Post::where('title', 'My First Post')->exists())->toBeTrue();
expect(Post::first()->user_id)->toBe($user->id);
});Verify RED - Watch It Fail
php artisan test --filter=authenticated_user_can_create_postGREEN - Minimal Laravel Code
Write simplest Laravel code to pass the test.
Verify GREEN - Watch It Pass
php artisan testREFACTOR - Clean Up Laravel Code
After green only:
- Extract services for complex logic
- Create policies for authorization
- Add query scopes for reusability
- Use events for side effects
Laravel-Specific Test Patterns
Database Testing
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
test('creates post in database', function () {
$user = User::factory()->create();
$this->actingAs($user)
->post('/posts', ['title' => 'Test', 'content' => 'Content']);
$this->assertDatabaseHas('posts', ['title' => 'Test']);
});Authorization Testing
test('user cannot delete others posts', function () {
$user = User::factory()->create();
$post = Post::factory()->create();
$this->actingAs($user)
->delete("/posts/{$post->id}")
->assertForbidden();
});API Testing
test('creates post via API', function () {
$user = User::factory()->create();
$this->actingAs($user, 'sanctum')
->postJson('/api/posts', ['title' => 'API Post', 'content' => 'Content'])
->assertCreated();
});Verification Checklist
- Migration test passes
- Model relationships tested
- Controller actions tested
- Validation rules tested
- Authorization tested
- Database state verified
- All tests passing
- Used RefreshDatabase
- Used factories
Remember
Every Laravel feature → Test exists and failed first
Otherwise → Not TDDDoes 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.

