claude-code - 💡(How to fix) Fix [Bug] System prompt aggressively removes necessary docstrings explaining non-obvious code behavior [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52808Fetched 2026-04-25 06:20:22
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1
RAW_BUFFERClick to expand / collapse

Bug Description the system prompt is destructive to existing code base comments. See this transcript:

You were right — I over-applied the "no comments" guidance. Source precedence and raise conditions are exactly the non-obvious WHY that belongs in a docstring.

❯ where was the "no comments" guidance from?

● From my Claude Code system prompt — not from you or any CLAUDE.md in this repo. The built-in instructions include lines like "Default to writing no comments. Only add one when the WHY is non-obvious..." and "Never write multi-paragraph docstrings or multi-line comment blocks — one short line max."

I misapplied it: the guidance says keep comments/docstrings that explain non-obvious WHY (hidden constraints, surprising behavior) — the source-precedence order and raise conditions on _load_openweather_settings fit that exactly, so they should've stayed. Sorry for the churn.

❯ the system prompt or the /simplify plugin prompt?

● Both, actually.

  • System prompt has it as a general rule: "Default to writing no comments... Never write multi-paragraph docstrings or multi-line comment blocks — one short line max."
  • /simplify reinforces it in Agent 2's checklist as item #8 ("Unnecessary comments: ... delete; keep only non-obvious WHY").

The immediate trigger was Agent 2 flagging the docstrings as "longer than their bodies" during the review, but the underlying rule is baked into the system prompt too. I applied both too aggressively — in this case the docstrings described non-obvious WHY (source precedence, raise conditions) and should have been kept.

Environment Info

  • Platform: win32
  • Terminal: vscode
  • Version: 2.1.118
  • Feedback ID: ee3e6b51-78c7-4ce0-89cb-4b9db93412eb
<img width="2016" height="563" alt="Image" src="https://github.com/user-attachments/assets/7f9ec0b1-f8d0-458f-b263-8e149207c216" />

extent analysis

TL;DR

Review and adjust the application of the "no comments" guidance from the system prompt and /simplify plugin to preserve comments that explain non-obvious behavior.

Guidance

  • Re-evaluate the comments removed and restore those that describe non-obvious WHY, such as source precedence and raise conditions.
  • Consider adding an exception to the "no comments" rule for docstrings that explain hidden constraints or surprising behavior.
  • Review the /simplify plugin's checklist to ensure it aligns with the revised commenting guidelines.
  • Verify that the system prompt's general rules are applied thoughtfully, considering the context and potential impact on code readability.

Example

No code snippet is provided as the issue focuses on the application of commenting guidelines rather than specific code changes.

Notes

The solution may vary depending on the specific use case and the trade-off between code conciseness and readability. It is essential to strike a balance between following the "no comments" guidance and preserving essential comments that explain non-obvious behavior.

Recommendation

Apply workaround: Review and adjust the application of the commenting guidelines to ensure that essential comments are preserved, as the current implementation may be too aggressive in removing useful comments.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] System prompt aggressively removes necessary docstrings explaining non-obvious code behavior [1 comments, 2 participants]