ingenious: Command for Claude Code

.claude/commands/quality/py-quality/docstrings.md

docstrings is a command for Claude Code from Insight-Services-APAC/ingenious. It costs 0 tokens per session (1,003 once invoked), scanned A, original, MIT.

A command for finding and fixing missing or malformed docstrings, which are explanatory text attached to code elements such as functions and classes.

In plain words
What is it for?
Use it to scan Python modules with Interrogate and Pydocstyle, fix their documentation, and repeat the checks until they pass.
Why use it?
It gives the codebase consistent developer-facing documentation and checks that no reported docstring problems remain.

Command for Claude Code

Written for Claude Code: installed under .claude/.

This is Insight-Services-APAC/ingenious's own configuration. It tells Claude Code how to work on ingenious itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ingenious configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Insight-Services-APAC/ingenious. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Insight-Services-APAC/ingenious/main/.claude/commands/quality/py-quality/docstrings.md
Clone the repo
git clone --depth 1 https://github.com/Insight-Services-APAC/ingenious

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for docstrings

README.md
[![agentmods](https://agentmods.dev/badge/commands/insight-services-apac/ingenious/docstrings.svg)](https://agentmods.dev/commands/insight-services-apac/ingenious/docstrings)
Your own site
<a href="https://agentmods.dev/commands/insight-services-apac/ingenious/docstrings"><img src="https://agentmods.dev/badge/commands/insight-services-apac/ingenious/docstrings.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,003 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01003
Opus 5 $0.00000 $0.00502
Sonnet 5 $0.00000 $0.00201
Haiku 4.5 $0.00000 $0.00100

Measured 2d ago against content hash a8a0f3dab43d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

docstrings scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/quality/py-quality/docstrings.md · 139 lines

How it starts

The opening of the file, as written. The whole thing — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Verify and Fix Docstrings with Interrogate and Pydocstyle

Use static analysis tools to ensure all functions, classes, and modules have proper, consistent docstrings.

CRITICAL: Persistence Requirement

DO NOT STOP until ALL docstring issues are resolved. This task requires complete coverage:

  • Process every single file reported by the tools
  • Fix every missing or malformed docstring
  • Continue working through all modules systematically
  • Re-run the analysis tools after each batch of fixes to confirm progress
  • Only consider this task complete when both interrogate and pydocstyle report zero issues

If context window limits approach, document remaining files in the todo list and continue in the next session. Do not leave the codebase in a partially documented state.

1. Run Docstring Coverage Analysis

uv run interrogate -v . --fail-under 100 --ignore-init-method --ignore-init-module --exclude .venv --exclude venv --exclude .git --exclude __pycache__ --exclude node_modules

This shows which modules, classes, and functions are missing docstrings. The -v flag provides detailed output. The --fail-under 100 ensures nothing is missed.

For a summary report:

uv run interrogate . --generate-badge /tmp/docstring-badge --exclude .venv --exclude venv

2. Run Docstring Style Check

uv run pydocstyle . --convention=google --match='(?!test_).*\.py' --ignore=D100,D104

This validates docstrings follow Google style conventions (D100 and D104 are ignored for module-level docstrings which are often unnecessary).

For specific error codes only:

uv run pydocstyle . --select=D101,D102,D103,D107

Key codes:

  • D100: Missing docstring in public module
  • D101: Missing docstring in public class
  • D102: Missing docstring in public method
  • D103: Missing docstring in public function
  • D107: Missing docstring in init

3. Processing Order

Work through files systematically:

  1. Start with public API functions and classes
  2. Then complex functions with cyclomatic complexity >= B
  3. Then entry points and orchestration code
  4. Then utility functions and helpers
  5. Finally, private methods and internal functions

Read the full file on GitHub · 139 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 139 lines · 0 tokens per session scan A a8a0f3dab43d

Subscribe to this mod's changes

docstrings is a command published in the GitHub repository Insight-Services-APAC/ingenious (24 stars, last pushed 7mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,003 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.