Generate API documentation from TypeScript source code for RSPress. Use when documenting package APIs, extracting types from source code, or creating function/class reference pages.
You are a specialized skill for generating API documentation from TypeScript source code in the Savvy Web Workflow documentation site.
Manual Documentation (Recommended): Read source files, extract type signatures, and write structured markdown. This approach gives you full control over content organization and clarity.
Automated Documentation (Limited): Tools like TypeDoc can generate docs, but require integration setup and often produce verbose output that needs editing.
This skill focuses on the manual approach for better results.
API reference documentation lives under package directories:
docs/src/en/{package}/api/
├── index.mdx # API overview (frontmatter only, user can add content)
├── functions/ # Function reference pages
│ ├── index.mdx
│ └── function-name.mdx
├── types/ # Type and interface reference
│ ├── index.mdx
│ └── type-name.mdx
└── classes/ # Class reference pages
├── index.mdx
└── class-name.mdx
Note: All API documentation files are generated as .mdx files. The main
index.mdx overview file is only generated if it doesn't exist - if you've
added custom content to it, it will be preserved across regenerations.
api/index.mdx for navigationCreate function reference pages at api/functions/{function-name}.mdx:
# functionName
Brief description of what the function does.
## Signature
```typescript
function functionName<T>(param1: string, param2: T): Promise<Result>
| Name | Type | Description |
|---|---|---|
| param1 | string | Description of parameter |
| param2 | T | Generic parameter |
Promise<Result> - Description of return value
const result = await functionName('value', { data: true });
console.log(result);
Error - When validation failsTypeError - When parameters are invalid
<!-- markdownlint-disable MD024 -->
## Type/Interface Documentation
Create type reference pages at `api/types/{type-name}.mdx`:
```markdown
# TypeName
Brief description of what this type represents.
## Definition
```typescript
interface TypeName {
property1: string;
property2?: number;
method(): void;
}
| Property | Type | Required | Description |
|---|---|---|---|
| property1 | string | Yes | Description of property |
| property2 | number | No | Optional property |
Description of the method.
Returns: void
const example: TypeName = {
property1: 'value',
method() {
console.log('called');
}
};
## Class Documentation
Create class reference pages at `api/classes/{class-name}.mdx`:
```markdown
# ClassName
Brief description of the class purpose.
## Constructor
```typescript
constructor(param1: string, options?: Options)
| Name | Type | Description |
|---|---|---|
| param1 | string | Required parameter |
| options | Options | Optional config |
| Property | Type | Description |
|---|---|---|
| name | string | Read-only property |
Description of what the method does.
Example:
const instance = new ClassName('value');
const result = instance.methodName(param);
<!-- markdownlint-enable MD024 -->
## Extracting Exports from Source
Use these patterns to find exports in TypeScript files:
**Find all exports**:
```bash
grep -r "^export " src/
Find exported functions:
grep -r "^export function " src/
Find exported types:
grep -r "^export (type|interface) " src/
Find exported classes:
grep -r "^export class " src/
The overview file at api/index.mdx is auto-generated with frontmatter only.
If the file doesn't exist, it will be created with:
---