claude-base-setup 1.0.0 → 1.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.
Files changed (43) hide show
  1. package/README.md +83 -8
  2. package/bin/cli.js +201 -21
  3. package/package.json +3 -3
  4. package/templates/CLAUDE.md +20 -0
  5. package/templates/agents/10x-simplifier.md +64 -0
  6. package/templates/agents/accessibility-auditor.md +62 -0
  7. package/templates/agents/api-contract-guardian.md +67 -0
  8. package/templates/agents/assumption-challenger.md +54 -0
  9. package/templates/agents/breaking-change-predictor.md +64 -0
  10. package/templates/agents/context-curator.md +55 -0
  11. package/templates/agents/decision-logger.md +70 -0
  12. package/templates/agents/dependency-detective.md +60 -0
  13. package/templates/agents/devils-advocate.md +67 -0
  14. package/templates/agents/error-boundary-designer.md +67 -0
  15. package/templates/agents/future-you.md +65 -0
  16. package/templates/agents/incident-replayer.md +64 -0
  17. package/templates/agents/intent-clarifier.md +47 -0
  18. package/templates/agents/legacy-archaeologist.md +56 -0
  19. package/templates/agents/migration-planner.md +63 -0
  20. package/templates/agents/package-checker.md +11 -21
  21. package/templates/agents/performance-profiler.md +63 -0
  22. package/templates/agents/pr-narrator.md +51 -0
  23. package/templates/agents/pre-code-check.md +13 -11
  24. package/templates/agents/refactor-scope-limiter.md +56 -0
  25. package/templates/agents/rubber-duck.md +57 -0
  26. package/templates/agents/scope-creep-detector.md +63 -0
  27. package/templates/agents/session-handoff.md +59 -0
  28. package/templates/agents/structure-validator.md +8 -19
  29. package/templates/agents/test-gap-finder.md +73 -0
  30. package/templates/commands/commit.md +9 -0
  31. package/templates/commands/review.md +12 -0
  32. package/templates/commands/test.md +11 -0
  33. package/templates/hooks/session-start.sh +41 -12
  34. package/templates/hooks/smart-inject-llm.sh +94 -13
  35. package/templates/hooks/smart-inject-rules.sh +89 -7
  36. package/templates/hooks/triggers.json +106 -0
  37. package/templates/rules/agent-lifecycle-messages.md +77 -0
  38. package/templates/rules/announce-actions.md +37 -36
  39. package/templates/rules/command-format.md +60 -0
  40. package/templates/rules/context-passing-protocol.md +75 -0
  41. package/templates/rules/subagent-format.md +36 -5
  42. package/templates/{settings.local.json → settings.json} +9 -7
  43. package/templates/skills/.gitkeep +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # claude-base-setup
2
2
 
3
- A reusable `.claude` configuration for Claude Code projects with smart context injection, rules, and agents.
3
+ A reusable `.claude` configuration for Claude Code projects with smart context injection, rules, agents, and slash commands.
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,18 +10,36 @@ npx claude-base-setup
10
10
 
11
11
  This creates a `.claude/` directory in your project with:
12
12
 
13
+ - **CLAUDE.md** - Project context (auto-loaded by Claude)
13
14
  - **hooks/** - Smart context injection on every prompt
14
15
  - **rules/** - Behavioral guidelines injected into context
15
16
  - **agents/** - Task workers (pre-code-check, package-checker, etc.)
16
- - **skills/** - Custom slash commands (empty by default)
17
- - **settings.local.json** - Hook configuration
17
+ - **commands/** - Slash commands (/review, /test, /commit)
18
+ - **settings.json** - Hook configuration
18
19
 
19
- ## Usage
20
-
21
- ### Re-initialize (overwrite existing)
20
+ ## CLI Options
22
21
 
23
22
  ```bash
23
+ # Initialize (interactive - prompts for API key)
24
+ npx claude-base-setup
25
+
26
+ # Initialize without API key prompt (CI/automation)
27
+ npx claude-base-setup --skip-api-key
28
+
29
+ # Overwrite existing .claude directory
24
30
  npx claude-base-setup --force
31
+
32
+ # Remove .claude directory
33
+ npx claude-base-setup --remove
34
+
35
+ # Update specific components (preserves settings.json and CLAUDE.md)
36
+ npx claude-base-setup --update-hooks
37
+ npx claude-base-setup --update-agents
38
+ npx claude-base-setup --update-rules
39
+ npx claude-base-setup --update-commands
40
+
41
+ # Show help
42
+ npx claude-base-setup --help
25
43
  ```
26
44
 
27
45
  ### What it does
@@ -39,9 +57,11 @@ npx claude-base-setup --force
39
57
  | announce-actions | always | Announce actions, track agent usage |
40
58
  | rule-format | "rule" keywords | How to create rules |
41
59
  | subagent-format | "agent" keywords | How to create agents |
60
+ | command-format | "command" keywords | How to create slash commands |
42
61
 
43
- ## Included Agents
62
+ ## Included Agents (23 specialized agents)
44
63
 
64
+ ### Core Agents
45
65
  | Agent | Purpose |
46
66
  |-------|---------|
47
67
  | pre-code-check | Search for existing code before creating new |
@@ -49,6 +69,60 @@ npx claude-base-setup --force
49
69
  | context-loader | Scan codebase and generate CONTEXT.md |
50
70
  | structure-validator | Validate project structure after file ops |
51
71
 
72
+ ### Planning & Requirements
73
+ | Agent | Purpose |
74
+ |-------|---------|
75
+ | intent-clarifier | Clarifies requirements before coding starts |
76
+ | assumption-challenger | Reviews plans and lists hidden assumptions |
77
+ | breaking-change-predictor | Predicts what might break from changes |
78
+
79
+ ### Code Quality
80
+ | Agent | Purpose |
81
+ |-------|---------|
82
+ | legacy-archaeologist | Explains why old code exists and its history |
83
+ | dependency-detective | Investigates packages before adding them |
84
+ | test-gap-finder | Finds untested code paths and logic gaps |
85
+ | refactor-scope-limiter | Defines minimum safe scope for refactoring |
86
+
87
+ ### Workflow
88
+ | Agent | Purpose |
89
+ |-------|---------|
90
+ | pr-narrator | Writes PR descriptions from commits/diffs |
91
+ | migration-planner | Plans safe database/API migrations |
92
+ | incident-replayer | Traces errors through code to explain them |
93
+
94
+ ### Session Management
95
+ | Agent | Purpose |
96
+ |-------|---------|
97
+ | context-curator | Summarizes conversation and suggests compaction |
98
+ | decision-logger | Records architectural decisions as ADRs |
99
+ | session-handoff | Prepares summary for continuing later |
100
+ | scope-creep-detector | Monitors if work is drifting from task |
101
+
102
+ ### Domain-Specific
103
+ | Agent | Purpose |
104
+ |-------|---------|
105
+ | api-contract-guardian | Ensures API changes don't break consumers |
106
+ | accessibility-auditor | Checks UI code for a11y issues |
107
+ | performance-profiler | Finds obvious performance issues |
108
+ | error-boundary-designer | Suggests where to add error handling |
109
+
110
+ ### Thinking Partners
111
+ | Agent | Purpose |
112
+ |-------|---------|
113
+ | rubber-duck | Helps think through problems via questions |
114
+ | devils-advocate | Argues against solutions to stress-test them |
115
+ | 10x-simplifier | Challenges code to be radically simpler |
116
+ | future-you | Reviews code as if maintaining it 6 months later |
117
+
118
+ ## Included Commands
119
+
120
+ | Command | Purpose |
121
+ |---------|---------|
122
+ | /review | Review current changes for issues |
123
+ | /test | Run tests and fix failures |
124
+ | /commit | Stage and commit changes |
125
+
52
126
  ## Customization
53
127
 
54
128
  After installation, modify files in `.claude/` to fit your project:
@@ -56,7 +130,8 @@ After installation, modify files in `.claude/` to fit your project:
56
130
  - Add project-specific rules in `rules/`
57
131
  - Customize keyword triggers in `hooks/triggers.json`
58
132
  - Add custom agents in `agents/`
59
- - Update `settings.local.json` for permissions
133
+ - Add custom slash commands in `commands/`
134
+ - Update `settings.json` for permissions
60
135
 
61
136
  ## License
62
137
 
package/bin/cli.js CHANGED
@@ -2,9 +2,24 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
+ const readline = require('readline');
5
6
 
6
7
  const TEMPLATES_DIR = path.join(__dirname, '..', 'templates');
7
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;
8
23
 
9
24
  function copyDir(src, dest) {
10
25
  fs.mkdirSync(dest, { recursive: true });
@@ -23,6 +38,23 @@ function copyDir(src, dest) {
23
38
  }
24
39
  }
25
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
+
26
58
  function makeExecutable(dir) {
27
59
  const hooksDir = path.join(dir, 'hooks');
28
60
  if (fs.existsSync(hooksDir)) {
@@ -36,12 +68,72 @@ function makeExecutable(dir) {
36
68
  }
37
69
  }
38
70
 
39
- function init() {
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() {
40
131
  console.log('🔧 Initializing Claude Code base setup...\n');
41
132
 
42
- if (fs.existsSync(TARGET_DIR)) {
133
+ if (fs.existsSync(TARGET_DIR) && !forceMode) {
43
134
  console.log('⚠️ .claude directory already exists.');
44
- console.log(' Use --force to overwrite.\n');
135
+ console.log(' Use --force to overwrite, or use selective updates:');
136
+ console.log(' --update-hooks, --update-agents, --update-rules, --update-commands\n');
45
137
  process.exit(1);
46
138
  }
47
139
 
@@ -50,6 +142,11 @@ function init() {
50
142
  process.exit(1);
51
143
  }
52
144
 
145
+ if (forceMode && fs.existsSync(TARGET_DIR)) {
146
+ fs.rmSync(TARGET_DIR, { recursive: true });
147
+ console.log('🗑️ Removed existing .claude directory.\n');
148
+ }
149
+
53
150
  copyDir(TEMPLATES_DIR, TARGET_DIR);
54
151
  makeExecutable(TARGET_DIR);
55
152
 
@@ -57,16 +154,81 @@ function init() {
57
154
  console.log(' 📁 hooks/ - Smart context injection');
58
155
  console.log(' 📁 rules/ - Behavioral guidelines');
59
156
  console.log(' 📁 agents/ - Task workers');
60
- console.log(' 📁 skills/ - Custom commands (empty)');
61
- console.log(' 📄 settings.local.json\n');
157
+ console.log(' 📁 commands/ - Slash commands (/review, /test, /commit)');
158
+ console.log(' 📄 settings.json');
159
+ console.log(' 📄 CLAUDE.md\n');
160
+
161
+ // Handle API key
162
+ if (skipApiKey) {
163
+ console.log('⏭️ Skipped API key prompt (--skip-api-key).');
164
+ console.log(' Using keyword-based injection.\n');
165
+ updateSettingsForLLM(false);
166
+ } else {
167
+ console.log('🔑 Smart injection uses Claude Haiku for semantic rule matching.');
168
+ console.log(' This requires an Anthropic API key.\n');
169
+
170
+ const apiKey = await prompt(
171
+ ' Enter your ANTHROPIC_API_KEY (or press Enter to skip): '
172
+ );
173
+
174
+ if (apiKey) {
175
+ saveApiKey(apiKey);
176
+ saveModel(DEFAULT_MODEL);
177
+ updateSettingsForLLM(true);
178
+ console.log('\n ✅ API key saved to .env');
179
+ console.log(` ✅ Model set to ${DEFAULT_MODEL}`);
180
+ console.log(' ✅ Enabled LLM-powered smart injection');
181
+ console.log(' 💡 Add .env to your .gitignore if not already there.');
182
+ console.log(' 💡 Change ANTHROPIC_MODEL in .env to use a different model.\n');
183
+ } else {
184
+ console.log('\n ⏭️ Skipped. Using keyword-based injection.');
185
+ console.log(
186
+ ' 💡 Set ANTHROPIC_API_KEY env var later to enable LLM-powered injection.\n'
187
+ );
188
+ updateSettingsForLLM(false);
189
+ }
190
+ }
191
+
62
192
  console.log('🚀 Ready! Claude Code will now use these rules and agents.\n');
63
193
  }
64
194
 
65
- function forceInit() {
66
- if (fs.existsSync(TARGET_DIR)) {
67
- fs.rmSync(TARGET_DIR, { recursive: true });
195
+ async function update() {
196
+ if (!fs.existsSync(TARGET_DIR)) {
197
+ console.error('❌ .claude directory not found. Run without flags to initialize first.');
198
+ process.exit(1);
199
+ }
200
+
201
+ console.log('🔄 Updating selected components...\n');
202
+
203
+ const updates = [];
204
+
205
+ if (updateHooks) {
206
+ if (copySubdir('hooks')) {
207
+ makeExecutable(TARGET_DIR);
208
+ updates.push('hooks');
209
+ }
210
+ }
211
+ if (updateAgents && copySubdir('agents')) updates.push('agents');
212
+ if (updateRules && copySubdir('rules')) updates.push('rules');
213
+ if (updateCommands && copySubdir('commands')) updates.push('commands');
214
+
215
+ if (updates.length > 0) {
216
+ console.log(`✅ Updated: ${updates.join(', ')}\n`);
217
+ console.log('💡 Your settings.json and CLAUDE.md were preserved.\n');
218
+ } else {
219
+ console.log('⚠️ No components updated.\n');
68
220
  }
69
- init();
221
+ }
222
+
223
+ function remove() {
224
+ if (!fs.existsSync(TARGET_DIR)) {
225
+ console.log('ℹ️ .claude directory does not exist. Nothing to remove.\n');
226
+ return;
227
+ }
228
+
229
+ fs.rmSync(TARGET_DIR, { recursive: true });
230
+ console.log('✅ Removed .claude directory.\n');
231
+ console.log('💡 Note: .env file (if created) was not removed.\n');
70
232
  }
71
233
 
72
234
  function showHelp() {
@@ -74,26 +236,44 @@ function showHelp() {
74
236
  claude-base-setup - Initialize .claude configuration for Claude Code
75
237
 
76
238
  Usage:
77
- npx claude-base-setup Initialize .claude in current directory
78
- npx claude-base-setup --force Overwrite existing .claude directory
79
- npx claude-base-setup --help Show this help message
239
+ npx claude-base-setup Initialize .claude in current directory
240
+ npx claude-base-setup --force Overwrite existing .claude directory
241
+ npx claude-base-setup --remove Remove .claude directory
242
+ npx claude-base-setup --skip-api-key Skip API key prompt (CI/automation)
243
+
244
+ Selective updates (preserves settings.json and CLAUDE.md):
245
+ npx claude-base-setup --update-hooks Update only hooks/
246
+ npx claude-base-setup --update-agents Update only agents/
247
+ npx claude-base-setup --update-rules Update only rules/
248
+ npx claude-base-setup --update-commands Update only commands/
249
+
250
+ Options:
251
+ -h, --help Show this help message
252
+ -f, --force Overwrite existing .claude directory
253
+ -r, --remove Remove .claude directory (alias: --uninstall)
254
+ -s, --skip-api-key Skip API key prompt (alias: --no-api-key)
80
255
 
81
256
  What's included:
82
257
  • hooks/ Smart context injection on every prompt
83
258
  • rules/ Behavioral guidelines (code standards, etc.)
84
259
  • agents/ Task workers (pre-code-check, package-checker, etc.)
85
- skills/ Custom slash commands (empty by default)
260
+ commands/ Slash commands (/review, /test, /commit)
261
+ • CLAUDE.md Project context (auto-loaded by Claude)
86
262
 
87
263
  Learn more: https://github.com/fr0mpy/claude-base-setup
88
264
  `);
89
265
  }
90
266
 
91
- const args = process.argv.slice(2);
92
-
93
- if (args.includes('--help') || args.includes('-h')) {
94
- showHelp();
95
- } else if (args.includes('--force') || args.includes('-f')) {
96
- forceInit();
97
- } else {
98
- init();
267
+ async function main() {
268
+ if (helpMode) {
269
+ showHelp();
270
+ } else if (removeMode) {
271
+ remove();
272
+ } else if (updateMode) {
273
+ await update();
274
+ } else {
275
+ await init();
276
+ }
99
277
  }
278
+
279
+ main();
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "claude-base-setup",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "A reusable .claude configuration for Claude Code projects with smart context injection, rules, and agents",
5
5
  "main": "index.js",
6
6
  "bin": {
7
7
  "claude-base-setup": "./bin/cli.js"
8
8
  },
9
9
  "scripts": {
10
- "test": "echo \"No tests yet\" && exit 0"
10
+ "test": "node test/cli.test.js"
11
11
  },
12
12
  "keywords": [
13
13
  "claude",
@@ -20,7 +20,7 @@
20
20
  "agents",
21
21
  "hooks"
22
22
  ],
23
- "author": "",
23
+ "author": "fr0mpy",
24
24
  "license": "MIT",
25
25
  "repository": {
26
26
  "type": "git",
@@ -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,64 @@
1
+ ---
2
+ name: 10x-simplifier
3
+ description: Challenges code to be radically simpler. Use when code feels complex or over-engineered.
4
+ tools: Read, Grep, Glob
5
+ model: sonnet
6
+ ---
7
+
8
+ You are a simplification expert that finds the essence of solutions.
9
+
10
+ ## Your Task
11
+
12
+ Given code or a design:
13
+
14
+ 1. **Identify complexity** - What makes this complicated?
15
+ 2. **Question necessity** - Does each part need to exist?
16
+ 3. **Find the essence** - What's the core problem being solved?
17
+ 4. **Propose radical simplification** - How would this look 10x simpler?
18
+ 5. **Challenge abstractions** - Are these earning their complexity?
19
+
20
+ ## Simplification Lenses
21
+
22
+ - **Delete it** - Can we just not do this?
23
+ - **Inline it** - Do we need this abstraction?
24
+ - **Hardcode it** - Is this configurability used?
25
+ - **Combine it** - Are these separate things really one thing?
26
+ - **Defer it** - Do we need this now?
27
+
28
+ ## Output Format
29
+
30
+ ```
31
+ ✨ 10x simplification: [target]
32
+
33
+ Current complexity:
34
+ - Lines of code: [count]
35
+ - Abstractions: [count]
36
+ - Dependencies: [count]
37
+ - Cognitive load: [low/medium/high]
38
+
39
+ Complexity sources:
40
+ 1. [source] - Reason: [why it exists]
41
+ 2. [source] - Reason: [why it exists]
42
+
43
+ Questions to challenge:
44
+ - "Do we actually need [X]?"
45
+ - "What if we just [simpler approach]?"
46
+ - "Is [abstraction] earning its complexity?"
47
+
48
+ 10x simpler version:
49
+
50
+ [Describe or sketch the radically simpler approach]
51
+
52
+ What we'd lose: [tradeoffs]
53
+ What we'd gain: [benefits]
54
+
55
+ Concrete suggestion:
56
+ [Specific simplification to try first]
57
+ ```
58
+
59
+ ## Rules
60
+
61
+ - "The best code is no code"
62
+ - Abstractions should be earned, not anticipated
63
+ - Simple and working beats complex and flexible
64
+ - Ask "what would a junior dev understand?"
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: accessibility-auditor
3
+ description: Checks UI code for accessibility issues. Use before shipping UI components or after design changes.
4
+ tools: Read, Grep, Glob
5
+ model: haiku
6
+ ---
7
+
8
+ You are an accessibility checker that catches a11y issues early.
9
+
10
+ ## Your Task
11
+
12
+ Review UI code for:
13
+
14
+ 1. **Semantic HTML** - Proper element usage
15
+ 2. **ARIA attributes** - Labels, roles, states
16
+ 3. **Keyboard navigation** - Focus management, tab order
17
+ 4. **Color/contrast** - Not relying on color alone
18
+ 5. **Screen reader** - Meaningful content order
19
+
20
+ ## Common Issues to Check
21
+
22
+ - Images without alt text
23
+ - Buttons/links without accessible names
24
+ - Form inputs without labels
25
+ - Missing focus indicators
26
+ - Non-semantic div/span overuse
27
+ - Color-only state indication
28
+ - Missing skip links
29
+ - Inaccessible modals/dialogs
30
+
31
+ ## Output Format
32
+
33
+ ```
34
+ ♿ Accessibility audit: [file/component]
35
+
36
+ Issues found:
37
+
38
+ 🔴 Critical (blocks users):
39
+ - [line]: [issue] - Fix: [solution]
40
+
41
+ 🟡 Serious (major barriers):
42
+ - [line]: [issue] - Fix: [solution]
43
+
44
+ 🟢 Minor (best practice):
45
+ - [line]: [issue] - Fix: [solution]
46
+
47
+ Checklist:
48
+ - [ ] All images have alt text
49
+ - [ ] All interactive elements are keyboard accessible
50
+ - [ ] All form inputs have labels
51
+ - [ ] Focus order is logical
52
+ - [ ] Color is not the only indicator
53
+
54
+ WCAG level: [A/AA/AAA estimate]
55
+ ```
56
+
57
+ ## Rules
58
+
59
+ - Prioritize issues that block users entirely
60
+ - Provide specific fix suggestions
61
+ - Note when manual testing is needed
62
+ - Don't flag decorative images needing alt=""
@@ -0,0 +1,67 @@
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
+ tools: Read, Grep, Glob
5
+ model: sonnet
6
+ ---
7
+
8
+ You are an API contract enforcer that prevents breaking changes.
9
+
10
+ ## Your Task
11
+
12
+ Before API modifications:
13
+
14
+ 1. **Document current contract** - What do consumers expect?
15
+ 2. **Analyze proposed changes** - What would change?
16
+ 3. **Find all consumers** - Who uses this API?
17
+ 4. **Assess compatibility** - Is this breaking?
18
+ 5. **Suggest versioning** - How to change safely?
19
+
20
+ ## Contract Elements
21
+
22
+ - Request method and path
23
+ - Required/optional parameters
24
+ - Request body shape
25
+ - Response status codes
26
+ - Response body shape
27
+ - Error formats
28
+ - Headers expected/returned
29
+
30
+ ## Output Format
31
+
32
+ ```
33
+ 🔒 API contract analysis: [endpoint/interface]
34
+
35
+ Current contract:
36
+ - Method: [GET/POST/etc]
37
+ - Path: [path with params]
38
+ - Request: [shape summary]
39
+ - Response: [shape summary]
40
+
41
+ Proposed changes:
42
+ - [change 1]
43
+ - [change 2]
44
+
45
+ Consumers found: [count]
46
+ - [consumer 1] - Uses: [which fields]
47
+ - [consumer 2] - Uses: [which fields]
48
+
49
+ Breaking change assessment:
50
+ 🔴 Breaking: [list]
51
+ 🟡 Potentially breaking: [list]
52
+ 🟢 Safe: [list]
53
+
54
+ Recommendation:
55
+ [version bump / additive change / deprecation path]
56
+
57
+ Safe migration:
58
+ 1. [step 1]
59
+ 2. [step 2]
60
+ ```
61
+
62
+ ## Rules
63
+
64
+ - Removing or renaming fields is always breaking
65
+ - Adding optional fields is usually safe
66
+ - Changing types is always breaking
67
+ - Document the deprecation path