specialist-agent 1.6.0 → 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/.claude-plugin/marketplace.json +77 -0
- package/.claude-plugin/plugin.json +43 -0
- package/.codex/INSTALL.md +113 -0
- package/.cursor-plugin/marketplace.json +9 -0
- package/.cursor-plugin/plugin.json +35 -0
- package/.opencode/INSTALL.md +123 -0
- package/README.md +204 -263
- package/agents/analyst-lite.md +48 -0
- package/agents/analyst.md +391 -0
- package/agents/api-lite.md +43 -0
- package/agents/api.md +145 -0
- package/agents/cloud-lite.md +1 -1
- package/agents/cloud.md +1 -1
- package/agents/data-lite.md +1 -1
- package/agents/data.md +1 -1
- package/agents/debugger-lite.md +46 -0
- package/agents/debugger.md +406 -0
- package/agents/deps-lite.md +41 -0
- package/agents/deps.md +206 -0
- package/agents/designer-lite.md +1 -1
- package/agents/designer.md +1 -1
- package/agents/devops-lite.md +1 -1
- package/agents/devops.md +1 -1
- package/agents/docs-lite.md +42 -0
- package/agents/docs.md +197 -0
- package/agents/executor-lite.md +61 -0
- package/agents/executor.md +456 -0
- package/agents/explorer-lite.md +1 -1
- package/agents/explorer.md +1 -1
- package/agents/finance-lite.md +1 -1
- package/agents/finance.md +1 -1
- package/agents/i18n-lite.md +44 -0
- package/agents/i18n.md +198 -0
- package/agents/legal-lite.md +1 -1
- package/agents/legal.md +1 -1
- package/agents/memory.md +240 -0
- package/agents/orchestrator-lite.md +40 -0
- package/agents/orchestrator.md +387 -0
- package/agents/pair-lite.md +38 -0
- package/agents/pair.md +308 -0
- package/agents/perf-lite.md +42 -0
- package/agents/perf.md +141 -0
- package/agents/planner-lite.md +59 -0
- package/agents/planner.md +265 -0
- package/agents/refactor-lite.md +42 -0
- package/agents/refactor.md +178 -0
- package/agents/scout-lite.md +37 -0
- package/agents/scout.md +222 -0
- package/agents/security-lite.md +1 -1
- package/agents/security.md +1 -1
- package/agents/starter-lite.md +1 -1
- package/agents/starter.md +1 -1
- package/agents/tdd-lite.md +43 -0
- package/agents/tdd.md +317 -0
- package/agents/tester-lite.md +1 -1
- package/agents/tester.md +1 -1
- package/cli/index.mjs +636 -15
- package/hooks/after-review.mjs +130 -0
- package/hooks/after-task.mjs +117 -0
- package/hooks/before-plan.mjs +155 -0
- package/hooks/before-review.mjs +139 -0
- package/hooks/hooks.json +81 -0
- package/hooks/native/auto-dispatch.mjs +197 -0
- package/hooks/native/auto-format.mjs +193 -0
- package/hooks/native/security-config.json +31 -0
- package/hooks/native/security-guard.mjs +267 -0
- package/hooks/native/session-context.mjs +136 -0
- package/hooks/native/settings-template.json +50 -0
- package/hooks/native/utils.mjs +62 -0
- package/hooks/on-error.mjs +129 -0
- package/hooks/session-end.mjs +185 -0
- package/hooks/session-start.mjs +154 -0
- package/package.json +16 -3
- package/packs/nextjs/agents/builder.md +24 -1
- package/packs/nextjs/agents/doctor.md +70 -4
- package/packs/nextjs/agents/migrator.md +24 -1
- package/packs/nextjs/agents/reviewer.md +93 -3
- package/packs/nextjs/agents-lite/builder.md +1 -1
- package/packs/nextjs/agents-lite/doctor.md +1 -1
- package/packs/nextjs/agents-lite/migrator.md +1 -1
- package/packs/nextjs/agents-lite/reviewer.md +1 -1
- package/packs/nextjs/skills/dev-create-component/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-hook/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-module/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-service/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-test/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-generate-types/SKILL.md +1 -1
- package/packs/nextjs/skills/docs-onboard/SKILL.md +1 -1
- package/packs/nextjs/skills/migration-migrate-component/SKILL.md +1 -1
- package/packs/nextjs/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/nextjs/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/nextjs/skills/review-fix-violations/SKILL.md +1 -1
- package/packs/nextjs/skills/review-review/SKILL.md +1 -1
- package/packs/react/agents/builder.md +24 -1
- package/packs/react/agents/doctor.md +107 -13
- package/packs/react/agents/migrator.md +24 -1
- package/packs/react/agents/reviewer.md +113 -9
- package/packs/react/agents-lite/builder.md +1 -1
- package/packs/react/agents-lite/doctor.md +1 -1
- package/packs/react/agents-lite/migrator.md +1 -1
- package/packs/react/agents-lite/reviewer.md +1 -1
- package/packs/react/skills/dev-create-component/SKILL.md +1 -1
- package/packs/react/skills/dev-create-hook/SKILL.md +1 -1
- package/packs/react/skills/dev-create-module/SKILL.md +1 -1
- package/packs/react/skills/dev-create-service/SKILL.md +1 -1
- package/packs/react/skills/dev-create-test/SKILL.md +1 -1
- package/packs/react/skills/dev-generate-types/SKILL.md +1 -1
- package/packs/react/skills/docs-onboard/SKILL.md +1 -1
- package/packs/react/skills/migration-migrate-component/SKILL.md +1 -1
- package/packs/react/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/react/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/react/skills/review-fix-violations/SKILL.md +1 -1
- package/packs/react/skills/review-review/SKILL.md +1 -1
- package/packs/svelte/agents/builder.md +24 -1
- package/packs/svelte/agents/doctor.md +70 -4
- package/packs/svelte/agents/migrator.md +24 -1
- package/packs/svelte/agents/reviewer.md +93 -3
- package/packs/svelte/agents-lite/builder.md +1 -1
- package/packs/svelte/agents-lite/doctor.md +1 -1
- package/packs/svelte/agents-lite/migrator.md +1 -1
- package/packs/svelte/agents-lite/reviewer.md +1 -1
- package/packs/svelte/skills/dev-create-component/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-module/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-service/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-store/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-test/SKILL.md +1 -1
- package/packs/svelte/skills/dev-generate-types/SKILL.md +1 -1
- package/packs/svelte/skills/docs-onboard/SKILL.md +1 -1
- package/packs/svelte/skills/migration-migrate-component/SKILL.md +1 -1
- package/packs/svelte/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/svelte/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/svelte/skills/review-fix-violations/SKILL.md +1 -1
- package/packs/svelte/skills/review-review/SKILL.md +1 -1
- package/packs/vue/agents/builder.md +24 -1
- package/packs/vue/agents/doctor.md +107 -13
- package/packs/vue/agents/migrator.md +24 -1
- package/packs/vue/agents/reviewer.md +113 -9
- package/packs/vue/agents-lite/builder.md +1 -1
- package/packs/vue/agents-lite/doctor.md +1 -1
- package/packs/vue/agents-lite/migrator.md +1 -1
- package/packs/vue/agents-lite/reviewer.md +1 -1
- package/packs/vue/skills/dev-create-component/SKILL.md +1 -1
- package/packs/vue/skills/dev-create-composable/SKILL.md +1 -1
- package/packs/vue/skills/dev-create-module/SKILL.md +1 -1
- package/packs/vue/skills/dev-create-service/SKILL.md +1 -1
- package/packs/vue/skills/dev-create-test/SKILL.md +1 -1
- package/packs/vue/skills/dev-generate-types/SKILL.md +1 -1
- package/packs/vue/skills/docs-onboard/SKILL.md +1 -1
- package/packs/vue/skills/migration-migrate-component/SKILL.md +1 -1
- package/packs/vue/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/vue/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/vue/skills/review-fix-violations/SKILL.md +1 -1
- package/packs/vue/skills/review-review/SKILL.md +1 -1
- package/skills/audit/SKILL.md +169 -0
- package/skills/brainstorm/SKILL.md +245 -0
- package/skills/checkpoint/SKILL.md +209 -0
- package/skills/debug/SKILL.md +210 -0
- package/skills/estimate/SKILL.md +145 -0
- package/skills/finish/SKILL.md +211 -0
- package/skills/health/SKILL.md +242 -0
- package/skills/learn/SKILL.md +260 -0
- package/skills/migrate-framework/SKILL.md +172 -0
- package/skills/onboard/SKILL.md +168 -0
- package/skills/plan/SKILL.md +132 -0
- package/skills/recall/SKILL.md +150 -0
- package/skills/remember/SKILL.md +158 -0
- package/skills/tdd/SKILL.md +156 -0
- package/skills/tutorial/SKILL.md +346 -0
- package/skills/verify/SKILL.md +168 -0
- package/skills/worktree/SKILL.md +168 -0
- package/skills/write-skill/SKILL.md +213 -0
- package/templates/industry/ecommerce.md +127 -0
- package/templates/industry/fintech.md +161 -0
- package/templates/industry/saas.md +134 -0
- package/templates/session-memory.json +48 -0
- package/templates/skill-template/SKILL.md +90 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Session End Hook
|
|
5
|
+
*
|
|
6
|
+
* Runs when a session ends (manually triggered or detected).
|
|
7
|
+
*
|
|
8
|
+
* Actions:
|
|
9
|
+
* - Generates session summary
|
|
10
|
+
* - Saves metrics to history
|
|
11
|
+
* - Cleans up temporary data
|
|
12
|
+
* - Updates session memory
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
16
|
+
import { join } from 'path';
|
|
17
|
+
|
|
18
|
+
const SESSION_FILE = '.claude/metrics/current-session.json';
|
|
19
|
+
const HISTORY_DIR = '.claude/metrics/history';
|
|
20
|
+
const MEMORY_FILE = '.claude/session-memory.json';
|
|
21
|
+
|
|
22
|
+
async function main() {
|
|
23
|
+
console.log('\n════════════════════════════════════════');
|
|
24
|
+
console.log(' SESSION SUMMARY ');
|
|
25
|
+
console.log('════════════════════════════════════════\n');
|
|
26
|
+
|
|
27
|
+
// 1. Load session data
|
|
28
|
+
const session = loadSession();
|
|
29
|
+
if (!session) {
|
|
30
|
+
console.log('No active session to summarize.');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 2. Calculate final metrics
|
|
35
|
+
const metrics = calculateMetrics(session);
|
|
36
|
+
|
|
37
|
+
// 3. Display summary
|
|
38
|
+
displaySummary(session, metrics);
|
|
39
|
+
|
|
40
|
+
// 4. Compare with competitors
|
|
41
|
+
displayComparison(metrics);
|
|
42
|
+
|
|
43
|
+
// 5. Save to history
|
|
44
|
+
saveToHistory(session, metrics);
|
|
45
|
+
|
|
46
|
+
// 6. Clean up
|
|
47
|
+
cleanup();
|
|
48
|
+
|
|
49
|
+
console.log('\n════════════════════════════════════════\n');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function loadSession() {
|
|
53
|
+
if (!existsSync(SESSION_FILE)) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const session = JSON.parse(readFileSync(SESSION_FILE, 'utf-8'));
|
|
59
|
+
session.endTime = new Date().toISOString();
|
|
60
|
+
return session;
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function calculateMetrics(session) {
|
|
67
|
+
const startTime = new Date(session.startTime);
|
|
68
|
+
const endTime = new Date(session.endTime);
|
|
69
|
+
const durationMs = endTime - startTime;
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
duration: formatDuration(durationMs),
|
|
73
|
+
durationMs,
|
|
74
|
+
tasksCompleted: session.tasks.length,
|
|
75
|
+
tasksFailed: session.errors.length,
|
|
76
|
+
totalTokens: session.tokens.estimated,
|
|
77
|
+
estimatedCost: session.tokens.estimated * 0.000015, // ~Sonnet pricing
|
|
78
|
+
filesCreated: [...new Set(session.files.created)].length,
|
|
79
|
+
filesModified: [...new Set(session.files.modified)].length,
|
|
80
|
+
agentsUsed: session.agents.length,
|
|
81
|
+
skillsUsed: session.skills.length,
|
|
82
|
+
checkpointsCreated: session.checkpoints.length,
|
|
83
|
+
tokensPerTask: session.tasks.length > 0
|
|
84
|
+
? Math.round(session.tokens.estimated / session.tasks.length)
|
|
85
|
+
: 0
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function formatDuration(ms) {
|
|
90
|
+
const seconds = Math.floor(ms / 1000);
|
|
91
|
+
const minutes = Math.floor(seconds / 60);
|
|
92
|
+
const hours = Math.floor(minutes / 60);
|
|
93
|
+
|
|
94
|
+
if (hours > 0) {
|
|
95
|
+
return `${hours}h ${minutes % 60}m`;
|
|
96
|
+
} else if (minutes > 0) {
|
|
97
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
98
|
+
} else {
|
|
99
|
+
return `${seconds}s`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function displaySummary(session, metrics) {
|
|
104
|
+
console.log('──── Overview ────');
|
|
105
|
+
console.log(`Session ID: ${session.sessionId}`);
|
|
106
|
+
console.log(`Duration: ${metrics.duration}`);
|
|
107
|
+
console.log(`Status: ${metrics.tasksFailed > 0 ? '⚠ Completed with errors' : '✓ Completed successfully'}`);
|
|
108
|
+
|
|
109
|
+
console.log('\n──── Tasks ────');
|
|
110
|
+
console.log(`Completed: ${metrics.tasksCompleted}`);
|
|
111
|
+
console.log(`Errors: ${metrics.tasksFailed}`);
|
|
112
|
+
|
|
113
|
+
console.log('\n──── Files ────');
|
|
114
|
+
console.log(`Created: ${metrics.filesCreated}`);
|
|
115
|
+
console.log(`Modified: ${metrics.filesModified}`);
|
|
116
|
+
|
|
117
|
+
console.log('\n──── Token Usage ────');
|
|
118
|
+
console.log(`Total tokens: ~${metrics.totalTokens.toLocaleString()}`);
|
|
119
|
+
console.log(`Per task avg: ~${metrics.tokensPerTask.toLocaleString()}`);
|
|
120
|
+
console.log(`Estimated cost: ~$${metrics.estimatedCost.toFixed(2)}`);
|
|
121
|
+
|
|
122
|
+
console.log('\n──── Agents & Skills ────');
|
|
123
|
+
if (session.agents.length > 0) {
|
|
124
|
+
console.log(`Agents: ${session.agents.join(', ')}`);
|
|
125
|
+
}
|
|
126
|
+
if (session.skills.length > 0) {
|
|
127
|
+
console.log(`Skills: ${session.skills.join(', ')}`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (session.checkpoints.length > 0) {
|
|
131
|
+
console.log(`\nCheckpoints: ${session.checkpoints.length} created`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (session.errors.length > 0) {
|
|
135
|
+
console.log('\n──── Errors ────');
|
|
136
|
+
session.errors.forEach((err, i) => {
|
|
137
|
+
console.log(`${i + 1}. [${err.agent}] ${err.message}`);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function displayComparison(metrics) {
|
|
143
|
+
// Estimate what Superpowers would cost for same work
|
|
144
|
+
// They use O(n²) scaling, we use linear
|
|
145
|
+
const superpowersEstimate = metrics.tasksCompleted > 1
|
|
146
|
+
? metrics.estimatedCost * Math.pow(metrics.tasksCompleted, 1.5)
|
|
147
|
+
: metrics.estimatedCost * 1.5;
|
|
148
|
+
|
|
149
|
+
const savings = ((superpowersEstimate - metrics.estimatedCost) / superpowersEstimate * 100).toFixed(0);
|
|
150
|
+
|
|
151
|
+
console.log('\n──── Cost Comparison ────');
|
|
152
|
+
console.log(`Specialist Agent: ~$${metrics.estimatedCost.toFixed(2)}`);
|
|
153
|
+
console.log(`Superpowers (est): ~$${superpowersEstimate.toFixed(2)}`);
|
|
154
|
+
console.log(`Savings: ~${savings}%`);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function saveToHistory(session, metrics) {
|
|
158
|
+
if (!existsSync(HISTORY_DIR)) {
|
|
159
|
+
mkdirSync(HISTORY_DIR, { recursive: true });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const historyFile = join(HISTORY_DIR, `${session.sessionId}.json`);
|
|
163
|
+
const historyData = {
|
|
164
|
+
...session,
|
|
165
|
+
metrics
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
writeFileSync(historyFile, JSON.stringify(historyData, null, 2));
|
|
169
|
+
console.log(`\n✓ Session saved to ${historyFile}`);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function cleanup() {
|
|
173
|
+
// Remove current session file
|
|
174
|
+
try {
|
|
175
|
+
if (existsSync(SESSION_FILE)) {
|
|
176
|
+
// Keep it for now, can be deleted manually
|
|
177
|
+
console.log('ℹ Session file preserved for review');
|
|
178
|
+
}
|
|
179
|
+
} catch {
|
|
180
|
+
// Ignore cleanup errors
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Run
|
|
185
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Session Start Hook
|
|
5
|
+
*
|
|
6
|
+
* Runs when a new Claude Code session starts.
|
|
7
|
+
*
|
|
8
|
+
* Actions:
|
|
9
|
+
* - Validates project setup
|
|
10
|
+
* - Initializes metrics tracking
|
|
11
|
+
* - Creates session restore point
|
|
12
|
+
* - Loads session memory (if enabled)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { execSync } from 'child_process';
|
|
16
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
|
|
17
|
+
import { join } from 'path';
|
|
18
|
+
|
|
19
|
+
const METRICS_DIR = '.claude/metrics';
|
|
20
|
+
const SESSION_FILE = '.claude/metrics/current-session.json';
|
|
21
|
+
|
|
22
|
+
async function main() {
|
|
23
|
+
const startTime = new Date().toISOString();
|
|
24
|
+
const sessionId = `session-${Date.now()}`;
|
|
25
|
+
|
|
26
|
+
console.log('──── Session Start ────');
|
|
27
|
+
|
|
28
|
+
// 1. Validate project setup
|
|
29
|
+
validateSetup();
|
|
30
|
+
|
|
31
|
+
// 2. Initialize metrics directory
|
|
32
|
+
initializeMetrics(sessionId, startTime);
|
|
33
|
+
|
|
34
|
+
// 3. Create session restore point
|
|
35
|
+
createRestorePoint(sessionId);
|
|
36
|
+
|
|
37
|
+
// 4. Load previous session memory (if exists)
|
|
38
|
+
loadSessionMemory();
|
|
39
|
+
|
|
40
|
+
// 5. Display session info
|
|
41
|
+
displaySessionInfo(sessionId, startTime);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function validateSetup() {
|
|
45
|
+
const checks = [
|
|
46
|
+
{ path: '.claude', name: 'Claude directory' },
|
|
47
|
+
{ path: 'CLAUDE.md', name: 'CLAUDE.md config' },
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
let allValid = true;
|
|
51
|
+
|
|
52
|
+
for (const check of checks) {
|
|
53
|
+
if (existsSync(check.path)) {
|
|
54
|
+
console.log(`✓ ${check.name}`);
|
|
55
|
+
} else {
|
|
56
|
+
console.log(`✗ ${check.name} missing`);
|
|
57
|
+
allValid = false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!allValid) {
|
|
62
|
+
console.log('\nRun "npx specialist-agent init" to set up.');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function initializeMetrics(sessionId, startTime) {
|
|
67
|
+
if (!existsSync(METRICS_DIR)) {
|
|
68
|
+
mkdirSync(METRICS_DIR, { recursive: true });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const sessionData = {
|
|
72
|
+
sessionId,
|
|
73
|
+
startTime,
|
|
74
|
+
endTime: null,
|
|
75
|
+
duration: null,
|
|
76
|
+
agents: [],
|
|
77
|
+
skills: [],
|
|
78
|
+
tasks: [],
|
|
79
|
+
tokens: {
|
|
80
|
+
estimated: 0,
|
|
81
|
+
input: 0,
|
|
82
|
+
output: 0
|
|
83
|
+
},
|
|
84
|
+
files: {
|
|
85
|
+
created: [],
|
|
86
|
+
modified: [],
|
|
87
|
+
deleted: []
|
|
88
|
+
},
|
|
89
|
+
checkpoints: [],
|
|
90
|
+
errors: []
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
writeFileSync(SESSION_FILE, JSON.stringify(sessionData, null, 2));
|
|
94
|
+
console.log(`✓ Metrics initialized`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function createRestorePoint(sessionId) {
|
|
98
|
+
try {
|
|
99
|
+
// Check if in git repo
|
|
100
|
+
execSync('git rev-parse --git-dir', { stdio: 'pipe' });
|
|
101
|
+
|
|
102
|
+
// Check for uncommitted changes
|
|
103
|
+
const status = execSync('git status --porcelain', { encoding: 'utf-8' });
|
|
104
|
+
|
|
105
|
+
if (status.trim()) {
|
|
106
|
+
console.log('⚠ Uncommitted changes detected');
|
|
107
|
+
console.log(' Consider committing before major changes');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Create restore point tag
|
|
111
|
+
const tagName = `restore-point/${sessionId}`;
|
|
112
|
+
try {
|
|
113
|
+
execSync(`git tag ${tagName}`, { stdio: 'pipe' });
|
|
114
|
+
console.log(`✓ Restore point: ${tagName}`);
|
|
115
|
+
} catch {
|
|
116
|
+
// Tag might already exist or no commits yet
|
|
117
|
+
console.log('ℹ Restore point not created (no commits or already exists)');
|
|
118
|
+
}
|
|
119
|
+
} catch {
|
|
120
|
+
console.log('ℹ Not a git repository');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function loadSessionMemory() {
|
|
125
|
+
const memoryFile = '.claude/session-memory.json';
|
|
126
|
+
|
|
127
|
+
if (existsSync(memoryFile)) {
|
|
128
|
+
try {
|
|
129
|
+
const memory = JSON.parse(readFileSync(memoryFile, 'utf-8'));
|
|
130
|
+
const decisions = memory.decisions || [];
|
|
131
|
+
|
|
132
|
+
if (decisions.length > 0) {
|
|
133
|
+
console.log(`\n📝 Session Memory (${decisions.length} decisions):`);
|
|
134
|
+
// Show last 3 decisions
|
|
135
|
+
decisions.slice(-3).forEach(d => {
|
|
136
|
+
console.log(` • ${d.topic}: ${d.decision}`);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
} catch {
|
|
140
|
+
// Invalid memory file, ignore
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function displaySessionInfo(sessionId, startTime) {
|
|
146
|
+
console.log('\n──── Ready ────');
|
|
147
|
+
console.log(`Session: ${sessionId}`);
|
|
148
|
+
console.log(`Started: ${new Date(startTime).toLocaleString()}`);
|
|
149
|
+
console.log('\nAvailable agents: @planner @builder @reviewer @tdd @debugger');
|
|
150
|
+
console.log('Available skills: /plan /tdd /debug /checkpoint /estimate /finish');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Run
|
|
154
|
+
main().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specialist-agent",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI agents for Claude Code — any framework, any stack",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
"cli",
|
|
11
11
|
"agents",
|
|
12
12
|
"packs",
|
|
13
|
+
"skills",
|
|
14
|
+
"hooks",
|
|
15
|
+
".claude-plugin",
|
|
16
|
+
".cursor-plugin",
|
|
17
|
+
".codex",
|
|
18
|
+
".opencode",
|
|
19
|
+
"templates",
|
|
13
20
|
"README.md",
|
|
14
21
|
"LICENSE"
|
|
15
22
|
],
|
|
@@ -17,7 +24,8 @@
|
|
|
17
24
|
"prepare": "husky",
|
|
18
25
|
"docs:dev": "vitepress dev docs",
|
|
19
26
|
"docs:build": "vitepress build docs",
|
|
20
|
-
"docs:preview": "vitepress preview docs"
|
|
27
|
+
"docs:preview": "vitepress preview docs",
|
|
28
|
+
"test:hooks": "node tests/test-native-hooks.mjs"
|
|
21
29
|
},
|
|
22
30
|
"devDependencies": {
|
|
23
31
|
"@commitlint/cli": "^20.4.2",
|
|
@@ -35,7 +43,12 @@
|
|
|
35
43
|
"nextjs",
|
|
36
44
|
"svelte",
|
|
37
45
|
"developer-tools",
|
|
38
|
-
"code-generation"
|
|
46
|
+
"code-generation",
|
|
47
|
+
"tdd",
|
|
48
|
+
"code-review",
|
|
49
|
+
"debugging",
|
|
50
|
+
"cursor",
|
|
51
|
+
"codex"
|
|
39
52
|
],
|
|
40
53
|
"engines": {
|
|
41
54
|
"node": ">=18"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: builder
|
|
3
|
-
description: "
|
|
3
|
+
description: "Use when creating new modules, components, services, hooks, or pages in an existing project."
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -158,6 +158,28 @@ export function XxxComponent({ items, onSelect }: XxxComponentProps) {
|
|
|
158
158
|
5. Hook tests: use `renderHook()` from `@testing-library/react`
|
|
159
159
|
6. Run: `npx vitest run [file]`
|
|
160
160
|
|
|
161
|
+
## Verification Protocol
|
|
162
|
+
|
|
163
|
+
**Before claiming ANY module/component is complete:**
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
1. RUN `npx tsc --noEmit` — No TypeScript errors
|
|
167
|
+
2. RUN `npm test` — All tests pass
|
|
168
|
+
3. RUN `npm run lint` — No lint errors
|
|
169
|
+
4. VERIFY files exist as specified
|
|
170
|
+
5. ONLY THEN claim "complete" WITH evidence
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Anti-Rationalization
|
|
174
|
+
|
|
175
|
+
| Excuse | Reality |
|
|
176
|
+
|--------|---------|
|
|
177
|
+
| "It compiles, so it works" | Compiling is not testing. Run the tests. |
|
|
178
|
+
| "I'll add tests later" | Later never comes. Tests are part of "complete." |
|
|
179
|
+
| "It's just boilerplate" | Boilerplate has typos. Verify. |
|
|
180
|
+
| "The pattern is proven" | Proven patterns with wrong inputs still fail. |
|
|
181
|
+
| "Types are enough validation" | Types catch type errors, not logic errors. Test. |
|
|
182
|
+
|
|
161
183
|
## Rules
|
|
162
184
|
- Follow ARCHITECTURE.md strictly
|
|
163
185
|
- Modules don't import from each other (use shared/)
|
|
@@ -168,6 +190,7 @@ export function XxxComponent({ items, onSelect }: XxxComponentProps) {
|
|
|
168
190
|
- Client Components: `'use client'` directive, hooks allowed
|
|
169
191
|
- Server Actions: `'use server'` directive, revalidatePath after mutations
|
|
170
192
|
- Components: typed props, < 200 lines
|
|
193
|
+
- **Verify before claiming complete** — Tests pass = complete
|
|
171
194
|
|
|
172
195
|
## Output
|
|
173
196
|
|
|
@@ -1,17 +1,61 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: doctor
|
|
3
|
-
description: "
|
|
4
|
-
tools: Read, Bash, Glob, Grep
|
|
3
|
+
description: "Use when encountering bugs, unexpected behavior, console errors, or test failures that need systematic investigation."
|
|
4
|
+
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Doctor
|
|
7
|
+
# Doctor — Systematic 4-Phase Debugging
|
|
8
8
|
|
|
9
9
|
## Mission
|
|
10
|
-
Investigate bugs
|
|
10
|
+
Investigate bugs using systematic 4-phase methodology. Never guess — build hypotheses from evidence and prove them before fixing.
|
|
11
11
|
|
|
12
12
|
## First Action
|
|
13
13
|
Read `docs/ARCHITECTURE.md` to understand the expected data flow.
|
|
14
14
|
|
|
15
|
+
## 4-Phase Methodology
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
┌──────────────────────────────────────────────────────────────────┐
|
|
19
|
+
│ Phase 1 Phase 2 Phase 3 Phase 4 │
|
|
20
|
+
│ ┌─────────┐ ┌──────────┐ ┌───────────┐ ┌───────────┐ │
|
|
21
|
+
│ │ GATHER │ ─► │ ANALYZE │ ─► │ FORMULATE │ ─► │ IMPLEMENT │ │
|
|
22
|
+
│ │ Evidence│ │ Patterns │ │ Hypothesis│ │ & Prove │ │
|
|
23
|
+
│ └─────────┘ └──────────┘ └───────────┘ └───────────┘ │
|
|
24
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Phase 1: GATHER EVIDENCE
|
|
28
|
+
- Read the COMPLETE error message and stack trace
|
|
29
|
+
- Reproduce consistently (document exact steps)
|
|
30
|
+
- Identify: Server error? Client error? Hydration mismatch?
|
|
31
|
+
- Check recent changes: `git log --oneline -10`
|
|
32
|
+
|
|
33
|
+
**⛔ BLOCKED** until evidence collected.
|
|
34
|
+
|
|
35
|
+
### Phase 2: ANALYZE PATTERNS
|
|
36
|
+
- Trace execution path: entry → error location
|
|
37
|
+
- Check RSC vs Client Component boundaries
|
|
38
|
+
- Compare with working code
|
|
39
|
+
- Identify: consistent or intermittent? data-dependent?
|
|
40
|
+
|
|
41
|
+
**⛔ BLOCKED** until patterns identified.
|
|
42
|
+
|
|
43
|
+
### Phase 3: FORMULATE HYPOTHESIS
|
|
44
|
+
- Generate MULTIPLE hypotheses (not just one)
|
|
45
|
+
- Rank by probability
|
|
46
|
+
- Design test for each
|
|
47
|
+
|
|
48
|
+
**⛔ BLOCKED** until hypotheses formulated.
|
|
49
|
+
|
|
50
|
+
### Phase 4: IMPLEMENT & PROVE
|
|
51
|
+
- Test primary hypothesis
|
|
52
|
+
- If confirmed → Write test that reproduces bug → Fix → Verify
|
|
53
|
+
- If rejected → Test next hypothesis
|
|
54
|
+
- Create checkpoint after fix
|
|
55
|
+
|
|
56
|
+
### Three-Strike Rule
|
|
57
|
+
After 3 failed hypotheses → Stop and rethink understanding of the system.
|
|
58
|
+
|
|
15
59
|
## Core Principles
|
|
16
60
|
|
|
17
61
|
### Security First (Mandatory)
|
|
@@ -168,6 +212,27 @@ grep -rn "getServerSideProps\|getStaticProps\|getStaticPaths" src/ app/ --includ
|
|
|
168
212
|
- Ensure Server/Client boundary is correct
|
|
169
213
|
- Validate: `npx tsc --noEmit && npx vitest run`
|
|
170
214
|
|
|
215
|
+
## Verification Protocol
|
|
216
|
+
|
|
217
|
+
**Before claiming ANY bug is fixed:**
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
1. RUN the test that reproduces the bug
|
|
221
|
+
2. VERIFY it passes (output must show PASS)
|
|
222
|
+
3. RUN the full test suite
|
|
223
|
+
4. VERIFY no regressions (0 failures)
|
|
224
|
+
5. ONLY THEN claim "bug fixed" WITH evidence
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Anti-Rationalization
|
|
228
|
+
|
|
229
|
+
| Excuse | Reality |
|
|
230
|
+
|--------|---------|
|
|
231
|
+
| "I see the problem, let me fix it" | Seeing symptoms is not understanding root cause |
|
|
232
|
+
| "Quick fix for now" | Fix root cause. "Quick fixes" compound. |
|
|
233
|
+
| "It's probably X" | "Probably" is not evidence. Prove it. |
|
|
234
|
+
| "The fix is obvious" | Obvious fixes that skip investigation create new bugs. |
|
|
235
|
+
|
|
171
236
|
## Rules
|
|
172
237
|
- Trace before fixing -- understand the full data flow first
|
|
173
238
|
- Fix at the root layer, not at the symptom layer
|
|
@@ -175,6 +240,7 @@ grep -rn "getServerSideProps\|getStaticProps\|getStaticPaths" src/ app/ --includ
|
|
|
175
240
|
- Add typing if the bug revealed type gaps
|
|
176
241
|
- If the fix requires architecture changes, report to user first
|
|
177
242
|
- Always check both server and client environments for the error
|
|
243
|
+
- **Verify before claiming fixed** — Test output is proof
|
|
178
244
|
|
|
179
245
|
## Output
|
|
180
246
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: migrator
|
|
3
|
-
description: "
|
|
3
|
+
description: "Use when legacy code needs modernization to the target architecture — components, modules, or full codebase migration."
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -107,11 +107,33 @@ Read `docs/ARCHITECTURE.md`.
|
|
|
107
107
|
- Report remaining issues
|
|
108
108
|
- Get user approval
|
|
109
109
|
|
|
110
|
+
## Verification Protocol
|
|
111
|
+
|
|
112
|
+
**Before claiming ANY migration phase is complete:**
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
1. RUN `npx tsc --noEmit` — No TypeScript errors
|
|
116
|
+
2. RUN `npm test` — All tests pass
|
|
117
|
+
3. RUN `npm run build` — Build succeeds
|
|
118
|
+
4. VERIFY migrated code matches target architecture
|
|
119
|
+
5. ONLY THEN claim "phase complete" WITH evidence
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Anti-Rationalization
|
|
123
|
+
|
|
124
|
+
| Excuse | Reality |
|
|
125
|
+
|--------|---------|
|
|
126
|
+
| "Old tests still pass" | Old tests may not cover new patterns. Add new tests. |
|
|
127
|
+
| "It looks correct" | Looking is not running. Verify with commands. |
|
|
128
|
+
| "Partial migration is fine" | Partial migration = two patterns = confusion. Complete it. |
|
|
129
|
+
| "I'll fix the edge cases later" | Edge cases in migration = production bugs. Fix now. |
|
|
130
|
+
|
|
110
131
|
### Rules
|
|
111
132
|
- Order matters: bottom-up (types -> services -> state -> components -> pages)
|
|
112
133
|
- Validate build/tsc after each phase
|
|
113
134
|
- One module at a time
|
|
114
135
|
- Ask user approval between phases
|
|
136
|
+
- **Verify each phase** — Partial migration is worse than none
|
|
115
137
|
|
|
116
138
|
---
|
|
117
139
|
|
|
@@ -226,6 +248,7 @@ const { items, isLoading, error } = useMarketplaceList({ page: 1 })
|
|
|
226
248
|
- Report bugs found during migration (don't silently fix)
|
|
227
249
|
- Always check for hydration mismatches after conversion
|
|
228
250
|
- Remove `pages/` files only after `app/` equivalents are verified working
|
|
251
|
+
- **Verify each phase** — Partial migration is worse than none
|
|
229
252
|
|
|
230
253
|
## Output
|
|
231
254
|
|
|
@@ -1,17 +1,54 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: reviewer
|
|
3
|
-
description: "
|
|
3
|
+
description: "Use when code changes need review before merge — validates architecture conformance, code quality, and spec compliance."
|
|
4
4
|
tools: Read, Bash, Glob, Grep
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Reviewer
|
|
7
|
+
# Reviewer — Unified 3-in-1 Review
|
|
8
8
|
|
|
9
9
|
## Mission
|
|
10
|
-
Analyze code against `docs/ARCHITECTURE.md
|
|
10
|
+
Analyze code against `docs/ARCHITECTURE.md` with unified 3-in-1 review: Spec Compliance + Code Quality + Architecture Fit in a single pass. 50% more efficient than separate reviews.
|
|
11
11
|
|
|
12
12
|
## First Action
|
|
13
13
|
Read `docs/ARCHITECTURE.md`.
|
|
14
14
|
|
|
15
|
+
## Unified 3-in-1 Review System
|
|
16
|
+
|
|
17
|
+
Unlike competitors that use separate agents for spec review and code review (doubling token cost), we perform everything in ONE pass:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
21
|
+
│ UNIFIED 3-IN-1 REVIEW │
|
|
22
|
+
├─────────────────┬─────────────────┬─────────────────────────────┤
|
|
23
|
+
│ Spec Compliance │ Code Quality │ Architecture Fit │
|
|
24
|
+
│ ────────────────│─────────────────│─────────────────────────────│
|
|
25
|
+
│ • Requirements │ • Clean code │ • Follows ARCHITECTURE.md │
|
|
26
|
+
│ • No extras │ • No smells │ • RSC vs Client correct │
|
|
27
|
+
│ • Acceptance │ • Tests exist │ • Server Actions proper │
|
|
28
|
+
│ criteria │ • Types correct │ • Naming conventions │
|
|
29
|
+
└─────────────────┴─────────────────┴─────────────────────────────┘
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 1. Spec Compliance Check
|
|
33
|
+
- [ ] Implements ALL specified requirements?
|
|
34
|
+
- [ ] Does NOT add features not requested?
|
|
35
|
+
- [ ] Meets acceptance criteria from the plan?
|
|
36
|
+
- [ ] Edge cases from spec handled?
|
|
37
|
+
|
|
38
|
+
### 2. Code Quality Check
|
|
39
|
+
- [ ] Clean, readable code?
|
|
40
|
+
- [ ] No code smells (long methods, deep nesting)?
|
|
41
|
+
- [ ] Proper error handling?
|
|
42
|
+
- [ ] Tests cover critical paths?
|
|
43
|
+
- [ ] TypeScript strict mode compliant?
|
|
44
|
+
|
|
45
|
+
### 3. Architecture Fit Check
|
|
46
|
+
- [ ] Follows ARCHITECTURE.md patterns?
|
|
47
|
+
- [ ] Correct RSC vs Client Component usage?
|
|
48
|
+
- [ ] Server Actions used for mutations?
|
|
49
|
+
- [ ] No circular imports?
|
|
50
|
+
- [ ] Naming follows conventions?
|
|
51
|
+
|
|
15
52
|
## Core Principles
|
|
16
53
|
|
|
17
54
|
### Security First (Mandatory)
|
|
@@ -178,6 +215,59 @@ done
|
|
|
178
215
|
6. Rendering: find unnecessary re-renders (missing useMemo/useCallback in Client Components)
|
|
179
216
|
7. Report bottlenecks sorted by user impact
|
|
180
217
|
|
|
218
|
+
## Anti-Sycophancy Protocol
|
|
219
|
+
|
|
220
|
+
### For the Reviewer (Giving Feedback)
|
|
221
|
+
|
|
222
|
+
Never soften critical feedback. Bad code is bad code.
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
WRONG: "This looks great! Just a small suggestion..."
|
|
226
|
+
RIGHT: "This has a security vulnerability at line 42. Fix required."
|
|
227
|
+
|
|
228
|
+
WRONG: "You might consider..."
|
|
229
|
+
RIGHT: "This violates ARCHITECTURE.md. Change required."
|
|
230
|
+
|
|
231
|
+
WRONG: "This is a minor thing but..."
|
|
232
|
+
RIGHT: "This will cause a production bug. Blocking."
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### For the Reviewed Agent (Receiving Feedback)
|
|
236
|
+
|
|
237
|
+
When another agent receives review feedback:
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
1. EVALUATE technically — Is the feedback correct?
|
|
241
|
+
2. CHECK against ARCHITECTURE.md — Does it align?
|
|
242
|
+
3. YAGNI test — Is the suggestion actually needed?
|
|
243
|
+
- Does it solve a real problem?
|
|
244
|
+
- Or is it speculative improvement?
|
|
245
|
+
4. IF valid → Implement the fix
|
|
246
|
+
5. IF invalid → Push back with EVIDENCE:
|
|
247
|
+
"This suggestion conflicts with [specific pattern] because [reason]"
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### YAGNI Checklist for Review Suggestions
|
|
251
|
+
|
|
252
|
+
Before accepting a reviewer suggestion:
|
|
253
|
+
|
|
254
|
+
| Question | If NO → |
|
|
255
|
+
|----------|---------|
|
|
256
|
+
| Does it fix a real bug? | Consider rejecting |
|
|
257
|
+
| Does ARCHITECTURE.md require it? | Consider rejecting |
|
|
258
|
+
| Will it break without this change? | Consider rejecting |
|
|
259
|
+
| Does the spec require it? | Consider rejecting |
|
|
260
|
+
|
|
261
|
+
### Forbidden Phrases in Reviews
|
|
262
|
+
|
|
263
|
+
| Phrase | Problem |
|
|
264
|
+
|--------|---------|
|
|
265
|
+
| "Looks good to me!" | Non-specific. What looks good? |
|
|
266
|
+
| "LGTM" | Lazy. Explain what you verified. |
|
|
267
|
+
| "Just a few nits" | Either it matters or it doesn't. |
|
|
268
|
+
| "You're absolutely right" | Sycophancy. Evaluate technically. |
|
|
269
|
+
| "Great job overall" | Empty praise. Cite specifics. |
|
|
270
|
+
|
|
181
271
|
## Rules
|
|
182
272
|
- Read-only. Never modify files.
|
|
183
273
|
- Always include positive highlights — good code deserves recognition.
|