
test-specialist
Proactive Pest 4 test generation for Laravel, Livewire, and Filament apps with coverage gap analysis.
- version
- 1.0.0
- GitHub stars
- 36
What it does
- Adds
generate-pest-test,analyze-coverage,run-test-suite,policies,livewire, andfilamentcommands plustest-specialist-agent - Covers test generation for models, controllers, policies, and Livewire components in PHP projects
- Analyzes coverage gaps and runs test suites with detailed reporting
- Designed for Laravel teams that use Pest 4 alongside Livewire and Filament
Proactive Pest 4 testing for PHP, Laravel, Livewire, and Filament apps. Auto-generates tests for models, controllers, policies, and Livewire components. Analyzes coverage gaps and runs test suites with detailed reporting.
Add marketplace
/plugin marketplace add mwguerra/claude-code-pluginsRun it inside Claude Code once, then install the plugin below.
Install
/plugin install test-specialist@mwguerra-marketplaceRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceAnalyze Coverage
Analyze test coverage for PHP, Laravel, Livewire, and Filament projects using Pest 4, identifying gaps and suggesting improvements.
Syntax
guerra:analyze-coverage [options] [target]
Options
--path=<n>- Analyze specific path or file--min=<n>- Set minimum coverage threshold (default: 80)--report=<type>- Generate report (html, text, clover, xml)--missing- Show only missing coverage--detailed- Show detailed line-by-line coverage--suggest- Suggest tests for uncovered code--save- Save report to file
Documentation Reference
- Pest Coverage - https://pestphp.com/docs/coverage
- PHPUnit Coverage - https://phpunit.de/manual/current/en/code-coverage-analysis.html
- Laravel Testing - https://laravel.com/docs/testing
Coverage Analysis Implementation
Step 1: Run Coverage Analysis
# Basic coverage
./vendor/bin/pest --coverage
# Coverage with minimum threshold
./vendor/bin/pest --coverage --min=80
# Coverage with HTML report
./vendor/bin/pest --coverage --coverage-html=coverage-report
# Coverage for specific path
./vendor/bin/pest --coverage tests/Feature/Posts
# Coverage with detailed output
./vendor/bin/pest --coverage --coverage-text
Step 2: Analyze Coverage Report
<?php
// Coverage analysis structure
[
'summary' => [
'lines_covered' => 850,
'lines_total' => 1000,
'percentage' => 85.0,
'methods_covered' => 120,
'methods_total' => 150,
'classes_covered' => 25,
'classes_total' => 30,
],
'by_directory' => [
'app/Models' => [
'percentage' => 95.0,
'lines' => [850, 900],
],
'app/Http/Controllers' => [
'percentage' => 75.0,
'lines' => [600, 800],
],
'app/Policies' => [
'percentage' => 60.0,
'lines' => [120, 200],
],
],
'uncovered_files' => [
'app/Services/PaymentService.php',
'app/Helpers/StringHelper.php',
],
]
Step 3: Identify Coverage Gaps
<?php
// Example: Identify untested methods
class CoverageAnalyzer
{
public function findUncoveredMethods(): array
{
return [
'PostController::archive' => [
'file' => 'app/Http/Controllers/PostController.php',
'lines' => [45, 52],
'complexity' => 3,
'priority' => 'high',
],
'PostPolicy::publish' => [
'file' => 'app/Policies/PostPolicy.php',
'lines' => [78, 85],
'complexity' => 2,
'priority' => 'high',
],
'Post::getExcerpt' => [
'file' => 'app/Models/Post.php',
'lines' => [156, 160],
'complexity' => 1,
'priority' => 'medium',
],
];
}
public function findUncoveredBranches(): array
{
return [
'PostController::update' => [
'uncovered_conditions' => [
'if ($request->has("publish"))' => 'line 67',
'elseif ($post->isLocked())' => 'line 72',
],
],
];
}
public function findCriticalUncovered(): array
{
return [
'authentication' => [
'LoginController::attempt',
'RegisterController::create',
],
'authorization' => [
'PostPolicy::forceDelete',
'UserPolicy::impersonate',
],
'payment_processing' => [
'PaymentService::refund',
'PaymentService::capture',
],
];
}
}
Coverage Report Formats
Text Report
Code Coverage Report:
2024-10-27 10:30:45
Summary:
Classes: 83.33% (25/30)
Methods: 80.00% (120/150)
Lines: 85.00% (850/1000)
app/Models
Post.php 95.00%
User.php 90.00%
Comment.php 85.00%
Category.php 70.00%
app/Http/Controllers
PostController.php 80.00%
UserController.php 75.00%
CommentController.php 65.00%
app/Policies
PostPolicy.php 70.00%
UserPolicy.php 65.00%
CommentPolicy.php 55.00%
Uncovered Files:
app/Services/PaymentService.php
app/Services/NotificationService.php
app/Helpers/StringHelper.php
HTML Report Structure
<!DOCTYPE html>
<html>
<head>
<title>Coverage Report</title>
<style>
.covered { background: #d4edda; }
.uncovered { background: #f8d7da; }
.partially { background: #fff3cd; }
</style>
</head>
<body>
<h1>Coverage Report: 85.00%</h1>
<table>
<tr>
<th>File</th>
<th>Coverage</th>
<th>Lines</th>
<th>Methods</th>
</tr>
<tr class="covered">
<td>app/Models/Post.php</td>
<td>95.00%</td>
<td>190/200</td>
<td>18/20</td>
</tr>
<tr class="partially">
<td>app/Policies/PostPolicy.php</td>
<td>70.00%</td>
<td>70/100</td>
<td>7/10</td>
</tr>
</table>
</body>
</html>
Test Suggestions Based on Coverage
Generate Test Stubs for Uncovered Code
<?php
// For uncovered controller method
describe('PostController archive method', function () {
beforeEach(function () {
$this->admin = User::factory()->admin()->create();
$this->post = Post::factory()->published()->create();
actingAs($this->admin);
});
it('can archive published post', function () {
post("/posts/{$this->post->id}/archive")
->assertRedirect()
->assertSessionHas('success');
expect($this->post->refresh()->status)->toBe('archived');
});
it('prevents archiving already archived post', function () {
$this->post->update(['status' => 'archived']);
post("/posts/{$this->post->id}/archive")
->assertSessionHasErrors();
expect($this->post->refresh()->status)->toBe('archived');
});
it('dispatches post archived event', function () {
Event::fake();
post("/posts/{$this->post->id}/archive");
Event::assertDispatched(PostArchived::class);
});
});
// For uncovered policy method
describe('PostPolicy publish method', function () {
beforeEach(function () {
$this->admin = User::factory()->admin()->create();
$this->editor = User::factory()->editor()->create();
$this->author = User::factory()->author()->create();
$this->post = Post::factory()->draft()->create();
});
it('allows admins to publish posts', function () {
expect($this->admin->can('publish', $this->post))->toBeTrue();
});
it('allows editors to publish posts', function () {
expect($this->editor->can('publish', $this->post))->toBeTrue();
});
it('denies authors from publishing posts', function () {
expect($this->author->can('publish', $this->post))->toBeFalse();
});
it('prevents publishing already published posts', function () {
$this->post->update(['status' => 'published']);
expect($this->admin->can('publish', $this->post))->toBeFalse();
});
});
// For uncovered model method
describe('Post getExcerpt method', function () {
it('returns first 150 characters', function () {
$post = Post::factory()->create([
'content' => str_repeat('a', 200),
]);
expect($post->getExcerpt())
->toHaveLength(150)
->toEndWith('...');
});
it('returns full content if shorter than 150 characters', function () {
$post = Post::factory()->create([
'content' => 'Short content',
]);
expect($post->getExcerpt())
->toBe('Short content')
->not->toEndWith('...');
});
it('strips HTML tags from excerpt', function () {
$post = Post::factory()->create([
'content' => '<p>Content with <strong>HTML</strong> tags</p>',
]);
expect($post->getExcerpt())
->not->toContain('<')
->not->toContain('>');
});
});
Priority-Based Test Generation
Critical Priority (Must Test)
// Authentication & Authorization
- Login/logout flows
- Password reset
- Registration
- Policy methods
- Gate definitions
- Middleware authorization
// Payment & Transactions
- Payment processing
- Refunds
- Transaction logging
- Invoice generation
// Data Integrity
- Database migrations
- Model relationships
- Validation rules
- Soft deletes
High Priority (Should Test)
// Business Logic
- Core workflows
- State transitions
- Event dispatching
- Job processing
// API Endpoints
- Request validation
- Response formatting
- Error handling
- Rate limiting
// User Interactions
- Form submissions
- File uploads
- AJAX requests
- Real-time updates
Medium Priority (Nice to Test)
// UI Components
- Livewire components
- Vue components
- Blade components
// Utility Functions
- Helper methods
- Service classes
- Formatting functions
// Admin Features
- Filament resources
- Custom actions
- Widgets
Coverage Improvement Strategies
Strategy 1: Fill Coverage Gaps
# Identify files with < 50% coverage
guerra:analyze-coverage --min=50 --missing
# Generate tests for identified gaps
guerra:generate-pest-test --path=app/Services/PaymentService.php
# Re-run coverage
guerra:analyze-coverage --path=app/Services/PaymentService.php
Strategy 2: Increase Branch Coverage
// Before: Only happy path tested
it('can update post', function () {
$post = Post::factory()->create();
put("/posts/{$post->id}", [
'title' => 'Updated Title',
])->assertRedirect();
});
// After: All branches tested
describe('Post update', function () {
it('can update post with valid data', function () {
// Happy path
});
it('validates required fields', function () {
// Validation branch
});
it('prevents unauthorized updates', function () {
// Authorization branch
});
it('handles concurrent updates', function () {
// Edge case branch
});
});
Strategy 3: Test Edge Cases
describe('Edge cases for post creation', function () {
it('handles maximum title length', function () {
// Test boundary
});
it('handles empty content', function () {
// Test empty state
});
it('handles special characters in slug', function () {
// Test special inputs
});
it('handles duplicate slugs', function () {
// Test uniqueness
});
it('handles concurrent creations', function () {
// Test race conditions
});
});
Integration with CI/CD
GitHub Actions Example
name: Test Coverage
on: [push, pull_request]
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: xdebug
- name: Install Dependencies
run: composer install
- name: Run Tests with Coverage
run: ./vendor/bin/pest --coverage --min=80
- name: Generate Coverage Report
run: ./vendor/bin/pest --coverage-html=coverage
- name: Upload Coverage
uses: actions/upload-artifact@v2
with:
name: coverage-report
path: coverage/
Best Practices
- Set minimum thresholds - Enforce coverage standards
- Focus on critical paths - Prioritize important code
- Test edge cases - Don't just test happy paths
- Review regularly - Check coverage in code reviews
- Improve incrementally - Don't try to reach 100% at once
- Ignore generated code - Exclude migrations, configs
- Track trends - Monitor coverage over time
- Use coverage to find gaps - Not as a goal itself
Quality Checklist
- Overall coverage meets minimum threshold (80%+)
- Critical paths have 100% coverage
- All policies tested
- All controllers tested
- All models tested
- Edge cases covered
- Branch coverage adequate
- No untested public methods
- Coverage report generated
- Trends tracked over time
Coverage Configuration
PHPUnit.xml Coverage Settings
<phpunit>
<coverage>
<include>
<directory suffix=".php">./app</directory>
</include>
<exclude>
<directory>./app/Console</directory>
<file>./app/Providers/RouteServiceProvider.php</file>
</exclude>
<report>
<html outputDirectory="coverage-report"/>
<text outputFile="php://stdout"/>
<clover outputFile="coverage.xml"/>
</report>
</coverage>
</phpunit>
Interpreting Coverage Metrics
Coverage Percentages
- 90-100%: Excellent - Comprehensive testing
- 80-89%: Good - Solid coverage, minor gaps
- 70-79%: Fair - Some important areas uncovered
- 60-69%: Poor - Significant gaps
- < 60%: Critical - Major testing needed
What Coverage Doesn't Tell You
- ❌ Quality of assertions
- ❌ Test maintainability
- ❌ Edge case handling
- ❌ Integration quality
- ❌ Real-world usage patterns
Balanced Approach
✅ Use coverage as a guide, not a goal ✅ Focus on meaningful tests ✅ Prioritize critical code paths ✅ Don't sacrifice quality for coverage ✅ Review tests, not just numbers
From the mwguerra/claude-code-plugins README
mwguerra Claude Code Plugins
A collection of Claude Code plugins for development workflows.
Installation
# Add the marketplace
/plugin marketplace add mwguerra/claude-code-plugins
# Browse and install plugins
/plugin
Available Plugins
article-writer
Create publication-ready technical articles with author voice profiles, web research, runnable code examples, and multi-language output. Supports interactive single-article creation or autonomous batch processing.
/plugin install article-writer@mwguerra-marketplace
code
Production readiness toolkit with code cleanup, comprehensive analysis, and automated testing. Removes debug artifacts for clean commits, runs Pest and Playwright tests, and prepares apps for deployment.
/plugin install code@mwguerra-marketplace
docs-specialist
Generate and maintain documentation from code with drift detection. Validates docs against source, auto-generates from code patterns, syncs outdated content, and provides reusable templates.
/plugin install docs-specialist@mwguerra-marketplace
docker-local
Expert agent for docker-local (mwguerra/docker-local) Laravel Docker development environment. Manages Docker services, diagnoses issues, checks project conflicts, handles database operations, and troubleshoots environment setup.
/plugin install docker-local@mwguerra-marketplace
docker-specialist
Docker and Docker Compose expert with complete documentation. Generates Dockerfiles, compose configs, database containers, SSL/TLS setup with Traefik or Nginx, and provides troubleshooting.
/plugin install docker-specialist@mwguerra-marketplace
e2e-test-specialist
Comprehensive E2E testing using Playwright MCP. Creates detailed test plans, tests all pages for errors, verifies user flows by role, and runs visual browser tests with full coverage.
/plugin install e2e-test-specialist@mwguerra-marketplace
filament-specialist
Expert FilamentPHP v4 assistant with complete official documentation. Generates resources, forms, tables, actions, widgets, infolists, and Pest tests following v4 patterns.
/plugin install filament-specialist@mwguerra-marketplace
laravel-filament-package-development-specialist
Scaffold and develop Laravel packages and Filament plugins with full testing support. Creates package structure, configures Pest testing, sets up GitHub Actions CI.
/plugin install laravel-filament-package-development-specialist@mwguerra-marketplace
post-development
App launch preparation toolkit with SEO analysis, automated screenshots, buyer persona creation, social media ad generation, technical article writing, and landing page proposals.
/plugin install post-development@mwguerra-marketplace
taskmanager
Plan and execute tasks from PRDs with hierarchical subtasks, dependency tracking, and project memories. Features dashboard visualization, autonomous batch execution, and persistent memory.
/plugin install taskmanager@mwguerra-marketplace
terminal-specialist
Terminal and shell systems expert with comprehensive documentation. Covers TTY/PTY architecture, stdin/stdout/stderr streams, signals, ANSI escape sequences, job control, and terminal modes.
/plugin install terminal-specialist@mwguerra-marketplace
test-specialist
Proactive Pest 4 testing for PHP, Laravel, Livewire, and Filament apps. Auto-generates tests for models, controllers, policies, and Livewire components. Analyzes coverage gaps.
/plugin install test-specialist@mwguerra-marketplace
obsidian-vault
Manage an Obsidian vault as your development knowledge base and automatic work journal. Auto-captures commits, tasks, and Claude Code components with structured frontmatter.
/plugin install obsidian-vault@mwguerra-marketplace
error-memory
Intelligent error tracking and solution recall system. Learns from every error you solve, providing instant access to past solutions with multi-level matching and confidence scores.
/plugin install error-memory@mwguerra-marketplace
prd-builder
Interactive PRD (Product Requirements Document) builder with comprehensive interview-driven discovery, gap analysis, and taskmanager integration.
/plugin install prd-builder@mwguerra-marketplace
my-workflow
Personal workflow management combining assistant, secretary, and executive roles. Tracks sessions, commitments, decisions, and goals. Integrates with GitHub and Obsidian vault. Provides intelligent briefings and productivity insights.
/plugin install my-workflow@mwguerra-marketplace
Reinstall Script
If you need to completely reinstall all marketplace plugins (useful after updates or to fix issues), add this script to ~/.claude/reinstall_marketplace.sh:
#!/bin/bash
# Delete marketplaces cleanup script
# Removes marketplace plugins and related configuration
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "Cleaning up marketplace plugins..."
# Delete installed_plugins.json
if [ -f "$SCRIPT_DIR/plugins/installed_plugins.json" ]; then
rm "$SCRIPT_DIR/plugins/installed_plugins.json"
echo "Deleted: plugins/installed_plugins.json"
else
echo "Not found: plugins/installed_plugins.json"
fi
# Delete marketplaces folder
if [ -d "$SCRIPT_DIR/plugins/marketplaces" ]; then
rm -rf "$SCRIPT_DIR/plugins/marketplaces"
echo "Deleted: plugins/marketplaces/"
else
echo "Not found: plugins/marketplaces/"
fi
if [ -d "$SCRIPT_DIR/plugins/cache" ]; then
rm -rf "$SCRIPT_DIR/plugins/cache"
echo "Deleted: plugins/cache/"
else
echo "Not found: plugins/cache/"
fi
# Remove enabledPlugins from settings.json using jq or sed
if [ -f "$SCRIPT_DIR/settings.json" ]; then
if command -v jq &> /dev/null; then
# Use jq if available
jq 'del(.enabledPlugins)' "$SCRIPT_DIR/settings.json" > "$SCRIPT_DIR/settings.json.tmp" && \
mv "$SCRIPT_DIR/settings.json.tmp" "$SCRIPT_DIR/settings.json"
echo "Removed enabledPlugins from settings.json"
else
# Fallback to Python if jq not available
python3 -c "
import json
with open('$SCRIPT_DIR/settings.json', 'r') as f:
data = json.load(f)
if 'enabledPlugins' in data:
del data['enabledPlugins']
with open('$SCRIPT_DIR/settings.json', 'w') as f:
json.dump(data, f, indent=2)
f.write('\n')
"
echo "Removed enabledPlugins from settings.json"
fi
else
echo "Not found: settings.json"
fi
# Function to reinstall a marketplace and all its plugins
reinstall_marketplace() {
local marketplace_name="$1"
local marketplace_repo="$2"
local marketplace_dir="$SCRIPT_DIR/plugins/marketplaces/$marketplace_name"
echo "Reinstalling marketplace: $marketplace_name"
claude plugin marketplace remove "$marketplace_name"
claude plugin marketplace add "$marketplace_repo"
if [ -d "$marketplace_dir" ]; then
echo "Installing plugins from $marketplace_name..."
for plugin_dir in "$marketplace_dir"/*/; do
local plugin_name=$(basename "$plugin_dir")
# Skip hidden directories (like .git, .claude-plugin)
if [[ "$plugin_name" != .* ]]; then
echo "Installing: $plugin_name@$marketplace_name"
claude plugin install "$plugin_name@$marketplace_name"
fi
done
else
echo "Error: Marketplace directory not found at $marketplace_dir"
return 1
fi
}
# Reinstall marketplaces
reinstall_marketplace "mwguerra-marketplace" "mwguerra/claude-code-plugins"
# Make all .sh files executable in plugins directory
echo "Making .sh files executable in plugins directory..."
find "$SCRIPT_DIR/plugins" -name "*.sh" -type f -exec chmod +x {} \;
echo "Done setting permissions."
echo "Done!"
Usage:
# Make executable
chmod +x ~/.claude/reinstall_marketplace.sh
# Run to reinstall all plugins
~/.claude/reinstall_marketplace.sh
Requirements
- Claude Code
License
MIT
Details
- Marketplace
- mwguerra/claude-code-plugins
- Source
- test-specialist
- Category
- Testing
- Keywords
- testing, pest, laravel, filament, livewire, coverage, automation, php, tdd
- Listed since
- Apr 7, 2026
More from mwguerra/claude-code-plugins
All 18- article-writerv1.0.0
- boardv1.0.0
- codev1.0.0
- docker-localv1.0.0
- docker-specialistv1.0.0
- docs-specialistv1.0.0
- e2e-test-specialistv2.7.0
- error-memoryv1.0.0
- filament-specialistv1.0.0
- laravel-filament-package-development-specialistv1.0.0
- obsidian-vaultv1.0.0
- post-developmentv1.0.0
- prd-builderv1.0.0
- reverb-specialistv1.0.0
- secretaryv1.0.0
- taskmanagerv1.0.0
- terminal-specialistv1.0.0
Similar to test-specialist
More Testing & QA
filament-specialistPluginmwguerra/claude-code-plugins36 starsExpert FilamentPHP v4 assistant with complete official documentation. Generates resources, forms, tables, actions, widgets, infolists, and Pest tests following
laravel-specialistSkilljeffallan/claude-skills24.1K installsLaravel 10+ specialist covering Eloquent, Sanctum, Horizon, API resources, Livewire, and Pest/PHPUnit testing.
pest-testingSkillspatie/freek.dev743 installsPest 4 test-writing guide covering unit, feature, and browser tests with assertions, datasets, and mocking.
laravel-filament-package-development-specialistPluginmwguerra/claude-code-plugins36 starsScaffold and develop Laravel packages and Filament plugins with full testing support. Creates package structure, configures Pest testing, sets up GitHub Actions
testing-suitePlugindavila7/claude-code-templates24.2K starsComprehensive testing toolkit with E2E, unit, integration, and visual testing automation
dotnet-testPlugindotnet/skills6.3K starsSkills for running, generating, analyzing, and improving .NET tests: test execution, filtering, platform detection, coverage, testability, and MSTest workflows.