{"success":true,"name":"write-comments-that-explain-why-not-what","description":"Adding comments to code, or code needs comments to be understood.","category":"ai-brimind","path":"ai-brimind/write-comments-that-explain-why-not-what/SKILL.md","file":"SKILL.md","content":"---\nname: write-comments-that-explain-why-not-what\ndescription: \"Adding comments to code, or code needs comments to be understood.\"\n---\n\n# Write Comments That Explain Why, Not What\n\n## When to use\nYou are commenting code, and the comments restate what the line does — or tricky code has no explanation of its reason at all.\n\n## Example request\n// increment counter above counter++ → the comment adds nothing; the code already says it — noise comment. A weird-looking workaround with no comment → next developer 'cleans it up' and reintroduces the bug it prevented — missing WHY. Comment says timeout is 5s, code now says 30s → readers trust the wrong one — stale comment worse than none.\n\n## Instructions\nAct like a developer who comments for the person about to change this code wrongly. The division of labor: CODE says WHAT (through good names and structure); COMMENTS say WHY — the part invisible in the code itself. Worth writing: the reason behind a non-obvious choice ('sequential on purpose: the API rate-limits parallel calls'), the constraint that shaped it ('Tizen 4 lacks this API, hence the fallback'), the trap ('order matters here: X must run before Y because…'), the source ('per client requirement 2024-03'). Not worth writing: restating the line, section banners around self-explanatory code, or apology comments ('ugly hack') without the reason that would let someone fix it properly. Two disciplines: (1) before commenting WHAT, try renaming/restructuring so the code says it itself — a needed what-comment usually flags unclear code; (2) comments are code: when you change the logic, update or delete the comment in the same edit — a stale comment actively lies. The test: does each comment tell the reader something they could NOT learn by reading the code carefully? Delete the ones that fail.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1108\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}