document-api

Document public API exports with parameters, returns, errors, and examples.

Updated Dec 21, 2018
One-click install
npx skills add https://github.com/dhnt/dhnt --skill document-api-dhnt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: document-api
Source: https://github.com/dhnt/dhnt/tree/main/catalog/md/document/document-api
Command: npx skills add https://github.com/dhnt/dhnt --skill document-api-dhnt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps developers avoid guesswork by producing complete, accurate documentation for the public surface of an API, including parameters, return values, errors, side effects, concurrency expectations, and stability.

Core Features & Use Cases

  • API contract documentation: Describes what each exported function, type, method, or constant does in present-tense, descriptive language.
  • Developer-ready call guidance: Documents inputs, output semantics, possible error conditions, and important invariants or gotchas.
  • Stability and examples: Adds stability expectations and includes runnable examples for non-trivial APIs, aligned with the project’s existing documentation style.

Quick Start

Ask the Skill to document your API by specifying the public exported symbols and the language-specific doc style the project already uses.

Frequently Asked Questions about document-api

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

FAQPage Schema
How do I generate API reference documentation for an SDK?

To generate API reference documentation, you document each exported symbol by detailing its purpose, parameters, return values, errors, side effects, concurrency behavior, stability, and examples. This ensures developers have a reliable contract for functions, types, and constants.

What should developer-ready API docs include for non-trivial functions?

Developer-ready API docs should include inputs, output semantics, possible error conditions, and important invariants or gotchas. They also need stability expectations and runnable code-linked examples that align with the project's existing documentation style.

Can I document public APIs across different programming languages?

Yes, you can document public APIs across different languages by applying a consistent documentation structure. The process applies to SDKs and libraries where developers need a reliable contract for methods and constants, regardless of the specific language.

What is the best way to avoid API documentation drift?

To avoid API documentation drift, you should describe the public API surface using present-tense, descriptive language and avoid implementation details. Enforcing project style conventions and using code-linked examples also prevents the docs from drifting from the actual code.

How do I document API stability and concurrency behavior?

You document API stability and concurrency behavior by explicitly stating the stability expectations and concurrency conditions for each exported symbol. This provides developers with a clear contract regarding how the API will behave under concurrent execution.

Do I need to specify the doc style to document an API?

Yes, you need to specify the public exported symbols and the language-specific doc style the project already uses. This ensures the generated API documentation follows your project's conventions and integrates seamlessly with existing references.