@torka/claude-workflows 0.1.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/plugin.json +51 -0
- package/LICENSE +21 -0
- package/README.md +299 -0
- package/agents/principal-code-reviewer.md +80 -0
- package/agents/story-prep-master.md +53 -0
- package/commands/git-cleanup-and-merge.md +519 -0
- package/commands/implement-epic-with-subagents.md +5 -0
- package/commands/plan-parallelization.md +194 -0
- package/examples/settings.local.example.json +57 -0
- package/hooks/auto_approve_safe.py +261 -0
- package/hooks/auto_approve_safe.rules.json +134 -0
- package/install.js +181 -0
- package/package.json +52 -0
- package/scripts/context-monitor.py +175 -0
- package/skills/agent-creator/COMMUNITY-REPOS.md +212 -0
- package/skills/agent-creator/NON-STORY-AGENT-TEMPLATE.md +90 -0
- package/skills/agent-creator/REGISTRY.yaml +107 -0
- package/skills/agent-creator/SKILL.md +339 -0
- package/skills/agent-creator/STORY-AGENT-TEMPLATE.md +199 -0
- package/uninstall.js +186 -0
package/install.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @torka/claude-workflows - Post-install script
|
|
4
|
+
* Copies workflow files to the appropriate .claude directory
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const os = require('os');
|
|
10
|
+
|
|
11
|
+
// ANSI colors for output
|
|
12
|
+
const colors = {
|
|
13
|
+
green: '\x1b[32m',
|
|
14
|
+
yellow: '\x1b[33m',
|
|
15
|
+
blue: '\x1b[34m',
|
|
16
|
+
red: '\x1b[31m',
|
|
17
|
+
reset: '\x1b[0m',
|
|
18
|
+
bold: '\x1b[1m',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function log(message, color = 'reset') {
|
|
22
|
+
console.log(`${colors[color]}${message}${colors.reset}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function logSuccess(message) {
|
|
26
|
+
log(` ✓ ${message}`, 'green');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function logSkip(message) {
|
|
30
|
+
log(` ○ ${message}`, 'yellow');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function logError(message) {
|
|
34
|
+
log(` ✗ ${message}`, 'red');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Determine the target .claude directory based on installation context
|
|
39
|
+
*/
|
|
40
|
+
function getTargetBase() {
|
|
41
|
+
// Check if this is a global installation
|
|
42
|
+
const isGlobal = process.env.npm_config_global === 'true';
|
|
43
|
+
|
|
44
|
+
if (isGlobal) {
|
|
45
|
+
// Global install: use ~/.claude
|
|
46
|
+
return path.join(os.homedir(), '.claude');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Local install: find the project root (where package.json lives)
|
|
50
|
+
// Start from INIT_CWD (where npm was run) or current working directory
|
|
51
|
+
let projectRoot = process.env.INIT_CWD || process.cwd();
|
|
52
|
+
|
|
53
|
+
// Walk up to find package.json (the actual project, not this package)
|
|
54
|
+
while (projectRoot !== path.dirname(projectRoot)) {
|
|
55
|
+
const packageJsonPath = path.join(projectRoot, 'package.json');
|
|
56
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
57
|
+
// Make sure it's not our own package.json
|
|
58
|
+
try {
|
|
59
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
60
|
+
if (pkg.name !== '@torka/claude-workflows') {
|
|
61
|
+
return path.join(projectRoot, '.claude');
|
|
62
|
+
}
|
|
63
|
+
} catch (e) {
|
|
64
|
+
// Continue walking up
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
projectRoot = path.dirname(projectRoot);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Fallback to INIT_CWD
|
|
71
|
+
return path.join(process.env.INIT_CWD || process.cwd(), '.claude');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Recursively copy directory contents
|
|
76
|
+
*/
|
|
77
|
+
function copyDirRecursive(src, dest, stats) {
|
|
78
|
+
if (!fs.existsSync(src)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Create destination directory if it doesn't exist
|
|
83
|
+
if (!fs.existsSync(dest)) {
|
|
84
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
88
|
+
|
|
89
|
+
for (const entry of entries) {
|
|
90
|
+
const srcPath = path.join(src, entry.name);
|
|
91
|
+
const destPath = path.join(dest, entry.name);
|
|
92
|
+
|
|
93
|
+
if (entry.isDirectory()) {
|
|
94
|
+
copyDirRecursive(srcPath, destPath, stats);
|
|
95
|
+
} else {
|
|
96
|
+
if (fs.existsSync(destPath)) {
|
|
97
|
+
stats.skipped.push(destPath);
|
|
98
|
+
logSkip(`Skipped (exists): ${path.relative(stats.targetBase, destPath)}`);
|
|
99
|
+
} else {
|
|
100
|
+
fs.copyFileSync(srcPath, destPath);
|
|
101
|
+
stats.copied.push(destPath);
|
|
102
|
+
logSuccess(`Copied: ${path.relative(stats.targetBase, destPath)}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Main installation function
|
|
110
|
+
*/
|
|
111
|
+
function install() {
|
|
112
|
+
const packageDir = __dirname;
|
|
113
|
+
const targetBase = getTargetBase();
|
|
114
|
+
const isGlobal = process.env.npm_config_global === 'true';
|
|
115
|
+
|
|
116
|
+
log('\n' + colors.bold + '📦 @torka/claude-workflows - Installing...' + colors.reset);
|
|
117
|
+
log(` Target: ${targetBase}`, 'blue');
|
|
118
|
+
log(` Mode: ${isGlobal ? 'Global' : 'Project-level'}\n`, 'blue');
|
|
119
|
+
|
|
120
|
+
// Create target .claude directory if it doesn't exist
|
|
121
|
+
if (!fs.existsSync(targetBase)) {
|
|
122
|
+
fs.mkdirSync(targetBase, { recursive: true });
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const stats = {
|
|
126
|
+
copied: [],
|
|
127
|
+
skipped: [],
|
|
128
|
+
targetBase,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// Define what to copy and where
|
|
132
|
+
const mappings = [
|
|
133
|
+
{ src: 'commands', dest: 'commands' },
|
|
134
|
+
{ src: 'agents', dest: 'agents' },
|
|
135
|
+
{ src: 'skills', dest: 'skills' },
|
|
136
|
+
{ src: 'hooks', dest: 'scripts' }, // Hooks go to scripts directory
|
|
137
|
+
{ src: 'scripts', dest: 'scripts' },
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
for (const { src, dest } of mappings) {
|
|
141
|
+
const srcPath = path.join(packageDir, src);
|
|
142
|
+
const destPath = path.join(targetBase, dest);
|
|
143
|
+
|
|
144
|
+
if (fs.existsSync(srcPath)) {
|
|
145
|
+
log(`\n${colors.bold}${src}/${colors.reset}`);
|
|
146
|
+
copyDirRecursive(srcPath, destPath, stats);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Summary
|
|
151
|
+
log('\n' + colors.bold + '📊 Installation Summary' + colors.reset);
|
|
152
|
+
log(` Files copied: ${stats.copied.length}`, 'green');
|
|
153
|
+
log(` Files skipped (already exist): ${stats.skipped.length}`, 'yellow');
|
|
154
|
+
|
|
155
|
+
// Post-install instructions
|
|
156
|
+
log('\n' + colors.bold + '📝 Next Steps' + colors.reset);
|
|
157
|
+
log(' 1. Configure hooks in .claude/settings.local.json');
|
|
158
|
+
log(' 2. See examples/settings.local.example.json for configuration');
|
|
159
|
+
log(' 3. Run /git-cleanup-and-merge or /plan-parallelization to test\n');
|
|
160
|
+
|
|
161
|
+
// Note about BMAD dependencies
|
|
162
|
+
log(colors.yellow + '⚠️ Note: Some components require BMAD Method workflows:' + colors.reset);
|
|
163
|
+
log(' - implement-epic-with-subagents');
|
|
164
|
+
log(' - principal-code-reviewer');
|
|
165
|
+
log(' - story-prep-master');
|
|
166
|
+
log('\n Standalone components work without dependencies:');
|
|
167
|
+
log(' ✓ git-cleanup-and-merge');
|
|
168
|
+
log(' ✓ plan-parallelization');
|
|
169
|
+
log(' ✓ agent-creator skill');
|
|
170
|
+
log(' ✓ auto_approve_safe hook');
|
|
171
|
+
log(' ✓ context-monitor status line\n');
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Run installation
|
|
175
|
+
try {
|
|
176
|
+
install();
|
|
177
|
+
} catch (error) {
|
|
178
|
+
logError(`Installation failed: ${error.message}`);
|
|
179
|
+
// Don't exit with error code - allow npm install to complete
|
|
180
|
+
console.error(error);
|
|
181
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@torka/claude-workflows",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Claude Code workflow helpers: epic automation, git cleanup, agents, hooks, and status line",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude-code",
|
|
7
|
+
"ai-workflows",
|
|
8
|
+
"developer-tools",
|
|
9
|
+
"automation",
|
|
10
|
+
"git-management",
|
|
11
|
+
"code-review",
|
|
12
|
+
"claude",
|
|
13
|
+
"anthropic"
|
|
14
|
+
],
|
|
15
|
+
"author": "Varun Torka",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"homepage": "https://github.com/varuntorka/vt-claude-workflows#readme",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/varuntorka/vt-claude-workflows.git"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/varuntorka/vt-claude-workflows/issues"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"postinstall": "node install.js",
|
|
27
|
+
"preuninstall": "node uninstall.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"commands",
|
|
31
|
+
"agents",
|
|
32
|
+
"skills",
|
|
33
|
+
"hooks",
|
|
34
|
+
"scripts",
|
|
35
|
+
"examples",
|
|
36
|
+
".claude-plugin",
|
|
37
|
+
"install.js",
|
|
38
|
+
"uninstall.js",
|
|
39
|
+
"README.md"
|
|
40
|
+
],
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"bmad-method": ">=1.0.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"bmad-method": {
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=16.0.0"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Claude Code Context Monitor
|
|
4
|
+
Real-time context usage monitoring with visual indicators and session analytics
|
|
5
|
+
https://code.claude.com/docs/en/statusline
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import sys
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def context_window_info(window):
|
|
14
|
+
"""
|
|
15
|
+
Build context info from the statusline `context_window` payload.
|
|
16
|
+
Expected shape:
|
|
17
|
+
{
|
|
18
|
+
"context_window_size": int,
|
|
19
|
+
"current_usage": {
|
|
20
|
+
"input_tokens": int,
|
|
21
|
+
"output_tokens": int,
|
|
22
|
+
"cache_creation_input_tokens": int,
|
|
23
|
+
"cache_read_input_tokens": int
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
"""
|
|
27
|
+
if not isinstance(window, dict):
|
|
28
|
+
return None
|
|
29
|
+
|
|
30
|
+
size = window.get("context_window_size")
|
|
31
|
+
if not size or size <= 0:
|
|
32
|
+
return None
|
|
33
|
+
|
|
34
|
+
usage = window.get("current_usage")
|
|
35
|
+
|
|
36
|
+
# If no calls yet, usage may be null; treat as 0% used.
|
|
37
|
+
if usage is None:
|
|
38
|
+
return {
|
|
39
|
+
"percent": 0,
|
|
40
|
+
"tokens": 0,
|
|
41
|
+
"method": "context_window",
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if not isinstance(usage, dict):
|
|
45
|
+
return None
|
|
46
|
+
|
|
47
|
+
tokens = (
|
|
48
|
+
usage.get("input_tokens", 0)
|
|
49
|
+
+ usage.get("output_tokens", 0)
|
|
50
|
+
+ usage.get("cache_creation_input_tokens", 0)
|
|
51
|
+
+ usage.get("cache_read_input_tokens", 0)
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
percent = (tokens / size) * 100 if size > 0 else 0
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
"percent": max(0, min(100, percent)),
|
|
58
|
+
"tokens": tokens,
|
|
59
|
+
"method": "context_window",
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def get_context_display(context_info):
|
|
64
|
+
"""Generate context display with visual indicators."""
|
|
65
|
+
if not context_info:
|
|
66
|
+
return "🔵 ???"
|
|
67
|
+
|
|
68
|
+
percent = context_info.get('percent', 0)
|
|
69
|
+
percent = max(0, min(100, percent))
|
|
70
|
+
warning = context_info.get('warning')
|
|
71
|
+
|
|
72
|
+
# Color based on usage level
|
|
73
|
+
if percent >= 95:
|
|
74
|
+
color = "\033[31;1m" # Blinking red
|
|
75
|
+
alert = "CRIT"
|
|
76
|
+
elif percent >= 90:
|
|
77
|
+
color = "\033[31m" # Red
|
|
78
|
+
alert = "HIGH"
|
|
79
|
+
elif percent >= 75:
|
|
80
|
+
color = "\033[91m" # Light red
|
|
81
|
+
alert = ""
|
|
82
|
+
elif percent >= 50:
|
|
83
|
+
color = "\033[33m" # Yellow
|
|
84
|
+
alert = ""
|
|
85
|
+
else:
|
|
86
|
+
color = "\033[32m" # Green
|
|
87
|
+
alert = ""
|
|
88
|
+
|
|
89
|
+
# Create progress bar
|
|
90
|
+
segments = 8
|
|
91
|
+
filled = int((percent / 100) * segments)
|
|
92
|
+
bar = "█" * filled + "▁" * (segments - filled)
|
|
93
|
+
|
|
94
|
+
# Special warnings
|
|
95
|
+
if warning == 'auto-compact':
|
|
96
|
+
alert = "AUTO-COMPACT!"
|
|
97
|
+
elif warning == 'low':
|
|
98
|
+
alert = "LOW!"
|
|
99
|
+
|
|
100
|
+
reset = "\033[0m"
|
|
101
|
+
alert_str = f" {alert}" if alert else ""
|
|
102
|
+
|
|
103
|
+
return f"{color}{bar}{reset} {percent:.0f}%{alert_str}"
|
|
104
|
+
|
|
105
|
+
def get_directory_display(workspace_data):
|
|
106
|
+
"""Get directory display name."""
|
|
107
|
+
current_dir = workspace_data.get('current_dir', '')
|
|
108
|
+
project_dir = workspace_data.get('project_dir', '')
|
|
109
|
+
cwd = workspace_data.get('cwd', '')
|
|
110
|
+
|
|
111
|
+
if current_dir and project_dir:
|
|
112
|
+
if current_dir.startswith(project_dir):
|
|
113
|
+
rel_path = current_dir[len(project_dir):].lstrip('/')
|
|
114
|
+
return rel_path or os.path.basename(project_dir)
|
|
115
|
+
else:
|
|
116
|
+
return os.path.basename(current_dir)
|
|
117
|
+
elif project_dir:
|
|
118
|
+
return os.path.basename(project_dir)
|
|
119
|
+
elif cwd:
|
|
120
|
+
return os.path.basename(cwd)
|
|
121
|
+
elif current_dir:
|
|
122
|
+
return os.path.basename(current_dir)
|
|
123
|
+
else:
|
|
124
|
+
return "unknown"
|
|
125
|
+
|
|
126
|
+
def get_git_branch():
|
|
127
|
+
"""Get the current git branch name by reading .git/HEAD directly."""
|
|
128
|
+
try:
|
|
129
|
+
git_dir = ".git"
|
|
130
|
+
if os.path.isdir(git_dir):
|
|
131
|
+
head_file = os.path.join(git_dir, "HEAD")
|
|
132
|
+
if os.path.isfile(head_file):
|
|
133
|
+
with open(head_file, 'r') as f:
|
|
134
|
+
ref = f.read().strip()
|
|
135
|
+
if ref.startswith('ref: refs/heads/'):
|
|
136
|
+
return ref.replace('ref: refs/heads/', '')
|
|
137
|
+
# Detached HEAD state
|
|
138
|
+
return ref[:8]
|
|
139
|
+
return None
|
|
140
|
+
except Exception:
|
|
141
|
+
return None
|
|
142
|
+
|
|
143
|
+
def main():
|
|
144
|
+
try:
|
|
145
|
+
# Read JSON input from Claude Code
|
|
146
|
+
data = json.load(sys.stdin)
|
|
147
|
+
|
|
148
|
+
# Extract information
|
|
149
|
+
model_data = data.get('model', {})
|
|
150
|
+
model_name = model_data.get('display_name') or model_data.get('name') or model_data.get('id') or 'Claude'
|
|
151
|
+
model_id = model_data.get('id') or model_data.get('name') or model_name
|
|
152
|
+
|
|
153
|
+
workspace = data.get('workspace', {})
|
|
154
|
+
context_window = data.get('context_window') or {}
|
|
155
|
+
|
|
156
|
+
# Build status components
|
|
157
|
+
context_info = context_window_info(context_window)
|
|
158
|
+
context_display = get_context_display(context_info)
|
|
159
|
+
directory = get_directory_display(workspace)
|
|
160
|
+
git_branch = get_git_branch()
|
|
161
|
+
git_display = f" \033[96m🌿 {git_branch}\033[0m" if git_branch else ""
|
|
162
|
+
|
|
163
|
+
model_display = f"\033[94m[{model_name}]\033[0m"
|
|
164
|
+
|
|
165
|
+
# Combine all components
|
|
166
|
+
status_line = f"{model_display} \033[93m📁 {directory}\033[0m{git_display} 🧠 {context_display}"
|
|
167
|
+
|
|
168
|
+
print(status_line)
|
|
169
|
+
|
|
170
|
+
except Exception as e:
|
|
171
|
+
# Fallback display on any error
|
|
172
|
+
print(f"\033[94m[Claude]\033[0m \033[93m📁 {os.path.basename(os.getcwd())}\033[0m 🧠 \033[31m[Error: {str(e)[:20]}]\033[0m")
|
|
173
|
+
|
|
174
|
+
if __name__ == "__main__":
|
|
175
|
+
main()
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Community Resources for Agent Patterns
|
|
2
|
+
|
|
3
|
+
Reference this file when researching agent patterns in Step 3.
|
|
4
|
+
|
|
5
|
+
## Research Limits
|
|
6
|
+
|
|
7
|
+
**IMPORTANT: To prevent endless research loops, follow these limits:**
|
|
8
|
+
|
|
9
|
+
| Activity | Maximum |
|
|
10
|
+
|----------|---------|
|
|
11
|
+
| GitHub repo searches | 3 queries |
|
|
12
|
+
| Repos to evaluate in detail | 5 repos |
|
|
13
|
+
| Web searches | 2 queries |
|
|
14
|
+
| Total research time | 10 minutes |
|
|
15
|
+
|
|
16
|
+
After hitting limits, proceed with the best patterns found.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Curated Community Repositories
|
|
21
|
+
|
|
22
|
+
These repositories are pre-vetted for agent/workflow patterns:
|
|
23
|
+
|
|
24
|
+
### Primary Resources (Check First)
|
|
25
|
+
|
|
26
|
+
| Repository | Focus Area | URL |
|
|
27
|
+
|------------|------------|-----|
|
|
28
|
+
| **claude-code-templates** | CLI tool components, templates | https://github.com/davila7/claude-code-templates |
|
|
29
|
+
| **wshobson/agents** | Agent definitions | https://github.com/wshobson/agents |
|
|
30
|
+
| **claude-flow** | Multi-agent orchestration | https://github.com/ruvnet/claude-flow |
|
|
31
|
+
| **awesome-claude-code** | Curated resources | https://github.com/hesreallyhim/awesome-claude-code |
|
|
32
|
+
| **SuperClaude Framework** | Enhanced agent framework | https://github.com/SuperClaude-Org/SuperClaude_Framework |
|
|
33
|
+
| **compound-engineering-plugin** | Engineering workflows | https://github.com/EveryInc/compound-engineering-plugin |
|
|
34
|
+
| **claude-code-workflows** | Workflow definitions | https://github.com/OneRedOak/claude-code-workflows |
|
|
35
|
+
| **infrastructure-showcase** | Infrastructure patterns | https://github.com/diet103/claude-code-infrastructure-showcase |
|
|
36
|
+
|
|
37
|
+
### Official Anthropic Resources
|
|
38
|
+
|
|
39
|
+
| Resource | URL |
|
|
40
|
+
|----------|-----|
|
|
41
|
+
| Claude Code Repository | https://github.com/anthropics/claude-code |
|
|
42
|
+
| Awesome Claude Code (Official) | https://github.com/anthropics/awesome-claude-code |
|
|
43
|
+
| Claude Code Documentation | https://docs.anthropic.com/en/docs/claude-code |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Quick Lookup Commands
|
|
48
|
+
|
|
49
|
+
Use these commands to quickly fetch patterns from curated repos:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Fetch agent examples from claude-code-templates
|
|
53
|
+
curl -s https://api.github.com/repos/davila7/claude-code-templates/contents/cli-tool/components | jq '.[].name'
|
|
54
|
+
|
|
55
|
+
# Check SuperClaude Framework structure
|
|
56
|
+
curl -s https://api.github.com/repos/SuperClaude-Org/SuperClaude_Framework/contents | jq '.[].name'
|
|
57
|
+
|
|
58
|
+
# View claude-flow agents
|
|
59
|
+
curl -s https://api.github.com/repos/ruvnet/claude-flow/contents | jq '.[].name'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Evaluation Criteria
|
|
65
|
+
|
|
66
|
+
When evaluating repositories and patterns, score using these criteria:
|
|
67
|
+
|
|
68
|
+
### Repository Quality (Score 1-5 each)
|
|
69
|
+
|
|
70
|
+
| Criteria | Weight | How to Check |
|
|
71
|
+
|----------|--------|--------------|
|
|
72
|
+
| **Recent Activity** | High | Last commit < 30 days = 5, < 90 days = 3, > 90 days = 1 |
|
|
73
|
+
| **Stars** | Medium | 100+ = 5, 50+ = 4, 20+ = 3, 10+ = 2, <10 = 1 |
|
|
74
|
+
| **Documentation** | Medium | Has README with examples = 5, Basic README = 3, None = 1 |
|
|
75
|
+
| **Relevance** | High | Directly applicable = 5, Needs adaptation = 3, Tangential = 1 |
|
|
76
|
+
|
|
77
|
+
### Quick Activity Check
|
|
78
|
+
```bash
|
|
79
|
+
# Check repo stats (stars, last update)
|
|
80
|
+
gh repo view {owner}/{repo} --json stargazerCount,pushedAt,description
|
|
81
|
+
|
|
82
|
+
# Example:
|
|
83
|
+
gh repo view ruvnet/claude-flow --json stargazerCount,pushedAt
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Pattern Quality (Score 1-5 each)
|
|
87
|
+
|
|
88
|
+
| Criteria | What to Look For |
|
|
89
|
+
|----------|------------------|
|
|
90
|
+
| **Clarity** | Is the agent's purpose immediately obvious? |
|
|
91
|
+
| **Specificity** | Will the description trigger correctly? |
|
|
92
|
+
| **Tool Access** | Follows least-privilege principle? |
|
|
93
|
+
| **Completeness** | Includes workflow steps? |
|
|
94
|
+
| **Adaptability** | Can be customized for this project? |
|
|
95
|
+
|
|
96
|
+
### Minimum Thresholds
|
|
97
|
+
|
|
98
|
+
Only use patterns from repos that meet:
|
|
99
|
+
- Last commit within 90 days OR 50+ stars
|
|
100
|
+
- Clear documentation or examples
|
|
101
|
+
- At least 3/5 on relevance score
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Agent Pattern Templates
|
|
106
|
+
|
|
107
|
+
### Explorer Pattern
|
|
108
|
+
```markdown
|
|
109
|
+
---
|
|
110
|
+
name: tmp-explorer
|
|
111
|
+
description: Explores and understands codebases. Use when needing to understand project structure, find specific code, or map dependencies.
|
|
112
|
+
tools: Read, Glob, Grep, Bash
|
|
113
|
+
model: haiku
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
You are a codebase explorer. Your job is to efficiently navigate and understand code.
|
|
117
|
+
|
|
118
|
+
When exploring:
|
|
119
|
+
1. Start with project structure (tree, ls)
|
|
120
|
+
2. Identify key files (package.json, config files)
|
|
121
|
+
3. Map dependencies and relationships
|
|
122
|
+
4. Report findings in structured format
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Implementer Pattern
|
|
126
|
+
```markdown
|
|
127
|
+
---
|
|
128
|
+
name: tmp-implementer
|
|
129
|
+
description: Implements features and writes code. Use when creating new functionality or modifying existing code.
|
|
130
|
+
tools: Read, Write, Edit, Bash, Glob
|
|
131
|
+
model: sonnet
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
You are a senior developer implementing features.
|
|
135
|
+
|
|
136
|
+
When implementing:
|
|
137
|
+
1. Understand requirements fully
|
|
138
|
+
2. Check existing patterns in codebase
|
|
139
|
+
3. Write clean, tested code
|
|
140
|
+
4. Follow project conventions
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Reviewer Pattern
|
|
144
|
+
```markdown
|
|
145
|
+
---
|
|
146
|
+
name: tmp-reviewer
|
|
147
|
+
description: Reviews code for quality, security, and best practices. Use proactively after code changes.
|
|
148
|
+
tools: Read, Grep, Glob
|
|
149
|
+
model: sonnet
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
You are a senior code reviewer.
|
|
153
|
+
|
|
154
|
+
Review checklist:
|
|
155
|
+
- Code clarity and readability
|
|
156
|
+
- Security vulnerabilities
|
|
157
|
+
- Error handling
|
|
158
|
+
- Test coverage
|
|
159
|
+
- Performance concerns
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Tester Pattern
|
|
163
|
+
```markdown
|
|
164
|
+
---
|
|
165
|
+
name: tmp-tester
|
|
166
|
+
description: Creates and runs tests. Use when writing unit tests, integration tests, or running test suites.
|
|
167
|
+
tools: Read, Write, Edit, Bash
|
|
168
|
+
model: sonnet
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
You are a QA engineer writing tests.
|
|
172
|
+
|
|
173
|
+
When testing:
|
|
174
|
+
1. Understand the code to test
|
|
175
|
+
2. Identify test cases (happy path, edge cases, errors)
|
|
176
|
+
3. Write comprehensive tests
|
|
177
|
+
4. Run and verify all pass
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Search Strategy (If Curated Repos Insufficient)
|
|
183
|
+
|
|
184
|
+
Only if the curated repos above don't have relevant patterns:
|
|
185
|
+
|
|
186
|
+
### GitHub Search (Max 3 queries)
|
|
187
|
+
```bash
|
|
188
|
+
# Query 1: General agent search
|
|
189
|
+
gh search repos "claude code agents" --sort stars --limit 5
|
|
190
|
+
|
|
191
|
+
# Query 2: Specific pattern search
|
|
192
|
+
gh search code "{pattern-type}" path:.claude/agents --limit 10
|
|
193
|
+
|
|
194
|
+
# Query 3: Workflow search
|
|
195
|
+
gh search repos "claude subagent" --sort updated --limit 5
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Web Search (Max 2 queries)
|
|
199
|
+
- `"{specific-agent-type}" claude code github`
|
|
200
|
+
- `claude code agent patterns {technology}`
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Web Resources
|
|
205
|
+
|
|
206
|
+
### Documentation
|
|
207
|
+
- Anthropic Docs: https://docs.anthropic.com
|
|
208
|
+
- Claude Code Guide: https://code.claude.com
|
|
209
|
+
|
|
210
|
+
### Community
|
|
211
|
+
- Anthropic Discord: https://discord.gg/anthropic
|
|
212
|
+
- GitHub Discussions: https://github.com/anthropics/claude-code/discussions
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Non-Story Agent Template (Rare)
|
|
2
|
+
|
|
3
|
+
Only use this template when explicitly requested for non-story tasks (research, exploration, documentation, etc.).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Full Template
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
---
|
|
11
|
+
name: {agent-name}
|
|
12
|
+
description: {Clear description of when/why to use this agent. Be specific about triggers.}
|
|
13
|
+
tools: {Comma-separated list of allowed tools}
|
|
14
|
+
model: {sonnet|haiku|opus|inherit}
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Role & Purpose
|
|
18
|
+
|
|
19
|
+
You are a {role description} specialized in {specialty}.
|
|
20
|
+
|
|
21
|
+
## When to Activate
|
|
22
|
+
|
|
23
|
+
This agent should be used when:
|
|
24
|
+
- {Trigger condition 1}
|
|
25
|
+
- {Trigger condition 2}
|
|
26
|
+
|
|
27
|
+
## Core Responsibilities
|
|
28
|
+
|
|
29
|
+
1. {Primary responsibility}
|
|
30
|
+
2. {Secondary responsibility}
|
|
31
|
+
|
|
32
|
+
## Workflow
|
|
33
|
+
|
|
34
|
+
1. {First step}
|
|
35
|
+
2. {Second step}
|
|
36
|
+
3. {Continue as needed}
|
|
37
|
+
|
|
38
|
+
## Output Format
|
|
39
|
+
|
|
40
|
+
{Describe expected output structure}
|
|
41
|
+
|
|
42
|
+
## Constraints
|
|
43
|
+
|
|
44
|
+
- {Limitation 1}
|
|
45
|
+
- {Limitation 2}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Minimal Template
|
|
51
|
+
|
|
52
|
+
```markdown
|
|
53
|
+
---
|
|
54
|
+
name: {name}
|
|
55
|
+
description: {When to use this agent}
|
|
56
|
+
tools: Read, Glob, Grep
|
|
57
|
+
model: sonnet
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
You are a {role}. Your job is to {primary task}.
|
|
61
|
+
|
|
62
|
+
When invoked:
|
|
63
|
+
1. {Step 1}
|
|
64
|
+
2. {Step 2}
|
|
65
|
+
3. {Step 3}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Common Non-Story Agent Patterns
|
|
71
|
+
|
|
72
|
+
| Agent Type | Use Case | Key Tools |
|
|
73
|
+
|------------|----------|-----------|
|
|
74
|
+
| `explorer` | Codebase research, file discovery | Read, Glob, Grep |
|
|
75
|
+
| `documenter` | Documentation-only updates | Read, Write |
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Validation Checklist
|
|
80
|
+
|
|
81
|
+
Before saving a non-story agent, verify:
|
|
82
|
+
|
|
83
|
+
1. **Name format**: `{lowercase-alphanumeric-hyphens}`
|
|
84
|
+
2. **Tools list**: Only valid Claude Code tools
|
|
85
|
+
3. **Model**: `sonnet`, `haiku`, `opus`, or `inherit`
|
|
86
|
+
4. **Description**: 20-300 characters, specific triggers
|
|
87
|
+
5. **Content includes**:
|
|
88
|
+
- Clear activation conditions
|
|
89
|
+
- Defined workflow steps
|
|
90
|
+
- Expected output format
|