I spent a whole afternoon today debugging an OpenClaw Skill, stepped in countless pits, and in the end discovered the biggest pit was API compatibility. This pitfall guide records the entire debugging process, and I hope it helps other developers.
Background
I wanted to add a WeRead (WeChat Reading) Skill to OpenClaw, so users could ask in Feishu “what have I been reading lately” and get their booklist back automatically. Sounds simple, right? Turned out…
Pitfall One: Skill File Format
Wrong way
|
Right way
|
Lesson: OpenClaw uses an XML-like tool-calling format, and the tool tag needs a name attribute.
Pitfall Two: Session Cache
Every time I edited SKILL.md, the Agent still used the old description. You must clear the session cache:
|
Lesson: OpenClaw’s session caches a snapshot of the skill; if you don’t clear the cache after editing, the Agent will never see the new content.
Pitfall Three: Safe Bin Configuration
OpenClaw 2026.3.8 requires configuring safeBinProfiles for the interpreter, otherwise exec gets ignored.
|
The pit inside the pit: If you use a virtualenv Python, you also need to configure safeBinTrustedDirs:
|
Pitfall Four: Agent Doesn’t Execute Commands
Everything was configured correctly, the Agent recognized the skill, but it kept saying it wanted to read the skill file and just wouldn’t run the command.
Checking the logs, the Agent’s response was:
|
Then I edited the skill description to explicitly tell it “execute the command directly, don’t read the file,” and the result was…
Pitfall Five: Tool-Calling Format (the ultimate pit)
This was the biggest pit of the day!
Symptom
The Agent emitted a tool call, but nothing happened:
|
Root cause
- The kimi-coding API returns tool calls in XML format
- OpenClaw expects the JSON format
tool_use
The two are incompatible, so the tool calls were silently dropped.
Verification
Check the session log:
|
Pitfall Six: The Model-Switching Chain of Pits
Trying to switch to another model to fix the problem:
- moonshot/kimi-k2-5 → HTTP 404, model doesn’t exist
- synthetic/hf:moonshotai/Kimi-K2-Thinking → 401 Invalid API Key
- kimi-coding/k2p5 → XML tool calls, incompatible
- deepseek/deepseek-chat → ✅ finally worked!
Lesson: Not every OpenAI-compatible API supports tool calls perfectly. DeepSeek’s API has the best support for tool calls.
The Final Solution
1. Configure the DeepSeek API
|
2. Simplify the Skill Design
Because tool calls had so many pitfalls, I ultimately chose to write the data directly into the skill, avoiding real-time command execution:
|
3. Shell Function as a Fallback
I also created a shell function so I can query directly in the terminal:
|
Debugging Tips Summary
1. View logs
|
2. Inspect the session
|
3. Verify the API
|
4. Test the script
Test directly whether the script runs:
|
Conclusion
- API compatibility is the biggest pit — not every “OpenAI-compatible” API is actually compatible
- Tool-calling format needs to be checked carefully — the XML vs. JSON difference is huge
- Session cache is easy to overlook — remember to clear it after changing the config
- Skill design should be simple and direct — complex logic easily goes wrong
In the end, DeepSeek’s API is the most stable of the ones I’ve tested, so I’d recommend using it first.
P.S. My WeRead booklist has 64 books. If you’re also interested in Company of One or AI Agent Development in Practice, feel free to reach out!
评论
0 条评论