claude-termux 1.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/CLAUDE.md +60 -0
- package/GEMINI.md +20 -0
- package/README.md +135 -0
- package/TERMUX.md +204 -0
- package/agents/accessibility-reviewer.md +96 -0
- package/agents/ai-prompt-optimizer.md +94 -0
- package/agents/api-tester.md +102 -0
- package/agents/code-generator.md +94 -0
- package/agents/code-reviewer.md +47 -0
- package/agents/component-generator.md +102 -0
- package/agents/doc-generator.md +91 -0
- package/agents/migration-generator.md +94 -0
- package/agents/performance-analyzer.md +90 -0
- package/agents/proactive-mode.md +91 -0
- package/agents/readme-generator.md +101 -0
- package/agents/security-auditor.md +86 -0
- package/agents/terraform-generator.md +94 -0
- package/agents/test-generator.md +76 -0
- package/commands/brainstorm.md +5 -0
- package/commands/execute-plan.md +5 -0
- package/commands/write-plan.md +5 -0
- package/hooks/auto-context.json +31 -0
- package/hooks/hooks.json +15 -0
- package/hooks/run-hook.cmd +19 -0
- package/hooks/session-start.sh +52 -0
- package/hooks/smart-session.sh +96 -0
- package/install.sh +210 -0
- package/lib/skills-core.js +208 -0
- package/mcp.json +34 -0
- package/package.json +49 -0
- package/plugins/README.md +47 -0
- package/plugins/installed_plugins.json +5 -0
- package/plugins/known_marketplaces.json +10 -0
- package/plugins/marketplace-info/marketplace.json +517 -0
- package/postinstall.js +238 -0
- package/settings.json +27 -0
- package/settings.local.json +25 -0
- package/skills/api-development/SKILL.md +11 -0
- package/skills/api-development/openapi/api-documentation.yaml +108 -0
- package/skills/brainstorming/SKILL.md +54 -0
- package/skills/code-quality/SKILL.md +196 -0
- package/skills/condition-based-waiting/SKILL.md +120 -0
- package/skills/condition-based-waiting/example.ts +158 -0
- package/skills/database-development/SKILL.md +11 -0
- package/skills/database-development/migrations/migration.template.sql +49 -0
- package/skills/defense-in-depth/SKILL.md +127 -0
- package/skills/deployment/SKILL.md +11 -0
- package/skills/deployment/ci-cd/github-actions.yml +95 -0
- package/skills/deployment/docker/Dockerfile.template +39 -0
- package/skills/dispatching-parallel-agents/SKILL.md +180 -0
- package/skills/documentation-generation/SKILL.md +8 -0
- package/skills/documentation-generation/templates/README.template.md +60 -0
- package/skills/error-handling/SKILL.md +267 -0
- package/skills/executing-plans/SKILL.md +76 -0
- package/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/frontend-design/frontend-design/SKILL.md +42 -0
- package/skills/integration-testing/SKILL.md +13 -0
- package/skills/integration-testing/examples/contract-test.py +317 -0
- package/skills/integration-testing/examples/e2e-test.js +147 -0
- package/skills/integration-testing/examples/test-isolation.md +94 -0
- package/skills/logging-monitoring/SKILL.md +66 -0
- package/skills/mobile-development/SKILL.md +11 -0
- package/skills/mobile-development/responsive/responsive.css +80 -0
- package/skills/performance-optimization/SKILL.md +9 -0
- package/skills/performance-optimization/profiling/profile.template.js +21 -0
- package/skills/receiving-code-review/SKILL.md +209 -0
- package/skills/refactoring/SKILL.md +11 -0
- package/skills/refactoring/code-smells/common-smells.md +115 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +146 -0
- package/skills/root-cause-tracing/SKILL.md +174 -0
- package/skills/root-cause-tracing/find-polluter.sh +63 -0
- package/skills/security-review/SKILL.md +11 -0
- package/skills/security-review/checklists/owasp-checklist.md +31 -0
- package/skills/sharing-skills/SKILL.md +194 -0
- package/skills/subagent-driven-development/SKILL.md +240 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
- package/skills/subagent-driven-development/implementer-prompt.md +78 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +295 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +364 -0
- package/skills/testing-anti-patterns/SKILL.md +302 -0
- package/skills/testing-skills-with-subagents/SKILL.md +387 -0
- package/skills/testing-skills-with-subagents/examples/CLAUDE_MD_TESTING.md +189 -0
- package/skills/ui-ux-review/SKILL.md +13 -0
- package/skills/ui-ux-review/checklists/ux-heuristics.md +61 -0
- package/skills/using-git-worktrees/SKILL.md +213 -0
- package/skills/using-superpowers/SKILL.md +101 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/writing-plans/SKILL.md +116 -0
- package/skills/writing-skills/SKILL.md +622 -0
- package/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/skills/writing-skills/persuasion-principles.md +187 -0
package/postinstall.js
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Claude Termux - Postinstall Script
|
|
5
|
+
* Automatically installs superpowers to Claude Code and Gemini CLI
|
|
6
|
+
* Optimized for Termux Android
|
|
7
|
+
* https://github.com/zesbe/termux-config
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const { execSync } = require('child_process');
|
|
13
|
+
|
|
14
|
+
// Colors for terminal
|
|
15
|
+
const colors = {
|
|
16
|
+
green: '\x1b[32m',
|
|
17
|
+
blue: '\x1b[34m',
|
|
18
|
+
yellow: '\x1b[33m',
|
|
19
|
+
red: '\x1b[31m',
|
|
20
|
+
reset: '\x1b[0m'
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const log = {
|
|
24
|
+
success: (msg) => console.log(`${colors.green}✓ ${msg}${colors.reset}`),
|
|
25
|
+
info: (msg) => console.log(`${colors.blue}→ ${msg}${colors.reset}`),
|
|
26
|
+
warn: (msg) => console.log(`${colors.yellow}! ${msg}${colors.reset}`),
|
|
27
|
+
error: (msg) => console.log(`${colors.red}✗ ${msg}${colors.reset}`)
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Detect environment
|
|
31
|
+
const isTermux = fs.existsSync('/data/data/com.termux');
|
|
32
|
+
const homeDir = isTermux ? '/data/data/com.termux/files/home' : process.env.HOME;
|
|
33
|
+
const packageDir = __dirname;
|
|
34
|
+
|
|
35
|
+
console.log(`
|
|
36
|
+
${colors.blue}╔═══════════════════════════════════════════════════════════╗
|
|
37
|
+
║ Claude Termux - AI CLI Config for Android ║
|
|
38
|
+
║ https://github.com/zesbe ║
|
|
39
|
+
╚═══════════════════════════════════════════════════════════╝${colors.reset}
|
|
40
|
+
`);
|
|
41
|
+
|
|
42
|
+
if (isTermux) {
|
|
43
|
+
log.success('Termux environment detected');
|
|
44
|
+
} else {
|
|
45
|
+
log.warn('Not running in Termux, using standard paths');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Check for installed CLIs
|
|
49
|
+
function commandExists(cmd) {
|
|
50
|
+
try {
|
|
51
|
+
execSync(`command -v ${cmd}`, { stdio: 'ignore' });
|
|
52
|
+
return true;
|
|
53
|
+
} catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const claudeInstalled = commandExists('claude');
|
|
59
|
+
const geminiInstalled = commandExists('gemini');
|
|
60
|
+
|
|
61
|
+
if (claudeInstalled) log.success('Claude Code found');
|
|
62
|
+
else log.warn('Claude Code not found (install: npm i -g @anthropic-ai/claude-code)');
|
|
63
|
+
|
|
64
|
+
if (geminiInstalled) log.success('Gemini CLI found');
|
|
65
|
+
else log.warn('Gemini CLI not found (install: npm i -g @google/gemini-cli)');
|
|
66
|
+
|
|
67
|
+
if (!claudeInstalled && !geminiInstalled) {
|
|
68
|
+
log.error('Neither Claude Code nor Gemini CLI is installed');
|
|
69
|
+
console.log('Please install at least one:');
|
|
70
|
+
console.log(' npm install -g @anthropic-ai/claude-code');
|
|
71
|
+
console.log(' npm install -g @google/gemini-cli');
|
|
72
|
+
process.exit(0); // Don't fail postinstall
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Helper functions
|
|
76
|
+
function copyDir(src, dest) {
|
|
77
|
+
if (!fs.existsSync(src)) return 0;
|
|
78
|
+
|
|
79
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
80
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
81
|
+
let count = 0;
|
|
82
|
+
|
|
83
|
+
for (const entry of entries) {
|
|
84
|
+
const srcPath = path.join(src, entry.name);
|
|
85
|
+
const destPath = path.join(dest, entry.name);
|
|
86
|
+
|
|
87
|
+
if (entry.isDirectory()) {
|
|
88
|
+
count += copyDir(srcPath, destPath);
|
|
89
|
+
} else {
|
|
90
|
+
fs.copyFileSync(srcPath, destPath);
|
|
91
|
+
count++;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return count;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function copyFile(src, dest) {
|
|
98
|
+
if (!fs.existsSync(src)) return false;
|
|
99
|
+
fs.copyFileSync(src, dest);
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function countItems(dir) {
|
|
104
|
+
if (!fs.existsSync(dir)) return 0;
|
|
105
|
+
return fs.readdirSync(dir).length;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Install for Claude Code
|
|
109
|
+
if (claudeInstalled) {
|
|
110
|
+
console.log(`\n${colors.blue}Installing Claude Code superpowers...${colors.reset}`);
|
|
111
|
+
|
|
112
|
+
const claudeDir = path.join(homeDir, '.claude');
|
|
113
|
+
|
|
114
|
+
// Create directories
|
|
115
|
+
['agents', 'skills', 'commands', 'hooks', 'plugins', 'lib'].forEach(dir => {
|
|
116
|
+
fs.mkdirSync(path.join(claudeDir, dir), { recursive: true });
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// Copy agents
|
|
120
|
+
copyDir(path.join(packageDir, 'agents'), path.join(claudeDir, 'agents'));
|
|
121
|
+
log.success(`Agents: ${countItems(path.join(claudeDir, 'agents'))} installed`);
|
|
122
|
+
|
|
123
|
+
// Copy skills
|
|
124
|
+
copyDir(path.join(packageDir, 'skills'), path.join(claudeDir, 'skills'));
|
|
125
|
+
log.success(`Skills: ${countItems(path.join(claudeDir, 'skills'))} installed`);
|
|
126
|
+
|
|
127
|
+
// Copy commands
|
|
128
|
+
copyDir(path.join(packageDir, 'commands'), path.join(claudeDir, 'commands'));
|
|
129
|
+
log.success(`Commands: ${countItems(path.join(claudeDir, 'commands'))} installed`);
|
|
130
|
+
|
|
131
|
+
// Copy hooks
|
|
132
|
+
copyDir(path.join(packageDir, 'hooks'), path.join(claudeDir, 'hooks'));
|
|
133
|
+
log.success('Hooks installed');
|
|
134
|
+
|
|
135
|
+
// Copy plugins
|
|
136
|
+
copyDir(path.join(packageDir, 'plugins'), path.join(claudeDir, 'plugins'));
|
|
137
|
+
log.success('Plugins installed');
|
|
138
|
+
|
|
139
|
+
// Copy lib
|
|
140
|
+
copyDir(path.join(packageDir, 'lib'), path.join(claudeDir, 'lib'));
|
|
141
|
+
log.success('Lib installed');
|
|
142
|
+
|
|
143
|
+
// Copy CLAUDE.md
|
|
144
|
+
if (copyFile(path.join(packageDir, 'CLAUDE.md'), path.join(claudeDir, 'CLAUDE.md'))) {
|
|
145
|
+
log.success('CLAUDE.md installed');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Copy TERMUX.md
|
|
149
|
+
if (copyFile(path.join(packageDir, 'TERMUX.md'), path.join(claudeDir, 'TERMUX.md'))) {
|
|
150
|
+
log.success('TERMUX.md installed');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Copy settings.local.json (bypass permissions)
|
|
154
|
+
if (copyFile(path.join(packageDir, 'settings.local.json'), path.join(claudeDir, 'settings.local.json'))) {
|
|
155
|
+
log.success('Bypass permissions configured');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Copy MCP config to home
|
|
159
|
+
const mcpDest = path.join(homeDir, '.mcp.json');
|
|
160
|
+
if (copyFile(path.join(packageDir, 'mcp.json'), mcpDest)) {
|
|
161
|
+
fs.chmodSync(mcpDest, 0o600);
|
|
162
|
+
log.success('MCP servers configured (6 servers)');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Install for Gemini CLI
|
|
167
|
+
if (geminiInstalled) {
|
|
168
|
+
console.log(`\n${colors.blue}Installing Gemini CLI superpowers...${colors.reset}`);
|
|
169
|
+
|
|
170
|
+
const geminiDir = path.join(homeDir, '.gemini');
|
|
171
|
+
const superpowersDir = path.join(geminiDir, 'superpowers');
|
|
172
|
+
|
|
173
|
+
// Create directories
|
|
174
|
+
['agents', 'skills', 'commands', 'hooks', 'lib'].forEach(dir => {
|
|
175
|
+
fs.mkdirSync(path.join(superpowersDir, dir), { recursive: true });
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Copy agents
|
|
179
|
+
copyDir(path.join(packageDir, 'agents'), path.join(superpowersDir, 'agents'));
|
|
180
|
+
log.success(`Agents: ${countItems(path.join(superpowersDir, 'agents'))} installed`);
|
|
181
|
+
|
|
182
|
+
// Copy skills
|
|
183
|
+
copyDir(path.join(packageDir, 'skills'), path.join(superpowersDir, 'skills'));
|
|
184
|
+
log.success(`Skills: ${countItems(path.join(superpowersDir, 'skills'))} installed`);
|
|
185
|
+
|
|
186
|
+
// Copy commands
|
|
187
|
+
copyDir(path.join(packageDir, 'commands'), path.join(superpowersDir, 'commands'));
|
|
188
|
+
log.success(`Commands: ${countItems(path.join(superpowersDir, 'commands'))} installed`);
|
|
189
|
+
|
|
190
|
+
// Copy hooks
|
|
191
|
+
copyDir(path.join(packageDir, 'hooks'), path.join(superpowersDir, 'hooks'));
|
|
192
|
+
log.success('Hooks installed');
|
|
193
|
+
|
|
194
|
+
// Copy lib
|
|
195
|
+
copyDir(path.join(packageDir, 'lib'), path.join(superpowersDir, 'lib'));
|
|
196
|
+
log.success('Lib installed');
|
|
197
|
+
|
|
198
|
+
// Copy GEMINI.md
|
|
199
|
+
if (copyFile(path.join(packageDir, 'GEMINI.md'), path.join(geminiDir, 'GEMINI.md'))) {
|
|
200
|
+
log.success('GEMINI.md installed');
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Copy settings.json (YOLO mode)
|
|
204
|
+
if (copyFile(path.join(packageDir, 'settings.json'), path.join(geminiDir, 'settings.json'))) {
|
|
205
|
+
log.success('YOLO mode configured');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Copy MCP config
|
|
209
|
+
const mcpDest = path.join(geminiDir, 'mcp.json');
|
|
210
|
+
if (copyFile(path.join(packageDir, 'mcp.json'), mcpDest)) {
|
|
211
|
+
fs.chmodSync(mcpDest, 0o600);
|
|
212
|
+
log.success('MCP servers configured (6 servers)');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Final message
|
|
217
|
+
console.log(`
|
|
218
|
+
${colors.green}╔═══════════════════════════════════════════════════════════╗
|
|
219
|
+
║ Installation Complete! ║
|
|
220
|
+
╚═══════════════════════════════════════════════════════════╝${colors.reset}
|
|
221
|
+
`);
|
|
222
|
+
|
|
223
|
+
if (claudeInstalled) {
|
|
224
|
+
console.log(`${colors.blue}Claude Code:${colors.reset}`);
|
|
225
|
+
console.log(' Run: claude');
|
|
226
|
+
console.log(' Bypass mode: claude --dangerously-skip-permissions');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (geminiInstalled) {
|
|
230
|
+
console.log(`${colors.blue}Gemini CLI:${colors.reset}`);
|
|
231
|
+
console.log(' Run: gemini');
|
|
232
|
+
console.log(' YOLO mode: gemini --yolo');
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
console.log(`
|
|
236
|
+
${colors.yellow}Documentation: ~/.claude/TERMUX.md${colors.reset}
|
|
237
|
+
${colors.yellow}GitHub: https://github.com/zesbe/termux-config${colors.reset}
|
|
238
|
+
`);
|
package/settings.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"model": {
|
|
3
|
+
"name": "gemini-2.5-flash"
|
|
4
|
+
},
|
|
5
|
+
"theme": "system",
|
|
6
|
+
"security": {
|
|
7
|
+
"allowedTools": [
|
|
8
|
+
"shell",
|
|
9
|
+
"read_file",
|
|
10
|
+
"write_file",
|
|
11
|
+
"edit_file",
|
|
12
|
+
"glob",
|
|
13
|
+
"grep",
|
|
14
|
+
"web_search",
|
|
15
|
+
"web_fetch"
|
|
16
|
+
],
|
|
17
|
+
"autoApprove": true
|
|
18
|
+
},
|
|
19
|
+
"superpowers": {
|
|
20
|
+
"enabled": true,
|
|
21
|
+
"path": "~/.gemini/superpowers"
|
|
22
|
+
},
|
|
23
|
+
"mcp": {
|
|
24
|
+
"enabled": true,
|
|
25
|
+
"configPath": "~/.gemini/mcp.json"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"agent": "proactive-mode",
|
|
3
|
+
"permissions": {
|
|
4
|
+
"allow": [
|
|
5
|
+
"Bash(git clone:*)",
|
|
6
|
+
"Bash(python3:*)",
|
|
7
|
+
"Bash(find:*)",
|
|
8
|
+
"Bash(node:*)",
|
|
9
|
+
"Bash(npm config set:*)",
|
|
10
|
+
"Bash(npm whoami:*)",
|
|
11
|
+
"Bash(git init:*)",
|
|
12
|
+
"Bash(git add:*)",
|
|
13
|
+
"Bash(git commit:*)",
|
|
14
|
+
"Bash(git push:*)",
|
|
15
|
+
"Bash(npm install:*)",
|
|
16
|
+
"Bash(npm publish:*)",
|
|
17
|
+
"Bash(npm view:*)",
|
|
18
|
+
"Bash(flutter:*)",
|
|
19
|
+
"Bash(go build:*)",
|
|
20
|
+
"Bash(go run:*)",
|
|
21
|
+
"Bash(systemctl:*)",
|
|
22
|
+
"Bash(docker:*)"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
api-development skill helps design and implement robust APIs following RESTful principles and GraphQL best practices.
|
|
2
|
+
|
|
3
|
+
For code review, check that:
|
|
4
|
+
1. API follows RESTful conventions (for REST APIs)
|
|
5
|
+
2. Proper HTTP status codes are used
|
|
6
|
+
3. Request/response validation is implemented
|
|
7
|
+
4. API documentation is complete (OpenAPI/Swagger)
|
|
8
|
+
5. Rate limiting is implemented
|
|
9
|
+
6. Versioning strategy is in place
|
|
10
|
+
7. Authentication and authorization are secure
|
|
11
|
+
8. Error handling is consistent and informative
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
openapi: 3.0.0
|
|
2
|
+
info:
|
|
3
|
+
title: API Documentation
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: API documentation for [Project Name]
|
|
6
|
+
contact:
|
|
7
|
+
name: [Contact Name]
|
|
8
|
+
email: [contact@domain.com]
|
|
9
|
+
license:
|
|
10
|
+
name: MIT
|
|
11
|
+
|
|
12
|
+
servers:
|
|
13
|
+
- url: https://api.example.com/v1
|
|
14
|
+
description: Production server
|
|
15
|
+
- url: https://staging-api.example.com/v1
|
|
16
|
+
description: Staging server
|
|
17
|
+
|
|
18
|
+
paths:
|
|
19
|
+
/users:
|
|
20
|
+
get:
|
|
21
|
+
summary: List all users
|
|
22
|
+
tags:
|
|
23
|
+
- Users
|
|
24
|
+
parameters:
|
|
25
|
+
- name: limit
|
|
26
|
+
in: query
|
|
27
|
+
schema:
|
|
28
|
+
type: integer
|
|
29
|
+
default: 10
|
|
30
|
+
- name: offset
|
|
31
|
+
in: query
|
|
32
|
+
schema:
|
|
33
|
+
type: integer
|
|
34
|
+
default: 0
|
|
35
|
+
responses:
|
|
36
|
+
'200':
|
|
37
|
+
description: List of users
|
|
38
|
+
content:
|
|
39
|
+
application/json:
|
|
40
|
+
schema:
|
|
41
|
+
type: object
|
|
42
|
+
properties:
|
|
43
|
+
users:
|
|
44
|
+
type: array
|
|
45
|
+
items:
|
|
46
|
+
$ref: '#/components/schemas/User'
|
|
47
|
+
total:
|
|
48
|
+
type: integer
|
|
49
|
+
'401':
|
|
50
|
+
$ref: '#/components/responses/Unauthorized'
|
|
51
|
+
|
|
52
|
+
/users/{id}:
|
|
53
|
+
get:
|
|
54
|
+
summary: Get user by ID
|
|
55
|
+
tags:
|
|
56
|
+
- Users
|
|
57
|
+
parameters:
|
|
58
|
+
- name: id
|
|
59
|
+
in: path
|
|
60
|
+
required: true
|
|
61
|
+
schema:
|
|
62
|
+
type: integer
|
|
63
|
+
responses:
|
|
64
|
+
'200':
|
|
65
|
+
description: User details
|
|
66
|
+
content:
|
|
67
|
+
application/json:
|
|
68
|
+
schema:
|
|
69
|
+
$ref: '#/components/schemas/User'
|
|
70
|
+
'404':
|
|
71
|
+
$ref: '#/components/responses/NotFound'
|
|
72
|
+
|
|
73
|
+
components:
|
|
74
|
+
schemas:
|
|
75
|
+
User:
|
|
76
|
+
type: object
|
|
77
|
+
required:
|
|
78
|
+
- id
|
|
79
|
+
- email
|
|
80
|
+
- name
|
|
81
|
+
properties:
|
|
82
|
+
id:
|
|
83
|
+
type: integer
|
|
84
|
+
example: 1
|
|
85
|
+
email:
|
|
86
|
+
type: string
|
|
87
|
+
format: email
|
|
88
|
+
example: user@example.com
|
|
89
|
+
name:
|
|
90
|
+
type: string
|
|
91
|
+
example: John Doe
|
|
92
|
+
created_at:
|
|
93
|
+
type: string
|
|
94
|
+
format: date-time
|
|
95
|
+
|
|
96
|
+
responses:
|
|
97
|
+
Unauthorized:
|
|
98
|
+
type: object
|
|
99
|
+
properties:
|
|
100
|
+
error:
|
|
101
|
+
type: string
|
|
102
|
+
example: Unauthorized
|
|
103
|
+
NotFound:
|
|
104
|
+
type: object
|
|
105
|
+
properties:
|
|
106
|
+
error:
|
|
107
|
+
type: string
|
|
108
|
+
example: Not Found
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brainstorming
|
|
3
|
+
description: Use when creating or developing, before writing code or implementation plans - refines rough ideas into fully-formed designs through collaborative questioning, alternative exploration, and incremental validation. Don't use during clear 'mechanical' processes
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Brainstorming Ideas Into Designs
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
|
|
11
|
+
|
|
12
|
+
Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design in small sections (200-300 words), checking after each section whether it looks right so far.
|
|
13
|
+
|
|
14
|
+
## The Process
|
|
15
|
+
|
|
16
|
+
**Understanding the idea:**
|
|
17
|
+
- Check out the current project state first (files, docs, recent commits)
|
|
18
|
+
- Ask questions one at a time to refine the idea
|
|
19
|
+
- Prefer multiple choice questions when possible, but open-ended is fine too
|
|
20
|
+
- Only one question per message - if a topic needs more exploration, break it into multiple questions
|
|
21
|
+
- Focus on understanding: purpose, constraints, success criteria
|
|
22
|
+
|
|
23
|
+
**Exploring approaches:**
|
|
24
|
+
- Propose 2-3 different approaches with trade-offs
|
|
25
|
+
- Present options conversationally with your recommendation and reasoning
|
|
26
|
+
- Lead with your recommended option and explain why
|
|
27
|
+
|
|
28
|
+
**Presenting the design:**
|
|
29
|
+
- Once you believe you understand what you're building, present the design
|
|
30
|
+
- Break it into sections of 200-300 words
|
|
31
|
+
- Ask after each section whether it looks right so far
|
|
32
|
+
- Cover: architecture, components, data flow, error handling, testing
|
|
33
|
+
- Be ready to go back and clarify if something doesn't make sense
|
|
34
|
+
|
|
35
|
+
## After the Design
|
|
36
|
+
|
|
37
|
+
**Documentation:**
|
|
38
|
+
- Write the validated design to `docs/plans/YYYY-MM-DD-<topic>-design.md`
|
|
39
|
+
- Use elements-of-style:writing-clearly-and-concisely skill if available
|
|
40
|
+
- Commit the design document to git
|
|
41
|
+
|
|
42
|
+
**Implementation (if continuing):**
|
|
43
|
+
- Ask: "Ready to set up for implementation?"
|
|
44
|
+
- Use superpowers:using-git-worktrees to create isolated workspace
|
|
45
|
+
- Use superpowers:writing-plans to create detailed implementation plan
|
|
46
|
+
|
|
47
|
+
## Key Principles
|
|
48
|
+
|
|
49
|
+
- **One question at a time** - Don't overwhelm with multiple questions
|
|
50
|
+
- **Multiple choice preferred** - Easier to answer than open-ended when possible
|
|
51
|
+
- **YAGNI ruthlessly** - Remove unnecessary features from all designs
|
|
52
|
+
- **Explore alternatives** - Always propose 2-3 approaches before settling
|
|
53
|
+
- **Incremental validation** - Present design in sections, validate each
|
|
54
|
+
- **Be flexible** - Go back and clarify when something doesn't make sense
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-quality
|
|
3
|
+
description: Use when the code has become difficult to understand, modify, or maintain, or when code smells or anti-patterns have accumulated - identify code smells, suggest improvements, and refactor systematically while preserving functionality
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Quality Skill
|
|
7
|
+
|
|
8
|
+
You are a Code Quality Expert specializing in improving code maintainability, readability, and structure. Your expertise includes:
|
|
9
|
+
|
|
10
|
+
- **Code Smell Detection**: Identify problematic code patterns
|
|
11
|
+
- **Refactoring Strategies**: Systematic approaches to improve code
|
|
12
|
+
- **Maintainability**: Make code easier to understand and modify
|
|
13
|
+
- **Documentation**: Ensure code is well-documented
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
|
|
17
|
+
Trigger this skill when:
|
|
18
|
+
|
|
19
|
+
- **Code Smell Accumulation**: Too many quick fixes have created technical debt
|
|
20
|
+
- **Readability Crisis**: Code has become difficult to understand
|
|
21
|
+
- **Maintenance Nightmare**: Changes keep breaking things
|
|
22
|
+
- "This code is a mess" or similar sentiments from the team
|
|
23
|
+
- **Performance Issues**: Code is slow or inefficient
|
|
24
|
+
- "Why is this so complex?" or similar questions
|
|
25
|
+
|
|
26
|
+
## Code Quality Fundamentals
|
|
27
|
+
|
|
28
|
+
### Identify Code Smells
|
|
29
|
+
|
|
30
|
+
Look for these common code smells:
|
|
31
|
+
|
|
32
|
+
#### 1. Duplicated Code
|
|
33
|
+
- Same logic appears in multiple places
|
|
34
|
+
- Copy-pasted code without abstraction
|
|
35
|
+
- Extract to function or method
|
|
36
|
+
|
|
37
|
+
#### 2. Long Methods/Functions
|
|
38
|
+
- Methods over 50-100 lines (depends on language)
|
|
39
|
+
- Doing too many things
|
|
40
|
+
- Break down into smaller functions
|
|
41
|
+
|
|
42
|
+
#### 3. Large Classes/Modules
|
|
43
|
+
- Class/module with too many responsibilities
|
|
44
|
+
- God object anti-pattern
|
|
45
|
+
- Apply Single Responsibility Principle
|
|
46
|
+
|
|
47
|
+
#### 4. Complex Conditionals
|
|
48
|
+
- Nested if/else or switch statements
|
|
49
|
+
- More than 3 levels of nesting
|
|
50
|
+
- Use guard clauses or early returns
|
|
51
|
+
|
|
52
|
+
#### 5. Magic Numbers/Strings
|
|
53
|
+
- Hardcoded values without explanation
|
|
54
|
+
- Create constants or configuration
|
|
55
|
+
|
|
56
|
+
#### 6. Poor Naming
|
|
57
|
+
- cryptic variable names (a, b, x, tmp, temp)
|
|
58
|
+
- Names that don't describe purpose
|
|
59
|
+
- Use descriptive names
|
|
60
|
+
|
|
61
|
+
#### 7. Dead Code
|
|
62
|
+
- Commented out code that should be removed
|
|
63
|
+
- Unused variables/functions
|
|
64
|
+
- Import statements for unused items
|
|
65
|
+
|
|
66
|
+
#### 8. God Methods
|
|
67
|
+
- Methods that do too much
|
|
68
|
+
- Try to do everything in one function
|
|
69
|
+
- Break down into smaller, testable units
|
|
70
|
+
|
|
71
|
+
## Quality Indicators
|
|
72
|
+
|
|
73
|
+
Good code should be:
|
|
74
|
+
- ✅ **Readable**: Self-documenting with clear names
|
|
75
|
+
- ✅ **Modular**: Broken into small, focused units
|
|
76
|
+
- ✅ **Testable**: Easy to unit test in isolation
|
|
77
|
+
- ✅ **Maintainable**: Easy to modify without breaking things
|
|
78
|
+
- ✅ **Well-Documented**: Comments explain WHY not WHAT
|
|
79
|
+
- ✅ **Consistent**: Follows team conventions and patterns
|
|
80
|
+
|
|
81
|
+
## Refactoring Process
|
|
82
|
+
|
|
83
|
+
### Phase 1: Analyze
|
|
84
|
+
1. Read the target code thoroughly
|
|
85
|
+
2. Understand what it does and why it exists
|
|
86
|
+
3. Identify specific code smells
|
|
87
|
+
4. Determine refactoring priority
|
|
88
|
+
|
|
89
|
+
### Phase 2: Plan
|
|
90
|
+
1. List all identified issues
|
|
91
|
+
2. Categorize by severity (high/medium/low)
|
|
92
|
+
3. Identify dependencies between issues
|
|
93
|
+
4. Create refactoring strategy
|
|
94
|
+
|
|
95
|
+
### Phase 3: Execute
|
|
96
|
+
1. Start with easiest wins (low hanging fruit)
|
|
97
|
+
2. Refactor incrementally with tests at each step
|
|
98
|
+
3. Run tests after each change
|
|
99
|
+
4. Update documentation
|
|
100
|
+
|
|
101
|
+
### Phase 4: Verify
|
|
102
|
+
1. Ensure all tests still pass
|
|
103
|
+
2. Check performance hasn't degraded
|
|
104
|
+
3. Get code review if available
|
|
105
|
+
4. Update documentation
|
|
106
|
+
|
|
107
|
+
## Refactoring Techniques
|
|
108
|
+
|
|
109
|
+
### Extract Method
|
|
110
|
+
- Break large method into smaller methods
|
|
111
|
+
- Each method does one thing well
|
|
112
|
+
- Use meaningful names
|
|
113
|
+
|
|
114
|
+
### Extract Class
|
|
115
|
+
- Extract related functionality into new class
|
|
116
|
+
- Single Responsibility Principle
|
|
117
|
+
- Reduce class size
|
|
118
|
+
|
|
119
|
+
### Replace Magic with Constants
|
|
120
|
+
```python
|
|
121
|
+
# Before
|
|
122
|
+
if user_age > 18: # What is 18?
|
|
123
|
+
return True
|
|
124
|
+
|
|
125
|
+
# After
|
|
126
|
+
ADULT_AGE = 18
|
|
127
|
+
if user_age > ADULT_AGE:
|
|
128
|
+
return True
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Simplify Conditionals
|
|
132
|
+
```python
|
|
133
|
+
# Before
|
|
134
|
+
if condition_a and condition_b:
|
|
135
|
+
do_thing()
|
|
136
|
+
elif condition_c:
|
|
137
|
+
do_alternative()
|
|
138
|
+
else:
|
|
139
|
+
do_default()
|
|
140
|
+
|
|
141
|
+
# After
|
|
142
|
+
if is_adult(): # Guard clause
|
|
143
|
+
do_thing()
|
|
144
|
+
return
|
|
145
|
+
do_alternative()
|
|
146
|
+
do_default()
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Extract Variable/Function
|
|
150
|
+
- Extract repeated logic into reusable components
|
|
151
|
+
- Reduce duplication, improve maintainability
|
|
152
|
+
|
|
153
|
+
## Performance Considerations
|
|
154
|
+
|
|
155
|
+
- Don't optimize prematurely
|
|
156
|
+
- Measure before optimizing
|
|
157
|
+
- Profile to find real bottlenecks
|
|
158
|
+
- Consider time vs space trade-offs
|
|
159
|
+
|
|
160
|
+
## Testing Quality
|
|
161
|
+
|
|
162
|
+
- Ensure 100% test coverage on refactored code
|
|
163
|
+
- Don't break existing functionality
|
|
164
|
+
- Add tests for new extracted functions
|
|
165
|
+
|
|
166
|
+
## Document Changes
|
|
167
|
+
|
|
168
|
+
- Update JSDoc comments/docstrings
|
|
169
|
+
- Update README if public API changes
|
|
170
|
+
- Document refactoring reason
|
|
171
|
+
- Update architecture diagrams if needed
|
|
172
|
+
|
|
173
|
+
## Output
|
|
174
|
+
|
|
175
|
+
Provide:
|
|
176
|
+
|
|
177
|
+
1. **Code Quality Assessment**:
|
|
178
|
+
- List found code smells
|
|
179
|
+
- Severity: Critical/High/Medium/Low
|
|
180
|
+
|
|
181
|
+
2. **Refactoring Plan**:
|
|
182
|
+
- List of refactorings with priorities
|
|
183
|
+
- Estimated time for each refactoring
|
|
184
|
+
|
|
185
|
+
3. Execute refactorings:
|
|
186
|
+
- Run tests after each refactoring step
|
|
187
|
+
- Update documentation
|
|
188
|
+
|
|
189
|
+
4. Quality Metrics:
|
|
190
|
+
- Cyclomatic complexity (lower is better)
|
|
191
|
+
- Lines of code (should decrease)
|
|
192
|
+
- Test coverage (should maintain 100%)
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
**Remember**: The best refactoring is the one that makes the code simpler, not more complex!
|