Skip to content

docs: reframe docstring guidance as public API reference, not prompts - #1606

Open
ajbozarth wants to merge 1 commit into
generative-computing:mainfrom
ajbozarth:docs/docstrings-published-not-prompts
Open

docs: reframe docstring guidance as public API reference, not prompts#1606
ajbozarth wants to merge 1 commit into
generative-computing:mainfrom
ajbozarth:docs/docstrings-published-not-prompts

Conversation

@ajbozarth

Copy link
Copy Markdown
Contributor

Description

The "Docstrings are prompts — the LLM reads them" framing in AGENTS.md and CONTRIBUTING.md tells contributors (and coding agents) to write docstrings for an LLM audience. In practice docstrings are published verbatim in the public API reference and read by humans, so that framing has two concrete downsides:

  • It steers docstrings toward an LLM audience instead of the humans reading the published reference. "Write for the LLM" is the wrong default for documentation that ships to users.
  • It encourages leaking session context into docstrings. Writing a docstring with the intent that another AI will read it invites transient, conversation-specific detail into the published reference — poor practice for documentation that ships to users.

Reframing the guidance to "published in the public API reference — be specific and accurate" keeps docstrings human-facing and accurate for the shipped docs.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

The "Docstrings are prompts — the LLM reads them" framing encouraged
writing docstrings for an LLM audience, when docstrings are actually
published verbatim in the public API reference and read by humans.
Reframe the guidance in AGENTS.md and CONTRIBUTING.md to emphasize
being specific and accurate for the published reference.

Assisted-by: Claude Code
Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
@ajbozarth
ajbozarth requested a review from a team as a code owner September 1, 2026 21:12
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 1, 2026
@ajbozarth

Copy link
Copy Markdown
Contributor Author

I have some personal preferences in my project memory around keeping docstring concise and direct, and to not leak session context into them. I regularly have to remind Claude to use these preferences and today my session pointed out to me that my preference conflict with the AGENTS file and pointed me at these lines.

I believe the original source of these lines came during the generation of AGENTS.md from our existing docs at the time and it picked up the best practices for writing docstrings in mellea apps which feed the docstrings for @tool functions, @generative functions, and mify methods to an LLM.

@ajbozarth ajbozarth self-assigned this Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant