feat: add openclaw-plugin-dev skill

Plugin development reference and workflows based on real development
experience (Dirigent, ContractorAgent, PrismFacet).

Docs: structure, entry-point, hooks, tools, state, config, debugging
Workflows: create-plugin, add-hook

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
zhi
2026-04-18 17:25:07 +00:00
parent 1d34768019
commit 5a8f490cc2
10 changed files with 465 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
# Development & Debugging
## Dev Loop
```bash
# 1. Modify code in plugin/
# 2. Reinstall
node scripts/install.mjs --install
# 3. Restart gateway
openclaw gateway restart
# 4. Watch logs
openclaw logs --follow
# 5. Test
```
## Log Keywords
| Keyword | Meaning |
|---------|---------|
| `plugin registered` | register() completed |
| `startSideCar called` / `already running` | Sidecar status |
| `must NOT have additional properties` | Schema vs config mismatch |
| `EADDRINUSE` | Port conflict (sidecar or HTTP server) |
## Checklist Before Deploy
### General
- [ ] All hook handlers have event dedup (globalThis, not module-level)
- [ ] Gateway lifecycle events protected by globalThis flag
- [ ] Business state on globalThis
- [ ] `openclaw.plugin.json` schema matches actual config fields
- [ ] Install script doesn't set schema-absent fields
- [ ] Sensitive fields not set by install script
- [ ] Install script cleans old dist before copying
### Connection-type plugins
- [ ] Start flag on globalThis (not module-level `let`)
- [ ] Runtime reference on globalThis
- [ ] Shared registries/callbacks on globalThis, init once
- [ ] Cross-plugin API object overwritten every register() but runtime started once
- [ ] Consumer plugins defend against provider not loaded