Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Document?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/mystilleef-document)
---
name: document
description: "Document code APIs, modules, and behavior."
user-invocable: false
---
# Documentation agent
## When to use
- Public `APIs`, modules, commands, configuration, or workflows lack
caller-facing documentation.
- Code changes alter contracts, side effects, errors, or operational
constraints.
- Existing documentation drifts from observed behavior.
- Maintainers need rationale, invariants, edge cases, or runnable examples near
the code.
## Goal
- Improve code comprehension through concise, accurate, idiomatic documentation
explaining intent, contracts, safety constraints, and maintenance obligations.
- Document code so callers understand purpose, usage, constraints, and failure
behavior.
- Keep documentation co-located, current, minimal, and aligned with the
implementation.
## Input
Determine scope by the first available source:
- Files or folders provided by the user.
- Current changes in the repository.
Halt if no scope exists.
_Current changes:_ staged and `unstaged` edits, deletions, and renames of
tracked files, plus new `untracked` files. Requires a versioned project.
## Workflow
1. **GATE**—Resolve scope per **Input**, halting if none exists.
2. **ORIENT**—State target scope and documentation goal in one sentence. Runtime
behavior stays unchanged.
3. **PLAN**—Declare the minimal documentation change:
- Identify target files, exported interfaces, modules, and commands.
- Find missing, stale, redundant, or misleading documentation.
4. **ACT**—Execute PLAN only:
- Add or update docs for purpose, parameters, returns, errors, side effects,
invariants, and examples.
- Delete stale, speculative, duplicate, or implementation-repeating prose.
5. **VERIFY**—Compare every documentation claim against code, tests, and project
conventions. Iterate on failures.
6. **PERSIST**—Write all modified documentation files atomically after VERIFY
passes.
7. **REPORT**—Emit the result following the result directives and using the
result template.
## Directives
- **Lead with Purpose**: start each block with a one-line caller-facing summary.
- **Explain Why**: document rationale, constraints, tradeoffs, and caller
obligations, skipping routine mechanics.
- **Describe Interfaces**: cover parameters, return values, errors, side
effects, performance costs, and concurrency or ordering constraints.
- **Capture Safety**: record invariants, preconditions, edge cases, failure
modes, and recovery expectations.
- **Use Examples**: add runnable examples when they clarify usage or prevent
misuse.
- **Match Idioms**: follow language, framework, and repository documentation
style.
- **Maintain Vocabulary**: use domain terms consistently with the code and
existing docs.
- **IMPORTANT:** Return the result to the caller.
## Constraints
- **Accuracy First**: describe only observed behavior, never speculation.
- **Minimal Prose**: omit boilerplate, history, redundant type information, and
implementation narration.
- **Public Focus**: document caller-facing contracts and hide private
implementation details unless maintainers need an invariant.
- **One Concept per Block**: split unrelated ideas instead of writing dense
paragraphs.
- **No Stale Markers**: move `TODOs` and `FIXMEs` to the issue tracker when
possible, otherwise preserving only actionable context.
- **No Behavioral Changes**: don't alter runtime behavior while documenting.
## Verification
- Public `APIs`, modules, commands, and changed behavior have accurate
caller-facing documentation.
- Documentation matches code, tests, and repository conventions.
- Examples run or state required context.
- Changes remove stale, redundant, speculative, or implementation-repeating
docs.
- Formatting and documentation lint checks pass when available.
## Result directives
- **Minimum** words. **Maximum** signal.
- Keep prose terse while ensuring clarity.
- Optimize prose for agent, token, and context efficiency.
- Split actions, findings, and summaries into terse bullet points.
- Use lists and sub-lists for long sentences and dense paragraphs.
- **Result contract**: orchestrating agents parse `Result`, so a missing,
altered, or inconsistent result breaks orchestration.
- End every run—completion, short-circuit, early stop, or halt—with the result
template as the final message, never on progress narration.
- Set `Result` to exactly one template literal, verbatim. Report an early stop
or halt lacking its own literal as `Failed`, with the reason under `Findings`.
- Emit the result template as live markdown—never in a code fence.
- Output nothing outside the template.
### Result template
<!-- prettier-ignore-start -->
```md
### Execution Summary
- **Actions**:
- [Terse list of actions taken]
- **Files**:
- [Terse list of affected files]
- **Findings**:
- [Terse list of notable findings]
- **Summary**:
- [Terse list of summary of changes]
> **Document Status** • `[scope]`
> **Result**: [Documented | No Action | Failed]
> **Impact**: [Terse impact statement]
```
<!-- prettier-ignore-end -->