4.4 KiB
Workflow: Create Plugin
Create a new Claude Code plugin from scratch with complete structure.
Who should do this work
| Phase | Model | Why |
|---|---|---|
| Scope clarification | Main | User interaction required |
| Scaffolding | Haiku | Mechanical file/directory creation |
| Skill creation | Sonnet | Content drafting (delegates to skill workflows) |
| Config creation | Haiku | Template-based file creation |
| Validation | Opus | Final quality decisions |
When to use
- Creating new Claude Code plugin from scratch
- Plugin directory doesn't exist yet
Before you start
If concept unclear, brainstorm: references/brainstorming/workflow.md
Dependencies (optional)
Initial skill creation delegates to ${CLAUDE_PLUGIN_ROOT}/workflows/plugin-add-skill.md.
Inputs required
- plugin_name - kebab-case
- plugin_purpose - Problem this solves
- include_skill - yes/no (default yes)
- skill_name - If including skill (defaults to plugin_name)
For descriptions: Read ${CLAUDE_PLUGIN_ROOT}/references/layout/descriptions.md - "when/why" formula, not implementation.
Task document
Create: .claude/plugin-data/plugin-architect/tasks/new-plugin-<plugin-name>-<date>.md
Pattern consideration
See references/tool-patterns/catalog.md.
| Question | If Yes |
|---|---|
| Plugin concept unclear? | Brainstorm first |
| Skills modify files? | Skills need verification (delegated to skill-architect) |
| Plugin creates files in user projects? | Follow plugin-data-convention |
| Maintained long-term? | Include reversion protection scaffolding |
| Orchestrate 2+ workflows with synthesis? | Consider Role-Workflow pattern |
Subtasks
1. Clarify scope
Subagent: Main with user.
Do:
- Confirm plugin name and purpose
- Ask if needs initial skill (most do)
- Write to task doc:
## Scope
2. Scaffold plugin structure
Subagent: Haiku.
Read: Task doc (scope), ${CLAUDE_PLUGIN_ROOT}/references/layout/plugin-structure.md
Do:
- Detect author name:
git config user.name- If returns a name: use it for
author.namein plugin.json - If empty/fails: inform user and tell them to set it:
Then prompt user for their name to continue.Git author name not configured. Set it with: git config --global user.name "Your Name"
- If returns a name: use it for
- Create
../<plugin-name>/in marketplace - Create
.claude-plugin/plugin.jsonwith required fields including author - Create empty
skills/directory - Reversion protection:
.decisions/directory - Note in task doc: "Skills create their own invariants.md and examples/golden/"
- Register in
marketplace.jsonusing the Ruby config script:
If exit code is non-zero, fall back to manual JSON editing and note in task doc.ruby ${CLAUDE_PLUGIN_ROOT}/scripts/plugin_config/plugin_config.rb register \ --plugin=<plugin-name> \ --marketplace_file=<path-to-marketplace.json> - Write to task doc:
## Scaffolded Files
3. Create initial skill (if requested)
Subagent: Depends on availability.
Do:
- Use
${CLAUDE_PLUGIN_ROOT}/workflows/plugin-add-skill.md - Pass: plugin_path, skill_name, skill_purpose
4. Create config workflow and command (optional)
Subagent: Haiku.
Read: Task doc, templates/config-workflow.tmpl, templates/config-command.tmpl
Do:
- Ask user if plugin needs configuration (most don't initially)
- If yes:
- Create
workflows/config.mdfrom template - Create
<plugin-path>/commands/config.mdfrom template - Replace
{{plugin_name}}placeholders with actual plugin name - Write to task doc:
## Config Files Created
- Create
- Remind user:
- "Customize the config workflow for your plugin's specific settings"
- "Common customizations: API keys, file paths, feature toggles, output formats"
- "Config is stored in
.claude/plugin-data/<plugin-name>/config.json"
5. Finalize and report
Subagent: Main.
Do:
ruby ${CLAUDE_PLUGIN_ROOT}/scripts/plugin_config/plugin_config.rb validate \
--plugin_path=<plugin-path>
Exits 0 if all structural checks pass, 1 if any fail (see JSON issues array for details).
- Fix validation errors
- Verify structure matches Claude Code spec
- Summarize created
- Suggest next steps
Reflection
Friction? Read references/self-improvement/friction-reflection.md and add to task doc.