home / skills / venkateshvenki404224 / frappe-apps-manager / frappe-documentation-generator

frappe-documentation-generator skill

/frappe-apps-manager/skills/frappe-documentation-generator

This skill helps you generate comprehensive Frappe API docs, user guides, and OpenAPI specs to streamline documentation workflows.

npx playbooks add skill venkateshvenki404224/frappe-apps-manager --skill frappe-documentation-generator

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

Files (1)
SKILL.md
4.6 KB
---
name: frappe-documentation-generator
description: Generate API documentation, user guides, and technical documentation for Frappe apps. Use when documenting APIs, creating user guides, or generating OpenAPI specs.
---

# Frappe Documentation Generator

Generate comprehensive documentation for Frappe applications including API documentation, user guides, and OpenAPI specifications.

## When to Use This Skill

Claude should invoke this skill when:
- User wants to document APIs
- User needs user documentation
- User mentions documentation, API docs, or guides
- User wants OpenAPI/Swagger specs
- User needs to document DocTypes or workflows

## Capabilities

### 1. API Documentation

**Whitelisted Method Documentation:**
```python
@frappe.whitelist()
def get_customer_details(customer):
    """
    Get detailed customer information

    Args:
        customer (str): Customer ID or name

    Returns:
        dict: Customer details including:
            - name: Customer ID
            - customer_name: Full name
            - email_id: Email address
            - mobile_no: Phone number
            - credit_limit: Credit limit amount
            - outstanding_amount: Current outstanding

    Raises:
        frappe.PermissionError: If user lacks read permission
        frappe.DoesNotExistError: If customer not found

    Example:
        >>> get_customer_details("CUST-001")
        {
            "name": "CUST-001",
            "customer_name": "John Doe",
            "email_id": "[email protected]",
            ...
        }

    Endpoint:
        POST /api/method/my_app.api.get_customer_details
        {
            "customer": "CUST-001"
        }
    """
    if not frappe.has_permission('Customer', 'read'):
        frappe.throw(_('Not permitted'), frappe.PermissionError)

    customer_doc = frappe.get_doc('Customer', customer)

    return {
        'name': customer_doc.name,
        'customer_name': customer_doc.customer_name,
        'email_id': customer_doc.email_id,
        'mobile_no': customer_doc.mobile_no,
        'credit_limit': customer_doc.credit_limit,
        'outstanding_amount': customer_doc.get_outstanding()
    }
```

### 2. OpenAPI Specification

**Generate OpenAPI/Swagger:**
```yaml
openapi: 3.0.0
info:
  title: My Frappe App API
  version: 1.0.0
  description: API documentation for My Frappe App

servers:
  - url: https://example.com/api
    description: Production server

paths:
  /method/my_app.api.get_customer_details:
    post:
      summary: Get customer details
      description: Retrieve detailed information for a customer
      tags:
        - Customers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customer:
                  type: string
                  description: Customer ID
              required:
                - customer
      responses:
        '200':
          description: Customer details
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string
                  customer_name:
                    type: string
                  email_id:
                    type: string
        '403':
          description: Permission denied
        '404':
          description: Customer not found
```

### 3. User Guide Generation

**DocType User Guide:**
```markdown
# Customer Management Guide

## Overview
The Customer DocType stores information about your customers including contact details, credit limits, and transaction history.

## Creating a Customer

1. Go to **Selling > Customer**
2. Click **New Customer**
3. Fill in required fields:
   - Customer Name: Full name of the customer
   - Customer Group: Classification (Individual/Company)
   - Territory: Geographic location
4. Optional fields:
   - Email, Phone, Address
   - Credit Limit and Payment Terms
5. Click **Save**

## Key Features

### Credit Management
- Set credit limits to control customer purchases
- Monitor outstanding amounts
- Get alerts on credit limit breach

### Transaction History
View all customer transactions:
- Sales Invoices
- Payment Entries
- Delivery Notes

## Workflows

### Standard Flow
1. Create Customer
2. Create Sales Order
3. Create Sales Invoice
4. Receive Payment
5. Deliver Goods

## Tips
- Use customer groups for bulk operations
- Set default price lists per customer
- Configure payment terms for auto-fill
```

## References

**Frappe Documentation Patterns:**
- Frappe Docs: https://github.com/frappe/frappe/tree/develop/frappe/docs
- ERPNext Docs: https://github.com/frappe/erpnext/tree/develop/erpnext/docs

Overview

This skill generates API documentation, user guides, and OpenAPI specifications for Frappe applications. It transforms whitelisted method docstrings, DocType structure, and workflow descriptions into consistent, developer- and user-facing docs. The output is ready for publishing as Markdown, OpenAPI YAML/JSON, or HTML help pages.

How this skill works

The skill parses Python docstrings (including frappe.whitelist methods), DocType definitions, and example usage blocks to extract endpoints, parameters, responses, and error conditions. It maps that information into structured API docs and OpenAPI 3.0 specifications, and produces user guides by converting DocType field lists, workflows, and step-by-step tasks into readable guides. It can output multiple formats (Markdown, OpenAPI YAML/JSON) and includes permission and error notes where detected.

When to use it

  • You need machine-readable API specs (OpenAPI/Swagger) for Frappe endpoints.
  • You want developer-facing API reference for whitelisted methods and endpoints.
  • You need user guides for DocTypes, workflows, or common tasks.
  • You are preparing release docs or onboarding material for a Frappe app.
  • You want to generate docs from code comments and DocType metadata to keep docs in sync.

Best practices

  • Annotate whitelisted methods with clear docstrings: purpose, args, returns, errors, and examples.
  • Include request/response examples and HTTP status notes in docstrings for accurate OpenAPI output.
  • Keep DocType field descriptions and workflow steps explicit so generated user guides are actionable.
  • Validate generated OpenAPI with a linter or Swagger UI before publishing.
  • Version your spec and docs alongside code to maintain parity with the app.

Example use cases

  • Produce OpenAPI YAML for an app's public endpoints to import into Swagger UI or Postman.
  • Generate a Developer API Reference from whitelisted method docstrings for internal use.
  • Create a user guide for a Customer DocType covering creation, key fields, and workflows.
  • Automate docs generation as part of CI to ensure documentation updates with code changes.
  • Bundle API docs and user manuals for a release or deployment handoff.

FAQ

Can the skill generate docs from existing docstrings automatically?

Yes. It reads whitelisted method docstrings and DocType metadata to produce API docs, examples, and OpenAPI specs automatically.

What output formats are supported?

It outputs Markdown user guides and OpenAPI 3.0 YAML/JSON for API specifications, suitable for Swagger UI, Postman, or static site generators.

How does it handle permissions and errors?

It detects permission checks and documented exceptions in docstrings and includes corresponding HTTP status codes and descriptions in the generated docs.