[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7FDDB0RZPK5T1901DEW1HCQ":3,"skill-same:01M7FDDB0RZPK5T1901DEW1HCQ":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7FDDB0RZPK5T1901DEW1HCQ","bughunt",null,"Run a structured bug hunt on a plugin in this repository as a Workflow - parallel read-only hunt jobs per lens and area, one dedupe job that merges the findings and keeps the lenses that found each, one verify job per finding that checks it per lens and picks the fix model, fix jobs from a queue with a parallel review job per finished fix (a rejected fix is queued again with the review notes), then simplify, code-review and a learnings pass. Use when the user asks for a bug hunt, a deep review, \"find all bugs\", an automated bug hunt, or a final verification of a plugin before merge.","kwitsch\u002Fclaude-plugins-development","kwitsch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F10324063?v=4","01M7FDD9EEY7P0P5C9QDQA74VK","Kwitsch","01M7FDD9FHJK7MPGWB04GTNV1M",0,"MIT","https:\u002F\u002Fgithub.com\u002Fkwitsch\u002Fclaude-plugins-development\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fbughunt\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: bughunt\ndescription: Run a structured bug hunt on a plugin in this repository as a Workflow - parallel read-only hunt jobs per lens and area, one dedupe job that merges the findings and keeps the lenses that found each, one verify job per finding that checks it per lens and picks the fix model, fix jobs from a queue with a parallel review job per finished fix (a rejected fix is queued again with the review notes), then simplify, code-review and a learnings pass. Use when the user asks for a bug hunt, a deep review, \"find all bugs\", an automated bug hunt, or a final verification of a plugin before merge.\nargument-hint: \"\u003Cplugin-name>\"\n---\n\n# bughunt\n\nWorked out on the dprint plugin (16 hand-run rounds, about 40 confirmed defects). The method matters more than the number of jobs. The argument is the plugin directory name (stop with one line if `\u003Cplugin>\u002Fpackage.json` does not exist). There are no rounds: the hunt runs once through the pipeline below.\n\nThe user's request for this skill is the opt-in for the Workflow tool (load `workflow-authoring` first if it is not loaded).\n\n## Pipeline\n\n**Hunt** (parallel) → **Dedupe** (one job) → **Verify** (parallel, one per finding) → **Fix** (queue, one job at a time) with a **Review** per finished fix (parallel to the next fix job).\n\n- **Hunt**: one read-only hunter per lens and area, all in parallel. A hunter's finding is only a claim.\n- **Dedupe**: when all hunt jobs are done, one job merges findings that describe the same defect. Every merged finding keeps the list of lenses that found it (computed by the script from the merged members, never by the model).\n- **Verify**: one verifier per deduplicated finding, in parallel. It re-runs the repro of every lens that reported the finding and says per lens whether the finding is valid; it also decides whether the fix is done by `sonnet` or `haiku` (and the effort) by the work the fix needs. A finding with no valid lens is dropped.\n- **Fix**: one fix job per finding with at least one valid lens, from a queue, one at a time (they share one worktree and one branch), with the model the verifier chose.\n- **Review**: when a fix job is done, a review job (`opus`) examines that fix while the next fix job already runs. It approves, or rejects with notes; a rejected finding gets a new fix job with the notes at the **end** of the fix queue. A finding is rejected at most twice, then the fix is kept and reported as unresolved (a limit, so a reviewer and a fixer cannot loop forever).\n\n## jev-api first\n\nThe skill and every workflow agent use the jev-api tools (`mcp__jev-api__batch`, `choice`, `noul`, `score`; load them via ToolSearch if deferred) before own reasoning for decisions that fit options, a rating or yes\u002Fno: hunters classify `severity`, `verifyModel` and `verifyEffort`; the dedupe job asks whether two findings describe the same defect (`noul`); verifiers rate the fix model and effort and whether a claim is a documented limit or style; fixers and the closer decide yes\u002Fno questions such as \"is this test failure related to my change\". Several questions about one text go in one `batch`. Own reasoning replaces the answer on low confidence or a failed call. jev-api never replaces a repro, a test run or reading the code: facts are measured, only classifications and yes\u002Fno go to jev-api.\n\n## Start: worktree and branch\n\nFirst action, before reading anything: check whether the session already is in a linked git worktree (`git rev-parse --git-dir` ends in `\u002Fworktrees\u002F\u003Cname>`, or `--git-common-dir` differs from `--git-dir`). If not, call `EnterWorktree` (load it via ToolSearch if deferred) with `name: \"bughunt-\u003Cplugin>\"`, then `git switch -c fix\u002F\u003Cplugin>-bughunt-\u003CYYYY-MM-DD>` (one branch and one draft PR for the whole run). In an existing linked worktree only create that branch when the current one has no commits of its own. Never nest. Note the worktree's absolute path and today's date: both go into the workflow `args`. A pure review request stays read-only (pass `fix: false`: Hunt, Dedupe and Verify only, verified findings are reported), but the scratch files and the checkout still belong in the worktree.\n\n## Scout (inline, before the Workflow)\n\nSplit the plugin into areas (protocol\u002Fserver, core logic, scripts\u002Fskills, hooks wiring + docs; fewer for a small plugin) and note per area the files. The script cannot read the file system, so this goes into `args.areas` as `[{ name, files }]`.\n\nScout also picks the hunt lenses and sets the hunter model and effort **per lens** (the lens list is under Run), by how hard that lens is to hunt in this plugin: `sonnet` for lenses that are mostly reading and grepping (docs against code, fail-open paths in a small plugin), `opus` for those that need deep reasoning (races, cache invalidation, interactions between fixes); effort `medium` or `high`. Leave out a lens that cannot apply (no caches, no file system access). Ask the jev-api tools first (`choice` for the model, `score` for the effort, one `batch` per lens). Pass them as `args.lenses = [{ lens, model, effort }]` using the lens texts below verbatim; without `args.lenses` all lenses run `sonnet`\u002F`medium`. The number of hunt jobs is lenses times areas, so a small plugin gets few areas.\n\n## Run\n\n`Workflow` with the script below, `args = { plugin, worktree, date, areas, lenses, fix }`.\n\n- **Hunt**: one read-only hunter per lens and area, in parallel (model and effort of the lens from Scout), each with the lens and the rule \"report only defects you reproduced, with the repro and its output\". Brief hunters to use real tools (real dprint\u002Fgit\u002Fnode, the built `plugin\u002F` output, the test stub) instead of reading alone, and \"high bar: no style, speculation or documented limitations\".\n- **Dedupe**: one `sonnet` job gets all findings and returns groups of finding indexes that describe the same defect with one merged title, repro and fix; the script computes each group's lenses from its members and adds any finding the job left out as its own group.\n- **Verify**: one verifier per deduplicated finding, in parallel, model and effort as the hunters classified the verify job (strongest of the merged findings, default `opus`\u002F`medium`); for every lens of the finding it re-runs that lens's repro itself, reads the code and refutes documented limits and style; then it rates the fix (`sonnet` for a local, well-understood change, `haiku` for a mechanical one; effort `low|medium|high`, not passed to `haiku`).\n- **Fix** (queue, sequential): re-run the repro, fix the root cause once in the shared code, add a test that fails without the fix (revert the line to check; a regression test that passes on the old code proves nothing), build, `pnpm lint`, plugin tests, commit and push. The first fix bumps `\u003Cplugin>\u002Fpackage.json` once per branch. A blocked fix is reported and the queue goes on.\n- **Review** (`opus`, parallel to the next fix): read-only on the checkout, it reads the fix commit (`git show \u003Csha>`), checks root cause versus symptom, that the test fails without the fix, other callers and regressions; to run something it uses a scratch copy outside the worktree. Approve or reject with concrete notes.\n- **Lenses** (hunters run before any fix of this run, so these two read the branch's earlier commits): newest diff and the last fixes; interactions between fixes; TOCTOU, races and symlink swaps; caches keyed too coarsely, stale state, leaks; per-turn or per-session caches and buffers added for speed (every event that must drop or flush them, `.claude\u002Frules\u002Fhook-caches-and-tests.md`); slow or unusual file systems, odd names and encodings; fail-open paths and missing error handling at trust boundaries; docs contradicting code and tests that cannot fail.\n- **Close** (when anything was fixed): the fix jobs report the files they changed, and one agent works only on those files. It first checks (jev-api `noul`) whether the code changes are too small or too simple for a simplifier (only documentation, or about 30 changed code lines or fewer without new logic): then `\u002Fsimplify` and `\u002Fcode-review` are both skipped, otherwise `\u002Fsimplify` runs on the changed code files and `\u002Fcode-review \u003Clevel> --fix` on them, the level (`low`, `medium`, `high`, `xhigh`, never `max`) chosen from the size and risk of those changes, not fixed at `high`. Build, lint and tests only when one of them changed something; then the learnings pass below; commit and push, clean tree, head equal to its upstream.\n\nNo agent narrates between tool calls (no human reads it); the structured results are all that comes back.\n\n## Also do (inline, around the Workflow)\n\n- **Tests audit**: revert each change one at a time in a scratch copy and see whether any test fails; add what is missing. Check temp dirs, env restore (`PATH`\u002F`HOME`\u002Fother env in `finally`), leaked processes, timing thresholds (`>= 290` for a 300 ms timer), flakiness over 5 runs and `--sequence.shuffle`. A negative test whose cases all run in a world where an earlier gate already returns nothing cannot fail: give each case a world where only its own gate blocks. A selection rule (which of several candidates wins) needs a test with several candidates. Every flag on a regex (`m`, `i`) and every TTL or reset branch gets a test that fails without it. Isolate user-level config of external tools (`HOME`, `XDG_CONFIG_HOME`, tool env such as `YAMLLINT_CONFIG_FILE`): a test that passes in CI fails on a machine with `~\u002F.config\u002F\u003Ctool>`.\n- **Randomized test** for the central invariant, seeded (mulberry32) so it is deterministic; run a bigger independent fuzz against the real tool once.\n- **Docs audit**: every number, default, limit, env var and event name in README, rules and docs must match the source. A claim about what an external tool does (\"never edits X\", \"writes only Y\") is checked by running it under a temp `HOME` and `CLAUDE_CONFIG_DIR` and listing what it wrote; after any fix that changes a path or env var, grep the README for the old one.\n- **Live checks** with the `live-verify` skill for the flows the tests cannot cover.\n- **Final gate**: the repository's `\u002Fcode-review high` on the whole branch (the Close step does it), then CI green on the head commit (`gh pr checks`).\n\n## Close: learnings\n\nAt the end of the hunt, before the final report, check what the hunt taught that holds beyond this plugin:\n\n1. List the confirmed defect classes and the Claude Code \u002F tool behaviours you verified (compare with `.claude\u002Frules\u002Fhook-file-safety.md`, `.claude\u002Frules\u002Fclaude-code-hook-facts.md`, `.claude\u002Frules\u002Fplugin-docs-tasks.md` and the other rules and skills).\n2. For each, decide: new general fact or defect class, correction of an existing rule or skill, or plugin-specific (stays in the plugin's `docs\u002F` and rules). Only what other plugins of this repository can use, written generally (no plugin names in the rule text except as the source), goes into `.claude\u002Frules\u002F*.md` (with `paths:`) or `.claude\u002Fskills\u002F`.\n3. Apply the additions and corrections in the same PR, say in one line which rules or skills changed (or that nothing new qualified).\n\n## Finish\n\n`gh pr view` first; when the branch has no PR (and `fix` is not false), `gh pr create --draft`, title `\u003Cplugin>: bug hunt (\u003Cn> fixes)`, body = per-finding table (key, lenses that found it, lenses verified, fix model, fix result, review result) and what stayed unexercised. No attribution lines. Bump the version once per PR. Report the PR URL and the limits of the hunt.\n\n## What to claim\n\nNever claim \"no bugs\". A hunt without confirmed findings only means these lenses found nothing in this pass; earlier clean passes were repeatedly followed by new defects. Report: what was checked (lenses and areas), what was fixed, which fixes stay unresolved after two rejections, which limits stay unexercised and why (for example a downloaded installer that auto mode will not run, a mount that was not available).\n\n## Session mechanics learned\n\n- A worktree-isolated session refuses compound commands (`cd x && git ...`, long pipelines, heredocs with git): put multi-step edits into a small node\u002Fpython script under the scratchpad and run it with one plain command; run git\u002Fpnpm from the worktree root.\n- Edit big literal blocks with a node script that throws when the anchor text is missing (`replace` silently doing nothing is the failure mode).\n- Agents that run `claude` with `--dangerously-skip-permissions` are denied by auto mode; run nested `claude -p` yourself with `--allowedTools` narrowed instead.\n- Do not run a downloaded script that auto mode refuses, and do not work around the refusal; read downloaded scripts first (the dprint installer runs `pkill -9 dprint`).\n\n## Workflow script\n\n```js\nexport const meta = {\n  name: 'bughunt',\n  description: 'Bug hunt on one plugin: parallel hunters per lens and area, dedupe, parallel verifiers, fix queue with a review per fix',\n  phases: [\n    { title: 'Hunt', detail: 'read-only hunters per lens and area, parallel' },\n    { title: 'Dedupe', detail: 'merge findings, keep the lenses of each' },\n    { title: 'Verify', detail: 'one verifier per finding, valid per lens, fix model', },\n    { title: 'Fix', detail: 'fix queue, one job at a time, review per fix in parallel' },\n    { title: 'Close', detail: 'simplify, code-review, learnings' },\n  ],\n}\n\nconst FINDINGS = {\n  type: 'object',\n  properties: {\n    findings: {\n      type: 'array',\n      items: {\n        type: 'object',\n        properties: { key: { type: 'string' }, title: { type: 'string' }, severity: { enum: ['high', 'medium', 'low'] }, verifyModel: { enum: ['sonnet', 'opus'] }, verifyEffort: { enum: ['low', 'medium', 'high'] }, repro: { type: 'string' }, fix: { type: 'string' } },\n        required: ['key', 'title', 'repro'],\n      },\n    },\n    checked: { type: 'string' },\n  },\n  required: ['findings', 'checked'],\n}\nconst DEDUPE = {\n  type: 'object',\n  properties: {\n    groups: {\n      type: 'array',\n      items: {\n        type: 'object',\n        properties: { members: { type: 'array', items: { type: 'integer' } }, key: { type: 'string' }, title: { type: 'string' }, repro: { type: 'string' }, fix: { type: 'string' } },\n        required: ['members', 'key', 'title', 'repro'],\n      },\n    },\n  },\n  required: ['groups'],\n}\nconst VERIFY = {\n  type: 'object',\n  properties: {\n    lenses: { type: 'array', items: { type: 'object', properties: { lens: { type: 'integer' }, valid: { type: 'boolean' }, reason: { type: 'string' } }, required: ['lens', 'valid', 'reason'] } },\n    fixModel: { enum: ['sonnet', 'haiku'] },\n    fixEffort: { enum: ['low', 'medium', 'high'] },\n  },\n  required: ['lenses'],\n}\nconst FIX = { type: 'object', properties: { verdict: { enum: ['fixed', 'refuted', 'blocked'] }, commit: { type: 'string' }, files: { type: 'array', items: { type: 'string' } }, summary: { type: 'string' } }, required: ['verdict', 'summary'] }\nconst REVIEW = { type: 'object', properties: { verdict: { enum: ['approve', 'reject'] }, notes: { type: 'string' } }, required: ['verdict', 'notes'] }\nconst CLOSE = { type: 'object', properties: { status: { enum: ['clean', 'fixed', 'blocked'] }, simplify: { type: 'string' }, reviewLevel: { type: 'string' }, summary: { type: 'string' } }, required: ['status', 'summary'] }\nconst { plugin, worktree, areas } = args\nconst doFix = args.fix !== false\nconst MAX_REJECTIONS = 2\nconst LENSES = [\n  'the newest diff of this branch and the history of the last fixes',\n  'interactions between earlier fixes and regressions they introduced',\n  'TOCTOU, races and symlink swaps',\n  'caches keyed too coarsely, stale state, resource leaks',\n  'per-turn or per-session caches and buffers added for speed: every event that must drop or flush them',\n  'slow or unusual file systems, odd file names and encodings',\n  'fail-open paths and missing error handling at trust boundaries',\n  'docs, README and rules contradicting the code; tests that cannot fail',\n]\nconst lenses = args.lenses ?? LENSES.map((lens) => ({ lens, model: 'sonnet', effort: 'medium' }))\n\n\u002F\u002F No human reads the agents' text: no narration between tool calls, only the structured result.\nconst QUIET = '\\n\\nNo narration: no text between tool calls, no plans, no progress notes, no recap. Call tools silently and end with the structured result only.'\n\u002F\u002F Classifications and yes\u002Fno go to the jev-api tools first; facts (repro, tests, code) are measured, never asked.\nconst JEV = '\\n\\nFor decisions that fit options, a rating or yes\u002Fno (severity, effort, same defect as another finding, documented limit or style, test failure unrelated to your change) call the jev-api tools first (mcp__jev-api__batch for several questions about one text; load them via ToolSearch if deferred) and use your own reasoning only on low confidence or a failed call. Never use them instead of a repro, a test run or reading the code.'\nconst run = (prompt, opts) => agent(prompt + JEV + QUIET, opts)\n\nconst huntPrompt = (a, lens) => `Bug hunt on plugin \"${plugin}\", area \"${a.name}\" (files: ${a.files}), in the git worktree ${worktree}. READ-ONLY on the repository; scratch files go under the session scratchpad. Stay in the worktree.\nLens: ${lens}. Read .claude\u002Fskills\u002Fbughunt\u002FSKILL.md and ${plugin}\u002FCLAUDE.md first.\nUse real tools (the built plugin\u002F output, real git\u002Fnode, the test stub) instead of reading alone. Report ONLY defects you reproduced: each with a stable key (file:symbol:short-slug), title, severity, verifyModel and verifyEffort (classify the verify job: sonnet\u002Flow for a simple, local repro; opus\u002Fhigh for subtle, concurrent or cross-cutting ones), the repro and its output, and a minimal fix. High bar: no style, speculation or documented limitations. A verifier will re-run every repro independently. If nothing is reproduced return an empty list and say in \"checked\" what you checked.`\n\nconst dedupePrompt = (raw) => `Merge duplicate findings of a bug hunt on plugin \"${plugin}\". Findings (index, lens, key, title, repro, fix):\n${raw.map((f, i) => `[${i}] lens ${f.lens} | ${f.key} | ${f.title}\\n  repro: ${f.repro}\\n  fix: ${f.fix ?? 'none'}`).join('\\n')}\nGroup the indexes that describe the same root defect (same code, same failure, even if found by another lens or worded differently). Different defects in the same file stay separate groups. Every index belongs to exactly one group. For each group return its members, one key, one title, and the repro and fix of the best member (merge them when they complement each other). Read the code only where two findings are too close to tell apart. READ-ONLY on the repository, worktree ${worktree}.`\n\nconst verifyPrompt = (f) => `Verify this claimed defect of plugin \"${plugin}\" in the git worktree ${worktree}. READ-ONLY on the repository; scratch files go under the session scratchpad. Stay in the worktree.\nFinding ${f.key}: ${f.title}. Severity ${f.severity ?? 'n\u002Fa'}. Suggested fix: ${f.fix ?? 'none'}.\nIt was reported by these lenses, each with its own repro:\n${f.reports.map((r) => `- lens ${r.lens} (${lenses[r.lens].lens}): ${r.repro}`).join('\\n')}\nFor EVERY lens above re-run its repro yourself and read the code around it. Return one entry per lens: valid true when reproduced and a real defect; valid false when not reproducible, a documented limit, style or speculation (with the reason).\nIf at least one lens is valid, also rate the fix: fixModel sonnet for a local change that needs judgment, haiku for a mechanical, well-understood one; fixEffort low, medium or high by the work the fix and its test need (not used for haiku).`\n\nconst fixPrompt = (job, first) => `Fix this verified defect of plugin \"${plugin}\" in the git worktree ${worktree} (stay there; run git and pnpm from its root).\nFinding ${job.f.key}: ${job.f.title}. Repro: ${job.f.repro}. Suggested fix: ${job.f.fix ?? 'none'}. Verified for lenses: ${job.f.validLenses.join('; ')}.\n${job.notes ? `A previous fix (commit ${job.prevCommit}) was REJECTED in review. Review notes: ${job.notes}\\nBuild on or replace that commit as the notes demand.\\n` : ''}1. Re-run the repro. If it does not reproduce after all (and there is no review note saying otherwise): verdict refuted, change nothing.\n2. Fix the root cause once in ${plugin}\u002Fsrc (shared code, after grepping every caller), never in plugin\u002F**\u002F*.mjs. Add a test that fails without the fix (revert the line to check).\n3. \\`pnpm --filter ${plugin} build\\`, \\`pnpm lint\\`, \\`pnpm --filter ${plugin} test\\` until green; read the output.\n${first ? `4. First fix of the branch: bump ${plugin}\u002Fpackage.json version once (only if \\`git diff origin\u002Fmain -- ${plugin}\u002Fpackage.json\\` shows none), then rebuild.\\n` : ''}5. \\`git add\\` what you changed, commit (\"${plugin}: fix ${job.f.key}\", no Co-Authored-By), \\`git push -u origin HEAD\\`.\nReturn verdict fixed|refuted|blocked (blocked: cannot be made green; commit nothing broken), the commit sha, files (the repo-relative paths of the files the commit changed, from \\`git show --name-only\\`) and one sentence.`\n\nconst reviewPrompt = (job, commit) => `Review a fix of plugin \"${plugin}\" in the git worktree ${worktree}. READ-ONLY: another fix job may be committing in this worktree right now, so do not edit, build or run tests there; read the fix with \\`git show ${commit}\\` and the code it touches. To run something, copy the commit into a scratch directory outside the worktree (\\`git archive ${commit}\\` and a symlink to node_modules).\nFinding ${job.f.key}: ${job.f.title}. Repro: ${job.f.repro}.\nCheck: does it fix the root cause rather than the symptom, is every caller covered, does the test fail without the fix, does it add a regression or break an invariant, is anything beyond the finding changed. Reject only for a concrete defect you can name; style is no reason. Verdict approve, or reject with notes the fixer can act on.`\n\nconst closePrompt = (summary, files) => `Close the bug hunt of plugin \"${plugin}\" in the git worktree ${worktree} (stay there).\nFiles changed by the fix jobs (the only scope of simplify and code-review): ${files.join(', ')}.\n1. Size up the changes: \\`git diff --stat origin\u002Fmain...HEAD -- \u003Cthose files>\\`. Doc files (markdown, text, anything under docs\u002F) never count as code. Ask the jev-api tools first (\\`noul\\`) whether the code changes are too small or too simple to need a simplifier: only documentation, or only a few lines (about 30 changed code lines or fewer) without new logic.\n2. Simplify: when that is a confident yes, skip it. Otherwise skill \"simplify\" restricted to the changed code files (revert any edit it makes elsewhere), apply its fixes.\n3. Code review: skip it under the same rule as simplify. Otherwise choose the level from the size and risk of the changes, jev-api \\`score\\` first: \\`low\\` few lines of simple code, \\`medium\\` moderate changes, \\`high\\` larger changes or concurrency, caches, security or protocol code, \\`xhigh\\` large and risky changes; never \\`max\\`. Run skill \"code-review\" with args \"\u003Clevel> --fix\" and the changed code files as its target.\n4. Only when step 2 or 3 changed something: \\`pnpm --filter ${plugin} build\\`, \\`pnpm lint\\`, \\`pnpm --filter ${plugin} test\\` until green.\n5. Learnings pass: follow \"Close: learnings\" in .claude\u002Fskills\u002Fbughunt\u002FSKILL.md for the defect classes of this hunt: ${summary}. Only general facts go into .claude\u002Frules\u002F*.md (with paths:) or .claude\u002Fskills\u002F.\n6. \\`git add\\`, commit (\"${plugin}: bug hunt review and learnings\", no Co-Authored-By), \\`git push\\`; then \\`git status --short\\` must be empty and \\`git rev-parse HEAD\\` equal \\`git rev-parse @{u}\\`, else commit and push again.\nReturn status clean|fixed|blocked, simplify (skipped or run, with the reason), reviewLevel (skipped or the level used) and one sentence.`\n\n\u002F\u002F Hunt: every lens, every area, all in parallel.\nconst hunts = await parallel(lenses.flatMap((l, li) => areas.map((a) => async () => ({ lens: li, report: await run(huntPrompt(a, l.lens), { label: `hunt:l${li}:${a.name}`, phase: 'Hunt', model: l.model, effort: l.effort, schema: FINDINGS }) }))))\nconst raw = hunts.filter((h) => h?.report).flatMap((h) => h.report.findings.map((f) => ({ ...f, lens: h.lens })))\nconst failedHunts = hunts.filter((h) => !h?.report).length\n\n\u002F\u002F Dedupe: one job after all hunts; the lenses of a group come from its members, not from the model.\nlet groups = []\nif (raw.length) {\n  const d = await run(dedupePrompt(raw), { label: 'dedupe', phase: 'Dedupe', model: 'sonnet', effort: 'medium', schema: DEDUPE })\n  const used = new Set()\n  for (const g of d?.groups ?? []) {\n    const members = [...new Set(g.members)].filter((i) => Number.isInteger(i) && raw[i] && !used.has(i))\n    if (!members.length) continue\n    members.forEach((i) => used.add(i))\n    groups.push({ ...g, members })\n  }\n  raw.forEach((f, i) => { if (!used.has(i)) groups.push({ members: [i], key: f.key, title: f.title, repro: f.repro, fix: f.fix }) })\n}\nconst found = groups.map((g) => {\n  const ms = g.members.map((i) => raw[i])\n  const sev = ['high', 'medium', 'low'].find((s) => ms.some((m) => m.severity === s))\n  \u002F\u002F The hunters' classification of the verify job: the strongest model and highest effort asked for by any member.\n  const verifyModel = ms.some((m) => m.verifyModel === 'opus') || !ms.some((m) => m.verifyModel) ? 'opus' : 'sonnet'\n  const verifyEffort = ['high', 'medium', 'low'].find((e) => ms.some((m) => m.verifyEffort === e)) ?? 'medium'\n  return { key: g.key, title: g.title, repro: g.repro, fix: g.fix, severity: sev, verifyModel, verifyEffort, reports: ms.map((m) => ({ lens: m.lens, repro: m.repro })), lensSet: [...new Set(ms.map((m) => m.lens))] }\n})\n\n\u002F\u002F Verify: one opus verifier per deduplicated finding, in parallel.\nconst verdicts = await parallel(found.map((f) => () => run(verifyPrompt(f), { label: `verify:${f.key}`, phase: 'Verify', model: f.verifyModel, effort: f.verifyEffort, schema: VERIFY })))\nconst verified = []\nfound.forEach((f, i) => {\n  const v = verdicts[i]\n  const ok = (v?.lenses ?? []).filter((x) => x.valid && f.lensSet.includes(x.lens)).map((x) => x.lens)\n  f.verifiedLenses = ok\n  if (ok.length) verified.push({ ...f, validLenses: ok.map((n) => lenses[n].lens), fixModel: v.fixModel ?? 'sonnet', fixEffort: v.fixEffort ?? 'medium' })\n})\n\n\u002F\u002F Fix queue (one job at a time) with a review per finished fix running in parallel to the next fix job.\nconst results = verified.map((f) => ({ key: f.key, lenses: f.lensSet.map((n) => lenses[n].lens), verifiedLenses: f.verifiedLenses.map((n) => lenses[n].lens), fixModel: f.fixModel, fix: doFix ? 'queued' : 'not run', review: null, rejections: 0 }))\nconst queue = doFix ? verified.map((f, i) => ({ f, res: results[i], notes: null, prevCommit: null })) : []\nconst pending = new Set()\nlet fixed = 0\nconst changed = new Set()\nwhile (queue.length || pending.size) {\n  if (!queue.length) { await Promise.race(pending); continue }\n  const job = queue.shift()\n  const model = job.f.fixModel\n  const r = await run(fixPrompt(job, fixed === 0), { label: `fix:${job.f.key}`, phase: 'Fix', model, ...(model === 'haiku' ? {} : { effort: job.f.fixEffort }), schema: FIX })\n  \u002F\u002F After a rejected fix its commit stays on the branch: say so in the result.\n  const left = job.prevCommit ? ` (rejected fix ${job.prevCommit} stays on the branch)` : ''\n  if (!r || r.verdict === 'blocked') { job.res.fix = `blocked${left}`; log(`${job.f.key}: blocked`); continue }\n  if (r.verdict === 'refuted') { job.res.fix = `refuted${left}`; continue }\n  fixed++\n  for (const f of r.files ?? []) changed.add(f)\n  job.res.fix = 'fixed'\n  job.res.commit = r.commit\n  const review = run(reviewPrompt(job, r.commit), { label: `review:${job.f.key}`, phase: 'Fix', model: 'opus', effort: 'medium', schema: REVIEW })\n    .catch(() => null)\n    .then((rv) => {\n      if (rv?.verdict === 'reject' && job.res.rejections \u003C MAX_REJECTIONS) {\n        job.res.rejections++\n        job.res.review = 'rejected, queued again'\n        queue.push({ ...job, notes: rv.notes, prevCommit: r.commit })\n      } else if (rv?.verdict === 'reject') job.res.review = 'unresolved after rejections'\n      else job.res.review = rv ? 'approved' : 'review failed'\n    })\n    .finally(() => pending.delete(review))\n  pending.add(review)\n}\n\nlet close = null\nif (fixed > 0) {\n  close = await run(closePrompt(verified.map((f) => f.title).join('; '), [...changed]), { label: 'close', phase: 'Close', model: 'sonnet', effort: 'medium', schema: CLOSE })\n}\nreturn { hunted: raw.length, failedHunts, deduped: found.length, verified: verified.length, failedVerifies: verdicts.filter((v) => !v).length, fixed, results, close }\n```\n","# bughunt\n\nWorked out on the dprint plugin (16 hand-run rounds, about 40 confirmed defects). The method matters more than the number of jobs. The argument is the plugin directory name (stop with one line if `\u003Cplugin>\u002Fpackage.json` does not exist). There are no rounds: the hunt runs once through the pipeline below.\n\nThe user's request for this skill is the opt-in for the Workflow tool (load `workflow-authoring` first if it is not loaded).\n\n## Pipeline\n\n**Hunt** (parallel) → **Dedupe** (one job) → **Verify** (parallel, one per finding) → **Fix** (queue, one job at a time) with a **Review** per finished fix (parallel to the next fix job).\n\n- **Hunt**: one read-only hunter per lens and area, all in parallel. A hunter's finding is only a claim.\n- **Dedupe**: when all hunt jobs are done, one job merges findings that describe the same defect. Every merged finding keeps the list of lenses that found it (computed by the script from the merged members, never by the model).\n- **Verify**: one verifier per deduplicated finding, in parallel. It re-runs the repro of every lens that reported the finding and says per lens whether the finding is valid; it also decides whether the fix is done by `sonnet` or `haiku` (and the effort) by the work the fix needs. A finding with no valid lens is dropped.\n- **Fix**: one fix job per finding with at least one valid lens, from a queue, one at a time (they share one worktree and one branch), with the model the verifier chose.\n- **Review**: when a fix job is done, a review job (`opus`) examines that fix while the next fix job already runs. It approves, or rejects with notes; a rejected finding gets a new fix job with the notes at the **end** of the fix queue. A finding is rejected at most twice, then the fix is kept and reported as unresolved (a limit, so a reviewer and a fixer cannot loop forever).\n\n## jev-api first\n\nThe skill and every workflow agent use the jev-api tools (`mcp__jev-api__batch`, `choice`, `noul`, `score`; load them via ToolSearch if deferred) before own reasoning for decisions that fit options, a rating or yes\u002Fno: hunters classify `severity`, `verifyModel` and `verifyEffort`; the dedupe job asks whether two findings describe the same defect (`noul`); verifiers rate the fix model and effort and whether a claim is a documented limit or style; fixers and the closer decide yes\u002Fno questions such as \"is this test failure related to my change\". Several questions about one text go in one `batch`. Own reasoning replaces the answer on low confidence or a failed call. jev-api never replaces a repro, a test run or reading the code: facts are measured, only classifications and yes\u002Fno go to jev-api.\n\n## Start: worktree and branch\n\nFirst action, before reading anything: check whether the session already is in a linked git worktree (`git rev-parse --git-dir` ends in `\u002Fworktrees\u002F\u003Cname>`, or `--git-common-dir` differs from `--git-dir`). If not, call `EnterWorktree` (load it via ToolSearch if deferred) with `name: \"bughunt-\u003Cplugin>\"`, then `git switch -c fix\u002F\u003Cplugin>-bughunt-\u003CYYYY-MM-DD>` (one branch and one draft PR for the whole run). In an existing linked worktree only create that branch when the current one has no commits of its own. Never nest. Note the worktree's absolute path and today's date: both go into the workflow `args`. A pure review request stays read-only (pass `fix: false`: Hunt, Dedupe and Verify only, verified findings are reported), but the scratch files and the checkout still belong in the worktree.\n\n## Scout (inline, before the Workflow)\n\nSplit the plugin into areas (protocol\u002Fserver, core logic, scripts\u002Fskills, hooks wiring + docs; fewer for a small plugin) and note per area the files. The script cannot read the file system, so this goes into `args.areas` as `[{ name, files }]`.\n\nScout also picks the hunt lenses and sets the hunter model and effort **per lens** (the lens list is under Run), by how hard that lens is to hunt in this plugin: `sonnet` for lenses that are mostly reading and grepping (docs against code, fail-open paths in a small plugin), `opus` for those that need deep reasoning (races, cache invalidation, interactions between fixes); effort `medium` or `high`. Leave out a lens that cannot apply (no caches, no file system access). Ask the jev-api tools first (`choice` for the model, `score` for the effort, one `batch` per lens). Pass them as `args.lenses = [{ lens, model, effort }]` using the lens texts below verbatim; without `args.lenses` all lenses run `sonnet`\u002F`medium`. The number of hunt jobs is lenses times areas, so a small plugin gets few areas.\n\n## Run\n\n`Workflow` with the script below, `args = { plugin, worktree, date, areas, lenses, fix }`.\n\n- **Hunt**: one read-only hunter per lens and area, in parallel (model and effort of the lens from Scout), each with the lens and the rule \"report only defects you reproduced, with the repro and its output\". Brief hunters to use real tools (real dprint\u002Fgit\u002Fnode, the built `plugin\u002F` output, the test stub) instead of reading alone, and \"high bar: no style, speculation or documented limitations\".\n- **Dedupe**: one `sonnet` job gets all findings and returns groups of finding indexes that describe the same defect with one merged title, repro and fix; the script computes each group's lenses from its members and adds any finding the job left out as its own group.\n- **Verify**: one verifier per deduplicated finding, in parallel, model and effort as the hunters classified the verify job (strongest of the merged findings, default `opus`\u002F`medium`); for every lens of the finding it re-runs that lens's repro itself, reads the code and refutes documented limits and style; then it rates the fix (`sonnet` for a local, well-understood change, `haiku` for a mechanical one; effort `low|medium|high`, not passed to `haiku`).\n- **Fix** (queue, sequential): re-run the repro, fix the root cause once in the shared code, add a test that fails without the fix (revert the line to check; a regression test that passes on the old code proves nothing), build, `pnpm lint`, plugin tests, commit and push. The first fix bumps `\u003Cplugin>\u002Fpackage.json` once per branch. A blocked fix is reported and the queue goes on.\n- **Review** (`opus`, parallel to the next fix): read-only on the checkout, it reads the fix commit (`git show \u003Csha>`), checks root cause versus symptom, that the test fails without the fix, other callers and regressions; to run something it uses a scratch copy outside the worktree. Approve or reject with concrete notes.\n- **Lenses** (hunters run before any fix of this run, so these two read the branch's earlier commits): newest diff and the last fixes; interactions between fixes; TOCTOU, races and symlink swaps; caches keyed too coarsely, stale state, leaks; per-turn or per-session caches and buffers added for speed (every event that must drop or flush them, `.claude\u002Frules\u002Fhook-caches-and-tests.md`); slow or unusual file systems, odd names and encodings; fail-open paths and missing error handling at trust boundaries; docs contradicting code and tests that cannot fail.\n- **Close** (when anything was fixed): the fix jobs report the files they changed, and one agent works only on those files. It first checks (jev-api `noul`) whether the code changes are too small or too simple for a simplifier (only documentation, or about 30 changed code lines or fewer without new logic): then `\u002Fsimplify` and `\u002Fcode-review` are both skipped, otherwise `\u002Fsimplify` runs on the changed code files and `\u002Fcode-review \u003Clevel> --fix` on them, the level (`low`, `medium`, `high`, `xhigh`, never `max`) chosen from the size and risk of those changes, not fixed at `high`. Build, lint and tests only when one of them changed something; then the learnings pass below; commit and push, clean tree, head equal to its upstream.\n\nNo agent narrates between tool calls (no human reads it); the structured results are all that comes back.\n\n## Also do (inline, around the Workflow)\n\n- **Tests audit**: revert each change one at a time in a scratch copy and see whether any test fails; add what is missing. Check temp dirs, env restore (`PATH`\u002F`HOME`\u002Fother env in `finally`), leaked processes, timing thresholds (`>= 290` for a 300 ms timer), flakiness over 5 runs and `--sequence.shuffle`. A negative test whose cases all run in a world where an earlier gate already returns nothing cannot fail: give each case a world where only its own gate blocks. A selection rule (which of several candidates wins) needs a test with several candidates. Every flag on a regex (`m`, `i`) and every TTL or reset branch gets a test that fails without it. Isolate user-level config of external tools (`HOME`, `XDG_CONFIG_HOME`, tool env such as `YAMLLINT_CONFIG_FILE`): a test that passes in CI fails on a machine with `~\u002F.config\u002F\u003Ctool>`.\n- **Randomized test** for the central invariant, seeded (mulberry32) so it is deterministic; run a bigger independent fuzz against the real tool once.\n- **Docs audit**: every number, default, limit, env var and event name in README, rules and docs must match the source. A claim about what an external tool does (\"never edits X\", \"writes only Y\") is checked by running it under a temp `HOME` and `CLAUDE_CONFIG_DIR` and listing what it wrote; after any fix that changes a path or env var, grep the README for the old one.\n- **Live checks** with the `live-verify` skill for the flows the tests cannot cover.\n- **Final gate**: the repository's `\u002Fcode-review high` on the whole branch (the Close step does it), then CI green on the head commit (`gh pr checks`).\n\n## Close: learnings\n\nAt the end of the hunt, before the final report, check what the hunt taught that holds beyond this plugin:\n\n1. List the confirmed defect classes and the Claude Code \u002F tool behaviours you verified (compare with `.claude\u002Frules\u002Fhook-file-safety.md`, `.claude\u002Frules\u002Fclaude-code-hook-facts.md`, `.claude\u002Frules\u002Fplugin-docs-tasks.md` and the other rules and skills).\n2. For each, decide: new general fact or defect class, correction of an existing rule or skill, or plugin-specific (stays in the plugin's `docs\u002F` and rules). Only what other plugins of this repository can use, written generally (no plugin names in the rule text except as the source), goes into `.claude\u002Frules\u002F*.md` (with `paths:`) or `.claude\u002Fskills\u002F`.\n3. Apply the additions and corrections in the same PR, say in one line which rules or skills changed (or that nothing new qualified).\n\n## Finish\n\n`gh pr view` first; when the branch has no PR (and `fix` is not false), `gh pr create --draft`, title `\u003Cplugin>: bug hunt (\u003Cn> fixes)`, body = per-finding table (key, lenses that found it, lenses verified, fix model, fix result, review result) and what stayed unexercised. No attribution lines. Bump the version once per PR. Report the PR URL and the limits of the hunt.\n\n## What to claim\n\nNever claim \"no bugs\". A hunt without confirmed findings only means these lenses found nothing in this pass; earlier clean passes were repeatedly followed by new defects. Report: what was checked (lenses and areas), what was fixed, which fixes stay unresolved after two rejections, which limits stay unexercised and why (for example a downloaded installer that auto mode will not run, a mount that was not available).\n\n## Session mechanics learned\n\n- A worktree-isolated session refuses compound commands (`cd x && git ...`, long pipelines, heredocs with git): put multi-step edits into a small node\u002Fpython script under the scratchpad and run it with one plain command; run git\u002Fpnpm from the worktree root.\n- Edit big literal blocks with a node script that throws when the anchor text is missing (`replace` silently doing nothing is the failure mode).\n- Agents that run `claude` with `--dangerously-skip-permissions` are denied by auto mode; run nested `claude -p` yourself with `--allowedTools` narrowed instead.\n- Do not run a downloaded script that auto mode refuses, and do not work around the refusal; read downloaded scripts first (the dprint installer runs `pkill -9 dprint`).\n\n## Workflow script\n\n```js\nexport const meta = {\n  name: 'bughunt',\n  description: 'Bug hunt on one plugin: parallel hunters per lens and area, dedupe, parallel verifiers, fix queue with a review per fix',\n  phases: [\n    { title: 'Hunt', detail: 'read-only hunters per lens and area, parallel' },\n    { title: 'Dedupe', detail: 'merge findings, keep the lenses of each' },\n    { title: 'Verify', detail: 'one verifier per finding, valid per lens, fix model', },\n    { title: 'Fix', detail: 'fix queue, one job at a time, review per fix in parallel' },\n    { title: 'Close', detail: 'simplify, code-review, learnings' },\n  ],\n}\n\nconst FINDINGS = {\n  type: 'object',\n  properties: {\n    findings: {\n      type: 'array',\n      items: {\n        type: 'object',\n        properties: { key: { type: 'string' }, title: { type: 'string' }, severity: { enum: ['high', 'medium', 'low'] }, verifyModel: { enum: ['sonnet', 'opus'] }, verifyEffort: { enum: ['low', 'medium', 'high'] }, repro: { type: 'string' }, fix: { type: 'string' } },\n        required: ['key', 'title', 'repro'],\n      },\n    },\n    checked: { type: 'string' },\n  },\n  required: ['findings', 'checked'],\n}\nconst DEDUPE = {\n  type: 'object',\n  properties: {\n    groups: {\n      type: 'array',\n      items: {\n        type: 'object',\n        properties: { members: { type: 'array', items: { type: 'integer' } }, key: { type: 'string' }, title: { type: 'string' }, repro: { type: 'string' }, fix: { type: 'string' } },\n        required: ['members', 'key', 'title', 'repro'],\n      },\n    },\n  },\n  required: ['groups'],\n}\nconst VERIFY = {\n  type: 'object',\n  properties: {\n    lenses: { type: 'array', items: { type: 'object', properties: { lens: { type: 'integer' }, valid: { type: 'boolean' }, reason: { type: 'string' } }, required: ['lens', 'valid', 'reason'] } },\n    fixModel: { enum: ['sonnet', 'haiku'] },\n    fixEffort: { enum: ['low', 'medium', 'high'] },\n  },\n  required: ['lenses'],\n}\nconst FIX = { type: 'object', properties: { verdict: { enum: ['fixed', 'refuted', 'blocked'] }, commit: { type: 'string' }, files: { type: 'array', items: { type: 'string' } }, summary: { type: 'string' } }, required: ['verdict', 'summary'] }\nconst REVIEW = { type: 'object', properties: { verdict: { enum: ['approve', 'reject'] }, notes: { type: 'string' } }, required: ['verdict', 'notes'] }\nconst CLOSE = { type: 'object', properties: { status: { enum: ['clean', 'fixed', 'blocked'] }, simplify: { type: 'string' }, reviewLevel: { type: 'string' }, summary: { type: 'string' } }, required: ['status', 'summary'] }\nconst { plugin, worktree, areas } = args\nconst doFix = args.fix !== false\nconst MAX_REJECTIONS = 2\nconst LENSES = [\n  'the newest diff of this branch and the history of the last fixes',\n  'interactions between earlier fixes and regressions they introduced',\n  'TOCTOU, races and symlink swaps',\n  'caches keyed too coarsely, stale state, resource leaks',\n  'per-turn or per-session caches and buffers added for speed: every event that must drop or flush them',\n  'slow or unusual file systems, odd file names and encodings',\n  'fail-open paths and missing error handling at trust boundaries',\n  'docs, README and rules contradicting the code; tests that cannot fail',\n]\nconst lenses = args.lenses ?? LENSES.map((lens) => ({ lens, model: 'sonnet', effort: 'medium' }))\n\n\u002F\u002F No human reads the agents' text: no narration between tool calls, only the structured result.\nconst QUIET = '\\n\\nNo narration: no text between tool calls, no plans, no progress notes, no recap. Call tools silently and end with the structured result only.'\n\u002F\u002F Classifications and yes\u002Fno go to the jev-api tools first; facts (repro, tests, code) are measured, never asked.\nconst JEV = '\\n\\nFor decisions that fit options, a rating or yes\u002Fno (severity, effort, same defect as another finding, documented limit or style, test failure unrelated to your change) call the jev-api tools first (mcp__jev-api__batch for several questions about one text; load them via ToolSearch if deferred) and use your own reasoning only on low confidence or a failed call. Never use them instead of a repro, a test run or reading the code.'\nconst run = (prompt, opts) => agent(prompt + JEV + QUIET, opts)\n\nconst huntPrompt = (a, lens) => `Bug hunt on plugin \"${plugin}\", area \"${a.name}\" (files: ${a.files}), in the git worktree ${worktree}. READ-ONLY on the repository; scratch files go under the session scratchpad. Stay in the worktree.\nLens: ${lens}. Read .claude\u002Fskills\u002Fbughunt\u002FSKILL.md and ${plugin}\u002FCLAUDE.md first.\nUse real tools (the built plugin\u002F output, real git\u002Fnode, the test stub) instead of reading alone. Report ONLY defects you reproduced: each with a stable key (file:symbol:short-slug), title, severity, verifyModel and verifyEffort (classify the verify job: sonnet\u002Flow for a simple, local repro; opus\u002Fhigh for subtle, concurrent or cross-cutting ones), the repro and its output, and a minimal fix. High bar: no style, speculation or documented limitations. A verifier will re-run every repro independently. If nothing is reproduced return an empty list and say in \"checked\" what you checked.`\n\nconst dedupePrompt = (raw) => `Merge duplicate findings of a bug hunt on plugin \"${plugin}\". Findings (index, lens, key, title, repro, fix):\n${raw.map((f, i) => `[${i}] lens ${f.lens} | ${f.key} | ${f.title}\\n  repro: ${f.repro}\\n  fix: ${f.fix ?? 'none'}`).join('\\n')}\nGroup the indexes that describe the same root defect (same code, same failure, even if found by another lens or worded differently). Different defects in the same file stay separate groups. Every index belongs to exactly one group. For each group return its members, one key, one title, and the repro and fix of the best member (merge them when they complement each other). Read the code only where two findings are too close to tell apart. READ-ONLY on the repository, worktree ${worktree}.`\n\nconst verifyPrompt = (f) => `Verify this claimed defect of plugin \"${plugin}\" in the git worktree ${worktree}. READ-ONLY on the repository; scratch files go under the session scratchpad. Stay in the worktree.\nFinding ${f.key}: ${f.title}. Severity ${f.severity ?? 'n\u002Fa'}. Suggested fix: ${f.fix ?? 'none'}.\nIt was reported by these lenses, each with its own repro:\n${f.reports.map((r) => `- lens ${r.lens} (${lenses[r.lens].lens}): ${r.repro}`).join('\\n')}\nFor EVERY lens above re-run its repro yourself and read the code around it. Return one entry per lens: valid true when reproduced and a real defect; valid false when not reproducible, a documented limit, style or speculation (with the reason).\nIf at least one lens is valid, also rate the fix: fixModel sonnet for a local change that needs judgment, haiku for a mechanical, well-understood one; fixEffort low, medium or high by the work the fix and its test need (not used for haiku).`\n\nconst fixPrompt = (job, first) => `Fix this verified defect of plugin \"${plugin}\" in the git worktree ${worktree} (stay there; run git and pnpm from its root).\nFinding ${job.f.key}: ${job.f.title}. Repro: ${job.f.repro}. Suggested fix: ${job.f.fix ?? 'none'}. Verified for lenses: ${job.f.validLenses.join('; ')}.\n${job.notes ? `A previous fix (commit ${job.prevCommit}) was REJECTED in review. Review notes: ${job.notes}\\nBuild on or replace that commit as the notes demand.\\n` : ''}1. Re-run the repro. If it does not reproduce after all (and there is no review note saying otherwise): verdict refuted, change nothing.\n2. Fix the root cause once in ${plugin}\u002Fsrc (shared code, after grepping every caller), never in plugin\u002F**\u002F*.mjs. Add a test that fails without the fix (revert the line to check).\n3. \\`pnpm --filter ${plugin} build\\`, \\`pnpm lint\\`, \\`pnpm --filter ${plugin} test\\` until green; read the output.\n${first ? `4. First fix of the branch: bump ${plugin}\u002Fpackage.json version once (only if \\`git diff origin\u002Fmain -- ${plugin}\u002Fpackage.json\\` shows none), then rebuild.\\n` : ''}5. \\`git add\\` what you changed, commit (\"${plugin}: fix ${job.f.key}\", no Co-Authored-By), \\`git push -u origin HEAD\\`.\nReturn verdict fixed|refuted|blocked (blocked: cannot be made green; commit nothing broken), the commit sha, files (the repo-relative paths of the files the commit changed, from \\`git show --name-only\\`) and one sentence.`\n\nconst reviewPrompt = (job, commit) => `Review a fix of plugin \"${plugin}\" in the git worktree ${worktree}. READ-ONLY: another fix job may be committing in this worktree right now, so do not edit, build or run tests there; read the fix with \\`git show ${commit}\\` and the code it touches. To run something, copy the commit into a scratch directory outside the worktree (\\`git archive ${commit}\\` and a symlink to node_modules).\nFinding ${job.f.key}: ${job.f.title}. Repro: ${job.f.repro}.\nCheck: does it fix the root cause rather than the symptom, is every caller covered, does the test fail without the fix, does it add a regression or break an invariant, is anything beyond the finding changed. Reject only for a concrete defect you can name; style is no reason. Verdict approve, or reject with notes the fixer can act on.`\n\nconst closePrompt = (summary, files) => `Close the bug hunt of plugin \"${plugin}\" in the git worktree ${worktree} (stay there).\nFiles changed by the fix jobs (the only scope of simplify and code-review): ${files.join(', ')}.\n1. Size up the changes: \\`git diff --stat origin\u002Fmain...HEAD -- \u003Cthose files>\\`. Doc files (markdown, text, anything under docs\u002F) never count as code. Ask the jev-api tools first (\\`noul\\`) whether the code changes are too small or too simple to need a simplifier: only documentation, or only a few lines (about 30 changed code lines or fewer) without new logic.\n2. Simplify: when that is a confident yes, skip it. Otherwise skill \"simplify\" restricted to the changed code files (revert any edit it makes elsewhere), apply its fixes.\n3. Code review: skip it under the same rule as simplify. Otherwise choose the level from the size and risk of the changes, jev-api \\`score\\` first: \\`low\\` few lines of simple code, \\`medium\\` moderate changes, \\`high\\` larger changes or concurrency, caches, security or protocol code, \\`xhigh\\` large and risky changes; never \\`max\\`. Run skill \"code-review\" with args \"\u003Clevel> --fix\" and the changed code files as its target.\n4. Only when step 2 or 3 changed something: \\`pnpm --filter ${plugin} build\\`, \\`pnpm lint\\`, \\`pnpm --filter ${plugin} test\\` until green.\n5. Learnings pass: follow \"Close: learnings\" in .claude\u002Fskills\u002Fbughunt\u002FSKILL.md for the defect classes of this hunt: ${summary}. Only general facts go into .claude\u002Frules\u002F*.md (with paths:) or .claude\u002Fskills\u002F.\n6. \\`git add\\`, commit (\"${plugin}: bug hunt review and learnings\", no Co-Authored-By), \\`git push\\`; then \\`git status --short\\` must be empty and \\`git rev-parse HEAD\\` equal \\`git rev-parse @{u}\\`, else commit and push again.\nReturn status clean|fixed|blocked, simplify (skipped or run, with the reason), reviewLevel (skipped or the level used) and one sentence.`\n\n\u002F\u002F Hunt: every lens, every area, all in parallel.\nconst hunts = await parallel(lenses.flatMap((l, li) => areas.map((a) => async () => ({ lens: li, report: await run(huntPrompt(a, l.lens), { label: `hunt:l${li}:${a.name}`, phase: 'Hunt', model: l.model, effort: l.effort, schema: FINDINGS }) }))))\nconst raw = hunts.filter((h) => h?.report).flatMap((h) => h.report.findings.map((f) => ({ ...f, lens: h.lens })))\nconst failedHunts = hunts.filter((h) => !h?.report).length\n\n\u002F\u002F Dedupe: one job after all hunts; the lenses of a group come from its members, not from the model.\nlet groups = []\nif (raw.length) {\n  const d = await run(dedupePrompt(raw), { label: 'dedupe', phase: 'Dedupe', model: 'sonnet', effort: 'medium', schema: DEDUPE })\n  const used = new Set()\n  for (const g of d?.groups ?? []) {\n    const members = [...new Set(g.members)].filter((i) => Number.isInteger(i) && raw[i] && !used.has(i))\n    if (!members.length) continue\n    members.forEach((i) => used.add(i))\n    groups.push({ ...g, members })\n  }\n  raw.forEach((f, i) => { if (!used.has(i)) groups.push({ members: [i], key: f.key, title: f.title, repro: f.repro, fix: f.fix }) })\n}\nconst found = groups.map((g) => {\n  const ms = g.members.map((i) => raw[i])\n  const sev = ['high', 'medium', 'low'].find((s) => ms.some((m) => m.severity === s))\n  \u002F\u002F The hunters' classification of the verify job: the strongest model and highest effort asked for by any member.\n  const verifyModel = ms.some((m) => m.verifyModel === 'opus') || !ms.some((m) => m.verifyModel) ? 'opus' : 'sonnet'\n  const verifyEffort = ['high', 'medium', 'low'].find((e) => ms.some((m) => m.verifyEffort === e)) ?? 'medium'\n  return { key: g.key, title: g.title, repro: g.repro, fix: g.fix, severity: sev, verifyModel, verifyEffort, reports: ms.map((m) => ({ lens: m.lens, repro: m.repro })), lensSet: [...new Set(ms.map((m) => m.lens))] }\n})\n\n\u002F\u002F Verify: one opus verifier per deduplicated finding, in parallel.\nconst verdicts = await parallel(found.map((f) => () => run(verifyPrompt(f), { label: `verify:${f.key}`, phase: 'Verify', model: f.verifyModel, effort: f.verifyEffort, schema: VERIFY })))\nconst verified = []\nfound.forEach((f, i) => {\n  const v = verdicts[i]\n  const ok = (v?.lenses ?? []).filter((x) => x.valid && f.lensSet.includes(x.lens)).map((x) => x.lens)\n  f.verifiedLenses = ok\n  if (ok.length) verified.push({ ...f, validLenses: ok.map((n) => lenses[n].lens), fixModel: v.fixModel ?? 'sonnet', fixEffort: v.fixEffort ?? 'medium' })\n})\n\n\u002F\u002F Fix queue (one job at a time) with a review per finished fix running in parallel to the next fix job.\nconst results = verified.map((f) => ({ key: f.key, lenses: f.lensSet.map((n) => lenses[n].lens), verifiedLenses: f.verifiedLenses.map((n) => lenses[n].lens), fixModel: f.fixModel, fix: doFix ? 'queued' : 'not run', review: null, rejections: 0 }))\nconst queue = doFix ? verified.map((f, i) => ({ f, res: results[i], notes: null, prevCommit: null })) : []\nconst pending = new Set()\nlet fixed = 0\nconst changed = new Set()\nwhile (queue.length || pending.size) {\n  if (!queue.length) { await Promise.race(pending); continue }\n  const job = queue.shift()\n  const model = job.f.fixModel\n  const r = await run(fixPrompt(job, fixed === 0), { label: `fix:${job.f.key}`, phase: 'Fix', model, ...(model === 'haiku' ? {} : { effort: job.f.fixEffort }), schema: FIX })\n  \u002F\u002F After a rejected fix its commit stays on the branch: say so in the result.\n  const left = job.prevCommit ? ` (rejected fix ${job.prevCommit} stays on the branch)` : ''\n  if (!r || r.verdict === 'blocked') { job.res.fix = `blocked${left}`; log(`${job.f.key}: blocked`); continue }\n  if (r.verdict === 'refuted') { job.res.fix = `refuted${left}`; continue }\n  fixed++\n  for (const f of r.files ?? []) changed.add(f)\n  job.res.fix = 'fixed'\n  job.res.commit = r.commit\n  const review = run(reviewPrompt(job, r.commit), { label: `review:${job.f.key}`, phase: 'Fix', model: 'opus', effort: 'medium', schema: REVIEW })\n    .catch(() => null)\n    .then((rv) => {\n      if (rv?.verdict === 'reject' && job.res.rejections \u003C MAX_REJECTIONS) {\n        job.res.rejections++\n        job.res.review = 'rejected, queued again'\n        queue.push({ ...job, notes: rv.notes, prevCommit: r.commit })\n      } else if (rv?.verdict === 'reject') job.res.review = 'unresolved after rejections'\n      else job.res.review = rv ? 'approved' : 'review failed'\n    })\n    .finally(() => pending.delete(review))\n  pending.add(review)\n}\n\nlet close = null\nif (fixed > 0) {\n  close = await run(closePrompt(verified.map((f) => f.title).join('; '), [...changed]), { label: 'close', phase: 'Close', model: 'sonnet', effort: 'medium', schema: CLOSE })\n}\nreturn { hunted: raw.length, failedHunts, deduped: found.length, verified: verified.length, failedVerifies: verdicts.filter((v) => !v).length, fixed, results, close }\n```\n",{"name":5,"description":7,"argument-hint":24},"\u003Cplugin-name>","main","bb893ea76ba6e0d3f64bb1f59d9020751fc5d618",".claude\u002Fskills\u002Fbughunt","https:\u002F\u002Fgithub.com\u002Fkwitsch\u002Fclaude-plugins-development","https:\u002F\u002Fgithub.com\u002Fkwitsch","2026-11-15 18:25:39",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add kwitsch\u002Fclaude-plugins-development --skill bughunt",{"tool":37,"command":38},"bunx","bunx skills add kwitsch\u002Fclaude-plugins-development --skill bughunt",{"tool":40,"command":41},"pnpm","pnpm dlx skills add kwitsch\u002Fclaude-plugins-development --skill bughunt","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkwitsch\u002Fclaude-plugins-development\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fbughunt\u002FSKILL.md",true,[],[46,53,60,67,74,81],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M7FDF4DKMYQ2TTKD6TBJ6T0B","universal-lint","User-invoked. Takes a free-text description of a set of files (\"all files in src\u002F\", \"files changed in PR 123\", or an explicit list) and lints each of them exactly as this plugin's Write\u002FEdit hook would — read-only, no autofix — printing one aggregated findings report. Self-contained: depends on no other plugin.","https:\u002F\u002Fgithub.com\u002Fkwitsch\u002Fclaude-plugins-development\u002Fblob\u002Fmain\u002Funiversal-lint\u002Fplugin\u002Fskills\u002Funiversal-lint\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7FDEXH3PZGS7PPQBNV9RTRS","solve","Single entry point for any coding task (change, feature, refactor, bug). Triages the task through the jev-api tools and routes it to the right track, loading the phase references it needs. Flags --headless (the decider agent answers every question) and --size=\u003CS|M|L|XL>. Use when the user hands over a task to implement or fix.","https:\u002F\u002Fgithub.com\u002Fkwitsch\u002Fclaude-plugins-development\u002Fblob\u002Fmain\u002Fjev-solver\u002Fplugin\u002Fskills\u002Fsolve\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7FDEM07PDNZ9DBZF90CVDBZ","dprint","Runs dprint for the project. The first argument selects the action - init checks for the plugin's minimum dprint version, installs or updates dprint at user level after confirmation via AskUserQuestion, offers to create a dprint config when none exists and to add dprint plugins for file types the config does not cover; check [scope] runs dprint check; fmt [scope] runs dprint fmt and rewrites files; without an argument it runs fmt on the whole current directory. Use init when the user wants dprint set up, installed, updated, checked or its plugins completed; check when they want formatting verified with dprint; fmt only when they ask to format files with dprint. When invoking this skill yourself, always pass init, check or fmt as the first argument.","https:\u002F\u002Fgithub.com\u002Fkwitsch\u002Fclaude-plugins-development\u002Fblob\u002Fmain\u002Fdprint\u002Fplugin\u002Fskills\u002Fdprint\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7FDEENDBD9H0PK0BM3CG0CX","split-hooks-lib","Split the hooks module of a function-hooks plugin of this repository into a readable entry register.mts plus helper modules that the build bundles into one compressed plugin\u002Fhooks\u002Flib.mjs, to keep the shipped size small. Use when the user asks to split a plugin's register.mts, to make a plugin smaller, to move a plugin to register.mjs plus lib.mjs, or when a hooks module has grown too large for one file.","https:\u002F\u002Fgithub.com\u002Fkwitsch\u002Fclaude-plugins-development\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsplit-hooks-lib\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7FDEBDF3CXHKQ9XDXRTT7RC","__SKILL_NAME__","__SKILL_DESCRIPTION__ Use when the user asks to …","https:\u002F\u002Fgithub.com\u002Fkwitsch\u002Fclaude-plugins-development\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fscaffold-plugin\u002Ftemplates\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7FDE5RSE231MVBRWM69TJ30","scaffold-plugin","Scaffold a new Claude Code plugin in this repository with the repo layout (\u003Cname>\u002Fpackage.json, plugin\u002F, src\u002F, tests\u002F). Use when the user asks to create, add, scaffold or start a new plugin here.","https:\u002F\u002Fgithub.com\u002Fkwitsch\u002Fclaude-plugins-development\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fscaffold-plugin\u002FSKILL.md",[],[]]