src/skills/copilot-loop/SKILL.md
Loop autonome PR → Copilot review → handoff JSON → fixes → merge. Lance le polling automatique après un git push sur une branche feature. Zéro intervention utilisateur.
npx skillsauth add malikkaraoui/claude-atelier copilot-loopInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
🌬️ La Bise surveille la boîte aux lettres GitHub. Quand Copilot répond, elle lit, intègre, corrige et ferme la boucle. Sans un mot de l'utilisateur.
Loop autonome complet : PR feature → Copilot review automatique → handoff JSON → fixes → merge cible.
Lancer immédiatement après git push sur une branche feature + gh pr create.
Aussi déclenché automatiquement par /review-copilot — pas besoin d'appel manuel.
Le loop tourne en arrière-plan via ScheduleWakeup.
⚠️ Limitation :
ScheduleWakeupest session-scoped — si la session Claude se ferme (tab fermé, timeout), le réveil est perdu. Pour une utilisation mode nuit / autonome, utiliserCronCreateà la place (jobs persistants inter-sessions). Le skill/night-launchbascule automatiquement surCronCreate.
# Lire les paramètres depuis features.json (global ou projet)
FEATURES_FILE="${HOME}/.claude/features.json"
[[ -f ".claude/features.json" ]] && FEATURES_FILE=".claude/features.json"
python3 -c "
import json, os
f = '$FEATURES_FILE'
data = json.load(open(f)) if os.path.exists(f) else {}
params = data.get('params', {})
print('AUTO_MERGE=' + str(data.get('auto_merge_after_review', False)).lower())
print('TARGET_BRANCH=' + params.get('merge_target_branch', 'main'))
print('POLL_SEC=' + str(params.get('copilot_loop_poll_sec', 300)))
print('MAX_ATTEMPTS=' + str(params.get('copilot_loop_max_attempts', 12)))
" 2>/dev/null || echo -e "AUTO_MERGE=false\nTARGET_BRANCH=main\nPOLL_SEC=300\nMAX_ATTEMPTS=12"
PR_NUM=$(gh pr view --json number -q .number)
CURRENT_SHA=$(git rev-parse HEAD)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
LAST_HANDOFF=$(ls -t docs/handoffs/202*.json 2>/dev/null | grep -v _template | head -1 || echo "")
Appeler ScheduleWakeup avec :
delaySeconds: <copilot_loop_poll_sec> (défaut 300)reason: "Polling Copilot review PR #N (tentative 1/<max_attempts>)"prompt : le prompt de réveil ci-dessous (auto-suffisant)Prompt de réveil (template) — remplacer les variables :
Loop Copilot PR #[PR_NUM] branche [BRANCH] — tentative [X]/[MAX_ATTEMPTS].
Repo: [REPO].
Config: AUTO_MERGE=[auto_merge_after_review], TARGET=[merge_target_branch], POLL=[poll_sec]s.
1. Vérifier la review Copilot (via MCP GitHub si disponible, sinon fallback bash) :
— MCP (préféré) : appeler `get_pull_request(owner, repo, pullNumber)` → lire `.reviews[]`
— Fallback bash : gh pr view [PR_NUM] --json reviews -q '.reviews[] | select(.author.login | test("copilot")) | .commit.oid[:8]'
2. Si Copilot a reviewé le commit [CURRENT_SHA][:8] :
a. Lire les commentaires inline (via MCP si disponible, sinon fallback) :
— MCP (préféré) : appeler `get_pull_request_files` ou `gh api repos/[REPO]/pulls/[PR_NUM]/comments`
— Fallback bash : gh api repos/[REPO]/pulls/[PR_NUM]/comments
b. Créer docs/handoffs/[DATE]-[SLUG].json à partir de _template.json.
Champs minimum requis par validate-handoff.js :
- meta.date (YYYY-MM-DD), meta.type, meta.reviewedRange (sha..sha valides dans git)
- from.question (≥ 50 chars), from.filesToRead (≥ 1 fichier réel)
- response.model = "github-copilot-pr-reviewer"
- response.content = résumé structuré des commentaires (≥ 100 chars)
- integration.retained_implement, integration.verdict (total ≥ 100 chars)
c. Appliquer les fixes suggérés dans le code
d. Valider le handoff : node test/validate-handoff.js [HANDOFF_FILE]
e. Si valide :
git add [HANDOFF_FILE] [fichiers modifiés]
git commit -m "fix: appliquer review Copilot #[PR_NUM]"
git push
f. Vérifier CI : gh pr view [PR_NUM] --json statusCheckRollup
g. Si CI verte ET handoff valide :
- Si AUTO_MERGE=true :
gh pr merge [PR_NUM] --merge --delete-branch
git checkout [TARGET_BRANCH] && git pull
LOOP TERMINÉ ✅ — notifier l'utilisateur
- Si AUTO_MERGE=false :
"PR #[PR_NUM] prête à merger — CI verte, handoff valide. Merger dans [TARGET_BRANCH] ?"
3. Si Copilot n'a pas encore reviewé ce commit :
- Si tentative < [MAX_ATTEMPTS] → ScheduleWakeup [POLL_SEC]s (tentative X+1/[MAX_ATTEMPTS])
- Si tentative = [MAX_ATTEMPTS] → "Copilot n'a pas reviewé après [MAX_ATTEMPTS*POLL_SEC/60]min — merger manuellement ?"
Filets de sécurité :
- Ne jamais merger si CI échoue
- Ne jamais merger si handoff invalide (node test/validate-handoff.js retourne exit 1)
- Ne jamais merger si Copilot a des commentaires bloquants non traités
- Stopper après [MAX_ATTEMPTS] tentatives
"Loop Copilot activé sur PR #[N] — je surveille toutes les [POLL_SEC]s (max [MAX_ATTEMPTS] tentatives).
[Si AUTO_MERGE=true] Je mergerai automatiquement dans [TARGET_BRANCH] quand : Copilot reviewé ✓ + Handoff valide ✓ + CI verte ✓
[Si AUTO_MERGE=false] Je te notifierai quand la PR sera prête — merge manuel requis.
Je notifie au merge ou si timeout."
features.json en étape 1 — jamais hardcoder main ou les délaisauto_merge_after_review = false par défaut — opt-in explicitedata-ai
Tableau de contrôle des features claude-atelier (on/off, paramètres). Affiche l'état de chaque rail et permet de les activer/désactiver interactivement.
tools
Génère un handoff review structuré pour Copilot/GPT. Utiliser après une feature, un bug fix, ou quand > 100 lignes ont changé. Aussi déclenché automatiquement par §25.
testing
Ferme la boucle d'un handoff inter-LLM. Si response.content est null, va chercher les inline Copilot sur la PR GitHub associée et les retranscrit automatiquement. Puis classe les points, applique les fixes, génère l'intégration. Utiliser quand Copilot a reviewé une PR portant un handoff.
documentation
Onboarding interactif post-install. Vérifie la config, guide le setup du watchdog et du review-reminder, propose BMAD et QMD. Utiliser après 'npx claude-atelier init' ou quand l'utilisateur dit /atelier-setup.