bugfix-comment-context
Skill2 starsChanged 5 months agoMITView on GitHub
Add durable, high-signal code comments that preserve the original bug symptom, evidence, root cause, and fix intent after a bug fix. Use when the user asks to "add comments", "record why this code exists", "防止后面不知道为什么加这个代码", "把问题现象写进注释", "记录一下这个行为", or when a fix introduces a guard, workaround, retry, compatibility branch, race-condition protection, vendor/device-specific behavior, or non-obvious defensive logic that future maintainers might remove.
In this repository12 other files it gives its agents.
- bug2csvSkill
- bugbatch-prepareSkill
- bugfix-doneSkill
- bugfix-worktreeSkill
- debug-tag-addSkill
- debug-tag-clearSkill
- feature-doneSkill
- feature-prepareSkill
- feature-worktreeSkill
- plan-csv-executeSkill
- planSkill
- plan-to-issues-csvSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use this skill to leave a compact maintenance note near non-obvious bugfix code.
- Distinctive: line 18
Add the comment immediately above the relevant code, or as a function/class KDoc when the whole helper exists only for this fix.
- Distinctive: line 34
Write comments in the repository's existing language.
- Distinctive: line 35
Do not narrate obvious code mechanics, such as "checks if x is null".
- Distinctive: line 36
Do not exaggerate certainty.
- Distinctive: line 37
Keep each comment close to the code it protects.
- Distinctive: line 39
Avoid TODO-style wording unless follow-up work is actually required.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Bugfix Comment Context
Purpose
Use this skill to leave a compact maintenance note near non-obvious bugfix code. The note should explain the real-world problem that triggered the change, not just restate what the code does.
Workflow
- Identify the smallest code location future maintainers are likely to question or delete: a guard clause, fallback, retry, compatibility branch, lifecycle ordering check, vendor workaround, or defensive exception.
- Capture the original user-facing symptom in plain language. Include the actor, state, trigger, and observed result when known.
- Capture the evidence-backed cause or strongest diagnosis. Mention logs, crash type, race, protocol mismatch, lifecycle timing, vendor behavior, or data shape only if actually confirmed.
- Explain why the code returns, retries, waits, no-ops, falls back, or throws. Make clear whether the behavior is a real failure, a deferred retry, or a deliberate compatibility boundary.
- Add the comment immediately above the relevant code, or as a function/class KDoc when the whole helper exists only for this fix.
- Re-run the narrowest relevant compile/test command when comments are in source files, especially in Kotlin/Java where comment encoding or formatting can still break builds.
Comment Content Checklist
Include only high-signal items that future readers need:
- Original symptom: what the user saw, such as "background receiver disconnects and app restarts".
- Trigger conditions: platform, lifecycle state, device/vendor, input shape, timing, or protocol step.
- Confirmed evidence: log tag, exception class, crash signal, status code, stack frame, or observed state.
- Fix intent: why this branch exists and why a simpler-looking path is unsafe.
- Retry/fallback semantics: whether returning
false, skipping work, or no-op means "try later" rather than "give up". - Boundaries: note uncertainty or device-specific scope when the root cause is inferred.
Style Rules
- Write comments in the repository's existing language; for Chinese projects, use concise Chinese.
- Do not narrate obvious code mechanics, such as "checks if x is null".
- Do not exaggerate certainty. Use "日志确认", "这里先挡住", or "疑似" according to evidence strength.
- Keep each comment close to the code it protects. Prefer one focused paragraph or 3-8 short comment lines.
- Preserve existing business comments; extend them instead of replacing useful context.
- Avoid TODO-style wording unless follow-up work is actually required.
Example Shape
// 修复现象:Android 接收端退到后台时,发起端投屏成功后立刻断开;
// 回到前台看到 App 重新启动。日志确认是硬解线程 native crash。
//
// 这里返回 false 不是终止流程,而是等待 Surface ready 后通过后续格式包重试,
// 避免把未就绪的输出面交给 MediaCodec。
if (!isOutputReady()) return falseDoes 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
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.

