@every-env/compound-plugin 2.36.4 → 2.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/plugins/compound-engineering/.claude-plugin/plugin.json +1 -1
- package/plugins/compound-engineering/README.md +1 -1
- package/plugins/compound-engineering/skills/agent-browser/SKILL.md +510 -169
- package/plugins/compound-engineering/skills/agent-browser/references/authentication.md +303 -0
- package/plugins/compound-engineering/skills/agent-browser/references/commands.md +266 -0
- package/plugins/compound-engineering/skills/agent-browser/references/profiling.md +120 -0
- package/plugins/compound-engineering/skills/agent-browser/references/proxy-support.md +194 -0
- package/plugins/compound-engineering/skills/agent-browser/references/session-management.md +193 -0
- package/plugins/compound-engineering/skills/agent-browser/references/snapshot-refs.md +194 -0
- package/plugins/compound-engineering/skills/agent-browser/references/video-recording.md +173 -0
- package/plugins/compound-engineering/skills/agent-browser/templates/authenticated-session.sh +105 -0
- package/plugins/compound-engineering/skills/agent-browser/templates/capture-workflow.sh +69 -0
- package/plugins/compound-engineering/skills/agent-browser/templates/form-automation.sh +62 -0
- package/plugins/compound-engineering/skills/create-agent-skills/SKILL.md +3 -14
- package/plugins/compound-engineering/skills/skill-creator/SKILL.md +0 -210
- package/plugins/compound-engineering/skills/skill-creator/scripts/init_skill.py +0 -303
- package/plugins/compound-engineering/skills/skill-creator/scripts/package_skill.py +0 -110
- package/plugins/compound-engineering/skills/skill-creator/scripts/quick_validate.py +0 -65
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Video Recording
|
|
2
|
+
|
|
3
|
+
Capture browser automation as video for debugging, documentation, or verification.
|
|
4
|
+
|
|
5
|
+
**Related**: [commands.md](commands.md) for full command reference, [SKILL.md](../SKILL.md) for quick start.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- [Basic Recording](#basic-recording)
|
|
10
|
+
- [Recording Commands](#recording-commands)
|
|
11
|
+
- [Use Cases](#use-cases)
|
|
12
|
+
- [Best Practices](#best-practices)
|
|
13
|
+
- [Output Format](#output-format)
|
|
14
|
+
- [Limitations](#limitations)
|
|
15
|
+
|
|
16
|
+
## Basic Recording
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Start recording
|
|
20
|
+
agent-browser record start ./demo.webm
|
|
21
|
+
|
|
22
|
+
# Perform actions
|
|
23
|
+
agent-browser open https://example.com
|
|
24
|
+
agent-browser snapshot -i
|
|
25
|
+
agent-browser click @e1
|
|
26
|
+
agent-browser fill @e2 "test input"
|
|
27
|
+
|
|
28
|
+
# Stop and save
|
|
29
|
+
agent-browser record stop
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Recording Commands
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Start recording to file
|
|
36
|
+
agent-browser record start ./output.webm
|
|
37
|
+
|
|
38
|
+
# Stop current recording
|
|
39
|
+
agent-browser record stop
|
|
40
|
+
|
|
41
|
+
# Restart with new file (stops current + starts new)
|
|
42
|
+
agent-browser record restart ./take2.webm
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Use Cases
|
|
46
|
+
|
|
47
|
+
### Debugging Failed Automation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
#!/bin/bash
|
|
51
|
+
# Record automation for debugging
|
|
52
|
+
|
|
53
|
+
agent-browser record start ./debug-$(date +%Y%m%d-%H%M%S).webm
|
|
54
|
+
|
|
55
|
+
# Run your automation
|
|
56
|
+
agent-browser open https://app.example.com
|
|
57
|
+
agent-browser snapshot -i
|
|
58
|
+
agent-browser click @e1 || {
|
|
59
|
+
echo "Click failed - check recording"
|
|
60
|
+
agent-browser record stop
|
|
61
|
+
exit 1
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
agent-browser record stop
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Documentation Generation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
#!/bin/bash
|
|
71
|
+
# Record workflow for documentation
|
|
72
|
+
|
|
73
|
+
agent-browser record start ./docs/how-to-login.webm
|
|
74
|
+
|
|
75
|
+
agent-browser open https://app.example.com/login
|
|
76
|
+
agent-browser wait 1000 # Pause for visibility
|
|
77
|
+
|
|
78
|
+
agent-browser snapshot -i
|
|
79
|
+
agent-browser fill @e1 "demo@example.com"
|
|
80
|
+
agent-browser wait 500
|
|
81
|
+
|
|
82
|
+
agent-browser fill @e2 "password"
|
|
83
|
+
agent-browser wait 500
|
|
84
|
+
|
|
85
|
+
agent-browser click @e3
|
|
86
|
+
agent-browser wait --load networkidle
|
|
87
|
+
agent-browser wait 1000 # Show result
|
|
88
|
+
|
|
89
|
+
agent-browser record stop
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### CI/CD Test Evidence
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
#!/bin/bash
|
|
96
|
+
# Record E2E test runs for CI artifacts
|
|
97
|
+
|
|
98
|
+
TEST_NAME="${1:-e2e-test}"
|
|
99
|
+
RECORDING_DIR="./test-recordings"
|
|
100
|
+
mkdir -p "$RECORDING_DIR"
|
|
101
|
+
|
|
102
|
+
agent-browser record start "$RECORDING_DIR/$TEST_NAME-$(date +%s).webm"
|
|
103
|
+
|
|
104
|
+
# Run test
|
|
105
|
+
if run_e2e_test; then
|
|
106
|
+
echo "Test passed"
|
|
107
|
+
else
|
|
108
|
+
echo "Test failed - recording saved"
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
agent-browser record stop
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Best Practices
|
|
115
|
+
|
|
116
|
+
### 1. Add Pauses for Clarity
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Slow down for human viewing
|
|
120
|
+
agent-browser click @e1
|
|
121
|
+
agent-browser wait 500 # Let viewer see result
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 2. Use Descriptive Filenames
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Include context in filename
|
|
128
|
+
agent-browser record start ./recordings/login-flow-2024-01-15.webm
|
|
129
|
+
agent-browser record start ./recordings/checkout-test-run-42.webm
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 3. Handle Recording in Error Cases
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
#!/bin/bash
|
|
136
|
+
set -e
|
|
137
|
+
|
|
138
|
+
cleanup() {
|
|
139
|
+
agent-browser record stop 2>/dev/null || true
|
|
140
|
+
agent-browser close 2>/dev/null || true
|
|
141
|
+
}
|
|
142
|
+
trap cleanup EXIT
|
|
143
|
+
|
|
144
|
+
agent-browser record start ./automation.webm
|
|
145
|
+
# ... automation steps ...
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 4. Combine with Screenshots
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Record video AND capture key frames
|
|
152
|
+
agent-browser record start ./flow.webm
|
|
153
|
+
|
|
154
|
+
agent-browser open https://example.com
|
|
155
|
+
agent-browser screenshot ./screenshots/step1-homepage.png
|
|
156
|
+
|
|
157
|
+
agent-browser click @e1
|
|
158
|
+
agent-browser screenshot ./screenshots/step2-after-click.png
|
|
159
|
+
|
|
160
|
+
agent-browser record stop
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Output Format
|
|
164
|
+
|
|
165
|
+
- Default format: WebM (VP8/VP9 codec)
|
|
166
|
+
- Compatible with all modern browsers and video players
|
|
167
|
+
- Compressed but high quality
|
|
168
|
+
|
|
169
|
+
## Limitations
|
|
170
|
+
|
|
171
|
+
- Recording adds slight overhead to automation
|
|
172
|
+
- Large recordings can consume significant disk space
|
|
173
|
+
- Some headless environments may have codec limitations
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Template: Authenticated Session Workflow
|
|
3
|
+
# Purpose: Login once, save state, reuse for subsequent runs
|
|
4
|
+
# Usage: ./authenticated-session.sh <login-url> [state-file]
|
|
5
|
+
#
|
|
6
|
+
# RECOMMENDED: Use the auth vault instead of this template:
|
|
7
|
+
# echo "<pass>" | agent-browser auth save myapp --url <login-url> --username <user> --password-stdin
|
|
8
|
+
# agent-browser auth login myapp
|
|
9
|
+
# The auth vault stores credentials securely and the LLM never sees passwords.
|
|
10
|
+
#
|
|
11
|
+
# Environment variables:
|
|
12
|
+
# APP_USERNAME - Login username/email
|
|
13
|
+
# APP_PASSWORD - Login password
|
|
14
|
+
#
|
|
15
|
+
# Two modes:
|
|
16
|
+
# 1. Discovery mode (default): Shows form structure so you can identify refs
|
|
17
|
+
# 2. Login mode: Performs actual login after you update the refs
|
|
18
|
+
#
|
|
19
|
+
# Setup steps:
|
|
20
|
+
# 1. Run once to see form structure (discovery mode)
|
|
21
|
+
# 2. Update refs in LOGIN FLOW section below
|
|
22
|
+
# 3. Set APP_USERNAME and APP_PASSWORD
|
|
23
|
+
# 4. Delete the DISCOVERY section
|
|
24
|
+
|
|
25
|
+
set -euo pipefail
|
|
26
|
+
|
|
27
|
+
LOGIN_URL="${1:?Usage: $0 <login-url> [state-file]}"
|
|
28
|
+
STATE_FILE="${2:-./auth-state.json}"
|
|
29
|
+
|
|
30
|
+
echo "Authentication workflow: $LOGIN_URL"
|
|
31
|
+
|
|
32
|
+
# ================================================================
|
|
33
|
+
# SAVED STATE: Skip login if valid saved state exists
|
|
34
|
+
# ================================================================
|
|
35
|
+
if [[ -f "$STATE_FILE" ]]; then
|
|
36
|
+
echo "Loading saved state from $STATE_FILE..."
|
|
37
|
+
if agent-browser --state "$STATE_FILE" open "$LOGIN_URL" 2>/dev/null; then
|
|
38
|
+
agent-browser wait --load networkidle
|
|
39
|
+
|
|
40
|
+
CURRENT_URL=$(agent-browser get url)
|
|
41
|
+
if [[ "$CURRENT_URL" != *"login"* ]] && [[ "$CURRENT_URL" != *"signin"* ]]; then
|
|
42
|
+
echo "Session restored successfully"
|
|
43
|
+
agent-browser snapshot -i
|
|
44
|
+
exit 0
|
|
45
|
+
fi
|
|
46
|
+
echo "Session expired, performing fresh login..."
|
|
47
|
+
agent-browser close 2>/dev/null || true
|
|
48
|
+
else
|
|
49
|
+
echo "Failed to load state, re-authenticating..."
|
|
50
|
+
fi
|
|
51
|
+
rm -f "$STATE_FILE"
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# ================================================================
|
|
55
|
+
# DISCOVERY MODE: Shows form structure (delete after setup)
|
|
56
|
+
# ================================================================
|
|
57
|
+
echo "Opening login page..."
|
|
58
|
+
agent-browser open "$LOGIN_URL"
|
|
59
|
+
agent-browser wait --load networkidle
|
|
60
|
+
|
|
61
|
+
echo ""
|
|
62
|
+
echo "Login form structure:"
|
|
63
|
+
echo "---"
|
|
64
|
+
agent-browser snapshot -i
|
|
65
|
+
echo "---"
|
|
66
|
+
echo ""
|
|
67
|
+
echo "Next steps:"
|
|
68
|
+
echo " 1. Note the refs: username=@e?, password=@e?, submit=@e?"
|
|
69
|
+
echo " 2. Update the LOGIN FLOW section below with your refs"
|
|
70
|
+
echo " 3. Set: export APP_USERNAME='...' APP_PASSWORD='...'"
|
|
71
|
+
echo " 4. Delete this DISCOVERY MODE section"
|
|
72
|
+
echo ""
|
|
73
|
+
agent-browser close
|
|
74
|
+
exit 0
|
|
75
|
+
|
|
76
|
+
# ================================================================
|
|
77
|
+
# LOGIN FLOW: Uncomment and customize after discovery
|
|
78
|
+
# ================================================================
|
|
79
|
+
# : "${APP_USERNAME:?Set APP_USERNAME environment variable}"
|
|
80
|
+
# : "${APP_PASSWORD:?Set APP_PASSWORD environment variable}"
|
|
81
|
+
#
|
|
82
|
+
# agent-browser open "$LOGIN_URL"
|
|
83
|
+
# agent-browser wait --load networkidle
|
|
84
|
+
# agent-browser snapshot -i
|
|
85
|
+
#
|
|
86
|
+
# # Fill credentials (update refs to match your form)
|
|
87
|
+
# agent-browser fill @e1 "$APP_USERNAME"
|
|
88
|
+
# agent-browser fill @e2 "$APP_PASSWORD"
|
|
89
|
+
# agent-browser click @e3
|
|
90
|
+
# agent-browser wait --load networkidle
|
|
91
|
+
#
|
|
92
|
+
# # Verify login succeeded
|
|
93
|
+
# FINAL_URL=$(agent-browser get url)
|
|
94
|
+
# if [[ "$FINAL_URL" == *"login"* ]] || [[ "$FINAL_URL" == *"signin"* ]]; then
|
|
95
|
+
# echo "Login failed - still on login page"
|
|
96
|
+
# agent-browser screenshot /tmp/login-failed.png
|
|
97
|
+
# agent-browser close
|
|
98
|
+
# exit 1
|
|
99
|
+
# fi
|
|
100
|
+
#
|
|
101
|
+
# # Save state for future runs
|
|
102
|
+
# echo "Saving state to $STATE_FILE"
|
|
103
|
+
# agent-browser state save "$STATE_FILE"
|
|
104
|
+
# echo "Login successful"
|
|
105
|
+
# agent-browser snapshot -i
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Template: Content Capture Workflow
|
|
3
|
+
# Purpose: Extract content from web pages (text, screenshots, PDF)
|
|
4
|
+
# Usage: ./capture-workflow.sh <url> [output-dir]
|
|
5
|
+
#
|
|
6
|
+
# Outputs:
|
|
7
|
+
# - page-full.png: Full page screenshot
|
|
8
|
+
# - page-structure.txt: Page element structure with refs
|
|
9
|
+
# - page-text.txt: All text content
|
|
10
|
+
# - page.pdf: PDF version
|
|
11
|
+
#
|
|
12
|
+
# Optional: Load auth state for protected pages
|
|
13
|
+
|
|
14
|
+
set -euo pipefail
|
|
15
|
+
|
|
16
|
+
TARGET_URL="${1:?Usage: $0 <url> [output-dir]}"
|
|
17
|
+
OUTPUT_DIR="${2:-.}"
|
|
18
|
+
|
|
19
|
+
echo "Capturing: $TARGET_URL"
|
|
20
|
+
mkdir -p "$OUTPUT_DIR"
|
|
21
|
+
|
|
22
|
+
# Optional: Load authentication state
|
|
23
|
+
# if [[ -f "./auth-state.json" ]]; then
|
|
24
|
+
# echo "Loading authentication state..."
|
|
25
|
+
# agent-browser state load "./auth-state.json"
|
|
26
|
+
# fi
|
|
27
|
+
|
|
28
|
+
# Navigate to target
|
|
29
|
+
agent-browser open "$TARGET_URL"
|
|
30
|
+
agent-browser wait --load networkidle
|
|
31
|
+
|
|
32
|
+
# Get metadata
|
|
33
|
+
TITLE=$(agent-browser get title)
|
|
34
|
+
URL=$(agent-browser get url)
|
|
35
|
+
echo "Title: $TITLE"
|
|
36
|
+
echo "URL: $URL"
|
|
37
|
+
|
|
38
|
+
# Capture full page screenshot
|
|
39
|
+
agent-browser screenshot --full "$OUTPUT_DIR/page-full.png"
|
|
40
|
+
echo "Saved: $OUTPUT_DIR/page-full.png"
|
|
41
|
+
|
|
42
|
+
# Get page structure with refs
|
|
43
|
+
agent-browser snapshot -i > "$OUTPUT_DIR/page-structure.txt"
|
|
44
|
+
echo "Saved: $OUTPUT_DIR/page-structure.txt"
|
|
45
|
+
|
|
46
|
+
# Extract all text content
|
|
47
|
+
agent-browser get text body > "$OUTPUT_DIR/page-text.txt"
|
|
48
|
+
echo "Saved: $OUTPUT_DIR/page-text.txt"
|
|
49
|
+
|
|
50
|
+
# Save as PDF
|
|
51
|
+
agent-browser pdf "$OUTPUT_DIR/page.pdf"
|
|
52
|
+
echo "Saved: $OUTPUT_DIR/page.pdf"
|
|
53
|
+
|
|
54
|
+
# Optional: Extract specific elements using refs from structure
|
|
55
|
+
# agent-browser get text @e5 > "$OUTPUT_DIR/main-content.txt"
|
|
56
|
+
|
|
57
|
+
# Optional: Handle infinite scroll pages
|
|
58
|
+
# for i in {1..5}; do
|
|
59
|
+
# agent-browser scroll down 1000
|
|
60
|
+
# agent-browser wait 1000
|
|
61
|
+
# done
|
|
62
|
+
# agent-browser screenshot --full "$OUTPUT_DIR/page-scrolled.png"
|
|
63
|
+
|
|
64
|
+
# Cleanup
|
|
65
|
+
agent-browser close
|
|
66
|
+
|
|
67
|
+
echo ""
|
|
68
|
+
echo "Capture complete:"
|
|
69
|
+
ls -la "$OUTPUT_DIR"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Template: Form Automation Workflow
|
|
3
|
+
# Purpose: Fill and submit web forms with validation
|
|
4
|
+
# Usage: ./form-automation.sh <form-url>
|
|
5
|
+
#
|
|
6
|
+
# This template demonstrates the snapshot-interact-verify pattern:
|
|
7
|
+
# 1. Navigate to form
|
|
8
|
+
# 2. Snapshot to get element refs
|
|
9
|
+
# 3. Fill fields using refs
|
|
10
|
+
# 4. Submit and verify result
|
|
11
|
+
#
|
|
12
|
+
# Customize: Update the refs (@e1, @e2, etc.) based on your form's snapshot output
|
|
13
|
+
|
|
14
|
+
set -euo pipefail
|
|
15
|
+
|
|
16
|
+
FORM_URL="${1:?Usage: $0 <form-url>}"
|
|
17
|
+
|
|
18
|
+
echo "Form automation: $FORM_URL"
|
|
19
|
+
|
|
20
|
+
# Step 1: Navigate to form
|
|
21
|
+
agent-browser open "$FORM_URL"
|
|
22
|
+
agent-browser wait --load networkidle
|
|
23
|
+
|
|
24
|
+
# Step 2: Snapshot to discover form elements
|
|
25
|
+
echo ""
|
|
26
|
+
echo "Form structure:"
|
|
27
|
+
agent-browser snapshot -i
|
|
28
|
+
|
|
29
|
+
# Step 3: Fill form fields (customize these refs based on snapshot output)
|
|
30
|
+
#
|
|
31
|
+
# Common field types:
|
|
32
|
+
# agent-browser fill @e1 "John Doe" # Text input
|
|
33
|
+
# agent-browser fill @e2 "user@example.com" # Email input
|
|
34
|
+
# agent-browser fill @e3 "SecureP@ss123" # Password input
|
|
35
|
+
# agent-browser select @e4 "Option Value" # Dropdown
|
|
36
|
+
# agent-browser check @e5 # Checkbox
|
|
37
|
+
# agent-browser click @e6 # Radio button
|
|
38
|
+
# agent-browser fill @e7 "Multi-line text" # Textarea
|
|
39
|
+
# agent-browser upload @e8 /path/to/file.pdf # File upload
|
|
40
|
+
#
|
|
41
|
+
# Uncomment and modify:
|
|
42
|
+
# agent-browser fill @e1 "Test User"
|
|
43
|
+
# agent-browser fill @e2 "test@example.com"
|
|
44
|
+
# agent-browser click @e3 # Submit button
|
|
45
|
+
|
|
46
|
+
# Step 4: Wait for submission
|
|
47
|
+
# agent-browser wait --load networkidle
|
|
48
|
+
# agent-browser wait --url "**/success" # Or wait for redirect
|
|
49
|
+
|
|
50
|
+
# Step 5: Verify result
|
|
51
|
+
echo ""
|
|
52
|
+
echo "Result:"
|
|
53
|
+
agent-browser get url
|
|
54
|
+
agent-browser snapshot -i
|
|
55
|
+
|
|
56
|
+
# Optional: Capture evidence
|
|
57
|
+
agent-browser screenshot /tmp/form-result.png
|
|
58
|
+
echo "Screenshot saved: /tmp/form-result.png"
|
|
59
|
+
|
|
60
|
+
# Cleanup
|
|
61
|
+
agent-browser close
|
|
62
|
+
echo "Done"
|
|
@@ -97,22 +97,11 @@ Access individual args: `$ARGUMENTS[0]` or shorthand `$0`, `$1`, `$2`.
|
|
|
97
97
|
|
|
98
98
|
### Dynamic Context Injection
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
Skills support dynamic context injection: prefix a backtick-wrapped shell command with an exclamation mark, and the preprocessor executes it at load time, replacing the directive with stdout. Write an exclamation mark immediately before the opening backtick of the command you want executed (for example, to inject the current git branch, write the exclamation mark followed by `git branch --show-current` wrapped in backticks).
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
name: pr-summary
|
|
105
|
-
description: Summarize changes in a pull request
|
|
106
|
-
context: fork
|
|
107
|
-
agent: Explore
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## Context
|
|
111
|
-
- PR diff: !`gh pr diff`
|
|
112
|
-
- Changed files: !`gh pr diff --name-only`
|
|
102
|
+
**Important:** The preprocessor scans the entire SKILL.md as plain text — it does not parse markdown. Directives inside fenced code blocks or inline code spans are still executed. If a skill documents this syntax with literal examples, the preprocessor will attempt to run them, causing load failures. To safely document this feature, describe it in prose (as done here) or place examples in a reference file, which is loaded on-demand by Claude and not preprocessed.
|
|
113
103
|
|
|
114
|
-
|
|
115
|
-
```
|
|
104
|
+
For a concrete example of dynamic context injection in a skill, see [official-spec.md](references/official-spec.md) § "Dynamic Context Injection".
|
|
116
105
|
|
|
117
106
|
### Running in a Subagent
|
|
118
107
|
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: skill-creator
|
|
3
|
-
description: Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
|
|
4
|
-
license: Complete terms in LICENSE.txt
|
|
5
|
-
disable-model-invocation: true
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Skill Creator
|
|
9
|
-
|
|
10
|
-
This skill provides guidance for creating effective skills.
|
|
11
|
-
|
|
12
|
-
## About Skills
|
|
13
|
-
|
|
14
|
-
Skills are modular, self-contained packages that extend Claude's capabilities by providing
|
|
15
|
-
specialized knowledge, workflows, and tools. Think of them as "onboarding guides" for specific
|
|
16
|
-
domains or tasks—they transform Claude from a general-purpose agent into a specialized agent
|
|
17
|
-
equipped with procedural knowledge that no model can fully possess.
|
|
18
|
-
|
|
19
|
-
### What Skills Provide
|
|
20
|
-
|
|
21
|
-
1. Specialized workflows - Multi-step procedures for specific domains
|
|
22
|
-
2. Tool integrations - Instructions for working with specific file formats or APIs
|
|
23
|
-
3. Domain expertise - Company-specific knowledge, schemas, business logic
|
|
24
|
-
4. Bundled resources - Scripts, references, and assets for complex and repetitive tasks
|
|
25
|
-
|
|
26
|
-
### Anatomy of a Skill
|
|
27
|
-
|
|
28
|
-
Every skill consists of a required SKILL.md file and optional bundled resources:
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
skill-name/
|
|
32
|
-
├── SKILL.md (required)
|
|
33
|
-
│ ├── YAML frontmatter metadata (required)
|
|
34
|
-
│ │ ├── name: (required)
|
|
35
|
-
│ │ └── description: (required)
|
|
36
|
-
│ └── Markdown instructions (required)
|
|
37
|
-
└── Bundled Resources (optional)
|
|
38
|
-
├── scripts/ - Executable code (Python/Bash/etc.)
|
|
39
|
-
├── references/ - Documentation intended to be loaded into context as needed
|
|
40
|
-
└── assets/ - Files used in output (templates, icons, fonts, etc.)
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
#### SKILL.md (required)
|
|
44
|
-
|
|
45
|
-
**Metadata Quality:** The `name` and `description` in YAML frontmatter determine when Claude will use the skill. Be specific about what the skill does and when to use it. Use the third-person (e.g. "This skill should be used when..." instead of "Use this skill when...").
|
|
46
|
-
|
|
47
|
-
#### Bundled Resources (optional)
|
|
48
|
-
|
|
49
|
-
##### Scripts (`scripts/`)
|
|
50
|
-
|
|
51
|
-
Executable code (Python/Bash/etc.) for tasks that require deterministic reliability or are repeatedly rewritten.
|
|
52
|
-
|
|
53
|
-
- **When to include**: When the same code is being rewritten repeatedly or deterministic reliability is needed
|
|
54
|
-
- **Example**: `scripts/rotate_pdf.py` for PDF rotation tasks
|
|
55
|
-
- **Benefits**: Token efficient, deterministic, may be executed without loading into context
|
|
56
|
-
- **Note**: Scripts may still need to be read by Claude for patching or environment-specific adjustments
|
|
57
|
-
|
|
58
|
-
##### References (`references/`)
|
|
59
|
-
|
|
60
|
-
Documentation and reference material intended to be loaded as needed into context to inform Claude's process and thinking.
|
|
61
|
-
|
|
62
|
-
- **When to include**: For documentation that Claude should reference while working
|
|
63
|
-
- **Examples**: `references/finance.md` for financial schemas, `references/mnda.md` for company NDA template, `references/policies.md` for company policies, `references/api_docs.md` for API specifications
|
|
64
|
-
- **Use cases**: Database schemas, API documentation, domain knowledge, company policies, detailed workflow guides
|
|
65
|
-
- **Benefits**: Keeps SKILL.md lean, loaded only when Claude determines it's needed
|
|
66
|
-
- **Best practice**: If files are large (>10k words), include grep search patterns in SKILL.md
|
|
67
|
-
- **Avoid duplication**: Information should live in either SKILL.md or references files, not both. Prefer references files for detailed information unless it's truly core to the skill—this keeps SKILL.md lean while making information discoverable without hogging the context window. Keep only essential procedural instructions and workflow guidance in SKILL.md; move detailed reference material, schemas, and examples to references files.
|
|
68
|
-
|
|
69
|
-
##### Assets (`assets/`)
|
|
70
|
-
|
|
71
|
-
Files not intended to be loaded into context, but rather used within the output Claude produces.
|
|
72
|
-
|
|
73
|
-
- **When to include**: When the skill needs files that will be used in the final output
|
|
74
|
-
- **Examples**: `assets/logo.png` for brand assets, `assets/slides.pptx` for PowerPoint templates, `assets/frontend-template/` for HTML/React boilerplate, `assets/font.ttf` for typography
|
|
75
|
-
- **Use cases**: Templates, images, icons, boilerplate code, fonts, sample documents that get copied or modified
|
|
76
|
-
- **Benefits**: Separates output resources from documentation, enables Claude to use files without loading them into context
|
|
77
|
-
|
|
78
|
-
### Progressive Disclosure Design Principle
|
|
79
|
-
|
|
80
|
-
Skills use a three-level loading system to manage context efficiently:
|
|
81
|
-
|
|
82
|
-
1. **Metadata (name + description)** - Always in context (~100 words)
|
|
83
|
-
2. **SKILL.md body** - When skill triggers (<5k words)
|
|
84
|
-
3. **Bundled resources** - As needed by Claude (Unlimited*)
|
|
85
|
-
|
|
86
|
-
*Unlimited because scripts can be executed without reading into context window.
|
|
87
|
-
|
|
88
|
-
## Skill Creation Process
|
|
89
|
-
|
|
90
|
-
To create a skill, follow the "Skill Creation Process" in order, skipping steps only if there is a clear reason why they are not applicable.
|
|
91
|
-
|
|
92
|
-
### Step 1: Understanding the Skill with Concrete Examples
|
|
93
|
-
|
|
94
|
-
Skip this step only when the skill's usage patterns are already clearly understood. It remains valuable even when working with an existing skill.
|
|
95
|
-
|
|
96
|
-
To create an effective skill, clearly understand concrete examples of how the skill will be used. This understanding can come from either direct user examples or generated examples that are validated with user feedback.
|
|
97
|
-
|
|
98
|
-
For example, when building an image-editor skill, relevant questions include:
|
|
99
|
-
|
|
100
|
-
- "What functionality should the image-editor skill support? Editing, rotating, anything else?"
|
|
101
|
-
- "Can you give some examples of how this skill would be used?"
|
|
102
|
-
- "I can imagine users asking for things like 'Remove the red-eye from this image' or 'Rotate this image'. Are there other ways you imagine this skill being used?"
|
|
103
|
-
- "What would a user say that should trigger this skill?"
|
|
104
|
-
|
|
105
|
-
To avoid overwhelming users, avoid asking too many questions in a single message. Start with the most important questions and follow up as needed for better effectiveness.
|
|
106
|
-
|
|
107
|
-
Conclude this step when there is a clear sense of the functionality the skill should support.
|
|
108
|
-
|
|
109
|
-
### Step 2: Planning the Reusable Skill Contents
|
|
110
|
-
|
|
111
|
-
To turn concrete examples into an effective skill, analyze each example by:
|
|
112
|
-
|
|
113
|
-
1. Considering how to execute on the example from scratch
|
|
114
|
-
2. Identifying what scripts, references, and assets would be helpful when executing these workflows repeatedly
|
|
115
|
-
|
|
116
|
-
Example: When building a `pdf-editor` skill to handle queries like "Help me rotate this PDF," the analysis shows:
|
|
117
|
-
|
|
118
|
-
1. Rotating a PDF requires re-writing the same code each time
|
|
119
|
-
2. A `scripts/rotate_pdf.py` script would be helpful to store in the skill
|
|
120
|
-
|
|
121
|
-
Example: When designing a `frontend-webapp-builder` skill for queries like "Build me a todo app" or "Build me a dashboard to track my steps," the analysis shows:
|
|
122
|
-
|
|
123
|
-
1. Writing a frontend webapp requires the same boilerplate HTML/React each time
|
|
124
|
-
2. An `assets/hello-world/` template containing the boilerplate HTML/React project files would be helpful to store in the skill
|
|
125
|
-
|
|
126
|
-
Example: When building a `big-query` skill to handle queries like "How many users have logged in today?" the analysis shows:
|
|
127
|
-
|
|
128
|
-
1. Querying BigQuery requires re-discovering the table schemas and relationships each time
|
|
129
|
-
2. A `references/schema.md` file documenting the table schemas would be helpful to store in the skill
|
|
130
|
-
|
|
131
|
-
To establish the skill's contents, analyze each concrete example to create a list of the reusable resources to include: scripts, references, and assets.
|
|
132
|
-
|
|
133
|
-
### Step 3: Initializing the Skill
|
|
134
|
-
|
|
135
|
-
At this point, it is time to actually create the skill.
|
|
136
|
-
|
|
137
|
-
Skip this step only if the skill being developed already exists, and iteration or packaging is needed. In this case, continue to the next step.
|
|
138
|
-
|
|
139
|
-
When creating a new skill from scratch, always run the `init_skill.py` script. The script conveniently generates a new template skill directory that automatically includes everything a skill requires, making the skill creation process much more efficient and reliable.
|
|
140
|
-
|
|
141
|
-
Usage:
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
scripts/init_skill.py <skill-name> --path <output-directory>
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
The script:
|
|
148
|
-
|
|
149
|
-
- Creates the skill directory at the specified path
|
|
150
|
-
- Generates a SKILL.md template with proper frontmatter and TODO placeholders
|
|
151
|
-
- Creates example resource directories: `scripts/`, `references/`, and `assets/`
|
|
152
|
-
- Adds example files in each directory that can be customized or deleted
|
|
153
|
-
|
|
154
|
-
After initialization, customize or remove the generated SKILL.md and example files as needed.
|
|
155
|
-
|
|
156
|
-
### Step 4: Edit the Skill
|
|
157
|
-
|
|
158
|
-
When editing the (newly-generated or existing) skill, remember that the skill is being created for another instance of Claude to use. Focus on including information that would be beneficial and non-obvious to Claude. Consider what procedural knowledge, domain-specific details, or reusable assets would help another Claude instance execute these tasks more effectively.
|
|
159
|
-
|
|
160
|
-
#### Start with Reusable Skill Contents
|
|
161
|
-
|
|
162
|
-
To begin implementation, start with the reusable resources identified above: `scripts/`, `references/`, and `assets/` files. Note that this step may require user input. For example, when implementing a `brand-guidelines` skill, the user may need to provide brand assets or templates to store in `assets/`, or documentation to store in `references/`.
|
|
163
|
-
|
|
164
|
-
Also, delete any example files and directories not needed for the skill. The initialization script creates example files in `scripts/`, `references/`, and `assets/` to demonstrate structure, but most skills won't need all of them.
|
|
165
|
-
|
|
166
|
-
#### Update SKILL.md
|
|
167
|
-
|
|
168
|
-
**Writing Style:** Write the entire skill using **imperative/infinitive form** (verb-first instructions), not second person. Use objective, instructional language (e.g., "To accomplish X, do Y" rather than "You should do X" or "If you need to do X"). This maintains consistency and clarity for AI consumption.
|
|
169
|
-
|
|
170
|
-
To complete SKILL.md, answer the following questions:
|
|
171
|
-
|
|
172
|
-
1. What is the purpose of the skill, in a few sentences?
|
|
173
|
-
2. When should the skill be used?
|
|
174
|
-
3. In practice, how should Claude use the skill? All reusable skill contents developed above should be referenced so that Claude knows how to use them.
|
|
175
|
-
|
|
176
|
-
### Step 5: Packaging a Skill
|
|
177
|
-
|
|
178
|
-
Once the skill is ready, it should be packaged into a distributable zip file that gets shared with the user. The packaging process automatically validates the skill first to ensure it meets all requirements:
|
|
179
|
-
|
|
180
|
-
```bash
|
|
181
|
-
scripts/package_skill.py <path/to/skill-folder>
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
Optional output directory specification:
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
scripts/package_skill.py <path/to/skill-folder> ./dist
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
The packaging script will:
|
|
191
|
-
|
|
192
|
-
1. **Validate** the skill automatically, checking:
|
|
193
|
-
- YAML frontmatter format and required fields
|
|
194
|
-
- Skill naming conventions and directory structure
|
|
195
|
-
- Description completeness and quality
|
|
196
|
-
- File organization and resource references
|
|
197
|
-
|
|
198
|
-
2. **Package** the skill if validation passes, creating a zip file named after the skill (e.g., `my-skill.zip`) that includes all files and maintains the proper directory structure for distribution.
|
|
199
|
-
|
|
200
|
-
If validation fails, the script will report the errors and exit without creating a package. Fix any validation errors and run the packaging command again.
|
|
201
|
-
|
|
202
|
-
### Step 6: Iterate
|
|
203
|
-
|
|
204
|
-
After testing the skill, users may request improvements. Often this happens right after using the skill, with fresh context of how the skill performed.
|
|
205
|
-
|
|
206
|
-
**Iteration workflow:**
|
|
207
|
-
1. Use the skill on real tasks
|
|
208
|
-
2. Notice struggles or inefficiencies
|
|
209
|
-
3. Identify how SKILL.md or bundled resources should be updated
|
|
210
|
-
4. Implement changes and test again
|