laravel-pint-patterns
Skill4 starsChanged 5 months agoMITView on GitHub
Laravel Pint code style patterns — autofix vs check-only modes, php_unit_method_casing rule behavior, fully_qualified_strict_types import rewriting, PHPStan constant() indirection for version-conditional constants, and two-pass idempotency. Use when setting up or running Pint in a Laravel project, encountering pre-commit hook failures, or navigating PHPStan analysis on PHP version-conditional class constants. Call for Pint pre-commit setup, PHP 8.4 deprecation constant workarounds, or PHPStan level 5 clean CI.
In this repository101 other files it gives its agents.
- ai-video-understandingSkill
- apple-foundation-modelsSkill
- arch-dddSkill
- arch-decision-recordsSkill
- arch-diagramsSkill
- arch-eventsSkill
- arch-mvp-roadmapSkill
- arch-python-modernSkill
- aws-app-runnerSkill
- aws-cicd-patternsSkill
- aws-security-hardeningSkill
- azure-functions-python-v2Skill
- azure-identity-m2m-authSkill
- azure-service-bus-messagingSkill
- azure-workflow-execution-modelsSkill
- caddy-tls-proxySkill
- compliance-frameworksSkill
- design-system-workflowSkill
- dev-debugging-strategiesSkill
- dev-standardsSkill
- docker-python-poetrySkill
- docker-pythonSkill
- fastapi-patternsSkill
- ffmpeg-laravel-videoSkill
- formik-yup-react-nativeSkill
- frontend-accessibilitySkill
- frontend-angular-aiSkill
- frontend-angularSkill
- frontend-angular-toolingSkill
- frontend-design-systemsSkill
- frontend-material-chatSkill
- frontend-material-design-3Skill
- frontend-svelteSkill
- gcp-cicd-patternsSkill
- gcp-cloud-runSkill
- gcp-cloudsql-infrastructureSkill
- gcp-finopsSkill
- gcp-observabilitySkill
- gcp-security-hardeningSkill
- github-actions-cicdSkill
- healthkit-biofeedbackSkill
- infra-terraformSkill
- ios-app-qualitySkill
- ios-audio-hapticsSkill
- jest-nestjs-testingSkill
- langchain-azure-openai-patternsSkill
- laravel-auth-hardeningSkill
- laravel-ci-mysqlSkill
- laravel-mix-webpackSkill
- laravel-modern-patternsSkill
- laravel-s3-storageSkill
- laravel-sail-dockerSkill
- mobile-app-deploymentSkill
- mobile-e2e-testingSkill
- mobile-offline-syncSkill
- mobile-push-notificationsSkill
- mobile-video-uploadSkill
- mongodb-asyncmongoclient-patternsSkill
- mongodb-atlas-patternsSkill
- nestjs-patternsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 43
When enabled, Pint hoists \Vendor\Class::CONST FQN literals to use imports.
- Very specific: line 68
Run vendor/bin/pint once across the entire codebase and commit as a standalone style: commit before turning on pint --test as a CI gate.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Laravel Pint Patterns
Code style automation patterns for Laravel Pint, including mode semantics, auto-rewrite rules, and PHPStan integration.
When to Use
- Setting up Pint in a new Laravel project
- Resolving pre-commit hook failures from Pint rewrites
- Writing PHPUnit test method names that survive Pint
- Working around PHP version-conditional constants under PHPStan
- Adopting a lint gate on a codebase with existing style debt
Pint Mode Semantics
Laravel Pint wraps PHP-CS-Fixer with two modes:
| Command | Behavior |
./vendor/bin/pint | Autofix — rewrites files in place |
./vendor/bin/pint --test | Check-only — reports violations, no writes, non-zero exit on failure |
./vendor/bin/pint <file> | Autofix a single file |
The pre-commit hook typically runs pint --test. When the hook fails, run pint (no flag) locally to autofix, then re-stage.
Two-Pass Idempotency
Pint is not guaranteed to be idempotent in a single pass — some rules' fixes expose other rules' violations. After running vendor/bin/pint, run vendor/bin/pint --test immediately. If it reports failures, run pint again until the state stabilizes. Without this, CI can fail after a single local pass that appeared clean.
Same applies to PHP-CS-Fixer, Rector, and other AST-rewriting formatters.
php_unit_method_casing Rule
When pint.json includes '@PHPUnit75Migration:risky', Pint enforces snake_case PHPUnit method names. camelCase embedded in test description text (referencing SDK method names like handleSubscriptionUpdated) is rewritten automatically. Writing snake_case from the start avoids the pre-commit-fail → autofix → restage round-trip. Confirm this rule is in the project's pint.json before assuming it applies.
fully_qualified_strict_types Rule
When enabled, Pint hoists \Vendor\Class::CONST FQN literals to use imports. Run ./vendor/bin/pint <file> after any manual edit introducing FQN literals to apply the rewrite before committing. See reference.md for a before/after example.
PHPStan constant() Indirection
Version-conditional class constants produce PHPStan errors when a class that doesn't exist on the CI PHP version appears in a ternary:
// PHPStan cannot resolve Pdo\Mysql::ATTR_SSL_CA on PHP 8.2 CI:
$attr = defined('Pdo\\Mysql::ATTR_SSL_CA')
? \Pdo\Mysql::ATTR_SSL_CA // PHPStan fails here on PHP 8.2
: PDO::MYSQL_ATTR_SSL_CA;Route both branches through constant() so PHPStan sees them as dynamic strings:
$attr = defined('Pdo\\Mysql::ATTR_SSL_CA')
? constant('Pdo\\Mysql::ATTR_SSL_CA') // PHPStan: dynamic string, passes
: constant('PDO::MYSQL_ATTR_SSL_CA');This avoids adding ignoreErrors entries to phpstan.neon for cases that are correct at runtime.
Adopting a Lint Gate on an Existing Codebase
Run vendor/bin/pint once across the entire codebase and commit as a standalone style: commit before turning on pint --test as a CI gate. Future PRs keep only their own changes Pint-clean, rather than a first PR with 1400 legacy-formatting lines mixed into the diff.
Anti-Patterns
| Anti-Pattern | Pattern |
pint --test --dirty in CI | --dirty checks only working-tree changes; CI checkouts have no unstaged changes — exit 0 every time, lint gate silently disabled. Use pint --test (full tree) |
Bypassing Pint with --no-verify | Run pint locally to autofix, then re-stage |
| Writing camelCase PHPUnit method names in Pint+PHPUnit75Migration projects | Write snake_case from the start |
Adding ignoreErrors to phpstan.neon for version-conditional constants | Use constant('FQCN::NAME') indirection instead |
| Assuming Pint is idempotent in one pass | Run pint --test after pint to confirm idempotency |
See reference.md for PHP tooling map (format/lint/type-check/test/refactor) and Larastan level guidance.
Related
laravel-ci-mysql— CI integration context where thepint --test --dirtylint-gate-silently-disabled bug surfacesgithub-actions-cicd— PHP/Laravel multi-job CI workflow shape that wraps Pint as the lint step
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

