Corriger les problèmes courants

VérifiéPrudence

Corrige automatiquement les problèmes mécaniques de validation des plugins (JSON, shebangs, permissions, hooks, frontmatter, settings). Demande approbation avant modifications.

Spar Skills Guide Bot
DeveloppementIntermédiaire
22/07/2026
Claude Code
#plugin-maintenance#auto-fix#json-cleanup#hooks#claude-code-plugins

Recommandé pour

Synthèse automatique

Cette skill répare automatiquement les problèmes mécaniques détectés lors de la validation d'un plugin Claude Code : JSON mal formé, shebangs manquants, permissions de scripts, types de hooks incompatibles, champs de frontmatter absents et clés par défaut de settings.json, avec confirmation obligatoire avant toute modification.

Points forts

  • Couvre un large éventail de corrections mécaniques précises (virgules finales JSON, shebang, chmod +x, conversion de hooks, frontmatter, settings.json)
  • Impose une porte d'approbation explicite : liste numérotée des changements puis attente de validation, avec approbation sélective possible
  • Vérifie chaque correctif après application et relance les validations pour confirmer la résolution
  • Produit un rapport final détaillé (avant/après par fichier, problèmes non corrigeables, résultats de re-validation)

Limites

  • Dépend de résultats de validation préalables : sans validation déjà exécutée, la skill ne fait que le signaler et suggère de la lancer d'abord
  • Les valeurs de secours du frontmatter sont des placeholders (description TODO, allowed-tools [Read]) qui exigent une reprise manuelle
  • La conversion des hooks prompt/agent en type command via echo conserve le texte en commentaire mais ne restitue pas leur comportement d'origine
Quand l'utiliser

À utiliser après une passe de validation de plugin, lorsque vous voulez corriger rapidement les problèmes mécaniques et laisser de côté ceux qui demandent un jugement humain.

Quand l'éviter

Ne l'utilisez pas comme premier outil sur un plugin non encore validé, ni pour des refactorisations de fond ou des choix de conception qui ne sont pas de simples corrections mécaniques.

Analyse de sécurité

Prudence
Score qualité86/100

The skill performs direct file modifications (JSON rewriting, shebang prepending, chmod +x, frontmatter edits, hook-type conversion) using Write/Edit/Bash. However, it requires an explicit interactive approval gate before any change, previews every modification, and is scoped to mechanical validation fixes with no network exfiltration, obfuscation, rm -rf, curl|sh, or safety-disabling behavior. The power tools are used for legitimate, documented purposes, so 'caution' rather than 'safe' is appropriate given the destructive-by-design nature.

Points d'attention
  • •Declares and uses Write, Edit, and Bash — powerful file-modification and shell tools
  • •Uses Bash for chmod +x and modification operations that alter files on disk
  • •No undo capability; fixes are destructive-by-design (only mitigated by the approval gate)
  • •Step 7 auto-populates settings.json agent key from first agent directory, a heuristic that could be wrong
Comment cette analyse est faite

Exemples

Fix after validation
I just ran the plugin validation and it flagged a bunch of issues. Auto-fix the common ones — but show me the list first before changing anything.
Repair hook types
My hooks.json uses prompt-type hooks on non-tool events. Use fix-common-issues to repair the plugin and tell me which entries you'd convert.
Clean up JSON and frontmatter
Fix common problems in this plugin: trailing commas in the JSON files, missing shebangs and exec bits on the .sh scripts, and any SKILL.md files missing frontmatter fields.

name: fix-common-issues author: JM Labs (Javier Montaño) description: > Automatically fixes mechanical issues found during plugin validation, including JSON formatting, missing shebangs, file permissions, hook types, frontmatter gaps, and settings.json defaults. ALWAYS asks for confirmation before modifying any files. Trigger: fix issues, auto-fix, fix common problems, repair plugin. allowed-tools:

  • Read
  • Write
  • Edit
  • Glob
  • Grep
  • Bash

Fix Common Issues

"Automate the mechanical so humans can focus on the meaningful."

Auto-remediates mechanical issues found during plugin validation: JSON syntax, missing shebangs, script permissions, incompatible hook types, missing frontmatter fields, and settings.json defaults. Presents all proposed changes for user approval before modifying any file.


Procedure

  1. Inventory fixable issues -- review findings from previous validation results. If no validation has been run yet, inform the user and suggest running validations first. Categorize issues into fixable (mechanical) vs. non-fixable (requires human judgment). List only mechanical issues for auto-fix.

  2. Detect and plan JSON trailing comma fixes -- scan all .json files for trailing commas (comma before ] or }). Plan: parse the JSON, reformat with standard 2-space indentation, write clean JSON back.

  3. Detect and plan missing shebang fixes -- scan all .sh files for missing #!/bin/bash (or #!/usr/bin/env bash) on line 1. Plan: prepend #!/bin/bash followed by a newline.

  4. Detect and plan non-executable script fixes -- check all .sh files in scripts/ and hooks/ for missing execute permission. Plan: mark for chmod +x.

  5. Detect and plan prompt-to-command hook conversion -- scan hooks/hooks.json for entries using type: "prompt" or type: "agent" on non-ToolUseContext events (any event other than PreToolUse, PostToolUse, PermissionRequest). Plan: convert to type: "command" using echo as the command, preserve the original prompt text as a comment in the command string.

  6. Detect and plan missing frontmatter field fixes -- scan all SKILL.md files for missing required frontmatter fields (name, description, allowed-tools). Plan:

    • Missing name: derive from parent directory name in kebab-case
    • Missing description: add placeholder "TODO: Add description with trigger phrases"
    • Missing allowed-tools: add default [Read]
  7. Detect and plan settings.json agent key fix -- check if settings.json exists but lacks an "agent" key. Plan: find the first agent directory under agents/, set "agent" to that path.

  8. Present all proposed changes for confirmation -- display a numbered list of every planned modification:

    • Change number
    • File to be modified
    • What will change (before/after summary)
    • Category (JSON fix, shebang, permissions, hook type, frontmatter, settings)

    STOP HERE AND WAIT FOR USER APPROVAL. Do not modify any files until the user explicitly confirms. The user may approve all, approve selectively by number, or reject.

  9. Apply approved fixes -- execute only the changes the user approved. For each fix:

    • Read the file before modification
    • Apply the change
    • Verify the result (e.g., JSON parses cleanly, shebang is on line 1)
  10. Re-validate after fixes -- run the relevant validation checks on modified files to confirm the issues are resolved. Report any fixes that did not resolve their target issue.

  11. Generate fix report -- produce a summary listing:

    • Total issues found vs. fixed vs. skipped
    • Per-file change log: file path, change type, before snippet, after snippet
    • Any issues that could not be auto-fixed (require manual intervention)
    • Re-validation results

Quality Criteria

  • [ ] No file is modified without explicit user confirmation -- the approval gate is mandatory.
  • [ ] Every fix is verified after application; a fix that breaks the file is detected and reported.
  • [ ] The before/after display is clear enough for the user to make an informed approval decision.
  • [ ] JSON fixes produce valid, parseable JSON -- verified by attempting to parse after writing.
  • [ ] Original file content is preserved except for the specific fix applied -- no unrelated reformatting.

Assumptions & Limits

  • Destructive by design (with consent). This is the only PQA skill that modifies files, and it does so only after explicit user approval.
  • Cannot fix semantic issues -- only mechanical ones. A vague description, a poorly ordered procedure, or a wrong anti-pattern requires human judgment.
  • Hook type conversion (prompt→command) is lossy -- the original prompt logic cannot be replicated in a shell command. The fix preserves the text as a comment but the behavior changes.
  • Re-validation after fixes runs only the checks relevant to the modified files, not the full audit pipeline.
  • Cannot undo applied fixes. If a fix causes a regression, the user must revert manually (e.g., via git).

Good vs Bad

Bad fix proposal:

Fix 1: Fix hooks.json

Missing: no file path, no before/after, no change type.

Good fix proposal:

Fix 1 [Hook Type] hooks/hooks.json
  Before: { "type": "prompt", "prompt": "Review safety" } on SessionStart
  After:  { "type": "command", "command": "echo 'Review safety'" } on SessionStart
  Reason: type:prompt requires ToolUseContext; SessionStart does not provide it.

Includes: fix number, category, file path, before/after with context, reason for the change.

Anti-Patterns

  1. Silent modification -- applying fixes without showing the user what will change. Every fix must be previewed.
  2. Fix-and-forget -- applying a fix without re-validating. The shebang fix means nothing if the file still has syntax errors.
  3. Destructive formatting -- reformatting an entire JSON file when only a trailing comma needed removal, destroying intentional formatting.
  4. Blind chmod -- making every file executable without checking if it is actually a script. Only .sh files in scripts/ and hooks/ should be modified.
  5. Overwriting custom frontmatter -- replacing existing valid frontmatter fields while adding missing ones. Only add what is missing; never overwrite existing values.

Edge Cases

  1. No fixable issues found -- report "No mechanical issues detected" and skip the approval gate. Do not create an empty fix report.
  2. User rejects all fixes -- acknowledge the rejection, do not apply any changes, and suggest manual fixes with specific guidance for each issue.
  3. File is read-only -- detect permission errors before batching fixes. Exclude read-only files from the proposal and note them as requiring manual permission changes.
  4. Conflicting fixes -- if two fixes target the same file and region (e.g., frontmatter field addition and frontmatter reformatting), merge them into a single coherent change rather than applying sequentially with potential conflicts.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/fix-common-issues-mrwakbdn/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/fix-common-issues-mrwakbdn' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/fix-common-issues-mrwakbdn/download' --output '.skill-downloads/fix-common-issues-mrwakbdn/SKILL.md.part' && mv '.skill-downloads/fix-common-issues-mrwakbdn/SKILL.md.part' '.skill-downloads/fix-common-issues-mrwakbdn/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/fix-common-issues-mrwakbdn/SKILL.md' && test -s '.skill-downloads/fix-common-issues-mrwakbdn/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/fix-common-issues' && cp -R '.skill-downloads/fix-common-issues-mrwakbdn' '.claude/skills/fix-common-issues'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/fix-common-issues-mrwakbdn'

openskills read 'fix-common-issues-mrwakbdn'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/fix-common-issues-mrwakbdn/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires