Discover and run code linters for the current project. Use when asked to lint code, check code quality, run static analysis, or after completing a feature. Detects PHPCS, PHPStan, ESLint, and Stylelint configurations and runs appropriate checks.
Install
npx skillscat add humanmade/claude-code-standards/run-linters Install via the SkillsCat registry.
SKILL.md
Run Project Linters
When asked to run linters, check code quality, or verify changes:
1. Discover Available Linters
Check for configuration files to determine which linters are available:
PHP Linting
phpcs.xmlorphpcs.xml.dist→ PHPCS availablephpstan.neonorphpstan.neon.dist→ PHPStan available
JavaScript Linting
.eslintrc.*oreslint.config.*→ ESLint available
CSS/SCSS Linting
.stylelintrc*→ Stylelint available
2. Check for Lint Scripts
Look in composer.json and package.json for predefined lint commands:
composer.json scripts:
{
"scripts": {
"lint": "phpcs && phpstan analyse",
"phpcs": "phpcs",
"phpstan": "phpstan analyse",
"fix": "phpcbf"
}
}package.json scripts:
{
"scripts": {
"lint": "eslint . && stylelint '**/*.scss'",
"lint:js": "eslint .",
"lint:css": "stylelint '**/*.scss'",
"lint:fix": "eslint . --fix"
}
}3. Run Linters Based on Changed Files
Determine what type of files were changed and run appropriate linters:
For PHP Changes
# If composer script exists:
composer run phpcs
# Or directly:
vendor/bin/phpcs path/to/changed/files
# For static analysis:
composer run phpstan
# Or:
vendor/bin/phpstan analyse path/to/changed/filesFor JavaScript/TypeScript Changes
# If npm script exists:
npm run lint:js
# Or directly:
npx eslint path/to/changed/filesFor CSS/SCSS Changes
# If npm script exists:
npm run lint:css
# Or directly:
npx stylelint "path/to/changed/**/*.scss"For All Changes
# Run all available linters
composer run lint # PHP linters
npm run lint # JS/CSS linters4. For Altis Projects
Run linters through the local server:
# PHP linting in Altis context
composer server cli -- eval-file .claude/lint-runner.php
# Or if PHPCS is available locally:
composer run phpcs5. Report and Fix
After running linters:
- Report findings - Summarize errors and warnings by category
- Offer auto-fix - If available, offer to run:
composer run fixorvendor/bin/phpcbffor PHPnpm run lint:fixornpx eslint --fixfor JSnpx stylelint --fixfor CSS/SCSS
- Manual fixes - For issues that can't be auto-fixed, explain what needs to change
Common Issues and Fixes
PHPCS
- Missing docblocks → Add appropriate PHPDoc comments
- Incorrect spacing → Usually auto-fixable with phpcbf
- Naming conventions → Rename to match standards
ESLint
- Unused variables → Remove or prefix with underscore
- Missing dependencies in hooks → Add to dependency array
- Prefer const → Change let to const where possible
Stylelint
- Color format → Convert to preferred format
- Selector specificity → Refactor to reduce nesting
- Unknown properties → Check for typos or vendor prefixes