home / skills / oimiragieo / agent-studio / doc-generator

doc-generator skill

/.cursor/skills/doc-generator

This skill generates comprehensive documentation from code and specifications, including API docs, guides, architecture, and user manuals with examples.

npx playbooks add skill oimiragieo/agent-studio --skill doc-generator

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.6 KB
---
name: doc-generator
description: Generates comprehensive documentation from code, APIs, and specifications. Creates API documentation, developer guides, architecture docs, and user manuals with examples and tutorials.
allowed-tools: read, write, glob, search, codebase_search
version: 1.0
best_practices:
  - Extract documentation from code comments
  - Generate OpenAPI/Swagger specs from code
  - Create comprehensive examples
  - Include troubleshooting guides
  - Follow documentation standards
error_handling: graceful
streaming: supported
templates: [api-docs, developer-guide, architecture-docs, user-manual]
---

<identity>
Documentation Generator Skill - Generates comprehensive documentation from code, APIs, and specifications including API docs, developer guides, architecture documentation, and user manuals.
</identity>

<capabilities>
- Generating API documentation
- Creating developer guides
- Documenting architecture
- Creating user manuals
- Generating OpenAPI/Swagger specs
- Updating existing documentation
</capabilities>

<instructions>
<execution_process>

### Step 1: Identify Documentation Type

Determine documentation type:

- **API Documentation**: Endpoint references
- **Developer Guide**: Setup and usage
- **Architecture Docs**: System overview
- **User Manual**: Feature guides

### Step 2: Extract Information

Gather documentation content:

- Read code and comments
- Analyze API endpoints
- Extract examples
- Understand architecture

### Step 3: Generate Documentation

Create documentation:

- Follow documentation templates
- Include examples
- Add troubleshooting
- Create clear structure

### Step 4: Validate Documentation

Validate quality:

- Check completeness
- Verify examples work
- Ensure clarity
- Validate links
  </execution_process>

<integration>
**Integration with Technical Writer Agent**:
- Uses this skill for documentation generation
- Ensures documentation quality
- Validates completeness

**Integration with Developer Agent**:

- Generates API documentation
- Creates inline documentation
- Updates docs with code changes
  </integration>

<best_practices>

1. **Extract from Code**: Use code as source of truth
2. **Include Examples**: Provide working examples
3. **Keep Updated**: Sync docs with code
4. **Clear Structure**: Organize logically
5. **User-Focused**: Write for users, not system
   </best_practices>
   </instructions>

<examples>
<formatting_example>
**API Documentation**

````markdown
# Users API

## Endpoints

### GET /api/users

List all users with pagination.

**Query Parameters:**

- `page` (number): Page number (default: 1)
- `limit` (number): Items per page (default: 10)

**Response:**

```json
{
  "data": [
    {
      "id": "uuid",
      "email": "[email protected]",
      "name": "User Name"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 100
  }
}
```
````

**Example:**

```bash
curl -X GET "http://localhost:3000/api/users?page=1&limit=10"
```

````
</formatting_example>

<formatting_example>
**Developer Guide**

```markdown
# Developer Guide

## Getting Started

### Prerequisites
- Node.js 18+
- pnpm 8+

### Installation
```bash
pnpm install
````

### Development

```bash
pnpm dev
```

## Architecture

[Architecture overview]

## Development Workflow

[Development process]

```
</formatting_example>
</examples>

<examples>
<usage_example>
**Example Commands**:

```

# Generate API documentation

Generate API documentation for app/api/users

# Generate developer guide

Generate developer guide for this project

# Generate architecture docs

Generate architecture documentation

# Generate OpenAPI spec

Generate OpenAPI specification from API routes

```
</usage_example>
</examples>

```

Overview

This skill generates comprehensive documentation from code, APIs, and specifications. It produces API references, developer guides, architecture documentation, and user manuals with runnable examples and tutorials. It can also generate or update OpenAPI/Swagger specs and keep docs synchronized with code changes.

How this skill works

The skill analyzes source code, comments, and API routes to extract endpoints, parameters, and response examples. It maps findings to documentation templates, inserts examples and troubleshooting sections, and validates completeness and link integrity. When requested, it emits OpenAPI/Swagger specifications and can patch existing docs to reflect recent code changes. It returns structured, ready-to-publish markdown or HTML content.

When to use it

  • You need full API reference documentation for public or internal APIs.
  • Onboarding new engineers with a clear developer guide and setup instructions.
  • Documenting system architecture, component responsibilities, and data flows.
  • Producing user manuals or feature guides for product releases.
  • Generating or updating OpenAPI/Swagger specs from route definitions.

Best practices

  • Treat code and inline comments as the single source of truth for examples and parameter meanings.
  • Include working examples and curl/SDK snippets for primary workflows.
  • Keep documentation generation in CI so docs stay synchronized with code changes.
  • Organize content by role: API reference, developer guide, architecture, and user manual.
  • Validate generated examples against test fixtures or mock servers before publishing.

Example use cases

  • Auto-generate endpoint reference and example responses for a REST API before a public launch.
  • Create a step-by-step developer guide with local setup, scripts, and common workflows.
  • Produce an architecture overview that includes component diagrams, data flow, and deployment notes.
  • Convert route handlers into an OpenAPI spec to feed API gateways or client SDK generators.
  • Update existing documentation after a refactor to ensure public docs match current behavior.

FAQ

Can the skill generate docs from multiple languages or frameworks?

Yes. It works by analyzing code, comments, and route metadata; support is strongest where routes and type information are available, but it can be extended to additional languages and frameworks.

How are examples validated?

Examples are validated by checking runnable snippets against extracted schemas or test fixtures and by verifying response formats match inferred types when possible.

Can it update existing documentation instead of replacing it?

Yes. The skill can patch or augment existing docs, inserting new endpoints, examples, or sections while preserving manual content where flagged.