code-documentation

Enforces spec-traceable docstrings on every public construct at authorship time.

Updated May 21, 2026
One-click install
npx skills add https://github.com/CagesThrottleUs/private-ai-harness --skill code-documentation-cagesthrottleus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-documentation
Source: https://github.com/CagesThrottleUs/private-ai-harness/tree/main/skills/code-documentation
Command: npx skills add https://github.com/CagesThrottleUs/private-ai-harness --skill code-documentation-cagesthrottleus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Codebases accumulate undocumented functions, types, and endpoints that no one can trace back to a requirement, making reviews, onboarding, and audits painful. This Skill enforces documentation at the moment of writing — never as a cleanup step — so every public construct carries a one-line summary, parameters, return values, error conditions, and mandatory @spec_id / @req_id traceability tags. ## Core Features & Use Cases - Six-tier construct taxonomy: Defines exact documentation requirements for callables, type definitions, module boundaries, external endpoints, exported values, and test units, each with required fields and per-language examples. - Spec/requirement traceability: Every construct must carry @spec_id SPEC-N and @req_id REQ-NNN (or @validates_req for tests), with an Iron Law that nothing exists in the codebase without a spec. - Language-agnostic annotation reference: Covers TypeScript, Python, Go, Rust, Java, Kotlin, C/C++, Swift, Ruby, and PHP with the correct doc-comment style per language, plus lifecycle tags like @deprecated, @since, and thread-safety notes. - Use Case: While implementing a new POST /api/v1/auth/login handler, the Skill ensures you document auth requirements, request/response schemas, side effects, and link the endpoint to SPEC-1 / REQ-001 before marking the work complete. ## Quick Start Ask the AI to apply the code-documentation rules to document the public functions and types in the file you just wrote, adding spec_id and req_id tags to each construct.

Frequently Asked Questions about code-documentation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I document code with spec and requirement traceability?

Add @spec_id SPEC-N and @req_id REQ-NNN tags to every public construct's docstring, alongside a one-line summary, parameters, return values, and error conditions. Tests use @validates_req instead of @req_id to link back to the requirement they verify.

What should a function docstring include for code documentation?

A callable docstring needs a one-line summary, parameter descriptions, return value meaning, thrown errors, side effects if any, one runnable example, and spec_id plus req_id tags. The Skill provides templates for TypeScript, Python, Go, Rust, and Java.

Does this documentation approach work with Python docstrings?

Yes, it uses Google-style docstrings for Python with spec_id and req_id placed inside a Note: section, because bare key-value pairs outside a section break Napoleon and mkdocstrings parsing. Examples cover functions, dataclasses, and module headers.

Do constants and type definitions really need documentation?

Yes, exported constants and type definitions are public API surface and require traceability. Types need a purpose statement plus represents and does-not-represent notes; constants need a one-line summary, and both need spec_id and req_id tags.

When should I not write documentation in a docstring?

Avoid multi-paragraph algorithm explanations, changelog entries, author attribution, and comments that will go stale. Long-form prose belongs in a wiki organized by the Diátaxis modes: tutorials, how-to guides, reference, and explanation.