Skip to content
affaan-m avatar

Laravel Tdd

Laravel test-first workflow with PHPUnit or Pest covering factories, HTTP tests, and Sanctum authentication.

CCM score
69 of 100
skills.sh installs
12.8K
GitHub stars
312.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers red-green-refactor feature development for Eloquent models, relationships, scopes, controllers, and JSON APIs
  • Includes PHPUnit XML config with Unit and Feature suites, a base TestCase with admin and user helpers, and factories with state methods
  • Provides HTTP assertions for redirects, validation errors, database state, and authorization (403) checks
  • Designed for Laravel projects using Sanctum or Passport authentication and needing mocking of queues, mail, and HTTP

Install

$ npx -y skills add affaan-m/ecc --skill laravel-tdd -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Laravel Testing with TDD

Test-driven development for Laravel applications using PHPUnit, Pest, Laravel factories, and testing helpers.

When to Activate

  • Writing new Laravel applications or features
  • Implementing API endpoints with Sanctum or Passport authentication
  • Testing Eloquent models, relationships, scopes, and accessors
  • Setting up testing infrastructure for Laravel projects
  • Writing feature tests for HTTP controllers and form requests
  • Mocking external services (queues, mail, notifications, HTTP)

TDD Workflow for Laravel

Red-Green-Refactor Cycle

// Step 1: RED — Write a failing test
public function test_a_product_can_be_created(): void
{
    $product = Product::factory()->create(['name' => 'Test Product']);
    $this->assertDatabaseHas('products', ['name' => 'Test Product']);
}

// Step 2: GREEN — Write the migration, model, and factory
// Step 3: REFACTOR — Improve while keeping tests green

Setup

PHPUnit Configuration

Details

Repository
github.com/affaan-m/ecc
Categories
Testing & QA, PHP & Laravel
First seen
Jul 14, 2026

Questions

What does the laravel-tdd skill help with?

The laravel-tdd skill guides test-driven development for Laravel applications using PHPUnit and Pest. It covers model factories, HTTP and JSON API feature tests, Sanctum authentication testing, mocking external services, and coverage.

Which Claude Marketplaces category is laravel-tdd in, and what sets it apart?

laravel-tdd sits in the Testing & QA category and ranks in the top 50 there, alongside skills such as tdd and webapp-testing. Its focus is Laravel specifically, with PHPUnit and Pest test setup, factories, and Sanctum authentication tests.

How do I install the laravel-tdd skill?

Run npx -y skills add affaan-m/ecc --skill laravel-tdd -y in your project. Once installed, the agent can write Laravel tests with PHPUnit or Pest and drive a Laravel feature test-first.

Does laravel-tdd test API endpoints that use Sanctum?

Yes, the skill covers implementing API endpoints with Sanctum or Passport authentication and includes JSON API testing examples. It also shows how to mock queues, mail, notifications, and HTTP calls in Laravel tests.

More from affaan-m/ecc

All 257

Similar to Laravel Tdd

More Testing & QA