Skip to content

Skills for Claude Code CLI such as full stack dev Cloudflare, React, Tailwind v4, and AI integrations.

feat(skill-development): Add api-doc-scraper agent and /scrape-api command

Jezaf483d6a8532
diff --git a/skills/skill-development/.claude-plugin/plugin.json b/skills/skill-development/.claude-plugin/plugin.json
index 287ae4e7..7cb2b784 100644
--- a/skills/skill-development/.claude-plugin/plugin.json
+++ b/skills/skill-development/.claude-plugin/plugin.json
@@ -9,5 +9,5 @@
"license": "MIT",
"repository": "https://github.com/jezweb/claude-skills",
"keywords": [],
- "agents": []
+ "agents": ["api-doc-scraper"]
}
diff --git a/skills/skill-development/SKILL.md b/skills/skill-development/SKILL.md
index 5ca19364..5bee613b 100644
--- a/skills/skill-development/SKILL.md
+++ b/skills/skill-development/SKILL.md
@@ -91,6 +91,30 @@ Extended deep audit with comprehensive doc scraping.
---
+### `/scrape-api <docs-url> [skill-name]`
+
+Generate a skill from API documentation URL.
+
+**What it does**:
+1. Validates the docs URL is accessible and contains API documentation
+2. Attempts WebFetch first for static docs
+3. Falls back to Playwright for JS-heavy sites (readme.io, GitBook)
+4. Extracts endpoints, authentication, request/response schemas
+5. Generates complete skill structure with SKILL.md, references/, templates/
+6. Runs plugin manifest generation
+
+**Usage**:
+- `/scrape-api https://api.example.com/docs my-api`
+- `/scrape-api https://rocketdotnet.readme.io/` (auto-detects name: rocket-net-api)
+
+**Supported Platforms**:
+- readme.io documentation sites
+- Swagger/OpenAPI specs
+- GitBook documentation
+- Standard HTML API docs
+
+---
+
## Templates
This skill includes templates for creating new skills:
@@ -145,6 +169,7 @@ This skill provides agents for automated skill maintenance:
| Agent | Purpose |
|-------|---------|
| `skill-creator` | Scaffold new skills with proper structure |
+| `api-doc-scraper` | Generate skills from API documentation URLs |
| `version-checker` | Verify package versions are current |
| `content-accuracy-auditor` | Compare skill content vs official docs |
| `code-example-validator` | Validate code examples are syntactically correct |
@@ -152,7 +177,7 @@ This skill provides agents for automated skill maintenance:
| `doc-validator` | Check documentation quality |
| `bulk-updater` | Apply changes across multiple skills |
-These agents are in `.claude/agents/` and used by the audit commands.
+These agents are in `.claude/agents/` (repo-level) and `agents/` (skill-bundled) and used by the commands.
---
diff --git a/skills/skill-development/agents/api-doc-scraper.md b/skills/skill-development/agents/api-doc-scraper.md
new file mode 100644
index 00000000..8db0e890
--- /dev/null
+++ b/skills/skill-development/agents/api-doc-scraper.md
@@ -0,0 +1,292 @@
+---
+name: api-doc-scraper
+description: |
+ API documentation scraper that generates skills from docs URLs. MUST BE USED when: creating API skills from documentation sites, scraping readme.io docs, extracting endpoint information, or building API reference skills. Handles JS-heavy sites with Playwright fallback.
+
+ Keywords: api docs, scrape docs, readme.io, api skill, endpoint documentation, swagger, openapi
+model: sonnet
+# tools field OMITTED - inherits ALL tools including Playwright MCP for browser fallback
+---
+
+# API Documentation Scraper Agent
+
+You scrape API documentation from URLs and generate Claude Code skills. You handle both static docs (WebFetch) and JS-heavy sites (Playwright fallback).
+
+## Input
+
+You'll receive:
+- **docs_url**: The API documentation URL
+- **skill_name**: Name for the skill (e.g., "rocket-net-api")
+- **output_dir**: Where to create the skill (default: `skills/[skill_name]/`)
+
+## Workflow
+
+### Phase 1: Reconnaissance
+
+First, try to understand the docs structure:
+
+```
+1. Try WebFetch on the main docs URL
+2. Check if content is meaningful or mostly JS placeholders
+3. Look for:
+ - OpenAPI/Swagger JSON (often at /openapi.json or /swagger.json)
+ - API reference section
+ - Navigation/sidebar structure
+```
+
+**WebFetch attempt:**
+```
+WebFetch(url: "[docs_url]", prompt: "Extract: 1) API base URL, 2) Authentication method, 3) List of all endpoint categories/sections visible, 4) Any links to OpenAPI/Swagger specs")
+```
+
+**Signs you need Playwright fallback:**
+- Response is mostly empty or just boilerplate
+- Content mentions "JavaScript required"
+- Known JS-heavy platforms: readme.io, gitbook, docusaurus (some)
+- Navigation items visible but content area empty
+
+### Phase 2A: WebFetch Path (if docs are static)
+
+If WebFetch returns good content:
+
+1. **Find all endpoint pages:**
+```
+WebFetch(url: "[docs_url]", prompt: "List ALL API endpoints mentioned with their paths and HTTP methods. Include links to detailed documentation for each.")
+```
+
+2. **For each endpoint section, fetch details:**
+```
+WebFetch(url: "[endpoint_page_url]", prompt: "Extract: HTTP method, path, description, request parameters (name, type, required), request body schema, response schema, example request, example response, error codes")
+```
+
+3. **Extract authentication:**
+```
+WebFetch(url: "[auth_docs_url]", prompt: "Extract: Authentication method (API key, OAuth, Bearer token), where to include credentials (header, query), any scopes or permissions, rate limits")
+```
+
+### Phase 2B: Playwright Path (if JS-heavy)
+
+If WebFetch fails or returns sparse content:
+
+1. **Navigate to docs:**
+```
+mcp__plugin_playwright_playwright__browser_navigate(url: "[docs_url]")
+```
+
+2. **Take snapshot to see structure:**
+```
+mcp__plugin_playwright_playwright__browser_snapshot()
+```
+
+3. **Find navigation/sidebar:**
+Look for nav elements, usually containing links to all API sections.
+
+4. **Extract navigation links:**
+```
+mcp__plugin_playwright_playwright__browser_evaluate(function: "Array.from(document.querySelectorAll('nav a, .sidebar a, [class*=nav] a')).map(a => ({text: a.textContent.trim(), href: a.href})).filter(l => l.text && l.href)")
+```
+
+5. **Visit each endpoint page:**
+For each link that looks like an API endpoint:
+```
+mcp__plugin_playwright_playwright__browser_navigate(url: "[endpoint_url]")
+mcp__plugin_playwright_playwright__browser_snapshot()
+```
+
+6. **Extract endpoint details from each page:**
+Look for:
+- HTTP method badges (GET, POST, PUT, DELETE)
+- Path/URL patterns
+- Parameter tables
+- Request/response examples
+- Code snippets
+
+### Phase 3: Generate Skill Structure
+
+Create the skill directory structure:
+
+```
+skills/[skill_name]/
+├── SKILL.md # Main skill file
+├── README.md # Keywords for discovery
+├── references/
+│ ├── endpoints.md # All endpoints documented
+│ ├── auth.md # Authentication details
+│ └── errors.md # Error codes (if found)
+└── templates/
+ └── client.ts # Example TypeScript client (if applicable)
+```
+
+### Phase 4: Write SKILL.md
+
+```markdown
+---
+name: [skill_name]
+description: |
+ [API name] integration for [what it does]. Covers authentication, [main endpoint categories].
+
+ Use when: [use cases]. Keywords: [api name], [key features], [common tasks].
+license: MIT
+---
+
+# [API Name] API
+
+**Status**: Production Ready
+**Last Updated**: [date]
+**API Version**: [if known]
+**Base URL**: [base url]
+
+---
+
+## Authentication
+
+[Authentication method and how to use it]
+
+## Quick Start
+
+```typescript
+// Example of basic API call
+```
+
+## Endpoints
+
+### [Category 1]
+
+| Method | Endpoint | Description |
+|--------|----------|-------------|
+| GET | /path | Description |
+| POST | /path | Description |
+
+[Continue for each category]
+
+## Rate Limits
+
+[If found]
+
+## Error Handling
+
+[Common error codes]
+
+## Official Documentation
+
+- [Link to official docs]
+```
+
+### Phase 5: Write References
+
+**references/endpoints.md:**
+Detailed documentation for each endpoint including:
+- Full request/response schemas
+- All parameters with types
+- Example requests and responses
+
+**references/auth.md:**
+- Step-by-step authentication setup
+- Token management
+- Scopes/permissions
+
+**references/errors.md:**
+- All error codes
+- What they mean
+- How to handle them
+
+### Phase 6: Generate Plugin Manifest
+
+```bash
+./scripts/generate-plugin-manifests.sh [skill_name]
+```
+
+## Output
+
+Report what was created:
+
+```
+═══════════════════════════════════════════════
+ API SKILL GENERATED
+═══════════════════════════════════════════════
+
+Skill: [skill_name]
+Source: [docs_url]
+Method: [WebFetch | Playwright]
+
+Created:
+ skills/[skill_name]/
+ ├── SKILL.md (overview + quick start)
+ ├── README.md (discovery keywords)
+ ├── references/
+ │ ├── endpoints.md ([X] endpoints documented)
+ │ ├── auth.md (authentication guide)
+ │ └── errors.md ([X] error codes)
+ └── templates/
+ └── client.ts (example client)
+
+Endpoints documented: [count]
+Categories: [list]
+
+Next steps:
+1. Review generated skill for accuracy
+2. Test with: /plugin install ./skills/[skill_name]
+3. Add any missing endpoints or details
+═══════════════════════════════════════════════
+```
+
+## Platform-Specific Tips
+
+### readme.io (like Rocket.net)
+- Navigation is usually in left sidebar
+- Each endpoint has its own page
+- Look for "Try It" sections with examples
+- Code examples often in tabs (curl, Node, Python)
+
+### Swagger/OpenAPI
+- If you find openapi.json, parse it directly
+- Contains all endpoints in structured format
+- Much easier than scraping HTML
+
+### GitBook
+- Similar to readme.io
+- Usually needs Playwright
+- Table of contents on left
+
+## Error Handling
+
+**If docs require login:**
+```
+⚠️ Documentation requires authentication.
+
+Options:
+1. Provide login credentials (I'll use Playwright to authenticate)
+2. Provide a session cookie
+3. Try a different docs URL (public API reference)
+```
+
+**If rate limited:**
+```
+⚠️ Rate limited by docs site.
+
+Waiting 30 seconds before continuing...
+[Or use Playwright which looks more like a real browser]
+```
+
+**If structure is unusual:**
+```
+⚠️ Couldn't auto-detect docs structure.
+
+Please provide:
+1. Link to endpoint list/index
+2. Example of a single endpoint page
+```
+
+## Do NOT
+
+- Scrape docs that explicitly prohibit it (check robots.txt)
+- Make excessive requests (be polite, add delays)
+- Generate skills with placeholder content ("TODO", "TBD")
+- Skip authentication documentation
+
+## Do
+
+- Verify extracted information makes sense
+- Include working code examples where possible
+- Note any gaps ("Endpoint X not fully documented in source")
+- Prefer OpenAPI/Swagger if available
diff --git a/skills/skill-development/commands/scrape-api.md b/skills/skill-development/commands/scrape-api.md
new file mode 100644
index 00000000..e9bf8fe3
--- /dev/null
+++ b/skills/skill-development/commands/scrape-api.md
@@ -0,0 +1,155 @@
+# Scrape API
+
+Generate a skill from API documentation URL.
+
+---
+
+## Command Usage
+
+`/scrape-api <docs-url> [skill-name]`
+
+- With name: `/scrape-api https://api.example.com/docs my-api`
+- Auto-detect name: `/scrape-api https://api.example.com/docs`
+
+---
+
+## Your Task
+
+Use the `api-doc-scraper` agent to scrape API documentation and generate a skill.
+
+### Step 1: Parse Input
+
+Extract from command:
+- `docs_url`: The documentation URL
+- `skill_name`: Provided name or derive from URL
+
+If no skill name provided, derive from URL:
+```
+https://rocketdotnet.readme.io/ → rocket-net-api
+https://api.elevenlabs.io/docs → elevenlabs-api
+https://developers.facebook.com/docs/whatsapp → whatsapp-api
+```
+
+### Step 2: Validate URL
+
+Check the URL is accessible:
+```
+WebFetch(url: "[docs_url]", prompt: "Is this a valid API documentation page? What API is it for?")
+```
+
+If invalid or not API docs:
+```
+⚠️ This doesn't appear to be API documentation.
+
+URL: [docs_url]
+Found: [what was found instead]
+
+Please provide a direct link to the API reference/documentation.
+```
+
+### Step 3: Launch Scraper Agent
+
+```
+Task(
+ subagent_type: "api-doc-scraper",
+ prompt: """
+Scrape API documentation and generate a skill.
+
+docs_url: [docs_url]
+skill_name: [skill_name]
+output_dir: skills/[skill_name]/
+
+Follow the full workflow:
+1. Recon - understand docs structure
+2. Extract - get all endpoints, auth, examples
+3. Generate - create skill files
+4. Report - summarize what was created
+"""
+)
+```
+
+### Step 4: Verify Output
+
+After agent completes:
+
+```bash
+# Check skill was created
+ls -la skills/[skill_name]/
+
+# Generate plugin manifest
+./scripts/generate-plugin-manifests.sh [skill_name]
+```
+
+### Step 5: Report to User
+
+```
+═══════════════════════════════════════════════
+ API SKILL CREATED
+═══════════════════════════════════════════════
+
+Skill: [skill_name]
+Source: [docs_url]
+
+Files:
+ skills/[skill_name]/
+ ├── SKILL.md
+ ├── README.md
+ └── references/
+ ├── endpoints.md
+ └── auth.md
+
+Endpoints: [count]
+
+Test with:
+ /plugin install ./skills/[skill_name]
+
+Review and edit:
+ code skills/[skill_name]/SKILL.md
+
+═══════════════════════════════════════════════
+```
+
+---
+
+## Error Handling
+
+**If scraping fails:**
+```
+⚠️ Scraping failed
+
+URL: [url]
+Error: [error details]
+
+The site may:
+- Require JavaScript (trying Playwright fallback...)
+- Block automated requests
+- Require authentication
+
+Would you like to:
+1. Try with Playwright (browser automation)
+2. Provide authentication details
+3. Try a different docs URL
+4. Create skill manually
+
+Your choice [1-4]:
+```
+
+---
+
+## Examples
+
+```
+/scrape-api https://rocketdotnet.readme.io/
+→ Creates skills/rocket-net-api/
+
+/scrape-api https://developers.facebook.com/docs/whatsapp/api whatsapp-business
+→ Creates skills/whatsapp-business/
+
+/scrape-api https://api.slack.com/methods slack-api
+→ Creates skills/slack-api/
+```
+
+---
+
+**Version**: 1.0.0
+**Last Updated**: 2026-02-03