phpcs-check-fix/SKILL.md
Fix PHP coding style issues using PHPCS and PHPCBF. Use this skill whenever the user mentions PHPCS, code style, coding standard, cs:fix, cs:check, PHP formatting, or asks to fix/check PHP code style. Also activate when you notice PHP files have been modified and need style compliance, or when a CI PHPCS check has failed.
npx skillsauth add figlabhq/agent-skills phpcs-check-fixInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This project uses PHP CodeSniffer (PHPCS) with the FigLab Coding Standard (which extends the IxDF Coding Standard, built on PSR + Slevomat rules). The config lives in phpcs.xml at the project root.
composer cs:fix — runs PHPCBF to automatically fix what it cancomposer cs:check — runs PHPCS to report remaining violationsFollow this exact sequence:
Run composer cs:fix to auto-fix as many issues as possible. This handles spacing, bracket placement, import ordering, and other mechanical fixes.
Run composer cs:check to see what remains. Parse the output carefully — it shows the file path, line number, error type, and the sniff name (e.g., SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh).
Fix remaining issues manually, one by one. The approach depends on the violation type — see the section below.
Re-run composer cs:check after manual fixes to confirm everything passes. If new issues appear, fix those too.
After composer cs:fix, these are the violations that typically need manual attention:
SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh)The project has a warning threshold of 7 and an error threshold of 10.
// phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh
public function handleComplexScenario(): void
{
// ...
}
Add proper PHP type declarations. Use union types (string|int) or nullable types (?string) where appropriate. For arrays, add PHPDoc with array shape when the structure is known:
/** @param array{name: string, email: string} $data */
public function process(array $data): void
If a function or class is too long, look for opportunities to extract methods or break the class into smaller focused classes. For test files, these rules are already excluded in phpcs.xml.
Already excluded for Policy classes and factories in phpcs.xml. For other files, either use the parameter or prefix with underscore if it's required by a parent signature.
The limit is 160 characters (absolute max 200). Break long lines at logical points — method chains, array entries, or string concatenation.
When you only changed a few files, you can target the check to just those files instead of the entire project:
vendor/bin/phpcs --standard=phpcs.xml path/to/File.php
vendor/bin/phpcbf --standard=phpcs.xml path/to/File.php
This is faster than running the full project scan. Use this when fixing style issues in files you've just edited.
The GitHub Actions workflow (.github/workflows/phpcs.yml) runs on every push:
composer cs:fix and commits the resultcomposer cs:check — failures show as annotations in the PRSo if you fix everything locally, CI will pass cleanly.
development
Use when reviewing code for security vulnerabilities, implementing authentication/authorization, handling user input, or discussing web application security. Covers OWASP Top 10:2025, ASVS 5.0, and Agentic AI security (2026).
development
Apply battle-tested code conventions when writing or modifying code in Laravel/PHP projects (with React/TypeScript frontend support). Use this skill whenever the user is writing a new feature, refactoring existing code, creating a controller/action/migration/model/test, or asks 'how should I structure this', 'what's the convention for X', 'is this the right pattern'. Also use proactively before producing non-trivial code so the output follows conventions the first time instead of needing rewrites.
development
Deep research before planning. Launches parallel agents to search docs, web, and codebase, then synthesizes findings into actionable context.
testing
Critically review and refine tests generated during a coding session. Use this skill when the user asks to review tests, clean up tests, refine tests, prune tests, improve test quality, or remove useless/low-value tests. Also use when the user says 'review my tests', 'clean up tests', or mentions test quality after a coding session.