commit 9f6001266117fa77b94b5c6fb155ae8bd0dac190 Author: Zhongwei Li Date: Sat Nov 29 18:19:59 2025 +0800 Initial commit diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..a6e4c90 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,11 @@ +{ + "name": "scaffold-claude-feature", + "description": "Generate Claude Code features (slash commands, skills, subagents, hooks, output styles) with proper structure and best practices", + "version": "1.2.0", + "author": { + "name": "Stefan Cho" + }, + "skills": [ + "./skills" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..484c105 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# scaffold-claude-feature + +Generate Claude Code features (slash commands, skills, subagents, hooks, output styles) with proper structure and best practices diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..22348b3 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,85 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:devstefancho/claude-plugins:scaffold-claude-feature", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "fe6de20a7374bc4b1f33da5fbe32b936c8f740df", + "treeHash": "a598043c18576a739cfafcbf2582d450233a210cfcdfa20abbc1b20cdd6a3357", + "generatedAt": "2025-11-28T10:16:20.898742Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "scaffold-claude-feature", + "description": "Generate Claude Code features (slash commands, skills, subagents, hooks, output styles) with proper structure and best practices", + "version": "1.2.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "5c371567aa75d0683543d69e5eb31fbcfbabc53cf8997c091d39fa3ee0f3e32a" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "50c3c821e7a08d9ced56810a53acce7dd28f8434df27e72c1ff20db2d50b9f9c" + }, + { + "path": "skills/scaffold-claude-feature/SKILL.md", + "sha256": "a772c2df44cebc07de9234c418a1de6353309cfd941ce9c6f363beabf0309946" + }, + { + "path": "skills/scaffold-claude-feature/references/slash-commands.md", + "sha256": "967b0151df220c2406ad176128f07ddbef339c8f87cc2af6779d58ea9376f750" + }, + { + "path": "skills/scaffold-claude-feature/references/subagents.md", + "sha256": "10e2a3f58947a7a0c240118b42ebf9cb733a363b71ff6b75e78c7404e1487415" + }, + { + "path": "skills/scaffold-claude-feature/references/skills.md", + "sha256": "586dd110af0c4872eb9ae474ea243f0bc201357014eadb6eaf34c7858ff2686d" + }, + { + "path": "skills/scaffold-claude-feature/references/hooks.md", + "sha256": "04bbee4ee5d85d20a8f21bdf4e14b3322623e0b2d82a45a20c8149b80cbd3dbf" + }, + { + "path": "skills/scaffold-claude-feature/references/output-styles.md", + "sha256": "d3c7cb80564d418d2bdb3b4a09aa579fdb5ba1b31695f4d36ebdd7c882dedae2" + }, + { + "path": "skills/scaffold-claude-feature/templates/slash-command.template.md", + "sha256": "cf14616ea2c4fad88a50396edea782dc64b24444f9ff5aada715a54428d8d4b4" + }, + { + "path": "skills/scaffold-claude-feature/templates/hooks.template.json", + "sha256": "4a509c1d740b9bc5f91a40a9eedf1b2d82342ffa249c7a79e11b4488de71bd48" + }, + { + "path": "skills/scaffold-claude-feature/templates/subagent.template.md", + "sha256": "3ae0397b53dc8c1e77e1b1686d705737fa08b666aa259a3434e96181fb95ee02" + }, + { + "path": "skills/scaffold-claude-feature/templates/output-style.template.md", + "sha256": "72540ce35947e6c50f6f50e9e1a761a12e26f4ab903b4fcdfffaf3d751c64d9e" + }, + { + "path": "skills/scaffold-claude-feature/templates/skill.template.md", + "sha256": "4c88d8c6b908082178cac47967bb216f5d2f781d8cc1c790ac72d1941e9aa6f0" + } + ], + "dirSha256": "a598043c18576a739cfafcbf2582d450233a210cfcdfa20abbc1b20cdd6a3357" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/scaffold-claude-feature/SKILL.md b/skills/scaffold-claude-feature/SKILL.md new file mode 100644 index 0000000..70b3446 --- /dev/null +++ b/skills/scaffold-claude-feature/SKILL.md @@ -0,0 +1,47 @@ +--- +name: scaffold-claude-feature +description: Claude Code 확장 기능(skill, slash command, subagent, hook, output style)의 기본 구조를 생성합니다. 새로운 skill을 만들거나, command 템플릿이 필요하거나, hook 설정을 시작할 때 사용합니다. +--- + +# Claude Code Feature Scaffolder + +Quick scaffolder for Claude Code features with proper structure and best practices. + +## Feature Types + +1. **Slash Commands** - Reusable prompts (`.claude/commands/`) +2. **Skills** - Model-invoked capabilities (`.claude/skills/`) +3. **Subagents** - Specialized AI agents (`.claude/agents/`) +4. **Hooks** - Event handlers (settings.json) +5. **Output Styles** - Custom system prompts (`.claude/output-styles/`) + +## Workflow + +1. **Detect feature type** from user request +2. **Ask location**: project (`.claude/`) or personal (`~/.claude/`) +3. **Load reference**: See appropriate file in [references/](references/) +4. **Generate feature** using [templates/](templates/) +5. **Validate** naming and structure +6. **Provide** testing guidance + +## Feature Detection + +- Keywords: "create", "generate", "add", "new" +- Feature names: "slash command", "skill", "subagent", "agent", "hook", "output style" +- Context: "Claude Code tool", "build tool", "custom feature" + +## Progressive Disclosure + +Load details only when needed: +- Slash commands → [references/slash-commands.md](references/slash-commands.md) +- Skills → [references/skills.md](references/skills.md) +- Subagents → [references/subagents.md](references/subagents.md) +- Hooks → [references/hooks.md](references/hooks.md) +- Output styles → [references/output-styles.md](references/output-styles.md) + +## Quick Rules + +- Use lowercase with hyphens for names +- Project features for teams, personal for individual use +- Keep examples simple and minimal +- Test after creation diff --git a/skills/scaffold-claude-feature/references/hooks.md b/skills/scaffold-claude-feature/references/hooks.md new file mode 100644 index 0000000..f57778a --- /dev/null +++ b/skills/scaffold-claude-feature/references/hooks.md @@ -0,0 +1,167 @@ +# Hooks Reference + +Quick reference for creating event hooks. For complete documentation, see @docs-claude/hooks-reference.md + +## Structure + +Add to settings.json: +```json +{ + "hooks": { + "EventName": [ + { + "matcher": "ToolPattern", + "hooks": [ + { + "type": "command", + "command": "your-command" + } + ] + } + ] + } +} +``` + +## Location + +- Project: `.claude/settings.json` +- Personal: `~/.claude/settings.json` +- Local: `.claude/settings.local.json` (gitignored) + +## Hook Types + +- `"type": "command"` - Execute bash command +- `"type": "prompt"` - LLM-based evaluation + +## Common Events + +- `PreToolUse` - Before tool runs (can block) +- `PostToolUse` - After tool completes +- `UserPromptSubmit` - Before processing user prompt +- `Stop` - When Claude finishes +- `SubagentStop` - When subagent finishes +- `Notification` - On notifications +- `SessionStart` - Session begins +- `SessionEnd` - Session ends + +## Matchers + +**For PreToolUse/PostToolUse:** +- `"Write"` - Exact match +- `"Write|Edit"` - Multiple tools +- `"Notebook.*"` - Regex pattern +- `"*"` - All tools + +**For other events:** Omit matcher + +## Exit Codes (Command Type) + +- `0` - Success +- `2` - Block action, show stderr to Claude +- Other - Error, execution continues + +## Simple Examples + +**Format on write:** +```json +{ + "hooks": { + "PostToolUse": [ + { + "matcher": "Write|Edit", + "hooks": [ + { + "type": "command", + "command": "prettier --write $file" + } + ] + } + ] + } +} +``` + +**Prevent stopping:** +```json +{ + "hooks": { + "Stop": [ + { + "hooks": [ + { + "type": "command", + "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/check-todos.sh" + } + ] + } + ] + } +} +``` + +**Validate bash commands:** +```json +{ + "hooks": { + "PreToolUse": [ + { + "matcher": "Bash", + "hooks": [ + { + "type": "command", + "command": "python $CLAUDE_PROJECT_DIR/.claude/hooks/validate-bash.py" + } + ] + } + ] + } +} +``` + +## Hook Input + +Hooks receive JSON via stdin: +```json +{ + "session_id": "abc123", + "hook_event_name": "PreToolUse", + "tool_name": "Write", + "tool_input": { "file_path": "/path/to/file" } +} +``` + +## Environment Variables + +- `$CLAUDE_PROJECT_DIR` - Project root path +- `$CLAUDE_ENV_FILE` - SessionStart only, for env vars + +## Tips + +- Use `$CLAUDE_PROJECT_DIR` for project scripts +- Test hooks with `claude --debug` +- Exit code 2 blocks and sends stderr to Claude +- Keep hooks fast (60s timeout default) +- For complete API, see @docs-claude/hooks-reference.md + +## Prompt-Based Hooks + +Use LLM for intelligent decisions: +```json +{ + "hooks": { + "Stop": [ + { + "hooks": [ + { + "type": "prompt", + "prompt": "Check if all tasks complete: $ARGUMENTS" + } + ] + } + ] + } +} +``` + +LLM responds with: `{"decision": "approve"|"block", "reason": "..."}` diff --git a/skills/scaffold-claude-feature/references/output-styles.md b/skills/scaffold-claude-feature/references/output-styles.md new file mode 100644 index 0000000..52ae1e2 --- /dev/null +++ b/skills/scaffold-claude-feature/references/output-styles.md @@ -0,0 +1,119 @@ +# Output Styles Reference + +Quick reference for creating custom output styles. + +## Structure + +Markdown file with frontmatter: +```markdown +--- +name: My Style +description: Brief description shown in UI +keep-coding-instructions: false +--- + +# Custom Style Instructions + +Your custom system prompt additions here. +Define how Claude should behave in this style. +``` + +## Location + +- Project: `.claude/output-styles/style-name.md` +- Personal: `~/.claude/output-styles/style-name.md` + +## Key Fields + +- `name` - Display name (optional, defaults to filename) +- `description` - Shown in `/output-style` menu +- `keep-coding-instructions` - Keep Claude's coding instructions (default: false) + +## Activation + +- `/output-style` - Open menu to select +- `/output-style style-name` - Switch directly +- Saved in `.claude/settings.local.json` + +## How It Works + +Output styles modify the system prompt: +- Removes efficiency instructions (concise output) +- Removes coding instructions (unless keep-coding-instructions: true) +- Adds your custom instructions + +## Simple Examples + +**Teacher mode:** +```markdown +--- +name: Teacher +description: Educational mode with explanations +keep-coding-instructions: true +--- + +# Teacher Mode + +You help users learn while coding. + +Behavior: +- Explain your reasoning +- Share insights between tasks +- Ask questions to check understanding +- Encourage hands-on practice +``` + +**Formal mode:** +```markdown +--- +name: Formal +description: Professional, detailed responses +--- + +# Formal Mode + +You provide formal, professional assistance. + +Style: +- Use formal language +- Provide detailed explanations +- Structure responses clearly +- Include relevant references +``` + +**Quick mode:** +```markdown +--- +name: Quick +description: Minimal, direct responses +keep-coding-instructions: true +--- + +# Quick Mode + +Provide minimal, direct responses. + +- Short answers +- Code only when needed +- No extra explanations +``` + +## Tips + +- Set `keep-coding-instructions: true` for coding tasks +- Clear behavior guidelines work best +- Test with different request types +- Use for non-coding tasks (research, writing, etc.) + +## Built-in Styles + +- **Default** - Standard software engineering +- **Explanatory** - Adds educational insights +- **Learning** - Collaborative learn-by-doing + +## Comparison + +- **Output Styles** - Change system prompt, affect all responses +- **CLAUDE.md** - Add context, doesn't change system prompt +- **Subagents** - Separate tasks, own context +- **Slash Commands** - Reusable prompts diff --git a/skills/scaffold-claude-feature/references/skills.md b/skills/scaffold-claude-feature/references/skills.md new file mode 100644 index 0000000..4630f59 --- /dev/null +++ b/skills/scaffold-claude-feature/references/skills.md @@ -0,0 +1,109 @@ +# Skills Reference + +Quick reference for creating agent skills. + +## Structure + +``` +my-skill/ +├── SKILL.md (required) +├── reference.md (optional) +├── examples.md (optional) +├── scripts/ +│ └── helper.py +└── templates/ + └── template.txt +``` + +## Location + +- Project: `.claude/skills/skill-name/` +- Personal: `~/.claude/skills/skill-name/` + +## SKILL.md Format + +```markdown +--- +name: my-skill-name +description: What it does and when to use it. Include trigger keywords. +allowed-tools: Read, Write, Bash +--- + +# My Skill + +## Instructions + +1. Clear step-by-step guidance +2. What to do and how + +## Examples + +Simple, minimal examples +``` + +## Description Tips + +Include WHEN to use: +- ✅ "Extract PDF text. Use when working with PDF files." +- ❌ "Extract PDF text." + +## Tool Access + +- Omit `allowed-tools` → inherit all tools +- Specify tools → restrict access (e.g., read-only: `Read, Grep, Glob`) + +## Progressive Disclosure + +Reference other files: +```markdown +For advanced usage, see [reference.md](reference.md) +Run helper: `python scripts/helper.py` +``` + +Claude loads files only when needed. + +## Simple Examples + +**Code reviewer:** +```markdown +--- +name: code-reviewer +description: Review code quality. Use after writing or modifying code. +allowed-tools: Read, Grep, Glob +--- + +# Code Reviewer + +## Checklist +- Readable code +- Error handling +- No duplicated code +- Security issues + +Review and provide specific feedback. +``` + +**Commit helper:** +```markdown +--- +name: commit-helper +description: Generate commit messages. Use when staging commits. +allowed-tools: Bash(git diff:*), Bash(git status:*) +--- + +# Commit Helper + +## Instructions +1. Run `git diff --staged` +2. Generate clear commit message: + - Summary under 50 chars + - Present tense + - Explain what and why +``` + +## Tips + +- One skill = one focused capability +- Clear, specific descriptions +- Simple instructions +- Test with relevant requests diff --git a/skills/scaffold-claude-feature/references/slash-commands.md b/skills/scaffold-claude-feature/references/slash-commands.md new file mode 100644 index 0000000..92eb191 --- /dev/null +++ b/skills/scaffold-claude-feature/references/slash-commands.md @@ -0,0 +1,85 @@ +# Slash Commands Reference + +Quick reference for creating custom slash commands. + +## Structure + +```markdown +--- +description: Brief description +argument-hint: [arg1] [arg2] +allowed-tools: Tool1, Tool2 +--- + +Your command prompt here with $ARGUMENTS or $1, $2, etc. +``` + +## Location + +- Project: `.claude/commands/filename.md` → `/filename` +- Personal: `~/.claude/commands/filename.md` → `/filename` +- Subdirectories: `.claude/commands/subdir/filename.md` → `/filename` (subdir shown in description) + +## Arguments + +- `$ARGUMENTS` - All arguments as single string +- `$1, $2, $3` - Individual arguments + +## File References + +Use `@` prefix to reference files: +``` +Review @src/app.js for bugs +Compare @old.js with @new.js +``` + +## Bash Execution + +Prefix with `!` to execute bash: +```markdown +--- +allowed-tools: Bash(git status:*), Bash(git diff:*) +--- + +Current status: !`git status` +Recent changes: !`git diff HEAD` +``` + +## Simple Examples + +**Commit helper:** +```markdown +--- +description: Create git commit +allowed-tools: Bash(git add:*), Bash(git commit:*) +--- + +Create a commit for these changes: !`git diff` +``` + +**Review PR:** +```markdown +--- +description: Review pull request +argument-hint: [pr-number] +--- + +Review PR #$1 focusing on code quality and security. +``` + +**Fix issue:** +```markdown +--- +description: Fix GitHub issue +argument-hint: [issue-number] +--- + +Fix issue #$ARGUMENTS following our coding standards. +``` + +## Tips + +- Keep descriptions short and clear +- Use `allowed-tools` to pre-approve tools +- Simple prompts work best +- Test with different arguments diff --git a/skills/scaffold-claude-feature/references/subagents.md b/skills/scaffold-claude-feature/references/subagents.md new file mode 100644 index 0000000..f1aba51 --- /dev/null +++ b/skills/scaffold-claude-feature/references/subagents.md @@ -0,0 +1,115 @@ +# Subagents Reference + +Quick reference for creating specialized subagents. + +## Structure + +Single Markdown file: +```markdown +--- +name: my-agent +description: What it does. Use proactively when [condition]. +tools: Read, Write, Bash +model: sonnet +--- + +System prompt for this subagent. +Detailed role and approach instructions. +``` + +## Location + +- Project: `.claude/agents/agent-name.md` +- Personal: `~/.claude/agents/agent-name.md` + +## Key Fields + +- `name` - lowercase-with-hyphens +- `description` - Include "use proactively" for automatic invocation +- `tools` - Optional; omit to inherit all tools +- `model` - Optional: `sonnet`, `opus`, `haiku`, or `inherit` + +## Model Selection + +- `sonnet` (default) - Balanced capability +- `opus` - Maximum capability +- `haiku` - Fast, cost-effective +- `inherit` - Use main conversation's model + +## Invocation + +**Automatic:** Claude delegates based on description +**Explicit:** User mentions agent by name + +## Simple Examples + +**Code reviewer:** +```markdown +--- +name: code-reviewer +description: Expert code reviewer. Use proactively after writing code. +tools: Read, Grep, Glob, Bash(git diff:*) +model: inherit +--- + +You are a senior code reviewer. + +When invoked: +1. Run git diff to see changes +2. Review for quality and security +3. Provide specific, actionable feedback + +Focus on: +- Readable code +- Error handling +- Security issues +- Performance +``` + +**Debugger:** +```markdown +--- +name: debugger +description: Debug errors and test failures. Use proactively when issues occur. +tools: Read, Edit, Bash, Grep +--- + +You are an expert debugger. + +Process: +1. Capture error message +2. Identify cause +3. Implement minimal fix +4. Verify solution + +Provide root cause and fix. +``` + +**Test runner:** +```markdown +--- +name: test-runner +description: Run tests and fix failures. Use proactively after code changes. +--- + +You run tests and fix failures. + +Steps: +1. Run appropriate tests +2. Analyze failures +3. Fix issues +4. Re-run tests +``` + +## Tips + +- Single, clear responsibility per agent +- Include "use proactively" for automatic use +- Limit tools to what's needed +- Test with relevant requests +- Use `/agents` command to manage + +## When to Use + +- **Subagents** - Separate context, specialized tasks +- **Skills** - Extend capabilities, loaded in main context diff --git a/skills/scaffold-claude-feature/templates/hooks.template.json b/skills/scaffold-claude-feature/templates/hooks.template.json new file mode 100644 index 0000000..7913f1b --- /dev/null +++ b/skills/scaffold-claude-feature/templates/hooks.template.json @@ -0,0 +1,16 @@ +{ + "hooks": { + "[EventName]": [ + { + "matcher": "[ToolPattern or omit for events like Stop]", + "hooks": [ + { + "type": "command", + "command": "[bash-command or $CLAUDE_PROJECT_DIR/script.sh]", + "timeout": 60 + } + ] + } + ] + } +} diff --git a/skills/scaffold-claude-feature/templates/output-style.template.md b/skills/scaffold-claude-feature/templates/output-style.template.md new file mode 100644 index 0000000..db8ef85 --- /dev/null +++ b/skills/scaffold-claude-feature/templates/output-style.template.md @@ -0,0 +1,16 @@ +--- +name: [Style Name] +description: [Brief description shown in /output-style menu] +keep-coding-instructions: [true or false] +--- + +# [Style Name] + +[Your custom system prompt instructions here] + +Define how Claude should behave in this style: +- [Behavior 1] +- [Behavior 2] +- [Behavior 3] + +[Additional guidelines and approach] diff --git a/skills/scaffold-claude-feature/templates/skill.template.md b/skills/scaffold-claude-feature/templates/skill.template.md new file mode 100644 index 0000000..c4875d9 --- /dev/null +++ b/skills/scaffold-claude-feature/templates/skill.template.md @@ -0,0 +1,20 @@ +--- +name: [skill-name-lowercase-with-hyphens] +description: [What it does and when to use it. Include trigger keywords.] +allowed-tools: [Optional: Read, Write, Bash - omit to inherit all tools] +--- + +# [Skill Name] + +## Instructions + +1. [Step-by-step guidance] +2. [What to do and how] + +## Examples + +[Simple, minimal examples] + +## Tips + +[Best practices or common patterns] diff --git a/skills/scaffold-claude-feature/templates/slash-command.template.md b/skills/scaffold-claude-feature/templates/slash-command.template.md new file mode 100644 index 0000000..6800035 --- /dev/null +++ b/skills/scaffold-claude-feature/templates/slash-command.template.md @@ -0,0 +1,11 @@ +--- +description: [Brief description of what this command does] +argument-hint: [arg1] [arg2] +allowed-tools: [Tool1, Tool2] +--- + +[Your command prompt here] + +Use $ARGUMENTS for all args, or $1, $2 for individual args. +Use @filepath to reference files. +Use !`command` to execute bash (requires allowed-tools). diff --git a/skills/scaffold-claude-feature/templates/subagent.template.md b/skills/scaffold-claude-feature/templates/subagent.template.md new file mode 100644 index 0000000..8f9136d --- /dev/null +++ b/skills/scaffold-claude-feature/templates/subagent.template.md @@ -0,0 +1,20 @@ +--- +name: [agent-name-lowercase-with-hyphens] +description: [What it does. Use proactively when [condition].] +tools: [Optional: Read, Write, Bash - omit to inherit all tools] +model: [Optional: sonnet, opus, haiku, or inherit] +--- + +You are [role description]. + +When invoked: +1. [Step 1] +2. [Step 2] +3. [Step 3] + +Focus on: +- [Key aspect 1] +- [Key aspect 2] +- [Key aspect 3] + +[Additional guidance and approach]