php-pro
What it does
It guides the AI agent to write typed, well-tested PHP applications. It is for PHP developers building web apps and APIs with Laravel or Symfony.
When to use it
- ✓When you are building a PHP app or API with Laravel or Symfony.
- ✓When you need PHP code checked with strict types and PHPStan at level 9.
- ✓When you want DTOs, value objects, and dependency injection set up in a PHP project.
Skill link
https://github.com/Jeffallan/claude-skills/blob/main/skills/php-pro/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Build a Laravel REST endpoint for creating invoices, with typed DTOs and tests that pass PHPStan.”
5 new skills a week. 1 minute to read.
How it works
The agent designs typed models and DTOs, implements the code following PSR standards, and adds validation and security protections. It then runs PHPStan and the test suite before delivery.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
PHP Pro
Senior PHP developer with deep expertise in PHP 8.3+, Laravel, Symfony, and modern PHP patterns with strict typing and enterprise architecture.
Core Workflow
- Analyze architecture — Review framework, PHP version, dependencies, and patterns
- Design models — Create typed domain models, value objects, DTOs
- Implement — Write strict-typed code with PSR compliance, DI, repositories
- Secure — Add validation, authentication, XSS/SQL injection protection
- Verify — Run
vendor/bin/phpstan analyse --level=9; fix all errors before proceeding. Runvendor/bin/phpunitorvendor/bin/pest; enforce 80%+ coverage. Only deliver when both pass clean.
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Modern PHP | references/modern-php-features.md |
Readonly, enums, attributes, fibers, types |
| Laravel | references/laravel-patterns.md |
Services, repositories, resources, jobs |
| Symfony | references/symfony-patterns.md |
DI, events, commands, voters |
| Async PHP | references/async-patterns.md |
Swoole, ReactPHP, fibers, streams |
| Testing | references/testing-quality.md |
PHPUnit, PHPStan, Pest, mocking |
Constraints
MUST DO
- Declare strict types (
declare(strict_types=1)) - Use type hints for all properties, parameters, returns
- Follow PSR-12 coding standard
- Run PHPStan level 9 before delivery
- Use readonly properties where applicable
- Write PHPDoc blocks for complex logic
- Validate all user input with typed requests
- Use dependency injection over global state
MUST NOT DO
- Skip type declarations (no mixed types)
- Store passwords in plain text (use bcrypt/argon2)
- Write SQL queries vulnerable to injection
- Mix business logic with controllers
- Hardcode configuration (use .env)
- Deploy without running tests and static analysis
- Use var_dump in production code
Code Patterns
Every complete implementation delivers: a typed entity/DTO, a service class, and a test. Use these as the baseline structure.
Readonly DTO / Value Object
<?php
declare(strict_types=1);
namespace App\DTO;
final readonly class CreateUserDTO
{
public function __construct(
public string $name,
public string $email,
public string $password,
) {}
public static function fromArray(array $data): self
{
return new self(
name: $data['name'],
email: $data['email'],
password: $data['password'],
);
}
}
Typed Service with Constructor DI
<?php
declare(strict_types=1);
namespace App\Services;
use App\DTO\CreateUserDTO;
use App\Models\User;
use App\Repositories\UserRepositoryInterface;
use Illuminate\Support\Facades\Hash;
final class UserService
{
public function __construct(
private readonly UserRepositoryInterface $users,
) {}
public function create(CreateUserDTO $dto): User
{
return $this->users->create([
'name' => $dto->name,
'email' => $dto->email,
'password' => Hash::make($dto->password),
]);
}
}
PHPUnit Test Structure
<?php
declare(strict_types=1);
namespace Tests\Unit\Services;
use App\DTO\CreateUserDTO;
use App\Models\User;
use App\Repositories\UserRepositoryInterface;
use App\Services\UserService;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
final class UserServiceTest extends TestCase
{
private UserRepositoryInterface&MockObject $users;
private UserService $service;
protected function setUp(): void
{
parent::setUp();
$this->users = $this->createMock(UserRepositoryInterface::class);
$this->service = new UserService($this->users);
}
public function testCreateHashesPassword(): void
{
$dto = new CreateUserDTO('Alice', 'alice@example.com', '<test-password>');
$user = new User(['name' => 'Alice', 'email' => 'alice@example.com']);
$this->users
->expects($this->once())
->method('create')
->willReturn($user);
$result = $this->service->create($dto);
$this->assertSame('Alice', $result->name);
}
}
Enum (PHP 8.1+)
<?php
declare(strict_types=1);
namespace App\Enums;
enum UserStatus: string
{
case Active = 'active';
case Inactive = 'inactive';
case Banned = 'banned';
FAQ
Which PHP version does it target?
It targets PHP 8.3 and newer, with strict typing.
What static analysis does it run?
It runs PHPStan at level 9 and fixes every error before delivery.
Does it cover async PHP?
Yes. It covers Swoole, ReactPHP, and fibers.
Details
Original description by the author
Use when building PHP applications with modern PHP 8.3+ features, Laravel, or Symfony frameworks. Invokes strict typing, PHPStan level 9, async patterns with Swoole, and PSR standards. Creates controllers, configures middleware, generates migrations, writes PHPUnit/Pest tests, defines typed DTOs and value objects, sets up dependency injection, and scaffolds REST/GraphQL APIs. Use when working with Eloquent, Doctrine, Composer, Psalm, ReactPHP, or any PHP API development.
repo: Jeffallan/claude-skills
Popularity
- GitHub stars
- 12k
- Ranking position
- #11443
- License
- MIT
- Updated
- 10/30/2026
Comments
- …
More skills from this repository
angular-architect
12kHelps your agent build Angular 17 and newer apps with standalone components, lazy-loaded routing, NgRx state, RxJS patterns, and performance tuning.
api-designer
12kHelps your agent design REST or GraphQL APIs and write OpenAPI 3.1 specs, with rules for resources, pagination, error formats, and versioning.
architecture-designer
12kHelps your agent design system architecture, compare patterns and technologies, and write Architecture Decision Records that explain each choice.
atlassian-mcp
12kHelps your agent search and update Jira issues and Confluence pages through MCP, including JQL and CQL queries, sprints, and documentation sync.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.