Skip to content
Agent loop · Docs

Docstrings Until Covered

Find public functions, classes, and endpoints with missing or stale reference docs, write accurate docstrings, and repeat until doc coverage hits your target.

Up to 8 iterationsStop rules and safety limits
The prompt

Copy the Docstrings Until Covered loop

Stops when documentation coverage of the public API meets the target and the doc build passes, or after 8 iterations. Edit the settings block, then paste the whole prompt into your agent.

docstrings-until-covered.prompt.md
You are running the "Docstrings Until Covered" loop.

Settings (edit before running):
- Coverage command: npx typedoc --validation.notDocumented --treatWarningsAsErrors false
- Doc build command: npx typedoc
- Target: every exported symbol in src/index.ts is documented
- Max iterations: 8

Goal: the public API meets the documentation target and the doc build passes.

Each iteration:
1. Run the coverage command and list undocumented or partially documented public symbols.
2. Take up to 15 symbols, grouped by module.
3. For each one, read the implementation, its tests, and at least one call site before writing anything.
4. Write a doc comment in the project's existing style: one-sentence summary, parameters, return value, thrown errors or failure modes, and a short example for anything non-obvious.
5. Run the doc build to catch formatting errors, then re-run coverage.
6. Log: iteration, symbols documented, coverage remaining.

Stop when:
- The target is met and the doc build passes. Success.
- You reach the max iteration count.

Rules:
- Only add or edit comments. Do not change code, signatures, or exports.
- Describe what the code does, not what its name suggests. If behavior looks like a bug, document the current behavior and flag it.
- Do not document private or internal helpers unless the target includes them.
- No filler such as "This function is a function that". Every sentence should tell the reader something.

Final report: coverage before and after, modules documented, and behavior you flagged as suspicious.
When to use it

When this loop fits

  • You publish a library or SDK and its generated API reference is full of blank entries.
  • A doc linter or coverage tool is failing in CI.
  • New contributors keep asking what parameters and return values mean.
How it works

What happens on each pass

The agent repeats these steps until the stop condition holds or it runs out of iterations.

  1. Measure coverage. Run the doc coverage or doc lint tool and list undocumented public symbols.
  2. Read before writing. Read each symbol's implementation, tests, and call sites to learn its real behavior.
  3. Write the docs. Document purpose, parameters, return value, errors, and a short example where useful.
  4. Build and re-measure. Build the API reference to catch syntax errors, then re-measure coverage.
Recommended servers

MCP servers for this loop

The 6 strongest of 2687 matching servers, ranked by how closely they fit and then by trust score.

More in Knowledge
  • Octri API Docs logo
    Trust score 67 of 100, Good

    Octri API Docs

    by octridev · TypeScript

    Search an Octri project's API docs and call its endpoints as tools, shaped by its SDK Studio config.

    Registry
    LicenseQualityMaintenanceLicense: A. MIT is a permissive open source license.Quality: Not graded. No README or tool list has been captured yet.Maintenance: A. Last commit or release 7 days ago.
    3 stars—/wk weekly downloads— tools
  • AstroWay API Docs logo
    Trust score 52 of 100, Fair

    AstroWay API Docs

    Unknown author

    AstroWay API documentation search and endpoint lookup with credit prices. No API key needed.

    RegistryRemote
    LicenseQualityMaintenanceLicense: Not graded. No license is recorded for this server.Quality: Not graded. No README or tool list has been captured yet.Maintenance: Not graded. No commit or release date has been recorded.
    — stars—/wk weekly downloads— tools
  • Trust score 52 of 100, Fair

    Ethos credibility scores and profiles for wallets and X accounts. Read-only, free, no key.

    RegistryRemote
    LicenseQualityMaintenanceLicense: Not graded. No license is recorded for this server.Quality: Not graded. No README or tool list has been captured yet.Maintenance: Not graded. No commit or release date has been recorded.
    — stars—/wk weekly downloads— tools
  • Fiscalisto API docs logo
    Trust score 52 of 100, Fair

    Fiscalisto API docs

    Unknown author

    Docs for Fiscalisto's Mexican e-invoicing API (CFDI 4.0): search, operations, SDK code, errors.

    RegistryRemote
    LicenseQualityMaintenanceLicense: Not graded. No license is recorded for this server.Quality: Not graded. No README or tool list has been captured yet.Maintenance: Not graded. No commit or release date has been recorded.
    — stars—/wk weekly downloads— tools
  • MarketCheck API Docs logo
    Trust score 47 of 100, Fair

    MarketCheck API Docs

    Unknown author

    MarketCheck API docs for coding assistants: search, endpoint reference, plans. Free, no auth.

    RegistryRemote
    LicenseQualityMaintenanceLicense: Not graded. No license is recorded for this server.Quality: Not graded. No README or tool list has been captured yet.Maintenance: Not graded. No commit or release date has been recorded.
    — stars—/wk weekly downloads— tools
  • Trust score 47 of 100, Fair

    Recruiter-grade boolean/x-ray search strings from a 20-year sourcing playbook.

    RegistryRemote
    LicenseQualityMaintenanceLicense: Not graded. No license is recorded for this server.Quality: Not graded. No README or tool list has been captured yet.Maintenance: Not graded. No commit or release date has been recorded.
    — stars—/wk weekly downloads— tools
Run it

How to run this loop

  1. Connect the tools. Install a server the loop can use, for example Octri API Docs, or rely on your agent's built-in terminal and file access.
  2. Edit the settings block. Replace the example commands, targets, and limits with your project's own. Keep the iteration cap low on the first run.
  3. Paste it into an agent session. Start a fresh session in Claude Code, Cursor, or VS Code agent mode, in the repository root, and paste the prompt.
  4. Review before you merge. Read the final report and the diff. The loop leaves its work for you to review rather than shipping it.
FAQ

Docstrings Until Covered questions

When does the Docstrings Until Covered loop stop?

It stops as soon as documentation coverage of the public API meets the target and the doc build passes. It also stops after 8 iterations by default, or earlier when the prompt's own stop rules say it is stuck, and then reports what changed and what is left. Change the cap in the settings block at the top of the prompt.

How do I run this loop on a Python project?

Use interrogate or pydocstyle as the coverage command and Sphinx or MkDocs as the doc build. Tell the agent which docstring style you use (Google, NumPy, or reStructuredText) in the settings block so it matches.

How does the loop keep generated docs accurate?

It requires the agent to read each symbol's implementation, tests, and a call site before writing, and to describe actual behavior rather than what the name implies. Anything that looks wrong is flagged instead of papered over.

Keep exploring
All loops