@fr0mpy/prompt-system 2.0.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/bin/cli.js +338 -0
- package/index.js +12 -0
- package/package.json +45 -0
- package/templates/CLAUDE.md +20 -0
- package/templates/agents/10x-simplifier.md +62 -0
- package/templates/agents/accessibility-auditor.md +60 -0
- package/templates/agents/api-contract-guardian.md +65 -0
- package/templates/agents/assumption-challenger.md +52 -0
- package/templates/agents/breaking-change-predictor.md +62 -0
- package/templates/agents/context-curator.md +53 -0
- package/templates/agents/context-loader.md +112 -0
- package/templates/agents/decision-logger.md +68 -0
- package/templates/agents/dependency-detective.md +58 -0
- package/templates/agents/devils-advocate.md +65 -0
- package/templates/agents/error-boundary-designer.md +65 -0
- package/templates/agents/future-you.md +63 -0
- package/templates/agents/incident-replayer.md +62 -0
- package/templates/agents/intent-clarifier.md +45 -0
- package/templates/agents/legacy-archaeologist.md +54 -0
- package/templates/agents/migration-planner.md +61 -0
- package/templates/agents/package-checker.md +33 -0
- package/templates/agents/performance-profiler.md +61 -0
- package/templates/agents/pr-narrator.md +49 -0
- package/templates/agents/pre-code-check.md +48 -0
- package/templates/agents/refactor-scope-limiter.md +54 -0
- package/templates/agents/rubber-duck.md +55 -0
- package/templates/agents/scope-creep-detector.md +61 -0
- package/templates/agents/session-handoff.md +57 -0
- package/templates/agents/structure-validator.md +43 -0
- package/templates/agents/test-gap-finder.md +71 -0
- package/templates/commands/commit.md +9 -0
- package/templates/commands/review.md +12 -0
- package/templates/commands/test.md +11 -0
- package/templates/hooks/session-start.sh +108 -0
- package/templates/hooks/smart-inject-llm.sh +267 -0
- package/templates/hooks/smart-inject-rules.sh +300 -0
- package/templates/hooks/triggers.d/.gitkeep +0 -0
- package/templates/hooks/triggers.json +174 -0
- package/templates/rules/agent-lifecycle-messages.md +77 -0
- package/templates/rules/announce-actions.md +58 -0
- package/templates/rules/code-standards.md +74 -0
- package/templates/rules/command-format.md +60 -0
- package/templates/rules/constructive-pushback.md +62 -0
- package/templates/rules/context-passing-protocol.md +75 -0
- package/templates/rules/rule-format.md +72 -0
- package/templates/rules/subagent-format.md +94 -0
- package/templates/settings.json +47 -0
package/bin/cli.js
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const readline = require('readline');
|
|
6
|
+
|
|
7
|
+
const TEMPLATES_DIR = path.join(__dirname, '..', 'templates');
|
|
8
|
+
const TARGET_DIR = path.join(process.cwd(), '.claude');
|
|
9
|
+
const ENV_FILE = path.join(process.cwd(), '.env');
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
|
|
12
|
+
// Parse flags
|
|
13
|
+
const hasFlag = (...flags) => flags.some((f) => args.includes(f));
|
|
14
|
+
const skipApiKey = hasFlag('--skip-api-key', '--no-api-key', '-s');
|
|
15
|
+
const forceMode = hasFlag('--force', '-f');
|
|
16
|
+
const removeMode = hasFlag('--remove', '--uninstall', '-r');
|
|
17
|
+
const helpMode = hasFlag('--help', '-h');
|
|
18
|
+
const updateHooks = hasFlag('--update-hooks');
|
|
19
|
+
const updateAgents = hasFlag('--update-agents');
|
|
20
|
+
const updateRules = hasFlag('--update-rules');
|
|
21
|
+
const updateCommands = hasFlag('--update-commands');
|
|
22
|
+
const updateMode = updateHooks || updateAgents || updateRules || updateCommands;
|
|
23
|
+
|
|
24
|
+
function copyDir(src, dest) {
|
|
25
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
26
|
+
|
|
27
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
28
|
+
|
|
29
|
+
for (const entry of entries) {
|
|
30
|
+
const srcPath = path.join(src, entry.name);
|
|
31
|
+
const destPath = path.join(dest, entry.name);
|
|
32
|
+
|
|
33
|
+
if (entry.isDirectory()) {
|
|
34
|
+
copyDir(srcPath, destPath);
|
|
35
|
+
} else {
|
|
36
|
+
fs.copyFileSync(srcPath, destPath);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function copySubdir(subdir) {
|
|
42
|
+
const src = path.join(TEMPLATES_DIR, subdir);
|
|
43
|
+
const dest = path.join(TARGET_DIR, subdir);
|
|
44
|
+
|
|
45
|
+
if (!fs.existsSync(src)) {
|
|
46
|
+
console.error(`❌ Source directory not found: ${subdir}`);
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (fs.existsSync(dest)) {
|
|
51
|
+
fs.rmSync(dest, { recursive: true });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
copyDir(src, dest);
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function makeExecutable(dir) {
|
|
59
|
+
const hooksDir = path.join(dir, 'hooks');
|
|
60
|
+
if (fs.existsSync(hooksDir)) {
|
|
61
|
+
const files = fs.readdirSync(hooksDir);
|
|
62
|
+
for (const file of files) {
|
|
63
|
+
if (file.endsWith('.sh')) {
|
|
64
|
+
const filePath = path.join(hooksDir, file);
|
|
65
|
+
fs.chmodSync(filePath, 0o755);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function prompt(question) {
|
|
72
|
+
const rl = readline.createInterface({
|
|
73
|
+
input: process.stdin,
|
|
74
|
+
output: process.stdout,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return new Promise((resolve) => {
|
|
78
|
+
rl.question(question, (answer) => {
|
|
79
|
+
rl.close();
|
|
80
|
+
resolve(answer.trim());
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const DEFAULT_MODEL = 'claude-3-5-haiku-latest';
|
|
86
|
+
|
|
87
|
+
function saveEnvVar(name, value) {
|
|
88
|
+
let envContent = '';
|
|
89
|
+
|
|
90
|
+
if (fs.existsSync(ENV_FILE)) {
|
|
91
|
+
envContent = fs.readFileSync(ENV_FILE, 'utf8');
|
|
92
|
+
const regex = new RegExp(`^${name}=.*$`, 'gm');
|
|
93
|
+
if (regex.test(envContent)) {
|
|
94
|
+
envContent = envContent.replace(regex, `${name}=${value}`);
|
|
95
|
+
} else {
|
|
96
|
+
envContent += `${envContent.endsWith('\n') ? '' : '\n'}${name}=${value}\n`;
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
envContent = `${name}=${value}\n`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
fs.writeFileSync(ENV_FILE, envContent);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function saveApiKey(apiKey) {
|
|
106
|
+
saveEnvVar('ANTHROPIC_API_KEY', apiKey);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function saveModel(model) {
|
|
110
|
+
saveEnvVar('ANTHROPIC_MODEL', model);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function updateSettingsForLLM(useLLM) {
|
|
114
|
+
const settingsPath = path.join(TARGET_DIR, 'settings.json');
|
|
115
|
+
if (!fs.existsSync(settingsPath)) return;
|
|
116
|
+
|
|
117
|
+
let settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
|
|
118
|
+
|
|
119
|
+
const hookScript = useLLM
|
|
120
|
+
? '.claude/hooks/smart-inject-llm.sh'
|
|
121
|
+
: '.claude/hooks/smart-inject-rules.sh';
|
|
122
|
+
|
|
123
|
+
if (settings.hooks?.UserPromptSubmit?.[0]?.hooks?.[0]) {
|
|
124
|
+
settings.hooks.UserPromptSubmit[0].hooks[0].command = hookScript;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async function init() {
|
|
131
|
+
console.log('🔧 Initializing Claude Code prompt system...\n');
|
|
132
|
+
|
|
133
|
+
if (fs.existsSync(TARGET_DIR) && !forceMode) {
|
|
134
|
+
// Check if this is an existing prompt-system install
|
|
135
|
+
const hasHooks = fs.existsSync(path.join(TARGET_DIR, 'hooks'));
|
|
136
|
+
if (hasHooks) {
|
|
137
|
+
console.log('⚠️ .claude directory already exists with prompt system.');
|
|
138
|
+
console.log(' Use --force to overwrite, or use selective updates:');
|
|
139
|
+
console.log(' --update-hooks, --update-agents, --update-rules, --update-commands\n');
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
// .claude exists but no hooks - might be component-system only, we can add to it
|
|
143
|
+
console.log('ℹ️ Existing .claude directory detected. Adding prompt system...\n');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (!fs.existsSync(TEMPLATES_DIR)) {
|
|
147
|
+
console.error('❌ Templates directory not found. Package may be corrupted.');
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (forceMode && fs.existsSync(TARGET_DIR)) {
|
|
152
|
+
fs.rmSync(TARGET_DIR, { recursive: true });
|
|
153
|
+
console.log('🗑️ Removed existing .claude directory.\n');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
copyDir(TEMPLATES_DIR, TARGET_DIR);
|
|
157
|
+
makeExecutable(TARGET_DIR);
|
|
158
|
+
|
|
159
|
+
// Create triggers.d directory for extensions
|
|
160
|
+
const triggersDDir = path.join(TARGET_DIR, 'hooks', 'triggers.d');
|
|
161
|
+
fs.mkdirSync(triggersDDir, { recursive: true });
|
|
162
|
+
|
|
163
|
+
console.log('✅ Created .claude/ directory with:');
|
|
164
|
+
console.log(' 📁 hooks/ - Smart context injection');
|
|
165
|
+
console.log(' 📁 rules/ - Behavioral guidelines');
|
|
166
|
+
console.log(' 📁 agents/ - Task workers');
|
|
167
|
+
console.log(' 📁 commands/ - Slash commands (/review, /test, /commit)');
|
|
168
|
+
console.log(' 📄 settings.json');
|
|
169
|
+
console.log(' 📄 CLAUDE.md\n');
|
|
170
|
+
|
|
171
|
+
// Handle API key
|
|
172
|
+
if (skipApiKey) {
|
|
173
|
+
console.log('⏭️ Skipped API key prompt (--skip-api-key).');
|
|
174
|
+
console.log(' Using keyword-based injection.\n');
|
|
175
|
+
updateSettingsForLLM(false);
|
|
176
|
+
} else {
|
|
177
|
+
console.log('🔑 Smart injection uses Claude Haiku for semantic rule matching.');
|
|
178
|
+
console.log(' This requires an Anthropic API key.\n');
|
|
179
|
+
|
|
180
|
+
const apiKey = await prompt(
|
|
181
|
+
' Enter your ANTHROPIC_API_KEY (or press Enter to skip): '
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
if (apiKey) {
|
|
185
|
+
saveApiKey(apiKey);
|
|
186
|
+
saveModel(DEFAULT_MODEL);
|
|
187
|
+
updateSettingsForLLM(true);
|
|
188
|
+
console.log('\n ✅ API key saved to .env');
|
|
189
|
+
console.log(` ✅ Model set to ${DEFAULT_MODEL}`);
|
|
190
|
+
console.log(' ✅ Enabled LLM-powered smart injection');
|
|
191
|
+
console.log(' 💡 Add .env to your .gitignore if not already there.');
|
|
192
|
+
console.log(' 💡 Change ANTHROPIC_MODEL in .env to use a different model.\n');
|
|
193
|
+
} else {
|
|
194
|
+
console.log('\n ⏭️ Skipped. Using keyword-based injection.');
|
|
195
|
+
console.log(
|
|
196
|
+
' 💡 Set ANTHROPIC_API_KEY env var later to enable LLM-powered injection.\n'
|
|
197
|
+
);
|
|
198
|
+
updateSettingsForLLM(false);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Suggest component-system
|
|
203
|
+
console.log('💡 For UI components and styling, also install:');
|
|
204
|
+
console.log(' npx @fr0mpy/component-system\n');
|
|
205
|
+
|
|
206
|
+
console.log('🚀 Ready! Claude Code will now use these rules and agents.\n');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function update() {
|
|
210
|
+
if (!fs.existsSync(TARGET_DIR)) {
|
|
211
|
+
console.error('❌ .claude directory not found. Run without flags to initialize first.');
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
console.log('🔄 Updating selected components...\n');
|
|
216
|
+
|
|
217
|
+
const updates = [];
|
|
218
|
+
|
|
219
|
+
if (updateHooks) {
|
|
220
|
+
if (copySubdir('hooks')) {
|
|
221
|
+
makeExecutable(TARGET_DIR);
|
|
222
|
+
// Preserve triggers.d if it exists
|
|
223
|
+
const triggersDDir = path.join(TARGET_DIR, 'hooks', 'triggers.d');
|
|
224
|
+
fs.mkdirSync(triggersDDir, { recursive: true });
|
|
225
|
+
updates.push('hooks');
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (updateAgents && copySubdir('agents')) updates.push('agents');
|
|
229
|
+
if (updateRules && copySubdir('rules')) updates.push('rules');
|
|
230
|
+
if (updateCommands && copySubdir('commands')) updates.push('commands');
|
|
231
|
+
|
|
232
|
+
if (updates.length > 0) {
|
|
233
|
+
console.log(`✅ Updated: ${updates.join(', ')}\n`);
|
|
234
|
+
console.log('💡 Your settings.json and CLAUDE.md were preserved.\n');
|
|
235
|
+
} else {
|
|
236
|
+
console.log('⚠️ No components updated.\n');
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function remove() {
|
|
241
|
+
if (!fs.existsSync(TARGET_DIR)) {
|
|
242
|
+
console.log('ℹ️ .claude directory does not exist. Nothing to remove.\n');
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Check if component-system files exist - if so, only remove prompt-system files
|
|
247
|
+
const hasSkills = fs.existsSync(path.join(TARGET_DIR, 'skills'));
|
|
248
|
+
const hasRecipes = fs.existsSync(path.join(TARGET_DIR, 'component-recipes'));
|
|
249
|
+
|
|
250
|
+
if (hasSkills || hasRecipes) {
|
|
251
|
+
console.log('ℹ️ Component system detected. Removing only prompt system files...\n');
|
|
252
|
+
const promptDirs = ['hooks', 'rules', 'agents'];
|
|
253
|
+
const promptFiles = ['CLAUDE.md', 'settings.json'];
|
|
254
|
+
|
|
255
|
+
for (const dir of promptDirs) {
|
|
256
|
+
const dirPath = path.join(TARGET_DIR, dir);
|
|
257
|
+
if (fs.existsSync(dirPath)) {
|
|
258
|
+
fs.rmSync(dirPath, { recursive: true });
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
for (const file of promptFiles) {
|
|
263
|
+
const filePath = path.join(TARGET_DIR, file);
|
|
264
|
+
if (fs.existsSync(filePath)) {
|
|
265
|
+
fs.unlinkSync(filePath);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Remove only prompt-system commands
|
|
270
|
+
const commandsDir = path.join(TARGET_DIR, 'commands');
|
|
271
|
+
if (fs.existsSync(commandsDir)) {
|
|
272
|
+
const promptCommands = ['review.md', 'test.md', 'commit.md'];
|
|
273
|
+
for (const cmd of promptCommands) {
|
|
274
|
+
const cmdPath = path.join(commandsDir, cmd);
|
|
275
|
+
if (fs.existsSync(cmdPath)) {
|
|
276
|
+
fs.unlinkSync(cmdPath);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
console.log('✅ Removed prompt system files. Component system preserved.\n');
|
|
282
|
+
} else {
|
|
283
|
+
fs.rmSync(TARGET_DIR, { recursive: true });
|
|
284
|
+
console.log('✅ Removed .claude directory.\n');
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
console.log('💡 Note: .env file (if created) was not removed.\n');
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function showHelp() {
|
|
291
|
+
console.log(`
|
|
292
|
+
@fr0mpy/prompt-system - Claude Code prompt engineering system
|
|
293
|
+
|
|
294
|
+
Usage:
|
|
295
|
+
npx @fr0mpy/prompt-system Initialize in current directory
|
|
296
|
+
npx @fr0mpy/prompt-system --force Overwrite existing installation
|
|
297
|
+
npx @fr0mpy/prompt-system --remove Remove prompt system files
|
|
298
|
+
npx @fr0mpy/prompt-system --skip-api-key Skip API key prompt
|
|
299
|
+
|
|
300
|
+
Selective updates (preserves settings.json and CLAUDE.md):
|
|
301
|
+
--update-hooks Update only hooks/
|
|
302
|
+
--update-agents Update only agents/
|
|
303
|
+
--update-rules Update only rules/
|
|
304
|
+
--update-commands Update only commands/
|
|
305
|
+
|
|
306
|
+
Options:
|
|
307
|
+
-h, --help Show this help message
|
|
308
|
+
-f, --force Overwrite existing installation
|
|
309
|
+
-r, --remove Remove prompt system (alias: --uninstall)
|
|
310
|
+
-s, --skip-api-key Skip API key prompt (alias: --no-api-key)
|
|
311
|
+
|
|
312
|
+
What's included:
|
|
313
|
+
• hooks/ Smart context injection on every prompt
|
|
314
|
+
• rules/ Behavioral guidelines (code standards, etc.)
|
|
315
|
+
• agents/ Task workers (pre-code-check, package-checker, etc.)
|
|
316
|
+
• commands/ Slash commands (/review, /test, /commit)
|
|
317
|
+
• CLAUDE.md Project context (auto-loaded by Claude)
|
|
318
|
+
|
|
319
|
+
For UI components and styling:
|
|
320
|
+
npx @fr0mpy/component-system
|
|
321
|
+
|
|
322
|
+
Learn more: https://github.com/fr0mpy/claude-base-setup
|
|
323
|
+
`);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
async function main() {
|
|
327
|
+
if (helpMode) {
|
|
328
|
+
showHelp();
|
|
329
|
+
} else if (removeMode) {
|
|
330
|
+
remove();
|
|
331
|
+
} else if (updateMode) {
|
|
332
|
+
await update();
|
|
333
|
+
} else {
|
|
334
|
+
await init();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
main();
|
package/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @claude-tools/prompt-system
|
|
3
|
+
*
|
|
4
|
+
* Claude Code prompt engineering system with rules, agents, hooks, and smart context injection.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
name: '@claude-tools/prompt-system',
|
|
11
|
+
templatesDir: path.join(__dirname, 'templates'),
|
|
12
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fr0mpy/prompt-system",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Claude Code prompt engineering system: rules, agents, hooks, and smart context injection",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"fromp-prompt-system": "./bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Tests not yet configured\""
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"claude",
|
|
14
|
+
"claude-code",
|
|
15
|
+
"ai",
|
|
16
|
+
"llm",
|
|
17
|
+
"rules",
|
|
18
|
+
"agents",
|
|
19
|
+
"hooks",
|
|
20
|
+
"prompt-engineering"
|
|
21
|
+
],
|
|
22
|
+
"author": "fr0mpy",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/fr0mpy/claude-base-setup.git",
|
|
27
|
+
"directory": "packages/prompt-system"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"bin/",
|
|
31
|
+
"templates/",
|
|
32
|
+
"index.js"
|
|
33
|
+
],
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=16.0.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@fr0mpy/component-system": ">=2.0.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependenciesMeta": {
|
|
41
|
+
"@fr0mpy/component-system": {
|
|
42
|
+
"optional": true
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Project Context
|
|
2
|
+
|
|
3
|
+
This project uses dynamic context management via `.claude/CONTEXT.md`.
|
|
4
|
+
|
|
5
|
+
## Quick Reference
|
|
6
|
+
|
|
7
|
+
Run `context-loader` agent if context is stale or missing.
|
|
8
|
+
|
|
9
|
+
See `.claude/CONTEXT.md` for:
|
|
10
|
+
- Project structure and file tree
|
|
11
|
+
- Detected stack and dependencies
|
|
12
|
+
- Key directories and their purposes
|
|
13
|
+
- TODOs and stub functions
|
|
14
|
+
|
|
15
|
+
## Configuration
|
|
16
|
+
|
|
17
|
+
- **Rules**: `.claude/rules/` - Behavioral guidelines (auto-injected)
|
|
18
|
+
- **Agents**: `.claude/agents/` - Task specialists
|
|
19
|
+
- **Commands**: `.claude/commands/` - Slash command workflows
|
|
20
|
+
- **Hooks**: `.claude/hooks/` - Automation scripts
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 10x-simplifier
|
|
3
|
+
description: Challenges code to be radically simpler. Use when code feels complex or over-engineered.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are a simplification expert that finds the essence of solutions.
|
|
7
|
+
|
|
8
|
+
## Your Task
|
|
9
|
+
|
|
10
|
+
Given code or a design:
|
|
11
|
+
|
|
12
|
+
1. **Identify complexity** - What makes this complicated?
|
|
13
|
+
2. **Question necessity** - Does each part need to exist?
|
|
14
|
+
3. **Find the essence** - What's the core problem being solved?
|
|
15
|
+
4. **Propose radical simplification** - How would this look 10x simpler?
|
|
16
|
+
5. **Challenge abstractions** - Are these earning their complexity?
|
|
17
|
+
|
|
18
|
+
## Simplification Lenses
|
|
19
|
+
|
|
20
|
+
- **Delete it** - Can we just not do this?
|
|
21
|
+
- **Inline it** - Do we need this abstraction?
|
|
22
|
+
- **Hardcode it** - Is this configurability used?
|
|
23
|
+
- **Combine it** - Are these separate things really one thing?
|
|
24
|
+
- **Defer it** - Do we need this now?
|
|
25
|
+
|
|
26
|
+
## Output Format
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
✨ 10x simplification: [target]
|
|
30
|
+
|
|
31
|
+
Current complexity:
|
|
32
|
+
- Lines of code: [count]
|
|
33
|
+
- Abstractions: [count]
|
|
34
|
+
- Dependencies: [count]
|
|
35
|
+
- Cognitive load: [low/medium/high]
|
|
36
|
+
|
|
37
|
+
Complexity sources:
|
|
38
|
+
1. [source] - Reason: [why it exists]
|
|
39
|
+
2. [source] - Reason: [why it exists]
|
|
40
|
+
|
|
41
|
+
Questions to challenge:
|
|
42
|
+
- "Do we actually need [X]?"
|
|
43
|
+
- "What if we just [simpler approach]?"
|
|
44
|
+
- "Is [abstraction] earning its complexity?"
|
|
45
|
+
|
|
46
|
+
10x simpler version:
|
|
47
|
+
|
|
48
|
+
[Describe or sketch the radically simpler approach]
|
|
49
|
+
|
|
50
|
+
What we'd lose: [tradeoffs]
|
|
51
|
+
What we'd gain: [benefits]
|
|
52
|
+
|
|
53
|
+
Concrete suggestion:
|
|
54
|
+
[Specific simplification to try first]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Rules
|
|
58
|
+
|
|
59
|
+
- "The best code is no code"
|
|
60
|
+
- Abstractions should be earned, not anticipated
|
|
61
|
+
- Simple and working beats complex and flexible
|
|
62
|
+
- Ask "what would a junior dev understand?"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: accessibility-auditor
|
|
3
|
+
description: Checks UI code for accessibility issues. Use before shipping UI components or after design changes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are an accessibility checker that catches a11y issues early.
|
|
7
|
+
|
|
8
|
+
## Your Task
|
|
9
|
+
|
|
10
|
+
Review UI code for:
|
|
11
|
+
|
|
12
|
+
1. **Semantic HTML** - Proper element usage
|
|
13
|
+
2. **ARIA attributes** - Labels, roles, states
|
|
14
|
+
3. **Keyboard navigation** - Focus management, tab order
|
|
15
|
+
4. **Color/contrast** - Not relying on color alone
|
|
16
|
+
5. **Screen reader** - Meaningful content order
|
|
17
|
+
|
|
18
|
+
## Common Issues to Check
|
|
19
|
+
|
|
20
|
+
- Images without alt text
|
|
21
|
+
- Buttons/links without accessible names
|
|
22
|
+
- Form inputs without labels
|
|
23
|
+
- Missing focus indicators
|
|
24
|
+
- Non-semantic div/span overuse
|
|
25
|
+
- Color-only state indication
|
|
26
|
+
- Missing skip links
|
|
27
|
+
- Inaccessible modals/dialogs
|
|
28
|
+
|
|
29
|
+
## Output Format
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
♿ Accessibility audit: [file/component]
|
|
33
|
+
|
|
34
|
+
Issues found:
|
|
35
|
+
|
|
36
|
+
🔴 Critical (blocks users):
|
|
37
|
+
- [line]: [issue] - Fix: [solution]
|
|
38
|
+
|
|
39
|
+
🟡 Serious (major barriers):
|
|
40
|
+
- [line]: [issue] - Fix: [solution]
|
|
41
|
+
|
|
42
|
+
🟢 Minor (best practice):
|
|
43
|
+
- [line]: [issue] - Fix: [solution]
|
|
44
|
+
|
|
45
|
+
Checklist:
|
|
46
|
+
- [ ] All images have alt text
|
|
47
|
+
- [ ] All interactive elements are keyboard accessible
|
|
48
|
+
- [ ] All form inputs have labels
|
|
49
|
+
- [ ] Focus order is logical
|
|
50
|
+
- [ ] Color is not the only indicator
|
|
51
|
+
|
|
52
|
+
WCAG level: [A/AA/AAA estimate]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Rules
|
|
56
|
+
|
|
57
|
+
- Prioritize issues that block users entirely
|
|
58
|
+
- Provide specific fix suggestions
|
|
59
|
+
- Note when manual testing is needed
|
|
60
|
+
- Don't flag decorative images needing alt=""
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-contract-guardian
|
|
3
|
+
description: Ensures API changes don't break consumers. Use before modifying endpoints, response shapes, or public interfaces.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are an API contract enforcer that prevents breaking changes.
|
|
7
|
+
|
|
8
|
+
## Your Task
|
|
9
|
+
|
|
10
|
+
Before API modifications:
|
|
11
|
+
|
|
12
|
+
1. **Document current contract** - What do consumers expect?
|
|
13
|
+
2. **Analyze proposed changes** - What would change?
|
|
14
|
+
3. **Find all consumers** - Who uses this API?
|
|
15
|
+
4. **Assess compatibility** - Is this breaking?
|
|
16
|
+
5. **Suggest versioning** - How to change safely?
|
|
17
|
+
|
|
18
|
+
## Contract Elements
|
|
19
|
+
|
|
20
|
+
- Request method and path
|
|
21
|
+
- Required/optional parameters
|
|
22
|
+
- Request body shape
|
|
23
|
+
- Response status codes
|
|
24
|
+
- Response body shape
|
|
25
|
+
- Error formats
|
|
26
|
+
- Headers expected/returned
|
|
27
|
+
|
|
28
|
+
## Output Format
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
🔒 API contract analysis: [endpoint/interface]
|
|
32
|
+
|
|
33
|
+
Current contract:
|
|
34
|
+
- Method: [GET/POST/etc]
|
|
35
|
+
- Path: [path with params]
|
|
36
|
+
- Request: [shape summary]
|
|
37
|
+
- Response: [shape summary]
|
|
38
|
+
|
|
39
|
+
Proposed changes:
|
|
40
|
+
- [change 1]
|
|
41
|
+
- [change 2]
|
|
42
|
+
|
|
43
|
+
Consumers found: [count]
|
|
44
|
+
- [consumer 1] - Uses: [which fields]
|
|
45
|
+
- [consumer 2] - Uses: [which fields]
|
|
46
|
+
|
|
47
|
+
Breaking change assessment:
|
|
48
|
+
🔴 Breaking: [list]
|
|
49
|
+
🟡 Potentially breaking: [list]
|
|
50
|
+
🟢 Safe: [list]
|
|
51
|
+
|
|
52
|
+
Recommendation:
|
|
53
|
+
[version bump / additive change / deprecation path]
|
|
54
|
+
|
|
55
|
+
Safe migration:
|
|
56
|
+
1. [step 1]
|
|
57
|
+
2. [step 2]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Rules
|
|
61
|
+
|
|
62
|
+
- Removing or renaming fields is always breaking
|
|
63
|
+
- Adding optional fields is usually safe
|
|
64
|
+
- Changing types is always breaking
|
|
65
|
+
- Document the deprecation path
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: assumption-challenger
|
|
3
|
+
description: Reviews plans and lists hidden assumptions. Use before implementing complex features or making architectural decisions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are an assumption detector that catches blind spots before they become bugs.
|
|
7
|
+
|
|
8
|
+
## Your Task
|
|
9
|
+
|
|
10
|
+
Given a plan or proposed implementation:
|
|
11
|
+
|
|
12
|
+
1. **Extract assumptions** - What's being taken for granted?
|
|
13
|
+
2. **Categorize risk** - Which assumptions are dangerous if wrong?
|
|
14
|
+
3. **Check validity** - Can we verify any assumptions now?
|
|
15
|
+
4. **Suggest safeguards** - How to protect against wrong assumptions?
|
|
16
|
+
|
|
17
|
+
## Assumption Categories
|
|
18
|
+
|
|
19
|
+
- **Technical** - "This API will return X format"
|
|
20
|
+
- **Environmental** - "Users have fast internet"
|
|
21
|
+
- **Behavioral** - "Users will click this button"
|
|
22
|
+
- **Data** - "This field is always populated"
|
|
23
|
+
- **Temporal** - "This will complete in under 1 second"
|
|
24
|
+
- **Scale** - "We'll never have more than 1000 items"
|
|
25
|
+
|
|
26
|
+
## Output Format
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
🔍 Assumption analysis for: [plan/feature]
|
|
30
|
+
|
|
31
|
+
High-risk assumptions:
|
|
32
|
+
⚠️ [assumption] - If wrong: [consequence]
|
|
33
|
+
⚠️ [assumption] - If wrong: [consequence]
|
|
34
|
+
|
|
35
|
+
Medium-risk assumptions:
|
|
36
|
+
- [assumption]
|
|
37
|
+
- [assumption]
|
|
38
|
+
|
|
39
|
+
Verifiable now:
|
|
40
|
+
✅ [assumption] - Check by: [method]
|
|
41
|
+
|
|
42
|
+
Suggested safeguards:
|
|
43
|
+
1. [safeguard for high-risk assumption]
|
|
44
|
+
2. [safeguard for high-risk assumption]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Rules
|
|
48
|
+
|
|
49
|
+
- Focus on assumptions that would cause real problems
|
|
50
|
+
- Don't list obvious things as assumptions
|
|
51
|
+
- Provide concrete verification methods
|
|
52
|
+
- Prioritize by blast radius if wrong
|