Quality tools

From event4u-app/agent-config · View interactive version

Quality tools is an AI agent skill from the GitHub repository event4u-app/agent-config. Use when PHPStan, Rector, or ECS output appears — \"phpstan says mixed\", type errors, \"fix code style\", \"run rector\" — even when Eloquent/Laravel/model code is also mentioned.

How to use this skill

Skill file

quality-tools

When to use

Use this skill whenever running or configuring code quality tools:

Modes

This skill is a router head. The cross-mode material — execution policy,

language detection, environment, output, gotchas — lives below. The per-tool

procedure bodies live in references/; load exactly the mode the detected

stack calls for.

| Detected stack | Mode body | Covers |

|---|---|---|

| PHP (.php changed) | CODE1 | Tool detection, PHPStan / ECS / Rector commands and flags, combined pipeline, config files, baseline policy, PHPStan error handling, testing framework, git-aware execution |

| JS/TS (.js / .ts / .tsx changed) | CODE3 | Detection, Biome, TypeScript type checking, Jest / Vitest, the JS/TS workflow sequence |

| Python (.py changed, or pyproject.toml) | CODE2 | Detection from pyproject.toml, Ruff, mypy, pytest, the workflow sequence, virtualenv and setup.cfg gotchas |

| Go (.go changed, or go.mod) | CODE2 | gofmt, go vet, golangci-lint where present, go test, the workflow sequence, vendor and build-tag gotchas |

More than one stack changed → load each mode body and run each pipeline.

The resolver decides which row applies, not the file extension alone.

resolve_toolchain returns the ecosystems it found and the quality commands

per ecosystem; the rows above name what those commands are. A TypeScript

repository resolves the ecosystem js, never typescript — the pack name and

the ecosystem label are different vocabularies.

Execution policy — on demand only, never proactive

NEVER RUN QUALITY TOOLS PROACTIVELY WHEN quality.local_auto_run IS
false OR MISSING (THE DEFAULT). DO NOT ASK WHETHER TO RUN THEM.
THE USER RUNS THEM MANUALLY. REMOTE CI IS THE AUTHORITATIVE GATE.

Toolchains differ per language and project and are often unknown to the

agent — discovering and running them burns time and tokens. Under the

default, exactly three triggers justify running a quality tool:

  1. Explicit ask this turn — the user says so or invokes /fix quality.
  2. Concrete CI failure — the remote pipeline reports a failing

check; run exactly that failing check to reproduce and fix it

(/fix:ci is the canonical flow).

  1. New-gate carve-out — the change itself introduces a NEW CI gate,

smoke test, or test file; it must run once locally to be proven.

quality.local_auto_run: true restores the legacy autonomous behaviour

(run the pipeline when work is ready for verification). When runs are

suppressed, the completion message says *"quality gates delegated to

remote CI"* — never that the tools passed.

Language detection

Detect which tools to run based on what files were changed:

# Check changed file extensions (diff against base branch)
git diff --name-only origin/main..HEAD | grep -E '\.(php)$'       # → PHP tools
git diff --name-only origin/main..HEAD | grep -E '\.(js|ts|tsx)$'  # → JS/TS tools

If both PHP and JS/TS files changed → run both pipelines.

Procedure

  1. Confirm a run is justified — see Execution policy above. No trigger, no run.
  2. Detect the stack from the changed files — see Language detection above.

2b. Inspect the project's own quality config before running anything. Read

the config files the detected stack actually ships (phpstan.neon,

ecs.php, rector.php, biome.json, tsconfig.json, the scripts block

of package.json) and the task/make wrapper if one exists. Never assume a

default ruleset, a default baseline, or a default command — the mode body

names where to look per stack. Running a tool against assumed config

produces findings the project never asked for.

  1. Load the matching mode body from the table in Modes and follow its

procedure. PHP → CODE0

§ Procedure: Run quality checks. JS/TS →

CODE0

§ JS/TS Quality Workflow.

  1. Both stacks changed → run both mode procedures; neither result excuses the

other.

  1. Report per Output format below.

Related rules and guidelines

CODE0 —

test-side rationalizations these tools cannot catch (e.g. "CI is red,

patch first, test later").


Execution environment

PHP tools

All PHP commands run inside the Docker container (make console or docker compose exec).

JS/TS tools

JS/TS commands run on the host or in a Node container, depending on the project setup:

  1. Check if a Makefile / Taskfile.yml has targets for linting/testing.
  2. Check if docker-compose.yml has a Node service.
  3. If neither → run on the host directly.

Output format

  1. Tool exit code and error count summary
  2. Fixed issues or remaining errors to address

Auto-trigger keywords

Gotcha

Do NOT

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.