Create or extract HOW_TO documentation
/plugin marketplace add otrebu/agents/plugin install meta-work@otrebu-dev-tools<name> <description> | from command <name> | from agent <name>Create HOW_TO docs following @plugins/meta-work/docs/HOW_TO_PROMPT_ENGINEERING.md principles.
Parse $ARGUMENTS to determine creation mode:
$ARGUMENTS starts with "from command"
/create-doc from command analyze-size/create-doc from command code-review for plugin meta-work$ARGUMENTS starts with "from agent"
/create-doc from agent security-scanner/create-doc from agent validate-specs for plugin development-lifecycle/create-doc CODE_REVIEW comprehensive code review processCurrent state of the codebase:
ls docs/HOW_TO_*.md 2>/dev/null | xargs -n1 basename | sed 's/HOW_TO_//' | sed 's/.md$//' || echo "none"ls commands/*.md 2>/dev/null | xargs -n1 basename | sed 's/.md$//' || echo "none"ls agents/*.md 2>/dev/null | xargs -n1 basename | sed 's/.md$//' || echo "none"cat .claude-plugin/marketplace.json 2>/dev/null | grep '"name"' | cut -d'"' -f4 | paste -sd ',' - || echo "none"Based on mode detected, extract:
Extract modes:
Create mode:
For "from command" mode:
test -f commands/{name}.md && echo "exists" || echo "missing"test -f plugins/{plugin}/commands/{name}.md && echo "exists" || echo "missing"For "from agent" mode:
test -f agents/{name}.md && echo "exists" || echo "missing"test -f plugins/{plugin}/agents/{name}.md && echo "exists" || echo "missing"Validate doc name:
test -f docs/HOW_TO_{DOC_NAME}.md && echo "exists" || echo "available"Read source file:
commands/{name}.md or plugins/{plugin}/commands/{name}.mdagents/{name}.md or plugins/{plugin}/agents/{name}.mdExtract content:
---)$ARGUMENTS or dynamic context (lines with !`command`)Analyze structure:
Create docs/HOW_TO_{DOC_NAME}.md following @plugins/meta-work/docs/HOW_TO_PROMPT_ENGINEERING.md.
Content guidelines for each mode:
Extract from command:
Extract from agent:
Create mode:
Use Write tool to create docs/HOW_TO_{DOC_NAME}.md.
After successful extraction, ask the user:
Created docs/HOW_TO_{DOC_NAME}.md
Would you like to refactor the source file to reference this doc?
This would:
- Replace inline instructions with: @docs/HOW_TO_{DOC_NAME}.md
- Keep source-specific elements (frontmatter, context, task description)
- Make the source file shorter and easier to maintain
Respond:
- "yes" to refactor now
- "no" to keep source as-is
Wait for user response. If "yes", proceed to Step 7.
For commands:
---
[keep existing frontmatter]
---
## Context
[keep any dynamic context lines with !`command`]
## Your Task
[Brief task description, can reference $ARGUMENTS if needed]
See @docs/HOW_TO_{DOC_NAME}.md for detailed guidelines.
For agents:
---
[keep existing frontmatter]
---
@docs/HOW_TO_{DOC_NAME}.md
Output a {name}-report.md file in the project root, then confirm creation.
Use Edit tool to replace content after frontmatter.
Report what was created:
Extract modes (without refactoring):
Created docs/HOW_TO_{DOC_NAME}.md
Extracted from: {source type} '{source name}'
Location: docs/HOW_TO_{DOC_NAME}.md
The original {source type} file remains unchanged.
You can now reference this doc with: @docs/HOW_TO_{DOC_NAME}.md
Extract modes (with refactoring):
Created docs/HOW_TO_{DOC_NAME}.md
Refactored {source path}
The {source type} now references the shared documentation.
Create mode:
Created docs/HOW_TO_{DOC_NAME}.md
You can now reference this doc in commands and agents with:
@docs/HOW_TO_{DOC_NAME}.md
Input: /create-doc from command analyze-size
Process:
commands/analyze-size.mddocs/HOW_TO_ANALYZE_SIZE.mdInput: /create-doc from agent code-reviewer
Process:
agents/code-reviewer.mddocs/HOW_TO_CODE_REVIEW.mdInput: /create-doc from command validate-specs for plugin development-lifecycle
Process:
plugins/development-lifecycle/commands/validate-specs.mddocs/HOW_TO_VALIDATE_SPECS.md (in project root)Input: /create-doc SECURITY_AUDIT comprehensive security vulnerability scanning
Process:
docs/HOW_TO_SECURITY_AUDIT.md