Skip to content

Docs: Improve inline comment guidance#16998

Open
kevinjqliu wants to merge 1 commit into
apache:mainfrom
kevinjqliu:kevinjqliu/codex-agents-comment-guidance
Open

Docs: Improve inline comment guidance#16998
kevinjqliu wants to merge 1 commit into
apache:mainfrom
kevinjqliu:kevinjqliu/codex-agents-comment-guidance

Conversation

@kevinjqliu

@kevinjqliu kevinjqliu commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Clarify that inline comments should explain non-obvious intent or constraints rather than restating code.
  • Preserve the existing Javadoc guidance while adding brief public API contract guidance.
  • Tell agents to describe current behavior or contracts, not how behavior changed over time.

Validation

  • git diff --check origin/main...HEAD

AI Disclosure

  • Model: GPT-5
  • Platform/Tool: Codex
  • Human Oversight: fully reviewed
  • Prompt Summary: Improve AGENTS.md guidance for inline comments, public API Javadocs, and historical-behavior phrasing.

@kevinjqliu kevinjqliu force-pushed the kevinjqliu/codex-agents-comment-guidance branch from 2b65e78 to 15f3fdc Compare June 29, 2026 04:06
Generated-by: GPT-5 Codex
@kevinjqliu kevinjqliu force-pushed the kevinjqliu/codex-agents-comment-guidance branch from 15f3fdc to adf6cd1 Compare June 29, 2026 04:09
@kevinjqliu kevinjqliu changed the title Docs: Clarify AGENTS comment guidance Docs: Improve inline comment guidance Jun 29, 2026
@kevinjqliu kevinjqliu marked this pull request as ready for review June 29, 2026 04:11
Comment thread AGENTS.md
- Javadoc describes the function or purpose of a class or method, not the implementation. Only describe what callers need to use the component, as though it were defined by an interface. Don't leak implementation details — over-documenting creates churn when the implementation changes.
- Magic numbers should be named constants. No personal pronouns in comments. Comments should explain non-obvious intent or constraints; don't restate what the code already says.
- Javadoc describes the function or purpose of a class or method, not the implementation. For public APIs, keep it brief and describe only what callers need to use the component, as though it were defined by an interface. Don't leak implementation details.
- Comments and Javadocs should describe the current behavior or contract, not how it changed over time.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this one. Sometimes I wish it can forget quickly.

@singhpk234 singhpk234 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants