PHPStan Error Resolver

VerifiedSafe

Automatically analyzes PHPStan errors and fixes them in batches of five, looping until zero errors or stagnation. Helps maintain a typed PHP codebase without repetitive manual intervention.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#phpstan#static-analysis#php#error-resolution#automated-fix

Recommended for

Automated summary

Automatically resolves PHPStan errors by analyzing and fixing type issues in batches, looping until zero errors or stagnation.

Strengths

  • Greatly reduces manual effort for fixing PHPStan errors
  • Batch processing with delegation to a sub-agent for each correction
  • Generates a final report with error counts and success rate
  • Handles stagnation and maximum iteration limits gracefully

Limitations

  • Only works with PHPStan, not other static analysis tools
  • Automatic fixes may introduce new errors if context is misinterpreted
  • Limited to type-related errors and does not address deep architectural issues
When to use it

Use this skill when your PHP project has a large number of PHPStan errors you want to fix systematically in an iterative manner.

When not to use it

Avoid using it when errors require deep architectural changes or when each fix must be manually reviewed for security or business logic reasons.

Security analysis

Safe
Quality score90/100

The skill uses Bash only to run PHPStan (vendor binary) with safe arguments and uses Edit to fix type errors; no destructive, exfiltration, or obfuscated commands.

No concerns found

How this analysis is made

Examples

Fix all PHPStan errors
/qa:phpstan
Resolve PHPStan errors batch by batch
Run the PHPStan error resolver workflow to fix type errors in the codebase, correcting 5 errors per iteration.
Iterative PHPStan resolution with report
Automatically resolve PHPStan errors using the resolver skill, then generate a summary of fixes.

name: phpstan-resolver description: > Résout automatiquement les erreurs PHPStan en analysant et corrigeant les problèmes de types. Boucle jusqu'à zéro erreur ou stagnation. allowed-tools: [Task, Bash, Read, Edit, Grep, Glob] model: claude-opus-4-1-20250805

PHPStan Error Resolver Skill

Instructions à Exécuter

IMPORTANT : Exécute ce workflow étape par étape :

Usage

/qa:phpstan

Configuration

PHPSTAN_BIN="./vendor/bin/phpstan"
PHPSTAN_CONFIG="phpstan.neon"  # ou phpstan.neon.dist
ERROR_BATCH_SIZE=5
MAX_ITERATIONS=10

Workflow

Initialisation

Créer les tâches du workflow :

Utiliser TaskCreate pour chaque phase :

TaskCreate #1: Vérifier environnement PHPStan
TaskCreate #2: Exécuter analyse initiale (--error-format=json)
TaskCreate #3: Grouper erreurs par fichier
TaskCreate #4: Boucle de résolution (max 10 itérations)
TaskCreate #5: Générer rapport final

Important :

  • Utiliser activeForm (ex: "Vérifiant environnement PHPStan", "Résolvant erreurs")
  • La tâche #4 peut prendre du temps (boucle jusqu'à 10 itérations)
  • Chaque tâche doit être marquée in_progress puis completed

Pattern d'exécution pour chaque étape :

  1. TaskUpdate → tâche en in_progress
  2. Exécuter l'étape
  3. TaskUpdate → tâche en completed

Spécial pour la boucle de résolution (tâche #4) :

  • Marquer en in_progress au début de la boucle
  • Ne marquer en completed qu'à la fin (0 erreur, stagnation, ou max itérations)
  • Le statut reste in_progress pendant toutes les itérations

Étapes

  1. Vérifier environnement PHPStan
  2. Exécuter analyse initiale (--error-format=json)
  3. Grouper erreurs par fichier
  4. Boucle de résolution :
    • Déléguer corrections à @phpstan-error-resolver
    • Re-exécuter PHPStan
    • Répéter jusqu'à 0 erreur ou stagnation
  5. Générer rapport final

Délégation

Utilise l'agent @phpstan-error-resolver pour les corrections :

  • Batch de 5 erreurs par fichier par itération
  • Maximum 10 itérations

Rapport

details:
  total_errors_initial: X
  total_errors_final: Y
  errors_fixed: Z
  success_rate: "X%"
  iterations: N

Task Management

Progression du workflow :

  • 5 tâches créées à l'initialisation
  • La tâche #4 (boucle) reste in_progress pendant toutes les itérations
  • Chaque tâche suit le pattern : in_progress → exécution → completed
  • Utiliser TaskList pour voir la progression (notamment pour la boucle longue)
  • Les tâches permettent à l'utilisateur de suivre la résolution progressive des erreurs

References

Error Handling

  • PHPStan non trouvé → ARRÊT
  • Config absente → ARRÊT
  • Stagnation → ARRÊT avec rapport
  • Max itérations → ARRÊT avec rapport

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/phpstan-error-resolver-mm5t8c06/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/phpstan-error-resolver-mm5t8c06' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/phpstan-error-resolver-mm5t8c06/download' --output '.skill-downloads/phpstan-error-resolver-mm5t8c06/SKILL.md.part' && mv '.skill-downloads/phpstan-error-resolver-mm5t8c06/SKILL.md.part' '.skill-downloads/phpstan-error-resolver-mm5t8c06/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/phpstan-error-resolver-mm5t8c06/SKILL.md' && test -s '.skill-downloads/phpstan-error-resolver-mm5t8c06/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/phpstan-resolver' && cp -R '.skill-downloads/phpstan-error-resolver-mm5t8c06' '.claude/skills/phpstan-resolver'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/phpstan-error-resolver-mm5t8c06'

openskills read 'phpstan-error-resolver-mm5t8c06'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/phpstan-error-resolver-mm5t8c06/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills