Agent skill

Laravel TDD

by affaan-m in affaan-m/ECC

Laravel での TDD:PHPUnit と Pest、ファクトリー、データベーステスト、フェイク、カバレッジターゲット

MITAuto-check passedBackend & APIs

Install Laravel TDD

skills CLI
$ npx skills add affaan-m/ECC --skill laravel-tdd -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install affaan-m/ECC laravel-tdd --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/docs/ja-JP/skills/laravel-tdd .claude/skills/laravel-tdd && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
laravel-tdd
GitHub stars
276k
Token cost
~1.6k tokens
SKILL.md length
161 words
Files
1
Skills in repo
683
Repo updated
First seen
Licence
MIT

At a glance

Laravel での TDD:PHPUnit と Pest、ファクトリー、データベーステスト、フェイク、カバレッジターゲット

  • Works in 3 steps: テスト失敗を書く → 最小限の変更を実装して合格させる → テストを緑に保ちながらリファクタリング
  • Tasks that involve Backend development
  • SKILL.md covers 使用時機, 仕組み and 例
  • Calls php

What it does

Laravel TDD is an agent skill from affaan-m/ECC. Laravel での TDD:PHPUnit と Pest、ファクトリー、データベーステスト、フェイク、カバレッジターゲット

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Backend development and Test-driven development. It works with Laravel. The repository describes itself as: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. The licence is MIT.

When your agent uses it

  • Tasks that involve Backend development
  • Tasks that involve Test-driven development

Example prompts

  • “/laravel-tdd”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. テスト失敗を書く
  2. 最小限の変更を実装して合格させる
  3. テストを緑に保ちながらリファクタリング

What it can do on your machine

Read from SKILL.md and the folder at commit 4eb71d9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • php

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Laravel TDD loads about 1.6k tokens when it runs. Until then it costs about 19 tokens; SKILL.md has 161 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~19
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from affaan-m/ECC at commit 4eb71d9, republished under its MIT licence (© affaan-m). 161 words, ~1,569 tokens.

Download SKILL.mdSave it as .claude/skills/laravel-tdd/SKILL.md (or your agent's skills folder).
name
laravel-tdd
description
Laravel での TDD:PHPUnit と Pest、ファクトリー、データベーステスト、フェイク、カバレッジターゲット
origin
ECC

Laravel TDD ワークフロー

PHPUnit と Pest を使用した Laravel アプリケーション用のテスト駆動開発。80%+ カバレッジ(ユニット + フィーチャー)。

使用時機

  • Laravel の新機能またはエンドポイント
  • バグ修正またはリファクタリング
  • Eloquent モデル、ポリシー、ジョブ、通知のテスト
  • プロジェクトが PHPUnit を標準化していない限り、新しいテストには Pest を優先

仕組み

RED-GREEN-REFACTOR サイクル
  1. テスト失敗を書く
  2. 最小限の変更を実装して合格させる
  3. テストを緑に保ちながらリファクタリング
テスト層
  • ユニット:純粋な PHP クラス、値オブジェクト、サービス
  • フィーチャー:HTTP エンドポイント、認証、バリデーション、ポリシー
  • 統合:データベース + キュー + 外部バウンダリー

スコープに基づいて層を選択:

  • ユニットテストを純粋なビジネスロジックとサービスに使用。
  • フィーチャーテストを HTTP、認証、バリデーション、レスポンス形状に使用。
  • 統合テストを DB/キュー/外部サービスを一緒に検証するときに使用。
データベース戦略
  • RefreshDatabase ほとんどのフィーチャー/統合テスト用(テスト実行ごとにマイグレーションを 1 回実行し、次に各テストをトランザクション内でラップ;メモリ内データベースは各テストごとに再マイグレーションする可能性がある)
  • DatabaseTransactions スキーマがすでにマイグレーションされており、テストごとのロールバックのみが必要なとき
  • DatabaseMigrations すべてのテストで完全な migrate/fresh が必要なとき、またはコストを負担できるとき

RefreshDatabase をデータベースに触れるテストのデフォルトとして使用:トランザクション サポート付きデータベースの場合、マイグレーション ステップ フラグを使用して テスト実行ごとに 1 回実行し、次に各テストをトランザクション内でラップします;:memory: SQLite または非トランザクションの接続では、各テストの前にマイグレーションします。スキーマがすでにマイグレーションされており、テストごとのロールバックのみが必要なときは DatabaseTransactions を使用します。

テストフレームワーク選択
  • 新しいテストの場合は Pest をデフォルトで使用。
  • PHPUnit はプロジェクトがすでにそれを標準化している、またはPHPUnit 固有のツールが必要なときのみ使用。

例

PHPUnit 例
php
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']);
    }
}
フィーチャーテスト例(HTTP レイヤー)
php
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 例
php
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']);
});
フィーチャーテスト Pest 例(HTTP レイヤー)
php
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']);
});
ファクトリーと状態
  • テストデータにはファクトリーを使用
  • エッジケース(アーカイブ済み、管理者、トライアル)の状態を定義
php
$user = User::factory()->state(['role' => 'admin'])->create();
データベーステスト
  • クリーンな状態には RefreshDatabase を使用
  • テストを隔離して決定論的に保つ
  • 手動クエリより assertDatabaseHas を優先
永続性テスト例
php
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);
    }
}
副作用のためのフェイク
  • Bus::fake() ジョブ用
  • Queue::fake() キュー作業用
  • Mail::fake() と Notification::fake() 通知用
  • Event::fake() ドメインイベント用
php
use Illuminate\Support\Facades\Queue;

Queue::fake();

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

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

Notification::fake();

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

Notification::assertSentTo($user, InvoiceReady::class);
認証テスト(Sanctum)
php
use Laravel\Sanctum\Sanctum;

Sanctum::actingAs($user);

$response = $this->getJson('/api/projects');
$response->assertOk();
HTTP と外部サービス
  • Http::fake() を使用して外部 API を隔離
  • Http::assertSent() で送信ペイロードをアサート
カバレッジターゲット
  • ユニット + フィーチャーテストで 80%+ カバレッジを実施
  • CI では pcov または XDEBUG_MODE=coverage を使用
テストコマンド
  • php artisan test
  • vendor/bin/phpunit
  • vendor/bin/pest
テスト設定
  • phpunit.xml を使用して DB_CONNECTION=sqlite と DB_DATABASE=:memory: を設定して高速テスト
  • テストは dev/prod データに触れないように別の env を保つ
認可テスト
php
use Illuminate\Support\Facades\Gate;

$this->assertTrue(Gate::forUser($user)->allows('update', $project));
$this->assertFalse(Gate::forUser($otherUser)->allows('update', $project));
Inertia フィーチャーテスト

Inertia.js 使用時、Inertia テスティングヘルパーでコンポーネント名とプロップをアサート。

php
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')
        );
    }
}

生の JSON アサーションより assertInertia を優先して、テストを Inertia レスポンスに合わせておく。

© affaan-m, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in docs/ja-JP/skills/laravel-tdd of affaan-m/ECC.

Open the folder on GitHubat commit 4eb71d9

Compare with similar skills

Laravel TDD next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Laravel TDD compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Laravel TDD this skillaffaan-m/ECC276k—~1.6kAutomated safety check: PassMIT
Pest Testingliberusoftware/real-estate-laravel1121 repos~1.8kAutomated safety check: PassMIT
Pest TestingMineTrax/minetrax116—~787Automated safety check: PassMIT
Pest Testingluadotsh/lua3431 repos~1.2kAutomated safety check: PassMIT
Pest Testingmnapoli/vibephp158—~1.4kAutomated safety check: PassMIT
Laraveldaily Testing AuditLaravelDaily/AI-Workflows-For-Laravel136—~4.6kAutomated safety check: NotesNone

Similar skills

  • Pest Testing

    liberusoftware/real-estate-laravel

    A skill your agent uses for Pest PHP testing in Laravel projects only.

    112 GitHub starsUsed in 1 repo~1.8k tokens
    Testing & QAAuto-check passed
  • Pest Testing

    MineTrax/minetrax

    A skill your agent uses for Pest PHP testing in Laravel projects only.

    116 GitHub stars~787 tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Pest Testing

    luadotsh/lua

    A skill your agent uses for Pest PHP testing in Laravel projects only.

    343 GitHub starsUsed in 1 repo~1.2k tokens
    Testing & QAAuto-check passed
  • Pest Testing

    mnapoli/vibephp

    A skill your agent uses for Pest PHP testing in Laravel projects only.

    158 GitHub stars~1.4k tokensUpdated 3 mo ago
    Testing & QAAuto-check passed
  • Laraveldaily Testing Audit

    LaravelDaily/AI-Workflows-For-Laravel

    This skill should be used when the user asks to "audit Laravel tests", "review test coverage", "check testing practices", "find missing tests", "testing review", "improve tests", or wants to analyze…

    136 GitHub stars~4.6k tokensUpdated 5 mo ago
    Backend & APIsAuto-check: notes
  • Rails Concern

    ThibautBaissac/rails_ai_agents

    Creates Rails concerns for shared behavior across models or controllers with TDD.

    665 GitHub stars~1.7k tokensUpdated 4 mo ago
    Backend & APIsAuto-check passed

More from affaan-m/ECC

All 682 skills in this repo
  • Skill Stocktake

    affaan-m/ECC

    Audits your installed Claude skills and commands for quality, with a quick mode for recently changed skills and a full mode that evaluates all of them through subagents.

    277k GitHub starsUsed in 5 repos~3.1k tokens
    Auto-check passed
  • Ingests, indexes, searches, edits and monitors video, audio and live streams through the VideoDB Python SDK, returning stream links, clips and timestamps.

    277k GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check: notes
  • Docs Governance

    affaan-m/ECC

    Route broad documentation-governance requests to existing ECC skills and run an opt-in, read-only audit of mapped documentation roles, links, ADR indexes, and evidence references.

    277k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Rules Distillation

    affaan-m/ECC

    Scans installed skills for principles that recur across them and proposes rule-file changes: append, revise, add a section, create a file or leave as covered.

    277k GitHub starsUsed in 2 repos~2.3k tokens
    Auto-check passed
  • Builds DRAFT counterparty agreements from one markdown template and a small JSON spec per party, with clauses picked by the party's role.

    277k GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • Set an ECC-specific frontend design direction for production UI work.

    277k GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed

Works with

Questions about Laravel TDD

What does Laravel TDD do?

Laravel での TDD:PHPUnit と Pest、ファクトリー、データベーステスト、フェイク、カバレッジターゲット. Laravel TDD is an agent skill from affaan-m/ECC.

When should I use Laravel TDD?

Laravel TDD fits situations like: tasks that involve Backend development; tasks that involve Test-driven development.

How do I install Laravel TDD in Claude Code?

Run `npx skills add affaan-m/ECC --skill laravel-tdd -a claude-code`. Or copy the skill folder (docs/ja-JP/skills/laravel-tdd in affaan-m/ECC) into .claude/skills/laravel-tdd in your project. Claude Code loads it when a task matches its description.

How do I install Laravel TDD in Codex?

Run `npx skills add affaan-m/ECC --skill laravel-tdd -a codex`. Or copy the skill folder (docs/ja-JP/skills/laravel-tdd in affaan-m/ECC) into .agents/skills/laravel-tdd in your project. Codex loads it when a task matches its description.

Can I use Laravel TDD in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add affaan-m/ECC --skill laravel-tdd -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/laravel-tdd, .gemini/skills/laravel-tdd, .github/skills/laravel-tdd and .opencode/skills/laravel-tdd in your project.

What does Laravel TDD need to run?

Going by SKILL.md and its folder, Laravel TDD needs the command-line tools its instructions call (php).

Does Laravel TDD access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Laravel TDD safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Laravel TDD use?

Laravel TDD is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Laravel TDD use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Laravel TDD?

Skills that share tags, products or a category with Laravel TDD: Pest Testing (liberusoftware/real-estate-laravel, 112 stars), Pest Testing (MineTrax/minetrax, 116 stars), Pest Testing (luadotsh/lua, 343 stars) and Pest Testing (mnapoli/vibephp, 158 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Laravel TDD?

affaan-m (a GitHub user) maintains it in affaan-m/ECC, which has 276,111 GitHub stars. The repository holds 683 skills in this directory. The repository was last updated on October 10, 2026.

Source: affaan-m/ECC on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.