.claude/skills/code-debug/SKILL.md
Code Fix and Iteration Tool. Handles all code modifications including training error fixes, performance tuning, etc. Can be called by /iterate code or used standalone. After modifying code, creates a semantic commit, then re-trains.
npx skillsauth add linzhe001/Harness-Research code-debugInstall 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.
Operation modes (determined by context):
planned_change: Called via /iterate code. Context in .claude/current_iteration.json
specifies hypothesis, config_diff, files_to_modify. Focus on implementing the planned change.bugfix: Called standalone for crash/error fixes. Focus on minimal diagnosis and fix.perf_tuning: Called standalone for performance optimization. Focus on profiling-driven changes.Inputs:
project_map.json — Locate relevant files and dependency chains (stable architecture files only).claude/current_iteration.json — Iteration context (exists when called by /iterate code, symlink to persistent context).
Contains mode, iteration_id, hypothesis, config_diff, files_to_modify, lessons_from_previous, etc.
If this file exists, prioritize its information to understand the modification intent and scope.docs/iterations/iter{N}.md — Previous iteration's evaluation report (if triggered by a DEBUG decision)After fix → re-train → /iterate eval or /evaluate re-evaluates. For language behavior, see ../../shared/language-policy.md. </context>
<instructions> 1. **Understand the problem**First check whether .claude/current_iteration.json exists:
Then read:
project_map.json: Locate relevant modules and their dependency chainsdocs/iterations/ directory (if triggered by a DEBUG decision)Locate the root cause
Trace the data flow along the dependencies chain in project_map.json:
io fields for consistencyexports fields for matchingPrecise fix
Use the Edit tool to modify code, following the minimal change principle:
Verify the fix
python -m py_compile <modified_files>
ruff check --select=E,F,I <modified_files>
If there are relevant tests, run them to confirm the fix is effective.
Sync project_map.json
If the fix involves interface changes to stable files (function signatures, tensor shapes, added/removed exports), update the corresponding node in project_map.json. Volatile files (per-iteration scripts/configs) do not need project_map updates.
Semantic Git Commit
After the fix is complete and verified, you must execute:
git add <modified files>
git commit -m "train(research): {semantic description}"
The message must describe what was done and why, for example:
train(research): fix shape mismatch — corrected neck output from [B,256,H,W] to [B,512,H,W]train(research): replace MSE loss with SSIM+L1 hybrid loss to improve reconstruction qualitytrain(research): fix OOM — batch_size 16→8, enable gradient accumulation with 2 stepstrain(baseline/{name}): fix data loading path, align evaluation metric computationThe commit is mandatory. If the commit fails, do not silently skip it — report the error.
User-facing debugging summaries should follow ../../shared/language-policy.md, while commands, commit prefixes, paths, and identifiers remain in English. </instructions>
<constraints> - NEVER make changes beyond the scope of the reported issue - NEVER refactor or "improve" unrelated code - NEVER skip py_compile validation after modification - NEVER re-train without committing first (semantic commit message required) - Core training/evaluation logic MUST stay in files listed in CLAUDE.md `## Entry Scripts`. Auxiliary scripts (ablation runners, submission packagers) may be created in `scripts/` as needed, but must not duplicate core logic. - ALWAYS read project_map.json to understand module dependencies before fixing - ALWAYS trace the full data flow when debugging shape mismatches - ALWAYS commit successfully — do not silently skip or proceed without a valid commit </constraints>development
WF7.5 training pipeline validation. Before entering WF8 iteration, first use Codex to review code for baseline equivalence, then run a 100-step smoke test to verify end-to-end pipeline functionality.
business
WF1 Inspiration survey and gap analysis. Takes the user's research idea, performs literature search, gap analysis, competitor analysis, and feasibility scoring, then outputs Feasibility_Report.md. Use when the user has a new CV research idea that needs a feasibility assessment.
tools
WF10 Submission/Release Tool. Multi-scene training, result packaging, filename validation, dry-run submission checks. Used after ablation experiments are complete and before competition submission.
development
WF2 Architecture refinement and MVP design. Reads the feasibility report, analyzes the base codebase architecture, designs plug-and-play new modules, defines the MVP, provides A/B/C alternative plans, and outputs Technical_Spec.md. Use when a research idea needs to be translated into a concrete technical architecture design.