Agent skill
document-api
Generate comprehensive API documentation in Markdown format for Swift classes and structs. Use this when creating API documentation, documenting public interfaces, or preparing developer documentation for iOS components.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/document-api
SKILL.md
API Documentation Generator
Generate user-friendly API documentation in Markdown format for Swift source files, focusing on public and internal members only.
Instructions
When asked to document a Swift component's API:
-
Analyze the Source: Identify the main class/struct, its purpose, and public-facing API (properties, initializers, methods). Use DocC-style comments (
///) as primary source. -
Generate Documentation with this structure:
Structure
# API Documentation: [ClassName]
## Overview
[Brief 1-2 sentence summary of component's purpose]
## Properties
* **propertyName** (`type`): Description of property's purpose and usage
## Initializers
### `init(param1:type1, param2:type2)`
Description of what this initializer does
- **param1**: Description of parameter
- **param2**: Description of parameter
## Methods
### `methodName(param1:type1) -> ReturnType`
Description of what the method does
- **param1**: Description of parameter
- **Returns**: Description of return value
Scope Rules
- Include:
publicandinternalmembers only - Exclude: All
privateandfileprivateimplementation details
Example
Input:
/// Converts temperature between different units.
class TemperatureConverter {
/// The current temperature in degrees Celsius.
public private(set) var celsius: Double
/// Creates a converter with an initial Celsius value.
public init(celsius: Double) {
self.celsius = celsius
}
/// Updates the temperature from a Kelvin value.
public func set(kelvin: Double) {
guard kelvin >= 0 else { return }
self.celsius = kelvin - 273.15
}
}
Output:
# API Documentation: TemperatureConverter
## Overview
A utility class that converts and stores temperature in Celsius.
## Properties
* **celsius** (`Double`): The current temperature in degrees Celsius. This property is read-only from outside the class.
## Initializers
### `init(celsius: Double)`
Creates a new instance of the converter with a specified initial temperature.
- **celsius**: The starting temperature in degrees Celsius.
## Methods
### `set(kelvin: Double)`
Updates the stored temperature from a Kelvin value. It ignores negative Kelvin values.
- **kelvin**: The new temperature in Kelvin.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?