scripts
Skill4 starsChanged 4 months agoMITView on GitHub
Automate project tasks with Composer scripts — named commands, event hooks, and script composition — invoked with composer run-script. Use when the user wants a single script that runs several tools in sequence, such as lint then test then static analysis; the user wants to run a task automatically after a Composer install or update, such as clearing a cache or dumping config; the user wants a short, named command (like test or lint) that runs a longer tooling invocation. Keywords: composer, scripts, event-hooks, automation, tooling.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- sfalasca/agent-context-kittheir own version, first seen Aug 17, 2026
- Yungho/family-doctortheir own version, first seen Mar 23, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- Yungho/family-doctor★ 2same name
- sfalasca/agent-context-kit★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository119 other files it gives its agents.
- strategy-bitrix-d7-incrementalSkill
- strategy-explicit-over-magicSkill
- strategy-framework-conventionsSkill
- strategy-legacy-safe-editsSkill
- strategy-minimal-diffSkill
- strategy-no-untested-refactorSkill
- strategy-preserve-public-apiSkill
- strategy-readonly-immutabilitySkill
- strategy-security-firstSkill
- strategy-test-drivenSkill
- openapiSkill
- paginationSkill
- rest-designSkill
- versioningSkill
- cqrsSkill
- dependency-inversionSkill
- hexagonalSkill
- repository-patternSkill
- service-layerSkill
- bitrixSkill
- findings-reportSkill
- laravelSkill
- performanceSkill
- phpSkill
- project-analysisSkill
- refactoringSkill
- roi-prioritizationSkill
- securitySkill
- stack-detectionSkill
- cache-layersSkill
- component-engineSkill
- d7-eventsSkill
- d7-loaderSkill
- d7-orm-queriesSkill
- iblock-elementsSkill
- kernel-main-moduleSkill
- localizationSkill
- controllersSkill
- ormSkill
- validationSkill
- controllersSkill
- query-builderSkill
- routingSkill
- autoload-psr4Skill
- dependency-managementSkill
- connection-poolingSkill
- mysql-indexingSkill
- redisSkill
- transactionsSkill
- ci-github-actionsSkill
- deployment-strategiesSkill
- docker-phpSkill
- env-configSkill
- associationsSkill
- entities-mappingSkill
- orm-basicsSkill
- entity-apiSkill
- module-developmentSkill
- routing-controllersSkill
- formsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 62
Do not use Composer scripts as the primary orchestrator for a complex, multi-stage build with parallelism and dependencies between targets.
- Distinctive: line 63
Do not put application runtime logic in a Composer script.
- Very specific: line 77
Add one script per tool under scripts, e.g.
- Very specific: line 79
Add a "check" script whose array calls @lint, @analyse, and @test in order so one command runs the whole gate.
- Very specific: line 81
Call composer check as the single quality step in the CI workflow.
- Very specific: line 85
Add a scripts-descriptions block so composer run-script --list explains what each script does for new contributors
- Very specific: line 87
When a script needs real PHP logic, reference a static method callable ("App\\Composer\\Hooks::postInstall") instead of packing logic into …
- Distinctive: line 114
Not applicable — no I/O, auth, or untrusted input.
≈ “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
<!-- generated: do not edit — source: knowledge/atoms/composer/scripts/ --><!-- schema: atomVersion=3 skillVersion=2 graphVersion=1 --><!-- compile: @php-skills/compiler v1.0.0 (deterministic build) -->Composer Scripts
When to use
- The user wants a single script that runs several tools in sequence, such as lint then test then static analysis.
- The user wants to run a task automatically after a Composer install or update, such as clearing a cache or dumping config.
- The user wants a short, named command (like test or lint) that runs a longer tooling invocation.
When NOT to use
- Do not use Composer scripts as the primary orchestrator for a complex, multi-stage build with parallelism and dependencies between targets.
- Do not put application runtime logic in a Composer script; scripts run at the developer or CI command line, never per HTTP request.
Core guidance
- Compose scripts by referencing them with @ — Build a pipeline by listing sub-commands in an array and calling other scripts with
an
@prefix, e.g. acheckscript that runs@lint,@analyse, and@test. - Subscribe automation to lifecycle events — Attach automation to the exact lifecycle event it belongs to, using
post-install-cmd,post-update-cmd, orpost-autoload-dumprather than expecting developers to run it by hand. - Define named scripts under the scripts key — Add commands under the top-level
scriptskey in composer.json, mapping a name to a command or an array of commands, then run them withcomposer <name>.
Quick recipe
- Add one script per tool under
scripts, e.g."lint","analyse", and"test", each pointing at its binary invendor/bin. (verify:composer testruns the test suite on its own) - Add a
"check"script whose array calls@lint,@analyse, and@testin order so one command runs the whole gate. (verify:composer checkruns lint, analyse, and test in sequence and stops on the first failure) - Call
composer checkas the single quality step in the CI workflow. (verify: The CI job runscomposer checkand fails the build if any sub-step exits non-zero)
Best practices
- Add a
scripts-descriptionsblock socomposer run-script --listexplains what each script does for new contributors - When a script needs real PHP logic, reference a static method callable
(
"App\\Composer\\Hooks::postInstall") instead of packing logic into a shell string
Anti-patterns
| Anti-pattern | Why it fails | Do instead |
| Duplicating the same command across scripts | The duplicated flags drift apart over time, so different entry points run subtly different checks. | Define the command once and reference it from aggregate scripts with an @ prefix. |
| Cramming logic into an inline php -r string | Inline code is unreadable, untestable, and breaks across shells due to quoting differences. | Move the logic into a class method and reference it as a static-method callable from the script. |
| Hardcoding secrets into a script command | composer.json is committed to version control, so any secret in a script is leaked to everyone with repo access. | Read secrets from environment variables inside the script and inject them through the CI secret store. |
See references/anti-patterns.md.
Common mistakes
- Script name collides with a Composer command — Naming a script after a built-in command like
installorupdatesilently overrides that command. Fix: Name scripts with task-specific verbs (test,lint,check) and never reuse a reserved Composer command name. - Post-install hook fails under --no-dev — A
post-install-cmdthat calls a dev-only tool crashes when production runscomposer install --no-dev. Fix: Guard dev-only steps so they skip when the tool is missing, or move them to a dedicated dev-only script not bound to install. - Chained shell command hides a failure — Joining sub-commands with a shell pipe or a stray
|| truecan make a failing step report success. Fix: List sub-commands as separate array entries so Composer stops on the first non-zero exit, and avoid|| trueon quality gates.
Version notes
- Composer 2 keeps run-script and adds exec (PHP >=7.4) — Composer 2 continues to run named scripts via
composer <name>orcomposer run-script <name>, and addscomposer execto run vendor binaries without defining a script.
Security
- Not applicable — no I/O, auth, or untrusted input.
Testing
- Activation and decision behavior are verified in
eval/scenarios/composer/scripts.yaml.
Additional resources
- references/anti-patterns.md
- references/core.md
- references/examples.md
- references/pitfalls.md
- references/recipes.md
- references/version-differences.md
Knowledge graph
Related: composer/dependency-management, psr/psr12-coding-style
<!-- graph-fragment: graph/fragments/composer/scripts.yaml -->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.

