Skip to content

Commit f29e110

Browse files
committed
fix(skill-extractor,update-plugins): wire stop hook, add READMEs, tighten allowed-tools
- skill-extractor: convert hooks.json.disabled to command hook wired to stop-hook.sh; fix arithmetic crash on zero grep matches ('|| echo 0' doubled grep -c's own '0' output); kebab-case SKILL.md name - both plugins: add missing READMEs with real marketplace install steps - update-plugins: narrow allowed-tools from unrestricted Bash to the two claude plugin commands actually used
1 parent bec1964 commit f29e110

6 files changed

Lines changed: 100 additions & 10 deletions

File tree

‎plugins/skill-extractor/README.md‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Skill Extractor
2+
3+
Analyze Claude Code conversation history and extract reusable patterns into component files — Skills, Commands, or Agents.
4+
5+
## Installation
6+
7+
```
8+
/plugin marketplace add DropFan/claude-code-plugins
9+
/plugin install skill-extractor@tiger-plugins
10+
```
11+
12+
## Commands
13+
14+
### `/skill-extractor:extract [type] [--name <component-name>]`
15+
16+
Scan the current conversation for extractable patterns (methodologies, operation sequences, decision workflows), then interactively confirm the type, name, and save location before generating the component file.
17+
18+
- `type` — `skill`, `command`, `agent`, or `auto` (default: `auto`, analyzes and recommends a type)
19+
- `--name <component-name>` — kebab-case name for the generated component
20+
21+
```
22+
/skill-extractor:extract # Auto-detect candidates
23+
/skill-extractor:extract skill # Extract as a Skill
24+
/skill-extractor:extract command --name deploy-flow # Extract as a Command with a given name
25+
```
26+
27+
Generated files can be saved to `~/.claude/skills/`, `~/.claude/commands/`, the project's `.claude/` directory, or a plugin directory. The content is previewed for approval before writing, and sensitive data (API keys, tokens, personal paths, credentials) is filtered out during extraction.
28+
29+
## Skill
30+
31+
The **extract-component** skill triggers on phrases like "extract skill", "save as command", "turn this into a skill", "提取技能", "保存为技能", and routes to the `/skill-extractor:extract` command with the user's intent.
32+
33+
## Configuration
34+
35+
Optionally create `.claude/skill-extractor.local.md` in your project root:
36+
37+
```markdown
38+
---
39+
default_output_dir: ~/.claude/skills/
40+
default_type: auto
41+
stop_hook: true
42+
---
43+
```
44+
45+
| Setting | Default | Description |
46+
|---------|---------|-------------|
47+
| `default_output_dir` | `~/.claude/skills/` | Default save directory |
48+
| `default_type` | `auto` | Default component type (`auto` / `skill` / `command` / `agent`) |
49+
| `stop_hook` | `true` | Whether the Stop hook (if enabled, see below) makes suggestions in this project |
50+
51+
Priority: command arguments > settings file > built-in defaults.
52+
53+
## Hooks (disabled by default)
54+
55+
The plugin ships an optional `Stop` hook (`hooks/stop-hook.sh`) that scores the session transcript when a session ends — based on user turns, files created/edited, and subagent tasks — and suggests running `/skill-extractor:extract` for methodology-rich sessions.
56+
57+
The hook is **disabled by default**: the configuration ships as `hooks/hooks.json.disabled`. To enable it, rename `hooks/hooks.json.disabled` to `hooks/hooks.json` in the installed plugin directory and restart the session. To silence it for a single project while enabled, set `stop_hook: false` in `.claude/skill-extractor.local.md`.
58+
59+
## License
60+
61+
MIT

‎plugins/skill-extractor/hooks/hooks.json.disabled‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"matcher": "*",
77
"hooks": [
88
{
9-
"type": "prompt",
10-
"prompt": "If this conversation contains reusable patterns (workflow, methodology, strategy) worth extracting as a Skill/Command/Agent, block and suggest `/skill-extractor:extract`. Otherwise approve silently."
9+
"type": "command",
10+
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/stop-hook.sh"
1111
}
1212
]
1313
}
1414
]
1515
}
16-
}
16+
}

‎plugins/skill-extractor/hooks/stop-hook.sh‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ if [ "$JQ_EXIT" -ne 0 ] && [ "${FILE_SIZE:-0}" -gt 10240 ]; then
5454
exit 0
5555
fi
5656

57-
UT=$(echo "$TOOL_DATA" | grep -c '^USER$' || echo 0)
58-
WE=$(echo "$TOOL_DATA" | grep -cE '^(CREATED|EDITED):' || echo 0)
59-
TC=$(echo "$TOOL_DATA" | grep -c '^Task$' || echo 0)
57+
UT=$(echo "$TOOL_DATA" | grep -c '^USER$' || true)
58+
WE=$(echo "$TOOL_DATA" | grep -cE '^(CREATED|EDITED):' || true)
59+
TC=$(echo "$TOOL_DATA" | grep -c '^Task$' || true)
6060

6161
# Extractable patterns need code output + complexity
6262
SCORE=$(( UT * 1 + WE * 5 + TC * 4 ))
@@ -67,9 +67,9 @@ fi
6767

6868
# Build contextual message describing what was built
6969
CREATED=$(echo "$TOOL_DATA" | grep '^CREATED:' | sed 's/^CREATED://' | sort -u)
70-
CREATED_COUNT=$(echo "$CREATED" | grep -c '.' || echo 0)
70+
CREATED_COUNT=$(echo "$CREATED" | grep -c '.' || true)
7171
EDITED=$(echo "$TOOL_DATA" | grep '^EDITED:' | sed 's/^EDITED://' | sort -u)
72-
EDITED_COUNT=$(echo "$EDITED" | grep -c '.' || echo 0)
72+
EDITED_COUNT=$(echo "$EDITED" | grep -c '.' || true)
7373

7474
if [ "$CREATED_COUNT" -gt 0 ]; then
7575
SHOWN=$(echo "$CREATED" | head -2 | tr '\n' ',' | sed 's/,$//' | sed 's/,/, /g')

‎plugins/skill-extractor/skills/extract-component/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Extract Component
2+
name: extract-component
33
description: This skill should be used when the user asks to "extract skill", "extract command", "extract agent", "extract pattern", "save as skill", "save as command", "save as agent", "turn this into a skill", "make this a command", "save this workflow", "提取技能", "提取命令", "提取 agent", "保存为技能", "提取可复用模式", or wants to extract reusable components (skills, commands, agents) from the current conversation history.
44
---
55

‎plugins/update-plugins/README.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Update Plugins
2+
3+
Batch update all installed Claude Code plugins to their latest versions with a single command.
4+
5+
## Installation
6+
7+
```
8+
/plugin marketplace add DropFan/claude-code-plugins
9+
/plugin install update-plugins@tiger-plugins
10+
```
11+
12+
## Commands
13+
14+
### `/update-plugins:update-plugins`
15+
16+
Update every installed plugin in one pass:
17+
18+
1. Runs `claude plugin list` to enumerate installed plugins
19+
2. Runs `claude plugin update <name@marketplace>` for each one
20+
3. Displays a summary table with each plugin's result (updated / already up-to-date / failed)
21+
4. Reminds you to restart the session to apply updates
22+
23+
```
24+
/update-plugins:update-plugins
25+
```
26+
27+
## License
28+
29+
MIT

‎plugins/update-plugins/commands/update-plugins.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
allowed-tools: Bash
2+
allowed-tools: Bash(claude plugin list:*), Bash(claude plugin update:*)
33
description: Batch update all installed Claude Code plugins to latest versions
44
---
55

0 commit comments

Comments
 (0)