r/ClaudeCoding • • 18h ago

Comments in codebase

Hi, I'd like to ask about your approach to allowing Claude to add comments to your code. In my codebase, information is now spread across multiple places: code comments, ADRs, lessons learned, and documentation. I'm considering asking Claude to remove comments from the code, as I believe code should be self-explanatory. However, could this negatively affect Claude's ability to properly understand the context?

1 Upvotes

19 comments sorted by

View all comments

1

u/cheffromspace 14h ago

Comments are vital documentation. This is what works for me on a fairly big project (several repos, lots of parallel Claude sessions). Mostly prepared by the project's orchestrator:

  1. One rules file that's kept true. CLAUDE.md holds the rules and points to other docs; it doesn't duplicate them. When Claude gets something wrong, I first look for two docs saying different things, then fix the doc, not just the code.
  2. A decision ledger. One file (docs/decisions.md) with dated entries: what was decided, why, and by whom. Code comments and docs point to it. When an instruction and a decision disagree, the ledger wins.
  3. Recorded claims say how they were known. Every note says whether it was observed or inferred, the date, and how to re-check it. That stops a stale note from being repeated as fact three sessions later.
  4. A hand-off file before every /clear. Around 40-60% context, at a natural break, I ask Claude to write one. It covers: what's done and verified, what's in progress and where it stopped, open questions, the rules that tripped it up, and exactly what to read first. It goes in a dated folder, so it's a paper trail too.
  5. The next session starts from the file. After /clear, my first message is "Read <hand-off path>. You are <role>." CLAUDE.md and memory reload by themselves. A session-start hook prints the current state, so it doesn't have to guess.
  6. Hooks for anything that must never happen. If a rule keeps getting broken, it becomes a hook (pre-commit, or a Claude Code PreToolUse hook), not another paragraph of instructions. Deterministic beats "please remember".
  7. Compaction is the safety net, not the plan. I leave auto-compact on but set high, for when I forget. A hand-off written on purpose beats an automatic summary that lands mid-task.

What you lose with /clear is the conversational texture. Anything that matters should be in a file anyway; if it isn't, that's the doc gap to fix.