create-community-plugin skill
Scaffold a standalone TypeScript project that exports one or more plugins for hiero-cli, registered via hcli plugin-management add -p '<manifest-path>'.
Setup
Before doing anything else, read the full contents of .claude/skills/create-community-plugin/references/RULES.md. It contains project structure rules, config file templates, naming conventions, and code generation standards. Apply them silently — do not narrate rule application. Only surface a rule if the user's requirements conflict with it.
Phase 0: Mode Detection
Check whether the target directory already contains a project (has a package.json):
- Fresh mode — no existing project. Run the full interview and generate everything from scratch.
- Expansion mode — existing project detected. Skip project-level questions; go directly to Phase 2 (Plugin Interview) and add the new plugin alongside the existing ones.
If the target directory does not exist yet, it is always fresh mode.
Phase 1: Project Interview (fresh mode only)
Ask questions one at a time. Each question follows naturally from the previous answer.
Required information:
- Project name (kebab-case) — used as the npm package name and directory name
- Project description — one sentence
- Target directory — default:
~/IdeaProjects/{project-name}; confirm with the user - hiero-cli source — ask the user to choose:
- Latest npm version (
@hiero-ledger/hiero-cli@latest) - Local
.tgzfile — ask for the absolute path to the file
- Latest npm version (
Phase 2: Plugin Interview
Ask questions one at a time. The goal is to gather enough information to generate every plugin file without ambiguity.
Minimum required before Phase 3:
- Plugin name (kebab-case)
- Plugin display name and description
- Full list of commands, and for each:
- Command name and purpose
- Whether it submits a Hedera transaction (determines handler pattern A or B)
- All CLI options: name, short flag, type, required/optional, default value, description
- Output fields: what data does the command return?
- Whether the command is destructive (needs
requireConfirmation) - Whether the command should support batchify/scheduled hooks
- Whether the plugin persists data to state (and if so, what fields)
- Whether the plugin defines its own hooks (custom hook classes)
Interview rules:
- "Creates something on Hedera" / "submits a transaction" → Pattern B (
BaseTransactionCommand). Ask about transaction lifecycle only when relevant. - "List", "view", "get", "show", "read" → Pattern A (simple
Command). Do not ask about transaction lifecycle. - When the user names an option, ask for its short flag if not provided.
- Ask about
requireConfirmationonly for commands described as deleting or clearing resources. - Ask about hook registration (batchify/scheduled) only for transaction commands.
- Ask about state persistence once — not per command.
Phase 3: Confirmation
Before generating anything, present a summary:
Project: {name}
Directory: {absolute-path}
hiero-cli: {npm version | file:/absolute/path.tgz}
Mode: {fresh | expansion}
Plugin: {plugin-name} ({displayName})
Description: {description}
Commands:
{command-name} — {summary}
Handler: Pattern A (simple) | Pattern B (transaction)
Options: {list}
Output fields: {list}
Hooks: {list or none}
Confirmation: {yes/no}
State: {yes — fields: ... | no}
Custom hooks: {yes — names: ... | no}
⚠️ Rule conflicts: {list or "none"}
Ask: "Does this look correct? Anything to change before I generate?"
Wait for explicit confirmation before proceeding.
Phase 4: Generate
4a. Project scaffold (fresh mode only)
Generate files in this order:
- Create the project directory
- Run
git initinside it; create.gitignore package.json— use the template from RULES.md §12, substituting{project-name},{description}, and the hiero-cli dependency value; cross-check alldevDependenciesversions againsthiero-ledger/hiero-clipackage.jsontsconfig.base.json,tsconfig.json,tsconfig.test.json— copy verbatim fromhiero-ledger/hiero-cli(see RULES.md §12)jest.config.js,jest.unit.config.js— copy verbatim fromhiero-ledger/hiero-clieslint.config.js— copy verbatim fromhiero-ledger/hiero-cliREADME.md— project name, one-line description, and the ready-to-runhcli plugin-management addcommand
4b. Plugin files
Generate in this order:
src/plugins/{name}/manifest.ts- For each command:
src/plugins/{name}/commands/{command}/input.tssrc/plugins/{name}/commands/{command}/output.tssrc/plugins/{name}/commands/{command}/handler.tssrc/plugins/{name}/commands/{command}/types.ts(only if Pattern B with complex intermediate types)src/plugins/{name}/commands/{command}/index.ts
src/plugins/{name}/schema.ts(only if the plugin persists state)src/plugins/{name}/index.tssrc/plugins/{name}/__tests__/unit/helpers/mocks.tssrc/plugins/{name}/__tests__/unit/helpers/fixtures.ts- For each command:
src/plugins/{name}/__tests__/unit/{command}.test.ts
Apply all rules from RULES.md silently. If a user requirement conflicts with a rule, flag it in the Phase 3 summary under "⚠️ Rule conflicts", propose a compliant alternative, and proceed with the compliant version unless the user explicitly overrides.
4c. Build verification
Run sequentially from inside the project directory:
npm install
npm run build
If either command fails:
- Read the full error output
- Fix the generated files (type errors, import issues, missing exports, formatting)
- Re-run
npm run build(no need to re-runnpm installunless a new dependency is required) - Repeat until both exit with code 0
Do not declare success until both commands complete cleanly.
Phase 5: Done
Output a short summary:
✅ Plugin project scaffolded.
Project: {absolute-path}
Plugin: {plugin-name}
Files created:
{list of all created files}
Register with hiero-cli:
hcli plugin-management add -p '{absolute-path}/dist/plugins/{plugin-name}/manifest.js'
⚠️ The manifest path above is machine-local. If you move this project, re-run the add command with the new path.
[If local .tgz: ⚠️ package.json references a local .tgz — update the path if that file moves.]
Next steps:
1. Implement handler logic in each handler.ts (marked with // IMPLEMENT)
2. Run tests: npm test