Install
openclaw skills install doc-accurate-codegenGenerate code that references actual documentation, preventing hallucination bugs. ALWAYS loads docs first, validates against API signatures, and verifies correctness. Use for ANY code generation, API usage, or configuration creation.
openclaw skills install doc-accurate-codegenCRITICAL: This skill prevents LLM hallucination by enforcing documentation reference.
NEVER generate code from memory. ALWAYS reference documentation.
1. IDENTIFY → What code/API/tool is needed?
2. LOCATE → Find documentation source
3. LOAD → Fetch and parse documentation
4. EXTRACT → Pull API signatures, parameters, examples
5. GENERATE → Create code using actual docs
6. VALIDATE → Check code matches documentation
7. REFERENCE → Track what docs were used
C:\Users\clipp\AppData\Roaming\npm\node_modules\openclaw\docsread tool--help flagsman <command>web_fetch to get docsweb_fetch# For OpenClaw tools
read("openclaw-docs-path/tool-name.md")
# For external tools
web_fetch("https://docs.tool.com/api")
# For local tools
exec("tool --help")
# Extract:
- Method names
- Parameters (names, types, required/optional)
- Return types
- Error handling
- Examples
- Version information
# Generate code using actual API data
def generate_from_docs(api_docs):
# Use real method names
# Use real parameter names
# Use real return types
# Include error handling from docs
# Add docstrings from docs
pass
def validate_against_docs(code, api_docs):
# Check method names match
# Check parameter names match
# Check types match
# Check return types match
# Verify no hallucinated methods
pass
codegen <api> — Generate code with doc referencevalidate <code> — Check code against docsdoc-lookup <api> — Load and display documentationapi-extract <tool> — Extract API signatures"Generate code to use the OpenClaw sessions_spawn tool"
# Process: Load docs → Extract API → Generate → Validate
"Create a Python script using the requests library"
# Process: Fetch requests docs → Extract API → Generate → Validate
"Write configuration for OpenClaw channels"
# Process: Load config docs → Extract format → Generate → Validate
--help for docs# Code Generation Reference
## Generated Code
- File: path/to/file.py
- Generated: 2026-02-23
- Tool: doc-accurate-codegen
## Documentation Sources
1. OpenClaw Tool Docs: /docs/tools/exec.md
2. API Reference: https://docs.example.com/api
3. Examples: /examples/exec-usage.py
## Validation
- ✅ Method names validated
- ✅ Parameters validated
- ✅ Return types validated
- ✅ Error handling validated
## Notes
- Using exec tool with sandbox mode
- All parameters from official docs
- Error handling from API reference
When generating code, always include:
# Code generated with documentation reference
# Source: [documentation URL or path]
# Validated: [timestamp]
# API Version: [version if available]
def function_name():
"""
[Docstring from actual documentation]
Source: [link to docs]
Parameters: [from docs]
Returns: [from docs]
"""
# Implementation using actual API
pass
# Get tool help
exec("tool --help")
# Read tool docs
read("openclaw/docs/tools/tool-name.md")
# Check tool examples
read("openclaw/examples/tool-usage.md")
# Read skill docs
read("skills/skill-name/SKILL.md")
# Check skill examples
read("skills/skill-name/examples/")
# Read config docs
read("openclaw/docs/configuration.md")
# Check config examples
read("openclaw/examples/config/")
Remember: This skill exists because LLMs hallucinate. ALWAYS use it for code generation. The only way to prevent bugs is to reference actual documentation.