con un clic
autofix
// Automatically find and fix code issues in the current branch. Iteratively verifies, plans fixes, and implements them with separate commits. Defers all review to the end.
// Automatically find and fix code issues in the current branch. Iteratively verifies, plans fixes, and implements them with separate commits. Defers all review to the end.
Configure autofix to only fix MAJOR and CRITICAL issues (unattended mode)
Review the conversation transcript for behavioral issues (misleading behavior, disobeyed instructions, instructions worth saving).
Assess whether the approach taken on a branch is the right way to solve the problem.
Make the stop hook non-blocking (remind once, then let the agent through)
Restore the stop hook to blocking mode (default: block up to 3 times before letting through)
Set the maximum number of times the stop hook will block before letting the agent through
| name | autofix |
| description | Automatically find and fix code issues in the current branch. Iteratively verifies, plans fixes, and implements them with separate commits. Defers all review to the end. |
| allowed-tools | Bash(git status *), Bash(git rev-parse *), Bash(git log *), Bash(git revert *), Bash(date -u +%Y-%m-%dT%H:%M:%SZ), Bash(echo "${GIT_BASE_BRANCH:-main}"), Read, Write, Agent, AskUserQuestion |
Iteratively verify the current branch for code issues, plan and implement fixes (each in a separate commit), and repeat until clean. At the end, present each fix for user review and revert any the user does not want.
Autofix requires a clean git state. Before proceeding, check for uncommitted changes:
git status --porcelain
If there are any untracked, staged, or unstaged changes, commit them first (or add them to .gitignore if they should not be tracked). Do NOT proceed until git status --porcelain produces no output.
initial_head): !git rev-parse HEADbase_branch): !echo "${GIT_BASE_BRANCH:-main}"If you do not already know what the changes on this branch are supposed to accomplish, STOP and ask the user before continuing.
Write a brief description of what the branch is trying to do. This helps the diff validation and fix agents distinguish intentional changes from issues.
Spawn a validate-diff Agent. Provide the base branch name and the problem description.
Based on the agent's response:
Repeat up to 10 times:
pre_iteration_head..reviewer/outputs/autofix/issues/{pre_iteration_head}.jsonlverify-and-fix Agent, providing the base branch ({base_branch}), the full current HEAD hash ({pre_iteration_head}), and the issue categories path: .reviewer/code-issue-categories.md if it exists, otherwise ${CLAUDE_PLUGIN_ROOT}/agents/categories/code-issue-categories.md.git rev-parse HEAD to pre_iteration_head.Important:
verify-and-fix agent task to finish--do not simply finish your response!After the loop ends:
git log --reverse --format="%H %s" {initial_head}..HEAD.reviewer/autofix/auto-accept.md exists. If it does, read it. This file contains free-text rules describing which kinds of fixes should be automatically accepted without prompting the user (e.g. "accept all naming fixes", "auto-accept anything in test files").AskUserQuestion call. Use one question per commit (up to 4 per call; if there are more than 4 commits, use multiple calls but still gather all answers before doing any git operations). Each question should:
git revert --no-edit {hash} for each, in reverse chronological order (newest first) to avoid conflicts..reviewer/outputs/autofix/issues/*.jsonl files).For this particular run of the autofix command, follow these adjustments from the user to the normal process:
$ARGUMENTS