Teaching Your OpenClaw Agent External Library Documentation (3 Methods)
Want your OpenClaw agent to become an expert on a specific library like Convex, Supabase, or Drizzle? Here are three proven methods from the community, ranked by effectiveness.
The Problem
You're building with a library your agent doesn't know well. Maybe it's Convex DB, a niche ORM, or your company's internal SDK. Every time you ask for help, the agent hallucinates APIs or gives outdated patterns.
Method 1: Clone the Repo Locally (Recommended)
The most reliable approach is giving your agent direct access to the source code and official docs.
Setup:
- Create a projects directory in your workspace:
mkdir -p ~/clawd/projects- Configure the GitHub CLI for your agent:
gh auth login- Ask your agent to clone the library:
Clone the Convex repo to projects/convex and summarize the key patterns in their docs folder
The agent will now have full access to:
- Source code with real implementations
- Official documentation
- Examples and tests
- Type definitions
Why this works best: The agent can grep, search, and cross-reference actual code. No hallucination risk on API signatures.
Method 2: Use the Context7 MCP Server
If you don't want to clone full repos, the Context7 MCP server provides curated documentation snippets on-demand.
Setup:
Add to your MCP config:
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@context7/mcp-server"]
}
}
}Then ask your agent:
Use context7 to look up how Convex handles real-time subscriptions
Pros: Lightweight, no local storage needed, curated content. Cons: Coverage depends on what Context7 has indexed.
Method 3: Web Docs as Reference
For well-documented libraries, you can simply point your agent at the web docs.
Example:
Reference https://docs.convex.dev when answering questions about Convex patterns
Pros: Zero setup. Cons: Agent may not fetch/parse docs correctly; can't search as efficiently.
Creating a Skill for Your Library
Once you've validated the approach, consider wrapping it in a skill:
/skills/convex-expert/
SKILL.md # When to use this skill
refs/ # Cloned repo or key doc excerpts
examples/ # Patterns you've validated
Then in your SKILL.md:
# Convex Expert Skill
Use this skill when working with Convex DB.
## References
- Local docs: ./refs/convex/docs
- Key patterns: ./examples/Quick Start
The fastest path for most libraries:
gh auth login(one-time setup)- Ask agent: "Clone [library] to projects and read their getting started docs"
- Start coding with library-specific context
Tip from the Discord: Your agent can do the cloning for you. Just make sure gh CLI is authenticated, then ask!
Credit: This pattern came from a helpful exchange between dirtdiver and reddev in the OpenClaw Discord.
Comments (0)
No comments yet. Be the first to comment!