php-development — Claude Code skill for PHP 8+ with SOLID and PSR
This skill makes your coding agent write PHP 8+ the disciplined way: SOLID, PSR-12, strict types, PHPUnit tests. Useful once a PHP codebase outgrows one person's habits.
npx skills add Mindrally/skills --skill php-development -a claude-codeWhat php-development does
The skill turns the assistant into a PHP developer with an object-oriented bias. It asks for declare(strict_types=1);, parameter and return types everywhere, union and nullable types, plus PHP 8.1 features: typed properties, match, named arguments, enums.
Rules are grouped by concern. Code organization means PSR-4 autoloading through Composer, the Repository pattern for data access, and dependency injection. Separate sections cover PHPDoc with @return and @throws, custom exception classes for domain errors, and security: input sanitizing, prepared statements, CSRF protection on forms.
For tests it points at PHPUnit and the Arrange-Act-Assert pattern, with external dependencies mocked. One thing to keep in mind: this is guidance for the agent, not a linter. It checks nothing on its own, and if your project already has a house style guide, the two will argue — settle which one wins before you install it.
What it helps with
- write a new PHP 8.1 class with types and no PSR-12 drift
- move data access behind a Repository and wire up dependency injection
- add PHPDoc that documents thrown exceptions and return types
- close SQL injection holes with prepared statements and input sanitizing
- cover business logic with PHPUnit tests and mocked services
Example prompts for the agent
- Write an OrderRepository class following PSR-12, with strict_types and typed methods
- Refactor this service: extract database access into a Repository and add dependency injection
- Add PHPUnit tests for the discount calculation using Arrange-Act-Assert
How to install php-development
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill php-development -a claude-code2Manually: put the files in place
~/.claude/skills/php-development/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/php-development/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill php-development -a codex2Manually: put the files in place
.agents/skills/php-development/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill php-development -a cursor2Manually: put the files in place
.cursor/skills/php-development/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills php-development2Manually: put the files in place
.github/skills/php-development/SKILL.md1Skills CLI (Vercel)
npx skills add Mindrally/skills --skill php-development -a gemini-cli2Platform CLI
gemini skills install https://github.com/Mindrally/skills --path php-developmentManually: put the files in place
.devin/skills/php-development/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Mindrally/skills --skill php-development -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about php-development
How do I install php-development in Claude?
Run npx skills add Mindrally/skills --skill php-development -a claude-code. The skill file lands at ~/.claude/skills/php-development/SKILL.md.
What does php-development do?
It gives the agent a rulebook for PHP 8+ work: SOLID, DRY, PSR-12, strict typing, PHPDoc, error handling, and PHPUnit testing.
Does the skill lint my code?
No. It shapes what the assistant generates; it does not run any checks against your project.
Source text
SKILL.md · Apache-2.0
--- name: php-development description: Expert guidance for PHP 8+ development with SOLID principles, PSR standards, and modern best practices metadata: maintainer: Mindrally source: https://github.com/Mindrally/skills --- # PHP Development You are an expert PHP developer with deep knowledge of PHP 8+, object-oriented programming, and SOLID principles. ## Core Principles - Write concise, technically accurate PHP code with proper examples - Follow SOLID principles for object-oriented programming - Follow the DRY (Don't Repeat Yourself) principle - Adhere to PSR coding standards - Design for maintainability and scalability ## PHP Standards - Use PHP 8.1+ features (typed properties, match expressions, named arguments, enums) - Follow PSR-12 coding standards - Declare strict typing: `declare(strict_types=1);` - Implement proper error handling and logging - Use type hints for all parameters and return types ## Best Practices ### Code Organization - Use PSR-4 autoloading with Composer - Implement Repository pattern for data access logic - Use dependency injection for loose coupling - Leverage interfaces for abstraction - Implement proper caching strategies ### Naming Conventions - Use PascalCase for class names - Use camelCase for method and variable names - Use SCREAMING_SNAKE_CASE for constants - Use meaningful, descriptive names ### Type Declarations - Always declare parameter types - Always declare return types - Use union types when appropriate - Use nullable types with `?` prefix when needed ### Documentation - Write complete PHPDoc blocks for classes, methods, and properties - Document parameter types and descriptions - Include `@return` tags with type information - Document exceptions with `@throws` ### Error Handling - Use try-catch blocks for expected exceptions - Create custom exception classes for domain-specific errors - Log errors appropriately with context information - Never expose sensitive information in error messages ### Security Practices - Sanitize all user input - Use prepared statements for database queries - Implement CSRF protection for forms - Validate and escape output appropriately ### Testing - Write unit tests for all business logic - Use PHPUnit for testing framework - Follow Arrange-Act-Assert pattern - Mock external dependencies in unit tests
© Mindrally · Apache-2.0 · Mindrally/skills