Compiler une compétence en harness déterministe

VérifiéSûr

Compile une compétence procédurale stable en script déterministe et réduit le SKILL.md à un mince bootloader, avec partition code/LLM/humain.

Spar Skills Guide Bot
DeveloppementAvancé
31/10/2026
Claude CodeCursor
#skill-compilation#agent-skills#refactoring#code-generation#harness-testing

Recommandé pour

Synthèse automatique

Cette méta-skill transforme une procédure d'agent stabilisée en un script déterministe placé sous scripts/agent_skills/ et réduit la SKILL.md d'origine à un mince bootloader.

Points forts

  • Une porte de préparation explicite refuse de compiler les procédures instables ou majoritairement discrétionnaires, avec nommage de la condition qui échoue.
  • La table de partition Code / LLM / Humain est produite et montrée à l'utilisateur avant toute écriture de code, ce qui rend explicites les décisions de frontière.
  • Le harnais est cadré concrètement : stdlib uniquement, racine résolue relativement au script, lecture seule par défaut, `--json`, marqueur `needs_llm_judgment` en cas d'ambiguïté.
  • Le processus inclut une preuve de parité comportementale via vitest puis les commandes de synchronisation et de validation du dépôt.

Limites

  • Suppose une arborescence de dépôt précise (`.agent/`, `scripts/`, `.cursor/skills/`) et des scripts internes (sync_assistant_trees.py, check_agent_frontmatter.py) qui ne sont pas fournis ici.
  • Aucun mécanisme automatique d'évaluation de la stabilité : l'agent doit apporter lui-même les preuves (transcripts répétés, ligne dans l'inventaire) et la décision reste subjective.
  • Le document s'appuie sur des fichiers de référence externes (`.agent/SKILL_COMPILATION.md`) pour les règles de partition, si bien que les critères complets ne sont pas autonomes.
Quand l'utiliser

À mobiliser lorsqu'une skill purement procédurale est exécutée à l'identique depuis plusieurs fois et que l'on veut décharger le modèle des étapes mécaniques au profit d'un script testé.

Quand l'éviter

À éviter pour les skills où le jugement domine (revue de sécurité, débogage systématique, revue par sous-agents) ou dont la procédure change encore à chaque exécution.

Analyse de sécurité

Sûr
Score qualité87/100

The content is a meta-skill describing how to convert a repetitive prose skill into a deterministic helper script. It contains no destructive commands, no credential or token handling, no outbound network/exfiltration, no encoded payloads, and no attempts to override the auditor or the host agent's safety behavior. The only executable surface is standard local test/lint/sync commands and code generation constrained to the repository, with explicit prohibitions on give the harness commit/push/tag or external-export authority. This is normal, conservative engineering guidance.

Points d'attention
  • •Skill directs the agent to author new scripts under `scripts/agent_skills/` and execute repo-local commands (`npm run test:run`, `npm run lint`, `python scripts/sync_assistant_trees.py`, `python scripts/ci/check_agent_frontmatter.py`). This is bounded developer tooling: stdlib-only, repo-relative paths, read-only by default, and it explicitly forbids the generated harness from commit/push/tag or external export. No network fetches, no secret handling, no destructive paths, no obfuscation.
  • •References several repository-specific governance documents (`.agent/SKILL_COMPILATION.md`, `.agent/SKILL_INVENTORY.md`, `.agent/SKILL_CHANGE_AST10_REVIEW.md`) without including them; an agent following the skill blindly in a repo lacking those files would fail or improvise. Availability/portability concern rather than a safety one.
Comment cette analyse est faite

Exemples

Compile a stable skill
The `.cursor/skills/release-notes/SKILL.md` procedure has run identically for the last eight releases. Compile it into a script harness under scripts/agent_skills/ — show me the Code/LLM/Human partition table before writing any code.
Check the readiness gate
Does `.cursor/skills/changelog-sync/SKILL.md` pass the compile readiness gate? If not, tell me which condition fails and what evidence I still need to gather.
Prove parity after compiling
Add a vitest spec for scripts/agent_skills/check-type-sync.mjs asserting it matches the old prose procedure on a realistic fixture, then run npm run test:run plus the sync and frontmatter checks.

/compile-skill — Lower a stable skill into a deterministic harness

Use when a procedural skill has crystallized and agents keep paying the reasoning tax to re-derive the same steps. Compiles the fixed parts into a script under scripts/agent_skills/ and shrinks the skill to a thin bootloader. Pattern and partition rules: .agent/SKILL_COMPILATION.md.

Inputs

  • Target skill: .cursor/skills/<name>/SKILL.md (or a command). If the user did not name one, list uncompiled candidates with the stability evidence you have and ask — do not pick silently.
  • Stability evidence: repeated transcripts running the same procedure, or a row in .agent/SKILL_INVENTORY.md with real usage.

Readiness gate

Compile only if all hold. If any fails, say "not ready" and name the failing condition instead of compiling an unstable procedure.

  • Same sources, filters, and state every run — no per-run re-planning.
  • At least one step is pure mechanics (path resolution, parsing, package.json / CHANGELOG.md rewrites, IPC or API-type checks, lint/test invocation, report skeletons).
  • The judgment left over is nameable in a sentence or two ("choose the semver level").
  • The skill is not mostly judgment. systematic-debugging, karpathy-guidelines, security-review, and subagent-review have nothing to lower — leave them as prose.

Step 1 — Partition the steps

Produce this table before writing code, and show it to the user. It must agree with the partition rules in .agent/SKILL_COMPILATION.md:

| Owner | Gets | |-------|------| | Code | Known paths, parsing, semver math, file rewrites, IPC/API-type checks, lint/test invocation, report skeletons | | LLM | Ambiguous change classification, AC verdicts from messy evidence, PR narrative, bug hunting, UI/UX judgment | | Human | Commit, push, publish, release tagging, board transitions, consequential overrides |

If a step needs a heuristic to stay correct, it belongs to the LLM. Freezing judgment into rules is the main way this pattern fails.

Step 2 — Implement the harness

scripts/agent_skills/<name>.mjs   # or .py — match the surrounding script language
  • Match the neighbors: .mjs like scripts/check-type-sync.mjs and scripts/doctor.mjs for anything inspecting TypeScript, IPC, or package.json; Python like scripts/ci/*.py for agent-asset governance. No new runtime dependencies — Node stdlib or Python stdlib.
  • Resolve the repo root relative to the script file — no hardcoded absolute paths.
  • Read-only by default. Inspect/plan run free; writes need an explicit apply subcommand or --run.
  • Support --json for agents and a readable summary otherwise. Errors to stderr, non-zero exit.
  • Emit a needs_llm_judgment marker rather than guessing when evidence is ambiguous — that is the handoff back to the model.
  • The harness never commits, pushes, tags, or exports outside the repo.

Step 3 — Shrink the skill to a bootloader

Keep name first and a non-empty description in frontmatter, then keep only: when to use, Invoke (copy-pasteable commands), LLM judgment slots (numbered), Human authority, and Verify. Delete prose the harness now enforces.

Step 4 — Test

Add a vitest spec alongside the repo's other script tests and run:

npm run test:run

Assert behavioral parity with the prose procedure on at least one realistic fixture — that is the evidence the compile was lossless.

Step 5 — Sync and record

python scripts/sync_assistant_trees.py
python scripts/sync_assistant_trees.py --check
python scripts/ci/check_agent_frontmatter.py
python scripts/validate_cli_hub_skills.py   # when a CLI-hub skill changed
npm run lint

Then update .agent/SKILL_COMPILATION.md (new row in the compiled table), .agent/SKILL_INVENTORY.md (note the harness path, refresh Last reviewed), and apply .agent/SKILL_CHANGE_AST10_REVIEW.md.

Done when

  • Partition table was shown and the LLM slots are named in the bootloader.
  • Harness runs read-only by default, emits --json, and hands ambiguity back to the model.
  • Tests pass and demonstrate parity on a real case.
  • Sync, frontmatter, and lint are green; .cursor/ is canonical and .claude/ was regenerated.

Do not

  • Do not hand-edit .claude/ — it is generated from .cursor/ by sync_assistant_trees.py.
  • Do not give the harness commit/push/tag or external-export authority.
  • Do not add an npm dependency for a harness; stdlib only.
  • Do not claim numeric token savings; this repo has no per-session telemetry. Savings are structural.

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/compile-skill-into-deterministic-harness-mvda88yg/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/compile-skill-into-deterministic-harness-mvda88yg' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/compile-skill-into-deterministic-harness-mvda88yg/download' --output '.skill-downloads/compile-skill-into-deterministic-harness-mvda88yg/SKILL.md.part' && mv '.skill-downloads/compile-skill-into-deterministic-harness-mvda88yg/SKILL.md.part' '.skill-downloads/compile-skill-into-deterministic-harness-mvda88yg/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

Le fichier ne fournit pas un en-tête name/description exploitable pour cette procédure native. Le téléchargement reste disponible pour lecture ; utilisez le mode manuel ci-dessous.

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/compile-skill-into-deterministic-harness-mvda88yg/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