/claude-toolkit:code-qualityfrom claude-toolkit
Manages PHP and Laravel code quality toolchain: static analysis with Larastan/PHPStan, code style enforcement with Pint, automated refactoring with Rector, baseline management for legacy codebases, and CI quality gates via GitHub Actions.
Ships in claude-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Static analysis, code style enforcement, automated refactoring, and CI quality gates for Laravel projects. Built on top of Laravel Kickoff's existing PHPStan, Pint, Rector, and GitHub Actions configuration.
| Command | Description |
|---|---|
/quality check | Run Larastan analysis, interpret errors, suggest fixes |
/quality fix | Auto-fix Pint violations with explanations of what changed |
/quality baseline | Generate or update PHPStan baseline for legacy code |
/quality rector | Suggest and apply Rector rules for code modernisation |
/quality ci | Extend GitHub Actions CI with custom quality gates |
Laravel Kickoff projects ship with these tools pre-configured:
| Tool | Config File | Purpose |
|---|---|---|
| PHPStan / Larastan | phpstan.neon | Static analysis |
| Laravel Pint | pint.json | Code style (PSR-12 / Laravel preset) |
| Rector | rector.php | Automated refactoring |
| GitHub Actions | .github/workflows/ci.yml | CI pipeline |
This skill extends that baseline — it does not replace it. Always read the existing config files before suggesting changes. Never overwrite without confirming with the user.
/quality check — Larastan Analysis./vendor/bin/phpstan analyse --memory-limit=512M
If a baseline exists (phpstan-baseline.neon), PHPStan automatically excludes baselined
errors. Only new errors are reported.
For each error, explain:
| Error Pattern | Meaning | Fix |
|---|---|---|
Parameter #1 $x expects string, int given | Type mismatch in function call | Cast or validate the input type |
Call to an undefined method | Method does not exist on the resolved type | Add @method PHPDoc or fix the class reference |
Property $x has no type declaration | Missing property type | Add typed property: public string $x; |
Method should return X but returns Y | Return type mismatch | Fix return value or widen the return type |
Access to an undefined property | Property not declared on the class | Declare the property or add @property PHPDoc |
Dead catch — Throwable is never thrown | Catching an exception that cannot occur | Remove the dead catch or fix the try block |
If condition is always true/false | Redundant conditional logic | Simplify the condition or remove dead code |
Present fixes grouped by file. For each fix:
File: app/Services/PaymentService.php:42
Error: Parameter #1 $amount expects int, string given
Current:
$this->charge($request->input('amount'));
Fix:
$this->charge((int) $request->input('amount'));
Explanation: Request input returns string|null. Cast to int before passing
to charge() which expects an integer parameter.
Refer to references/larastan-rules.md for the full error level breakdown (0-9).
Recommend the user start at level 5 for existing projects and work up incrementally.
/quality fix — Pint Code Style./vendor/bin/pint --test
This shows what would change without modifying files.
./vendor/bin/pint
After fixing, explain the most impactful changes. Group by rule:
Pint fixed 23 files:
Spacing & Alignment (14 files):
- binary_operator_spaces: aligned = and => operators
- no_extra_blank_lines: removed double blank lines
Imports (6 files):
- ordered_imports: sorted use statements alphabetically
- no_unused_imports: removed 4 unused imports
Type Declarations (3 files):
- fully_qualified_strict_types: converted FQCN to imports
If the user has no pint.json or uses the default preset, recommend a preset based on
project context. Refer to references/pint-presets.md for preset details and common
rule customisations.
| Context | Recommended Preset |
|---|---|
| New Laravel project | laravel (default) |
| Open-source package | psr12 |
| Strict team standards | per with custom rules |
| Symfony-influenced | symfony |
/quality baseline — PHPStan Baseline Management./vendor/bin/phpstan analyse --generate-baseline
This creates phpstan-baseline.neon containing all current errors as "accepted" — future
runs only flag new code.
Verify phpstan.neon includes the baseline:
includes:
- phpstan-baseline.neon
- vendor/larastan/larastan/extension.neon
Present a reduction plan:
Current baseline: 142 errors
Recommended reduction plan:
Week 1-2: Fix "missing return type" errors (38 occurrences)
Week 3-4: Fix "undefined property" errors (27 occurrences)
Week 5-6: Fix "type mismatch" errors (44 occurrences)
Week 7-8: Fix remaining 33 errors
After each batch: regenerate baseline to lock in progress.
After the user fixes a batch:
./vendor/bin/phpstan analyse --generate-baseline
Compare the before/after counts. Celebrate progress.
| Anti-Pattern | Why It's Bad | Instead |
|---|---|---|
| Baseline everything and forget | Errors accumulate silently | Schedule regular reduction sprints |
| Never baseline, fix everything now | Blocks feature work for days | Baseline and reduce incrementally |
| Baseline + lower the level | Hides problems at two layers | Keep level, use baseline only |
| Committing baseline changes without review | May silently accept new errors | Require PR review for baseline changes |
/quality rector — Code ModernisationRead rector.php and identify which rule sets are active. Refer to
references/rector-sets.md for the full catalogue.
Based on the project's PHP version and codebase patterns, suggest relevant rule sets:
// rector.php
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/app',
__DIR__ . '/config',
__DIR__ . '/database',
__DIR__ . '/routes',
__DIR__ . '/tests',
])
->withPhpSets(php83: true)
->withPreparedSets(
deadCode: true,
codeQuality: true,
typeDeclarations: true,
earlyReturn: true,
);
Always dry-run first:
./vendor/bin/rector process --dry-run
Present the proposed changes grouped by rule:
Rector would apply 47 changes:
Dead Code Removal (12 changes):
- RemoveUnusedPrivateMethodRector: 5 methods
- RemoveDeadConditionAboveReturnRector: 4 conditions
- RemoveUnusedConstructorParamRector: 3 params
Type Declarations (18 changes):
- AddReturnTypeDeclarationBasedOnParentClassMethodRector: 8 methods
- TypedPropertyFromAssignsRector: 10 properties
Early Return (9 changes):
- ChangeAndIfToEarlyReturnRector: 9 occurrences
Code Quality (8 changes):
- SimplifyIfReturnBoolRector: 5 occurrences
- CombinedAssignRector: 3 occurrences
After user confirms:
./vendor/bin/rector process
Then immediately run Pint to fix any style issues Rector may introduce:
./vendor/bin/pint
And verify with PHPStan:
./vendor/bin/phpstan analyse
Highlight the most impactful transformations with before/after examples:
Before (app/Services/OrderService.php:67):
public function isComplete($order)
{
if ($order->status === 'complete') {
return true;
}
return false;
}
After:
public function isComplete(Order $order): bool
{
return $order->status === 'complete';
}
Rules applied:
- AddReturnTypeDeclarationBasedOnParentClassMethodRector
- SimplifyIfReturnBoolRector
- TypedPropertyFromAssignsRector
/quality ci — GitHub Actions Quality GatesRead .github/workflows/ci.yml (Kickoff ships one). Identify what's already there and
what's missing.
Suggest adding dedicated quality jobs. Present as a diff against the existing workflow:
# Add to .github/workflows/ci.yml
phpstan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Run PHPStan
run: ./vendor/bin/phpstan analyse --memory-limit=512M --error-format=github
pint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Check code style
run: ./vendor/bin/pint --test
rector:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Check Rector
run: ./vendor/bin/rector process --dry-run
PHPStan supports --error-format=github which creates inline annotations on PRs.
Always recommend this format for CI:
./vendor/bin/phpstan analyse --error-format=github
Recommend branch protection settings:
Branch: main
- Require status checks to pass:
- phpstan
- pint
- rector
- tests
- Require PR reviews: 1
- Dismiss stale reviews on new pushes
Add Composer cache to speed up CI runs:
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
When the user asks for a complete quality check, run all tools in sequence:
./vendor/bin/pint
./vendor/bin/rector process
./vendor/bin/pint
./vendor/bin/phpstan analyse --memory-limit=512M
Present a summary:
Quality Pass Complete
=====================
Pint: Fixed 23 files (style violations)
Rector: Applied 47 changes (modernisation)
Pint: Fixed 3 files (post-Rector cleanup)
PHPStan: 0 errors (level 5)
Status: All quality gates passing
| Rationalization | Reality |
|---|---|
| "Just baseline it, it's legacy code" | A baseline entry is a permanent, invisible ignore. Baseline to unblock CI, then file the issue — a baseline that only ever grows is a broken quality gate. |
| "Level 5 is good enough for now" | Levels only ever ratchet up when someone forces them. "For now" has been the level for two years in most codebases. |
| "Pint fixed it, so the code is reviewed" | Pint fixes spacing and ordering. It has no opinion on the god class it just reformatted. |
| "Rector's diff is huge but it's automated" | Automated does not mean correct. Rector changes behaviour on mixed, on magic methods, and on anything it cannot type. Read the diff. |
| "I'll fix the PHPStan errors after the feature" | The feature is what introduced them. Fixing them later means fixing them without the context you have right now. |
| "The error is a false positive" | Sometimes true. Then annotate it with @phpstan-ignore-next-line and a reason — never widen a type or add mixed to silence it. |
| "CI is red but it's unrelated to my change" | Then it was red before your change and nobody dealt with it. Red CI that everyone ignores is the same as no CI. |
"Adding @var fixed the error" | It silenced the error by lying to the analyser. If the annotation is wrong, you have made the codebase less safe, not more. |
@phpstan-ignore with no reason comment beside itmixed, array, removing a return type) used to clear an error--memory-limit=-1 added instead of finding what blew uppint --dirty used as the whole quality gatecomposer.json but absent from CIcontinue-on-error: truephpstan analyse exits 0 with no new baseline entriespint --test clean@phpstan-ignore carries a reason and an issue referencecontinue-on-error| File | Read When |
|---|---|
references/larastan-rules.md | Interpreting PHPStan errors, choosing error levels, custom rule patterns |
references/pint-presets.md | Configuring Pint presets, customising rules, .pint.json examples |
references/rector-sets.md | Choosing Rector rule sets, PHP migration rules, Laravel-specific rules |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub nasrulhazim/claude --plugin claude-toolkit43 skills in this plugin
/business-cardSVG business card designer that takes contact details and brand preferences, then produces 12 front design concepts with optional back designs, interactive HTML preview galleries, individual card showcases with front/back flip animation, and print-ready SVG exports with bleed area and crop marks. Supports horizontal and vertical orientations, six layout styles (minimal, corporate, creative, elegant, bold, tech), multiple color schemes, QR code placeholders, social media icons, and logo integration. Use this skill whenever the user asks to design a business card, create a name card, make visiting cards, or says "design business card", "buat kad bisnes", "create name card", "reka kad perniagaan", "design kad nama", "I need a business card for X".
/ci-cd-pipelineCI/CD pipeline builder for Laravel projects — extends Kickoff's existing GitHub Actions CI with continuous deployment pipelines (staging/production), Docker containerisation, secret management, and failure notifications. Generates Dockerfiles, docker-compose.yml, deployment configs for VPS via SSH, container registry push workflows, and leverages Kickoff's /bin scripts (deploy.sh, backup.sh, setup.sh) in automated workflows. Use this skill whenever the user asks to set up deployment pipelines, containerise a Laravel app, configure CD for staging or production, push Docker images to a registry, manage deployment secrets, add failure notifications to CI, or integrate /bin scripts with GitHub Actions. Triggers for requests like "set up CD pipeline", "deploy to staging automatically", "dockerise my Laravel app", "add Docker to my project", "push image to registry", "manage secrets in CI", "notify on failure", "extend CI with deployment", "setup deploy pipeline", "nak deploy guna GitHub Actions", "tambah Docker dalam project", "setup CD untuk staging", "nak auto deploy ke production", "dockerise Laravel app aku", "tambah notification kalau CI fail", "macam mana nak manage secrets dalam GitHub Actions", or "integrate bin scripts dengan CI". Assumes Laravel Kickoff as the baseline — GitHub Actions CI (Pint, PHPStan, Rector, Pest) and /bin scripts (deploy.sh, backup.sh) are already configured. This skill extends that baseline with CD, Docker, and deployment automation.
/courseware-builderInteractive HTML courseware builder — turns any technical topic, flow, or process into a CD-Courseware-style interactive slide deck with animated diagrams, step-by-step simulation, syntax-highlighted code examples, and key points panels. Use this skill whenever the user wants to create teaching materials, interactive slides, animated flow diagrams, or step-by-step technical walkthroughs — even if they say "buatkan slides untuk topik X", "jadikan courseware", "buat interactive tutorial", or "create a lesson on X". Also triggers for "convert my diagram to interactive slides" or "build a visual walkthrough for my training".
/debuggingSystematic debugging and error recovery for Laravel and PHP projects — a five-step triage that goes reproduce, localise, reduce, fix, guard. Covers reading a stack trace properly, bisecting with git, isolating a failure to the smallest reproducer, telling a symptom apart from a root cause, and closing every fix with a regression test. Includes Laravel-specific traps: N+1 masked as a timeout, queue jobs failing silently on the wrong connection, cache and config caches serving stale values, Livewire state desync, and eloquent/model events firing in unexpected order. Use this skill whenever the user reports something broken, failing, flaky, slow-then-erroring, or behaving differently in production than locally — including "this test is flaky", "why is this failing", "debug this error", "it works locally but not on staging", "find the root cause", "this exception makes no sense", "the queue job never runs", "bisect this regression", "kenapa error ni", "tolong debug", "test ni kejap pass kejap fail", "cari punca sebenar", "jalan kat local tapi tak jalan kat production", or "job queue tak jalan". Pairs with kickoff-pest-testing for the regression test and log-monitor for production-log-driven investigations.
/deploy-appDeploys a Kickoff-based Laravel application to its host by running `bin/deploy` over SSH, then verifies the release and knows what each way it can stop means. Use this skill whenever the user asks to deploy an app, push the latest code to production, check what commit production is running, bring a site back up after a failed deploy, or roll back — "deploy latest", "deploy the app", "tolong deploy", "deploy latest dulu", "push to production", "apa commit dekat production", "site down after deploy", "keluarkan maintenance mode", "rollback production", "kenapa 503". Covers the deploy command and its flags, the post-deploy verification checklist, the recovery path for each failure mode, and the production traps that have already cost time. Does NOT cover provisioning a new host from bare metal (`bin/provision-host`), CI/CD pipeline design (`ci-cd-pipeline`), or writing deploy operations.
/design-patternsPHP and Laravel design pattern advisor — suggests, implements, refactors, and reviews design patterns in your codebase. Use this skill whenever the user asks about which pattern to use, wants to refactor code to follow a pattern, needs a pattern implemented, or wants a code review focused on architecture and patterns. Triggers for requests like "suggest a pattern for this", "refactor this to use repository pattern", "implement the action pattern", "review my code architecture", "which pattern should I use here", "is this a good use of singleton", "how do I decouple this", "tolong suggest pattern", "refactor guna pattern", "review architecture code ni", "pattern mana sesuai untuk ni", "nak implement strategy pattern", or "code ni dah jadi god controller, macam mana nak fix". Covers GoF patterns adapted for PHP/Laravel, Laravel-specific patterns (Actions, Services, DTOs, Value Objects, Query Scopes, Form Requests, API Resources), SOLID principles, and anti-pattern detection. Works with cleaniquecoders/laravel-action for the Action pattern.
Other plugins' skills for the same job