mit einem Klick
docwriter
// Generate Claude Code artifacts (skills, commands, subagents) from natural language descriptions. Creates properly structured files with frontmatter, hooks, and required sections.
// Generate Claude Code artifacts (skills, commands, subagents) from natural language descriptions. Creates properly structured files with frontmatter, hooks, and required sections.
| name | docwriter |
| description | Generate Claude Code artifacts (skills, commands, subagents) from natural language descriptions. Creates properly structured files with frontmatter, hooks, and required sections. |
| argument-hint | [description of what to create] |
| user-invocable | true |
| disable-model-invocation | false |
| hooks | {"PostToolUse":[{"matcher":"Write","hooks":[{"type":"command","command":"python3 \"$CLAUDE_PROJECT_DIR/.claude/skills/docwriter/validator.py\""}]}]} |
Generate Claude Code artifacts from natural language descriptions.
Templates and References loaded automatically:
| Path | Contains | Use For |
|---|---|---|
~/.claude/projects/{project}/{session}.jsonl | Conversation transcript | Reading history |
~/.claude/tasks/{session}/*.json | Task state | Checking/updating tasks |
~/.claude/file-history/{session}/ | File versions | Rollback, comparison |
~/.claude/debug/{session}.txt | Debug logs | Troubleshooting |
~/.claude/todos/ | Agent task assignments | Cross-agent coordination |
Note: Use the transcript_path field from hook input JSON for direct transcript access.
Use the AskUserQuestion tool to ask what type of artifact to create:
Question: "What type of Claude Code artifact do you want to create?"
Options:
docwriter/SKILL.md.hbs). Skills do NOT use Task Management Protocol.opsx/new.md.hbs). Commands MUST include Task Management Protocol.backend-researcher.md.hbs). Subagents include hook configurations.context: fork + agent field)model: sonnet|opus|haiku|inherit).claude/skills/<name>/SKILL.md.hbsjudospec/research or mycommand).claude/commands/<path>.md.hbs still works.claude/commands/<path>.md.hbstools allowlist and/or disallowedTools denylist)isolation: worktree, background: true)memory: user|project|local)maxTurns, default 50).claude/agents/<name>.md.hbsUse the AskUserQuestion tool:
Question: "Does this [artifact type] need hooks?"
Options:
Question: "Which lifecycle phases need hooks?"
Options (multi-select):
Tool Lifecycle Events:
| Event | Fires When | Can Block? | Matcher |
|---|---|---|---|
| PreToolUse | Before tool executes | Yes | tool_name |
| PostToolUse | After tool succeeds | No | tool_name |
| PostToolUseFailure | After tool fails | No | tool_name |
| PermissionRequest | Permission dialog appears | Yes | tool_name |
Agent Lifecycle Events:
| Event | Fires When | Can Block? | Matcher |
|---|---|---|---|
| SubagentStart | Subagent spawned | No | agent_type |
| SubagentStop | Subagent finishes | Yes | agent_type |
| Stop | Claude finishes responding | Yes | No matcher |
| Notification | Notification sent | No | notification_type |
| TeammateIdle | Agent team teammate going idle | No | No matcher |
| TaskCompleted | Task marked complete | No | No matcher |
Note: Stop in subagent frontmatter becomes SubagentStop event.
Config Lifecycle Events:
| Event | Fires When | Can Block? | Matcher |
|---|---|---|---|
| ConfigChange | Config file changed | No | config_type: user_settings, project_settings, local_settings, policy_settings, skills |
Worktree Lifecycle Events:
| Event | Fires When | Can Block? | Matcher |
|---|---|---|---|
| WorktreeCreate | Git worktree being created | No | No matcher (prints path to stdout) |
| WorktreeRemove | Git worktree being removed | No | No matcher |
Question: "Configure [Event] hook:"
Matcher pattern (if applicable): Regex to filter when hook fires
"Bash", "Edit|Write", "mcp__.*")"Explore", "gsd-.*")Handler type:
Script/prompt/URL details:
$CLAUDE_PROJECT_DIR/.claude/hooks/<name>.py)allowedEnvVars for env var substitution in headers$ARGUMENTS for hook input)Options:
async: true - Run in background (command only, cannot block)timeout - Custom timeout in secondsstatusMessage - Custom spinner text while hook runsonce: true - Run only once per session then is removed (skills only, not agents)If user's hook description mentions: session, transcript, task, history, metadata, conversation
Then spawn Explore subagent:
Explore ~/.claude to find paths for [user's data need].
Return the exact path pattern and example content structure.
Key starting points:
- ~/.claude/projects/ for sessions and transcripts
- ~/.claude/tasks/ for task state
- ~/.claude/file-history/ for file versions
Use discovered paths in the generated hook script with comment:
# Path discovered via Explore: ~/.claude/tasks/{session}/
Frontmatter-valid hooks (Tool + Agent lifecycle):
Settings.json-only hooks (Session + Prompt + Config + Worktree lifecycle):
If user selects a settings.json-only hook, warn:
"This hook event must be placed in
.claude/settings.json, not in artifact frontmatter. Would you like me to show the settings.json format instead?"
Prompt: "Describe what this [skill/command/agent] should do. Be specific about its purpose, workflow steps, and any constraints."
Based on the artifact type and description, generate the file:
For Skills:
context: fork, agent, model, allowed-tools$ARGUMENTS and $ARGUMENTS[N] substitution in contentFor Commands:
@.claude/rules/xml-rule.md.hbs referenceFor Subagents:
tools/disallowedTools for tool access controlmaxTurns, memory, isolation, background, mcpServers, skills@.claude/rules/xml-rule.md.hbs referenceHook Frontmatter Format:
hooks:
PreToolUse:
- matcher: "Bash" # Regex pattern
hooks:
- type: command
command: "$CLAUDE_PROJECT_DIR/.claude/hooks/validate.py"
statusMessage: "Validating..."
once: true # Run only once per session (skills only)
PostToolUse:
- matcher: "Write"
hooks:
- type: command
command: "$CLAUDE_PROJECT_DIR/.claude/hooks/process.py"
async: true
- type: http
url: "http://localhost:8080/hooks/post-write"
headers:
Authorization: "Bearer $API_TOKEN"
allowedEnvVars: ["API_TOKEN"]
timeout: 30
Stop: # Becomes SubagentStop for subagents
- hooks:
- type: prompt
prompt: "Evaluate if all tasks are complete. $ARGUMENTS"
model: haiku
timeout: 30
Important:
.md.hbs extension{{model.name}} where the project name is needed@.claude/... format (never absolute paths).claude/hooks/ directoryFor each hook configured in Step 2.5, generate the corresponding script:
Use templates from: .claude/skills/docwriter/templates/
pretooluse-validator.py - For PreToolUse permission decisionsposttooluse-processor.py - For PostToolUse result processingsubagent-stop-cleanup.py - For SubagentStop/Stop cleanupbash-hook-template.sh - For Bash-based hooksCustomize each script:
.claude/hooks/<artifact-name>-<event>.py# MODIFY: sections based on user requirements~/.claude data, add paths discovered via ExploreAfter creating the primary artifact, ask: "Do you also need any of these?"
Options (multi-select):
xml-rule.md.hbs)validator.py).claude/rules/<name>.md.hbs@.claude/rules/<name>.md.hbs to the primary artifact.claude/scripts/<name>.py (or .sh)$CLAUDE_PROJECT_DIR/.claude/scripts/<name>If the generated artifact introduces a pattern not in the current templates:
After generation, summarize:
{{model.name}} for project-specific references@.claude/... syntax~/.claude filesystem (persistent state)~/.claude data, spawn Explore to find exact paths