agentleFS
cano721cano721/ai-harness/.agents/skills/fix-bug/SKILL.md

fix-bug

Skill1 starsChanged 4 months agoMITView on GitHub

Start a project-local bug investigation and repair workflow. Use when behavior is incorrect, regressed, unreliable, or producing an error; not for a planned feature, refactor-only work, speculative cleanup, or finding a cause without changing code (use investigate).

50 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use improvement, build-feature and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • kiminmonacoSkill

    improvement

    Guide for making improvements to existing ClaudeBar functionality using TDD. Use this skill when: (1) Enhancing existing features (not adding new ones) (2) Improving UX, performance, or code quality (3) User asks "improve X", "make Y better", or "enhance Z" (4) Small enhancements that don't require full architecture design For NEW features, use implement-feature skill instead.

    Also in 4 projects that use this

  • sirakinbSkill

    build-feature

    Autonomous task loop that picks ready tasks, implements them, updates progress.txt, commits, and repeats. Use when asked to 'build feature', 'run the loop', or 'implement these tasks'.

    Also in 7 projects that use this

  • SentrySkill

    write-tests

    Write tests following project conventions. Use when adding new tests or modifying existing ones.

    Also in 6 projects that use this

  • DockerSkill

    review-changes

    Review uncommitted or recently committed documentation changes for correctness, coherence, and style compliance. Use before creating a PR to catch issues. "review my changes", "review the diff", "check the fix before submitting", "does this look right".

    Also in 4 projects that use this

  • JasonPaffSkill

    implement-plan

    Execute implementation plan with structured tracking and validation using subagent architecture

    Also in 3 projects that use this

  • JetBrainsSkill

    create-plan

    Research the codebase and create an implementation plan with architecture notes, design document, and track decomposition. Use when starting a new feature or large change.

    Also in 4 projects that use this

The file

Files
SKILL.md

Fix Bug

This is a project adapter, not the source of project policy. Read these files in order before investigating or editing:

  1. AGENTS.md
  2. .ai-harness/workflows/fix-bug.md
  3. .ai-harness/workflows/bug-fix-graph.json
  4. The personas and .ai-harness/docs/ files selected by the workflow

The project workflow and graph are authoritative. They define evidence and reproduction requirements, the bug-fix brief and approval gate, regression policy, validation commands, review/repair loop, and escalation conditions.

Collect evidence without editing, then present the workflow-required bug-fix brief. Do not edit before explicit approval, or before the policy approval below when personal HM_APPROVAL is auto. After approval, follow the graph transitions and use configured project agents only for bounded responsibilities. A delegated agent must preserve the resolved personal delivery level: it takes precedence over “PR only, do not merge” in a delegation prompt and an instruction to stop at the PR does not override HM_DELIVERY_LEVEL or a matching HM_DELIVERY_LEVEL_REPOS entry. Delegate bounded work through the runner when the resolved level is merge or deploy.

When the request names an investigation report from the project investigate workflow (a Markdown file, usually under ~/.ai-harness/investigations/), read it first and take its symptom, reproduction conditions, and evidence as the triage and reproduce results: go from triage straight to the brief (the graph's investigation_report_provided edge) and cite the report in the brief instead of repeating them. With the runner, pass it as --investigation <report> on start. If the report has neither a reproduction nor equivalent evidence, run triage and reproduce as usual.

Project policy

Read git_policy (with the repository facts in merge_policy) and issue_policy from .ai-harness/harness.json. Read approval mode from HM_APPROVAL_REPOS (matching repository), then HM_APPROVAL, then default human in ~/.ai-harness/config. Ignore legacy manifest approval and tell the user once to move it to personal settings. The runner picks the node runtime from --runtime, then HM_RUNTIME_REPOS (matching repository), then HM_RUNTIME in ~/.ai-harness/config, then the calling CLI and integrations; pass --runtime only when the user asks for a specific CLI.

  • HM_APPROVAL: human (default) — present the brief and do not edit before explicit approval. auto — present the brief, record it in the PR body and run state (including the setting source), and continue without waiting, unless the brief has open questions or a product or environment decision; then wait for the person.
  • git_policy: pr-only — once the graph reaches publish, commit, push the work branch with a normal push, and open a PR with the PR tool the project workflow names (for example /bitbucket or gh); take reviewers and labels from the project's default rules instead of asking. direct — commit and push the current branch with a normal push; open a PR only when the project workflow requires one. The older value merge is read as pr-only; the repository no longer decides merging. Resolve personal delivery level from HM_DELIVERY_LEVEL_REPOS (matching repository entry first), then HM_DELIVERY_LEVEL in ~/.ai-harness/config. Without a value, or with pr, the run stops at the PR; merge or deploy must use the runner and let only its merge node merge after remote CI passes, into a base branch the host protects with required approvals, under the user's merge conditions (HM_MERGE_*), then run every post-merge check covered by that level using repository facts in merge_policy (base branch, deploy and smoke commands). The runner is mandatory for merge and deploy; if it is unavailable, do not substitute a manual merge or report completion: the first line must report the configured delivery level, its setting source, and why it could not be applied. HM_INTERNAL_SESSION=1 runs never merge. git_policy sets only the commit and PR scope. Missing or any other value — do not commit, push, or create a PR unless separately authorized.
  • Remote CI (the graph's remote_ci node): work that was pushed is not done until remote CI for the pushed commit has finished. Watch it with the PR or CI tool the project workflow names (for example gh pr checks --watch, or the Bitbucket pipelines API through /bitbucket) until every check reaches a final state. If it fails, repair it through the same loop and limit (limits.max_repair_attempts), push with a normal push, and check again. If the repository has no remote CI, say so. If you cannot see the result, report "remote CI unverified" with the PR link instead of done. A local run of the CI-equivalent commands does not stand in for remote CI.
  • UI verification (the graph's ui_review node): when the change alters what users see or operate — markup, styles, server-rendered templates, user-facing text, or how buttons, links, disclosures, forms, and dialogs behave — the brief lists ui_scenarios (user role, entry → key action → success check → return, the states, viewports, and themes to see, and the mockup source — file, frame, or node — when a mockup exists). After a review with no blocking findings, verify them with the project ui-review skill (.agents/skills/ui-review/SKILL.md or .claude/skills/ui-review/SKILL.md) and .ai-harness/docs/ui.md: render and operate each scenario in the render target ui.md declares for that screen (chromium when none; never another engine in its place) without changing the working tree, keeping captures outside the repository. A blocking UI issue goes through repair, re-review, and ui_review again. If the screens could not be rendered or operated, report "implementation done, UI unverified" with what blocked it, never done. A test that clicked an element by its text, a class or token in the markup, or a screenshot file is not evidence.
  • UI copy: when the change adds or changes interface text and .ai-harness/docs/ux-writing.md exists, read it before writing the copy and follow its glossary, ending style, and component rules. Before review, check the changed copy with /ai-harness:ux-writing-audit on the diff and fix its deterministic findings; report the score in the PR body. Without the document, do not invent project copy rules.
  • issue_policy: in-progress-on-start — when the request names a tracker issue (a key such as ABC-123 or an issue URL), move that issue to its in-progress state with the issue tool the project workflow names (for example /jira), before branch or worktree setup and before collecting evidence. Pick the transition whose target status category is in progress instead of matching a status name. Leave an issue that is already in progress as it is; if it is done or closed, ask the person instead of reopening it. If the project workflow names no issue tool, ask the person which to use instead of guessing one. Missing or any other value — leave issue status alone.
  • Under every policy: never merge, force-push, push to the base branch under pr-only, or change project policy without separate authorization — the only merge is the runner's merge node under a personal delivery level of merge or deploy. Unattended runs never merge. When the merge is blocked only by a conflict with the base branch, the runner's sync_base node merges the latest origin/<base> with a normal merge (an agent session resolves the conflicts without committing or pushing), runs the checks again, pushes with a normal push, and goes back through remote CI and merge; a single base merge commit pushed from outside during remote CI takes the same path. The base sync limit limits.max_base_syncs, an unresolved conflict, a failing check, and any other merge blocker go to user_decision. Escalations the graph routes to user_decision, such as the repair limit in limits.max_repair_attempts or a product or environment decision, always go to the person.

Graph runner

When .ai-harness/workflows/workflow-driver.sh exists, run the bug fix through it instead of following the graph yourself. The runner executes bug-fix-graph.json outside the model: triage, reproduce, and brief run without changing the working tree (reproduce may run commands, keeping its notes in the run directory), the approval node waits for the person (or passes by policy under HM_APPROVAL=auto), regression and fix run only after that approval, verify is the checks the runner executes itself (the brief's fast checks before every review round, and its final_checks — the broad suite — once after a review finds nothing blocking; when the run pushes to a repository with CI configuration, remote CI is the final gate and the runner leaves final_checks to it instead of running them locally), review and ui_review follow, and publish and remote_ci act as git_policy allows. The runner exports HM_TEST_JOBS (the user's HM_TEST_JOBS in ~/.ai-harness/config, otherwise max(1, min(ncpu/2, 6))) to every check: when the project's test runner reads HM_TEST_JOBS itself (as a tests/run.sh does when -j is absent), the brief's checks and final_checks leave its parallelism option out; otherwise they pass $HM_TEST_JOBS to it instead of a literal number (for example pytest -n "${HM_TEST_JOBS:-2}"). A check that already passed on the same working tree is reused instead of run again, a narrow tests/run.sh check run together with the full tests/run.sh regression is skipped as covered, and progress.log and status show each check's seconds. The regression and fix sessions run only the tests for the areas they target; the full regression is the runner's final_checks, which the runner runs locally only when the repository has no remote CI it pushes to (otherwise remote CI is the final gate).

To stop a running run, use only bash .ai-harness/workflows/workflow-driver.sh stop [--run <id>] [--reason "<why>"]: it ends just the processes that run recorded (the runner and its node session group, TERM then KILL after 5 seconds) and records stopped with the node, time, and reason. Never kill the runner or agent sessions by pattern (pkill, killall, pgrep -f); the same pattern matches other runs and sessions on the machine. status shows a stopped run and a run cut off outside the runner (stale); continue either with resume. resume, approve, and revise refuse a run whose runner is still alive (exit 2).

  1. bash .ai-harness/workflows/workflow-driver.sh start --workflow bug-fix --request "<the bug report>" runs triage, reproduce, and brief, then stops at approval (exit 10). With --investigation <report> it skips triage and reproduce and builds the brief from that report when the project graph has the investigation_report_provided edge (an unsynced graph runs them with the report as input). When the bug is a monitoring error picked from /autofix, your delivery level is deploy, and merge_policy.verify includes monitor, save that candidate JSON line to a file and add --monitor-error <file>; after the merge the runner hands it to /autofix recurrence tracking. Show the Bug Fix Brief, the checks, and any open questions to the user as printed. If the bug could neither be reproduced nor given a safe observation plan, it stops with exit 20 instead; show what it needs (environment, logs, or expected behavior).
  2. If the user asks for changes, run revise --workflow bug-fix --feedback "<their words>" and show the new brief. The brief maps every completion condition of the report and of any issue it quotes or links in acceptance_map; under HM_APPROVAL=auto the runner rewrites a brief whose map is empty or leaves a condition unmapped, and past limits.max_brief_rewrites hands it to a person through brief_coverage_incomplete.
  3. When the user types 승인 or approve, run resume --workflow bug-fix. The runner accepts only a message the user typed after the brief was shown, read from the session transcript. Never write, quote, or simulate an approval yourself. Run it in the background when your tool allows it, follow the file the runner prints after progress: with a file monitor when your tool has one, and pass new lines to the user as short progress notes. The user can watch the same lines with bash .ai-harness/workflows/workflow-driver.sh watch --workflow bug-fix.
  4. Report the outcome by exit code: 0 done (with the PR link and the remote CI result when something was pushed, and when the runner merged, the merge commit and post-merge checks; a notice: about settings the runner no longer uses is passed on as is); 20 a person must decide (show the unresolved findings; an unverified UI or remote CI is never done; a blocked merge or a failed post-merge check — the change stays merged and is not reverted — goes here. When the runner stopped because the repository changed since it stopped (baseline-changes.txt), show that file; run resume --accept-changes only when the user explicitly says to take those changes into the run, never on your own.); 30 incomplete (show the cause, then resume after it is fixed or after the merge condition it waits for, such as an approval, is met); 40 invariant violation (stop and show it). status --workflow bug-fix shows the current node and history.

Under pr-only or direct the runner leaves a local checkpoint commit after regression, fix, and each repair; under any other git_policy it never commits. In Codex, the runner starts its own sandboxed codex exec sessions, so run it with permission to leave the current sandbox. If the runner is missing, follow the graph in this conversation as described above.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.