plugin-creator
by @pazyork
Build, review, and debug OpenClaw plugins with the official plugin SDK. Use when creating or modifying `extensions/<id>` plugins, `openclaw.plugin.json`, plu...
clawhub install plugin-creator📖 About This Skill
name: plugin-creator description: Build, review, and debug OpenClaw plugins with the official plugin SDK. Use when creating or modifying
extensions/ plugins, openclaw.plugin.json, plugin-shipped skills, tools, hooks, slash commands, manifests, or tests, and when diagnosing why a plugin, hook, skill, command, or tool is loaded but unavailable at runtime.
Plugin Creator
Use this skill to build or debug OpenClaw plugins. Prefer the official SDK surface, official documentation, and existing plugin patterns over generic plugin assumptions.
Why plugins exist
Plugins exist to extend OpenClaw without forking the host.
That matters because most user needs are not “change everything.” They are usually one of these:
The philosophical goal is not to put all custom logic into one plugin. The goal is to place each behavior at the smallest correct boundary so it stays understandable, testable, and portable.
When deciding what to build, start from the user need, not from the mechanism. Ask:
If you answer those questions first, the plugin shape usually becomes obvious.
Mental model: hook vs tool vs command vs skill
These are different layers. Do not collapse them into “plugin stuff.”
Hooks — react to runtime events
Use a hook when the behavior should happen because something else happened.
Tools — give the agent a capability
Use a tool when the agent needs to do something during reasoning.
Slash commands / native commands — give the user a deterministic shortcut
Use a command when the user should be able to explicitly trigger a behavior without relying on model judgment.
Skills — package reusable knowledge and workflow
Use a skill when the problem is not “run this one function,” but “help the model reason in a repeatable way.”
Practical decision rule
Many good plugins combine more than one layer. The mistake is not combining them. The mistake is combining them without separating responsibilities.
Decomposing user needs
When a user says “I want a plugin that does X,” do not immediately design files. Decompose the request.
Step 1: find the real trigger
Step 2: split the request by responsibility
Most plugin requests contain multiple concerns mixed together:
Split those concerns before coding. A clean plugin often looks like:
1. a thin registration layer in index.ts
2. small implementation modules per responsibility
3. tests that validate each boundary separately
Step 3: choose the smallest correct unit
Prefer:
Avoid “mega plugins” that mix unrelated behavior just because the code lives in one package.
Step 4: verify all four layers
Every plugin feature should be checked at four layers:
1. Manifest — is the plugin declared correctly? 2. Registration — does the plugin actually register the command/tool/hook/skill? 3. Runtime — can the runtime reach and execute it? 4. Surface — can the user actually observe or trigger it where expected?
This prevents a common failure mode: “the code exists, therefore the feature works.”
Evidence priority
When something is unclear, use this priority order:
1. Public behavior explicitly promised in official docs.
2. Published SDK types, manifest/schema references, and other stable plugin-facing contracts that do not require a full local source checkout.
3. Existing plugin patterns in the OpenClaw repo when the repo source is available, for example extensions/observability-lab/.
4. Project-specific operational experience and known pitfalls.
If layers 3 or 4 conflict with layers 1 or 2, trust layers 1 and 2. Also separate “current repo implementation observations” from “stable public contract” in your write-up.
What to do first
1. Classify the task first.
- If you are creating or refactoring plugin structure, read references/plugin-layout-and-registration.md first.
- If you are working on hooks or event observation, read references/hooks-and-events.md first.
- If the issue is “the plugin seems registered but does not work at runtime”, read references/pitfalls-and-debugging.md first.
- If you are adding tests, validating packaging, or tightening the dev workflow, read references/testing-and-workflow.md first.
- If you are not sure which official source to trust first, read references/official-docs.md first.
2. Confirm the plugin boundary before writing code. - Decide whether this plugin is a tool, hook, command, skill, service, channel, provider, or a combination. - Then split the problem into four layers: - whether the manifest declares it - whether registration actually happens - whether runtime agent / gateway flows can really use it - whether the relevant surface actually displays or exposes it - Start with the smallest verifiable slice. Do not pile on multiple capabilities at once.
3. Prefer an existing pattern before inventing one.
- extensions/observability-lab/: best for learning combined tool, typed hook, plugin skill, and slash-command patterns.
- extensions/open-prose/: useful for learning plugin-shipped skill packaging.
- extensions/lobster/ and extensions/llm-task/: useful for optional tools via optional: true.
Workflow
1. Choose the location and shape first.
- When developing inside the OpenClaw repo, prefer extensions/.
- When developing outside the repo, keep the same directory shape and SDK import discipline.
2. Build the smallest valid skeleton first.
- At minimum, create package.json, openclaw.plugin.json, and index.ts.
- If plugin code frequently references SDK types, add a local api.ts barrel.
- If the plugin grows beyond a tiny surface, split command / hook / tool / skill / shared state into separate modules.
3. Add capabilities after the boundary is clear.
- tools use api.registerTool(...)
- commands use api.registerCommand(...)
- typed hooks use api.on(...)
- lower-level or more generic hook work should consult api.registerHook(...)
- plugin-shipped skills are declared via the skills field in openclaw.plugin.json
4. Pass the pre-install validation gate before any install step.
- Run the most direct scoped test first: pnpm test -- extensions/ or pnpm test -- extensions/
- When developing inside the OpenClaw repo, run at least one pnpm build
- If the touched surface extends beyond the local plugin, add pnpm check and the appropriate broader pnpm test
- Only after those pass may you proceed to pnpm openclaw plugins inspect , install, restart, and real-surface verification
5. Then do post-install and runtime verification.
- pnpm openclaw plugins inspect
- install / restart / real conversation-surface verification
- read session logs or systemPromptReport when needed
6. Any new deliverable package must get a new version.
- Update the plugin package.json version before repackaging.
- Every new remote handoff or installable iteration needs a fresh patch version.
- Always give the remote operator the latest tgz filename, the exact version, and an optional checksum. Do not say “install the package in dist” without naming the file.
Pre-install validation
If the task includes “hand this to someone to install”, “ship to a remote environment”, “build a tgz”, or “prepare install instructions”, pre-install validation is mandatory. Do not treat openclaw plugins install ... as the first validation step.
Minimum gate for in-repo plugin development:
1. scoped tests pass
2. pnpm build passes
3. the target runtime version is known before compatibility and packaging claims are made
Recommended order:
pnpm test -- extensions//index.test.ts
pnpm build
pnpm check
pnpm openclaw plugins inspect --json
Execution rules:
pnpm check is not always required for the smallest isolated plugin-local change, but once the touched surface crosses plugin-local boundaries, do not skip it.plugins inspect before install so you can confirm manifest / registration / diagnostics before debugging a failed install.npm pack --pack-destination dist, then provide the exact latest dist/-.tgz filename, version, and checksum.2026.3.23, plugin compatibility is resolved against the active runtime version during install, so do not rely on stale constants.2026.3.23-2, do not reuse an older tgz. Repack and hand off the new deliverable version explicitly.Non-negotiable constraints
openclaw/plugin-sdk/ official surfaces; do not import core src/** paths directly.openclaw.plugin.json must exist, and configSchema must stay strict.api.registerCommand(...), plugin-shipped skills, skill commands, command-dispatch: tool, and native command menu visibility are different mechanisms; do not blur them together.before_model_resolve / before_prompt_build for prompt injection; treat before_agent_start as a compatibility path only.api.runtime.* instead of bypassing the SDK into host internals.openclaw plugins install ....Handling abnormal cases
Plugins fail in predictable ways. Treat failure handling as part of the design, not as a cleanup step.
When behavior is ambiguous
When config or environment is missing
When external dependencies fail
When state can drift or disappear
When debugging unexpected behavior
Use this order:
1. confirm the plugin is loadable 2. confirm the target capability is registered 3. confirm the runtime path can actually reach it 4. confirm the user-facing surface exposes it as expected 5. only then treat it as a deeper logic bug
This order matters because many “logic bugs” are actually loading, policy, or surface-discovery problems.
Design philosophy for users
The job is not just to expose SDK features. The job is to help the user get the behavior they actually want.
That means you should be able to explain, in simple language:
If you cannot explain the design simply, the design is probably still too tangled.
Delivery standard
When plugin development or debugging is complete, the output should cover at least:
References
references/plugin-layout-and-registration.mdreferences/hooks-and-events.mdreferences/testing-and-workflow.mdreferences/pitfalls-and-debugging.mdreferences/official-docs.mdreferences/example-map.md