.config/claude/skills/bdloop/SKILL.md
execute-review-fix loop until review passes
npx skillsauth add jm96441n/dotfiles .config/claude/skills/bdloopInstall 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.
Self-correcting feedback loop: execute ready bd issues, review the resulting code, create fix issues from review findings, and re-execute until the review passes clean. Combines /bdexecplan, the review agent, and /bdplan into an automated quality loop.
$ARGUMENTS
Optional: beads epic ID to scope which issues to work on. Passed through to /bdexecplan, which uses bd ready --parent for epic-scoped execution.
bdloop [epic-id]
├── Pre-loop: capture jj baseline, verify ready work exists
│
├── Iteration N:
│ ├── Record iteration baseline (jj log -r @ --no-graph -T 'change_id')
│ ├── /bdexecplan [epic-id]
│ ├── Check for changes since baseline (jj log)
│ ├── Review iteration changes (review agent, scoped to diff)
│ ├── Evaluate findings:
│ │ ├── No Critical + No Recommendations → exit (success)
│ │ └── Has Critical or Recommendations → /bdplan [findings]
│ └── Verify new ready issues exist for next iteration
│
└── Final summary report
Record the current jj change ID before any work begins:
jj log -r @ --no-graph -T 'change_id ++ "\n"'
Store this as LOOP_BASELINE — used to scope the final summary.
bd ready
If an epic ID is provided, check ready work with bd ready --parent [epic-id] --json. Otherwise, use bd ready --json. If nothing is ready, exit immediately with a message — there is nothing to do.
Initialize iteration counter to 0 and max iterations to 5.
Repeat until a stopping condition is met:
Increment the iteration counter. Record the current jj change ID:
jj log -r @ --no-graph -T 'change_id ++ "\n"'
Store as ITER_BASELINE for this iteration.
Output an iteration header:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⟳ ITERATION [N] of 5
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Invoke /bdexecplan with the epic argument:
Skill("bdexecplan", args="[scope]")
This runs all ready issues in the scope through /bdexecissue.
After execution completes, check whether any new commits were produced:
jj log -r '$ITER_BASELINE::@ ~ $ITER_BASELINE' --no-graph
If no new changes exist since the iteration baseline, exit the loop — execution produced nothing to review.
Invoke the review agent scoped to only this iteration's changes:
Task(
description="Review iteration [N] changes",
subagent_type="review",
prompt="Review the code changes made since jj change ID [ITER_BASELINE].
Use this command to see the diff:
jj diff --from [ITER_BASELINE] --to @
Use this command to see the commit log:
jj log -r '[ITER_BASELINE]::@'
Review all changed files thoroughly for correctness, security, best practices, error handling, and architecture."
)
Parse the review agent's response. Count findings by category:
Stopping condition: exit the loop if zero Critical AND zero Recommendations.
Output an evaluation card:
┌─ REVIEW RESULT (Iteration [N]) ──────
│ Critical: [count]
│ Recommendations: [count]
│ Suggestions: [count]
│ Verdict: [PASS / NEEDS FIXES]
└───────────────────────────────────────
If PASS, exit the loop.
If there are Critical or Recommendation findings, invoke /bdplan to create fix issues. Pass the review findings as the argument so bdplan can structure them into actionable issues:
Skill("bdplan", args="Fix issues from review iteration [N]:
[paste Critical and Recommendation findings here, not Suggestions]")
bd ready
If no new ready issues were created for the scoped epic (or globally when unscoped), exit the loop — there is nothing more to execute.
Oscillation check: If the findings in this iteration are substantially similar to the previous iteration's findings, exit the loop with a warning — fixes are not converging. Compare finding descriptions; if >50% overlap, treat as oscillating.
Loop back to Step A for the next iteration.
If the iteration counter reaches 5, exit the loop regardless of review status. Output a warning:
⚠ MAX ITERATIONS (5) REACHED — exiting loop.
Review still has findings. Manual attention needed.
After exiting the loop (for any reason), output a summary:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
BDLOOP COMPLETE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Iterations: [N]
Issues executed: [total count across all iterations]
Exit reason: [clean review / no changes / no new issues /
max iterations / oscillating fixes / no ready work]
Iteration breakdown:
1: Executed [X] issues, review found [Y] critical, [Z] recommendations
2: Executed [X] issues, review found [Y] critical, [Z] recommendations
...
Remaining suggestions (informational):
- [any Suggestion-level findings from final review]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Any of these triggers an exit:
| Condition | Exit Reason |
| ---------------------------------------------- | ---------------------------------- |
| Zero Critical + zero Recommendations in review | clean review |
| No new commits after /bdexecplan | no changes |
| No new ready issues after /bdplan | no new issues |
| Iteration counter reaches 5 | max iterations |
| Findings repeat across consecutive iterations | oscillating fixes |
| No ready work at start of loop | no ready work |
| Review agent fails/errors | review error (exit with warning) |
review error reason. Report what's known and recommend manual review.bd ready returns nothing (or nothing matching scope) at any point, exit cleanly.oscillating fixes. The fixes are not converging and human judgment is needed.no new issues since nothing can progress./bdexecplan handles execution, review agent handles review, /bdplan handles planningtools
Protocol for properly ending a coding session - ensures all work is committed, pushed, and handed off correctly.
tools
Prefer Jujutsu (jj) over git for version control. Use squash workflow pattern where commits are described first, then changes are made in a scratch child commit and squashed into the parent.
development
# Jira Skill Guidelines for creating and managing Jira issues for HashiCorp projects. ## InfraGraph Project (IG) ### Project Information - **Project Key**: `IG` - **Team Field**: `customfield_10001` - **Default Team Value**: `"InfraGraph-Graph Engine"` ### Creating Issues When creating Jira issues for the InfraGraph project, always include the team field: ```python jira_create_issue( project_key="IG", summary="Task summary", issue_type="Task", description="Task description
development
Write Gremlin graph traversal queries for Neptune using the gremlin-go driver patterns in this codebase