prjct-cli 0.28.2 → 0.28.4
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/CHANGELOG.md +105 -0
- package/core/agentic/index.ts +11 -1
- package/core/agentic/memory-system.ts +44 -5
- package/core/agentic/smart-context.ts +36 -64
- package/core/agentic/token-estimator.ts +264 -0
- package/core/infrastructure/path-manager.ts +7 -7
- package/core/infrastructure/setup.ts +28 -0
- package/core/infrastructure/slash-command-registry.ts +176 -0
- package/core/types/integrations.ts +28 -1
- package/package.json +1 -1
- package/templates/agentic/subagent-generation.md +237 -90
- package/templates/commands/bug.md +51 -392
- package/templates/commands/done.md +53 -232
- package/templates/commands/setup-statusline.md +138 -0
- package/templates/commands/ship.md +86 -668
- package/templates/commands/sync.md +189 -552
- package/templates/commands/task.md +50 -276
- package/templates/global/CLAUDE.md +101 -161
- package/templates/guides/agent-generation.md +164 -0
- package/templates/guides/claude-code-ux.md +232 -0
- package/templates/guides/integrations.md +149 -0
- package/templates/mcp-config.json +23 -18
- package/templates/shared/git-operations.md +68 -0
- package/templates/shared/io-patterns.md +72 -0
- package/templates/shared/standard.md +70 -0
- package/templates/shared/validation.md +75 -0
- package/CLAUDE.md +0 -204
- package/templates/agentic/agents/uxui.md +0 -218
- package/templates/subagents/domain/backend.md +0 -106
- package/templates/subagents/domain/database.md +0 -118
- package/templates/subagents/domain/devops.md +0 -149
- package/templates/subagents/domain/frontend.md +0 -100
- package/templates/subagents/domain/testing.md +0 -166
|
@@ -146,9 +146,34 @@ async function migrateProjectsCliVersion(): Promise<void> {
|
|
|
146
146
|
.map(dirent => dirent.name)
|
|
147
147
|
|
|
148
148
|
let migrated = 0
|
|
149
|
+
let configsCreated = 0
|
|
149
150
|
|
|
150
151
|
for (const projectId of projectDirs) {
|
|
151
152
|
const projectJsonPath = path.join(projectsDir, projectId, 'project.json')
|
|
153
|
+
const configDir = path.join(projectsDir, projectId, 'config')
|
|
154
|
+
|
|
155
|
+
// Ensure config directory exists for new config files
|
|
156
|
+
if (!fs.existsSync(configDir)) {
|
|
157
|
+
fs.mkdirSync(configDir, { recursive: true })
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Create slash-commands.json if missing (v0.28+ feature)
|
|
161
|
+
const slashCommandsPath = path.join(configDir, 'slash-commands.json')
|
|
162
|
+
if (!fs.existsSync(slashCommandsPath)) {
|
|
163
|
+
const slashCommandsConfig = {
|
|
164
|
+
version: '1.0.0',
|
|
165
|
+
generatedAt: new Date().toISOString(),
|
|
166
|
+
note: 'Run /p:sync to regenerate with full command list',
|
|
167
|
+
commands: {
|
|
168
|
+
'p:task': { description: 'Start any task', category: 'workflow' },
|
|
169
|
+
'p:done': { description: 'Complete subtask', category: 'workflow' },
|
|
170
|
+
'p:ship': { description: 'Ship feature', category: 'shipping' },
|
|
171
|
+
'p:sync': { description: 'Sync project', category: 'planning' },
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
fs.writeFileSync(slashCommandsPath, JSON.stringify(slashCommandsConfig, null, 2))
|
|
175
|
+
configsCreated++
|
|
176
|
+
}
|
|
152
177
|
|
|
153
178
|
if (!fs.existsSync(projectJsonPath)) {
|
|
154
179
|
continue
|
|
@@ -172,6 +197,9 @@ async function migrateProjectsCliVersion(): Promise<void> {
|
|
|
172
197
|
if (migrated > 0) {
|
|
173
198
|
console.log(` ${GREEN}✓${NC} Updated ${migrated} project(s) to v${VERSION}`)
|
|
174
199
|
}
|
|
200
|
+
if (configsCreated > 0) {
|
|
201
|
+
console.log(` ${GREEN}✓${NC} Created ${configsCreated} new config file(s)`)
|
|
202
|
+
}
|
|
175
203
|
} catch {
|
|
176
204
|
// Silently fail - migration is optional
|
|
177
205
|
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slash Command Registry
|
|
3
|
+
* Generates Claude Code native slash command configuration.
|
|
4
|
+
*
|
|
5
|
+
* This enables:
|
|
6
|
+
* - Native /p:* command autocomplete in Claude Code
|
|
7
|
+
* - Command validation before execution
|
|
8
|
+
* - Command discoverability in help systems
|
|
9
|
+
*
|
|
10
|
+
* @version 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import fs from 'fs/promises'
|
|
14
|
+
import path from 'path'
|
|
15
|
+
import os from 'os'
|
|
16
|
+
|
|
17
|
+
export interface SlashCommand {
|
|
18
|
+
name: string
|
|
19
|
+
description: string
|
|
20
|
+
args?: string
|
|
21
|
+
category: 'workflow' | 'planning' | 'shipping' | 'analytics' | 'maintenance'
|
|
22
|
+
requiresProject: boolean
|
|
23
|
+
deprecated?: boolean
|
|
24
|
+
replacedBy?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface SlashCommandRegistry {
|
|
28
|
+
version: string
|
|
29
|
+
generatedAt: string
|
|
30
|
+
commands: Record<string, SlashCommand>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Core prjct commands with metadata
|
|
35
|
+
*/
|
|
36
|
+
const PRJCT_COMMANDS: SlashCommand[] = [
|
|
37
|
+
// Workflow
|
|
38
|
+
{ name: 'task', description: 'Start any task with intelligent classification', args: '<description>', category: 'workflow', requiresProject: true },
|
|
39
|
+
{ name: 'done', description: 'Complete current subtask', category: 'workflow', requiresProject: true },
|
|
40
|
+
{ name: 'pause', description: 'Pause current task', category: 'workflow', requiresProject: true },
|
|
41
|
+
{ name: 'resume', description: 'Resume paused task', category: 'workflow', requiresProject: true },
|
|
42
|
+
{ name: 'next', description: 'Show next tasks in queue', category: 'workflow', requiresProject: true },
|
|
43
|
+
|
|
44
|
+
// Planning
|
|
45
|
+
{ name: 'init', description: 'Initialize prjct in current directory', args: '[description]', category: 'planning', requiresProject: false },
|
|
46
|
+
{ name: 'sync', description: 'Deep sync - analyze project, generate agents', category: 'planning', requiresProject: true },
|
|
47
|
+
{ name: 'idea', description: 'Capture an idea for later', args: '<idea>', category: 'planning', requiresProject: true },
|
|
48
|
+
{ name: 'spec', description: 'Generate feature specification', args: '<feature>', category: 'planning', requiresProject: true },
|
|
49
|
+
{ name: 'bug', description: 'Report a bug with auto-priority', args: '<description>', category: 'planning', requiresProject: true },
|
|
50
|
+
|
|
51
|
+
// Shipping
|
|
52
|
+
{ name: 'ship', description: 'Ship feature with PR workflow', args: '[feature]', category: 'shipping', requiresProject: true },
|
|
53
|
+
{ name: 'review', description: 'Run code review on changes', category: 'shipping', requiresProject: true },
|
|
54
|
+
{ name: 'test', description: 'Run tests for current changes', category: 'shipping', requiresProject: true },
|
|
55
|
+
{ name: 'verify', description: 'Verify deployment', category: 'shipping', requiresProject: true },
|
|
56
|
+
|
|
57
|
+
// Analytics
|
|
58
|
+
{ name: 'dash', description: 'Show project dashboard', category: 'analytics', requiresProject: true },
|
|
59
|
+
{ name: 'history', description: 'Show task history', category: 'analytics', requiresProject: true },
|
|
60
|
+
{ name: 'analyze', description: 'Analyze codebase', category: 'analytics', requiresProject: true },
|
|
61
|
+
|
|
62
|
+
// Maintenance
|
|
63
|
+
{ name: 'cleanup', description: 'Clean up project files', category: 'maintenance', requiresProject: true },
|
|
64
|
+
{ name: 'undo', description: 'Undo last action', category: 'maintenance', requiresProject: true },
|
|
65
|
+
{ name: 'redo', description: 'Redo undone action', category: 'maintenance', requiresProject: true },
|
|
66
|
+
|
|
67
|
+
// Deprecated
|
|
68
|
+
{ name: 'now', description: 'Start task (deprecated)', args: '<task>', category: 'workflow', requiresProject: true, deprecated: true, replacedBy: 'task' },
|
|
69
|
+
{ name: 'feature', description: 'Plan feature (deprecated)', args: '<feature>', category: 'planning', requiresProject: true, deprecated: true, replacedBy: 'task' },
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generate slash command registry for Claude Code
|
|
74
|
+
*/
|
|
75
|
+
export async function generateRegistry(): Promise<SlashCommandRegistry> {
|
|
76
|
+
const commands: Record<string, SlashCommand> = {}
|
|
77
|
+
|
|
78
|
+
for (const cmd of PRJCT_COMMANDS) {
|
|
79
|
+
commands[`p:${cmd.name}`] = cmd
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
version: '1.0.0',
|
|
84
|
+
generatedAt: new Date().toISOString(),
|
|
85
|
+
commands,
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Write registry to project's global path
|
|
91
|
+
*/
|
|
92
|
+
export async function writeRegistry(projectId: string): Promise<{ success: boolean; path?: string; error?: string }> {
|
|
93
|
+
try {
|
|
94
|
+
const globalPath = path.join(os.homedir(), '.prjct-cli', 'projects', projectId, 'config')
|
|
95
|
+
await fs.mkdir(globalPath, { recursive: true })
|
|
96
|
+
|
|
97
|
+
const registry = await generateRegistry()
|
|
98
|
+
const registryPath = path.join(globalPath, 'slash-commands.json')
|
|
99
|
+
|
|
100
|
+
await fs.writeFile(registryPath, JSON.stringify(registry, null, 2), 'utf-8')
|
|
101
|
+
|
|
102
|
+
return { success: true, path: registryPath }
|
|
103
|
+
} catch (error) {
|
|
104
|
+
return { success: false, error: (error as Error).message }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get command by name
|
|
110
|
+
*/
|
|
111
|
+
export function getCommand(name: string): SlashCommand | undefined {
|
|
112
|
+
return PRJCT_COMMANDS.find(cmd => cmd.name === name)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get all commands by category
|
|
117
|
+
*/
|
|
118
|
+
export function getCommandsByCategory(category: SlashCommand['category']): SlashCommand[] {
|
|
119
|
+
return PRJCT_COMMANDS.filter(cmd => cmd.category === category && !cmd.deprecated)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Validate command exists
|
|
124
|
+
*/
|
|
125
|
+
export function validateCommand(name: string): { valid: boolean; command?: SlashCommand; error?: string } {
|
|
126
|
+
const cmd = getCommand(name)
|
|
127
|
+
|
|
128
|
+
if (!cmd) {
|
|
129
|
+
return { valid: false, error: `Unknown command: ${name}` }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (cmd.deprecated) {
|
|
133
|
+
return {
|
|
134
|
+
valid: true,
|
|
135
|
+
command: cmd,
|
|
136
|
+
error: `Command '${name}' is deprecated. Use '${cmd.replacedBy}' instead.`,
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return { valid: true, command: cmd }
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Format commands for help display
|
|
145
|
+
*/
|
|
146
|
+
export function formatHelpText(): string {
|
|
147
|
+
const categories = ['workflow', 'planning', 'shipping', 'analytics', 'maintenance'] as const
|
|
148
|
+
const lines: string[] = ['# prjct Commands', '']
|
|
149
|
+
|
|
150
|
+
for (const category of categories) {
|
|
151
|
+
const cmds = getCommandsByCategory(category)
|
|
152
|
+
if (cmds.length === 0) continue
|
|
153
|
+
|
|
154
|
+
lines.push(`## ${category.charAt(0).toUpperCase() + category.slice(1)}`)
|
|
155
|
+
lines.push('')
|
|
156
|
+
|
|
157
|
+
for (const cmd of cmds) {
|
|
158
|
+
const args = cmd.args ? ` ${cmd.args}` : ''
|
|
159
|
+
lines.push(`- \`/p:${cmd.name}${args}\` - ${cmd.description}`)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
lines.push('')
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return lines.join('\n')
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export default {
|
|
169
|
+
generateRegistry,
|
|
170
|
+
writeRegistry,
|
|
171
|
+
getCommand,
|
|
172
|
+
getCommandsByCategory,
|
|
173
|
+
validateCommand,
|
|
174
|
+
formatHelpText,
|
|
175
|
+
PRJCT_COMMANDS,
|
|
176
|
+
}
|
|
@@ -3,10 +3,37 @@
|
|
|
3
3
|
* Types for external service integrations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* MCP Server Configuration
|
|
8
|
+
*/
|
|
9
|
+
export interface McpServerConfig {
|
|
10
|
+
name: string
|
|
11
|
+
description?: string
|
|
12
|
+
command: string
|
|
13
|
+
args: string[]
|
|
14
|
+
enabled: boolean
|
|
15
|
+
linkedAgents?: string[]
|
|
16
|
+
autoLoad?: boolean
|
|
17
|
+
setupAt?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* MCP Servers Configuration for a project
|
|
22
|
+
*/
|
|
23
|
+
export interface McpServersConfig {
|
|
24
|
+
projectId: string
|
|
25
|
+
version: string
|
|
26
|
+
servers: Record<string, McpServerConfig>
|
|
27
|
+
agentMcpMap: Record<string, string[]>
|
|
28
|
+
}
|
|
29
|
+
|
|
6
30
|
/**
|
|
7
31
|
* Integrations Config
|
|
8
32
|
* Container for all external integrations
|
|
9
33
|
*/
|
|
10
34
|
export interface IntegrationsConfig {
|
|
11
|
-
|
|
35
|
+
mcp?: {
|
|
36
|
+
enabled: boolean
|
|
37
|
+
configPath: string
|
|
38
|
+
}
|
|
12
39
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
# Sub-Agent Generation
|
|
1
|
+
# Sub-Agent Generation (AGENTIC)
|
|
2
2
|
|
|
3
|
-
Generate Claude Code sub-agents
|
|
3
|
+
Generate Claude Code sub-agents dynamically based on ACTUAL project analysis.
|
|
4
|
+
|
|
5
|
+
**CRITICAL**: There are NO hardcoded templates. You MUST analyze the project and GENERATE agents from scratch.
|
|
4
6
|
|
|
5
7
|
## Input Context
|
|
6
8
|
|
|
7
9
|
You have access to:
|
|
8
|
-
- `{analysis}` - repo-
|
|
10
|
+
- `{analysis}` - repo-analysis.json with detected technologies
|
|
9
11
|
- `{projectPath}` - Path to project root
|
|
10
12
|
- `{projectId}` - Project identifier
|
|
13
|
+
- `{globalPath}` - ~/.prjct-cli/projects/{projectId}
|
|
11
14
|
|
|
12
15
|
## Output Location
|
|
13
16
|
|
|
14
|
-
Write sub-agents to: `{globalPath}/agents/`
|
|
17
|
+
Write sub-agents to: `{globalPath}/agents/`
|
|
15
18
|
|
|
16
19
|
## Sub-Agent Format (Claude Code)
|
|
17
20
|
|
|
@@ -20,121 +23,265 @@ Write sub-agents to: `{globalPath}/agents/` (global storage, NOT local project)
|
|
|
20
23
|
name: agent-name
|
|
21
24
|
agentId: p.agent.{name}
|
|
22
25
|
description: When to use this agent. Include "Use PROACTIVELY" for auto-invocation.
|
|
23
|
-
tools: Read, Write, Glob, Grep, Bash
|
|
24
26
|
model: sonnet
|
|
25
|
-
|
|
27
|
+
temperature: {0.1-0.4}
|
|
28
|
+
maxSteps: {50-100}
|
|
29
|
+
tools:
|
|
30
|
+
- Read
|
|
31
|
+
- Write
|
|
32
|
+
- Edit
|
|
33
|
+
- Bash
|
|
34
|
+
- Glob
|
|
35
|
+
- Grep
|
|
36
|
+
permissions:
|
|
37
|
+
Bash: ask
|
|
38
|
+
Write: allow
|
|
39
|
+
Edit: allow
|
|
40
|
+
"rm *": deny
|
|
41
|
+
skills: [{detected-skill}]
|
|
42
|
+
mcp: [{detected-mcp-servers}]
|
|
26
43
|
projectId: {projectId}
|
|
27
44
|
projectPath: {projectPath}
|
|
28
45
|
---
|
|
29
46
|
|
|
30
|
-
Agent
|
|
47
|
+
# {Agent Name}
|
|
48
|
+
|
|
49
|
+
## Stack Detected
|
|
50
|
+
{ACTUAL technologies found in THIS project}
|
|
51
|
+
|
|
52
|
+
## Project Structure
|
|
53
|
+
{ACTUAL directory structure for this domain}
|
|
54
|
+
|
|
55
|
+
## Code Patterns (EXTRACTED FROM PROJECT)
|
|
56
|
+
{REAL patterns found by reading actual files}
|
|
57
|
+
|
|
58
|
+
## Quality Checklist
|
|
59
|
+
{Based on project conventions}
|
|
60
|
+
|
|
61
|
+
## Commands
|
|
62
|
+
{ACTUAL commands from package.json/Makefile/etc}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Generation Process (AGENTIC)
|
|
68
|
+
|
|
69
|
+
### Step 1: Analyze Project Deeply
|
|
70
|
+
|
|
71
|
+
DO NOT use templates. Instead:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
1. READ package.json, go.mod, Cargo.toml, requirements.txt, etc.
|
|
75
|
+
2. GLOB for source files: **/*.ts, **/*.tsx, **/*.py, **/*.go, etc.
|
|
76
|
+
3. READ 3-5 representative files from each domain
|
|
77
|
+
4. EXTRACT actual patterns, conventions, naming
|
|
78
|
+
5. CHECK for linter/formatter configs
|
|
31
79
|
```
|
|
32
80
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
81
|
+
### Step 2: Determine Domains Present
|
|
82
|
+
|
|
83
|
+
Based on your analysis, identify which domains exist:
|
|
84
|
+
|
|
85
|
+
| Domain | Detection Method |
|
|
86
|
+
|--------|------------------|
|
|
87
|
+
| frontend | React/Vue/Angular/Svelte in deps, .tsx/.vue files |
|
|
88
|
+
| backend | Express/Fastify/Hono/Gin/Flask in deps, API routes |
|
|
89
|
+
| database | Prisma/Drizzle/TypeORM schemas, SQL files |
|
|
90
|
+
| testing | Jest/Vitest/Pytest configs, *.test.* files |
|
|
91
|
+
| devops | Dockerfile, .github/workflows, k8s/ |
|
|
92
|
+
| uxui | UI components + design tokens/theme |
|
|
93
|
+
| mobile | React Native/Flutter/SwiftUI |
|
|
94
|
+
| cli | Command definitions, arg parsing |
|
|
95
|
+
| ml | Model files, training scripts |
|
|
96
|
+
|
|
97
|
+
### Step 3: Generate Each Agent FROM SCRATCH
|
|
98
|
+
|
|
99
|
+
For EACH detected domain:
|
|
38
100
|
|
|
39
|
-
**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
101
|
+
1. **Analyze domain-specific files**
|
|
102
|
+
```
|
|
103
|
+
READ actual source files in that domain
|
|
104
|
+
EXTRACT: imports, exports, naming, structure
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
2. **Determine configuration**
|
|
108
|
+
- `temperature`: 0.1 for DB, 0.2 for backend/testing, 0.3 for frontend, 0.4 for uxui
|
|
109
|
+
- `maxSteps`: 50 for simple, 75 for medium, 100 for complex
|
|
110
|
+
- `tools`: Based on what the domain needs
|
|
111
|
+
- `permissions`: Deny destructive commands
|
|
44
112
|
|
|
45
|
-
|
|
113
|
+
3. **Discover skills and MCP**
|
|
114
|
+
- Search claude-plugins.dev for relevant skills
|
|
115
|
+
- Determine if context7 MCP is needed (library docs)
|
|
46
116
|
|
|
47
|
-
|
|
117
|
+
4. **Write agent with REAL patterns**
|
|
118
|
+
```
|
|
119
|
+
Include ACTUAL code examples from the project
|
|
120
|
+
Include ACTUAL commands from package.json
|
|
121
|
+
Include ACTUAL file structure
|
|
122
|
+
```
|
|
48
123
|
|
|
49
|
-
|
|
124
|
+
### Step 4: Generate Workflow Agents (ALWAYS)
|
|
125
|
+
|
|
126
|
+
These 3 agents are always generated but STILL need project context:
|
|
50
127
|
|
|
51
128
|
#### prjct-workflow.md
|
|
52
129
|
- Commands: /p:now, /p:done, /p:next, /p:pause, /p:resume
|
|
53
|
-
-
|
|
54
|
-
- Purpose: Task lifecycle management
|
|
130
|
+
- Adapt with: project paths, detected commands
|
|
55
131
|
|
|
56
132
|
#### prjct-planner.md
|
|
57
133
|
- Commands: /p:feature, /p:idea, /p:spec, /p:bug
|
|
58
|
-
-
|
|
59
|
-
- Purpose: Feature planning and breakdown
|
|
134
|
+
- Adapt with: detected stack for planning context
|
|
60
135
|
|
|
61
136
|
#### prjct-shipper.md
|
|
62
137
|
- Commands: /p:ship
|
|
63
|
-
-
|
|
64
|
-
|
|
138
|
+
- Adapt with: actual test/build/lint commands from project
|
|
139
|
+
|
|
140
|
+
---
|
|
65
141
|
|
|
66
|
-
|
|
142
|
+
## MCP Integration
|
|
67
143
|
|
|
68
|
-
|
|
144
|
+
Determine which agents need MCP servers:
|
|
69
145
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
| Node.js, Express, Go, Python API, REST, GraphQL | `backend.md` | Read, Write, Bash, Glob, Grep | `javascript-typescript` or `python-development` |
|
|
74
|
-
| PostgreSQL, MySQL, MongoDB, Redis, Prisma | `database.md` | Read, Write, Bash | (none) |
|
|
75
|
-
| Docker, Kubernetes, CI/CD, GitHub Actions | `devops.md` | Read, Bash, Glob | `developer-kit` |
|
|
76
|
-
| Bun test, Jest, Pytest, Testing Library | `testing.md` | Read, Write, Bash | `developer-kit` |
|
|
77
|
-
| ANY frontend UI (web or mobile) | `uxui.md` | Read, Write, Glob, Grep | `frontend-design` |
|
|
146
|
+
```
|
|
147
|
+
IF agent works with libraries/frameworks:
|
|
148
|
+
ADD mcp: [context7]
|
|
78
149
|
|
|
79
|
-
|
|
150
|
+
Agents that typically need context7:
|
|
151
|
+
- frontend (React, Vue docs)
|
|
152
|
+
- backend (Express, Hono docs)
|
|
153
|
+
- database (Prisma, Drizzle docs)
|
|
154
|
+
- uxui (component library docs)
|
|
155
|
+
- prjct-planner (framework docs for planning)
|
|
156
|
+
```
|
|
80
157
|
|
|
81
|
-
|
|
82
|
-
- Project-specific paths from analysis
|
|
83
|
-
- Detected frameworks and versions
|
|
84
|
-
- Relevant patterns found in codebase
|
|
158
|
+
---
|
|
85
159
|
|
|
86
|
-
##
|
|
160
|
+
## Skill Discovery
|
|
87
161
|
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
Read("{globalPath}/analysis/repo-summary.md")
|
|
91
|
-
```
|
|
162
|
+
For each agent, search for relevant skills:
|
|
92
163
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
Bash("mkdir -p {globalPath}/agents")
|
|
96
|
-
```
|
|
164
|
+
```
|
|
165
|
+
WebFetch: https://claude-plugins.dev/skills?q={domain}+{stack}
|
|
97
166
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
167
|
+
Examples:
|
|
168
|
+
- frontend + React → search "react frontend"
|
|
169
|
+
- backend + TypeScript → search "typescript backend"
|
|
170
|
+
- testing + Bun → search "bun testing"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
If no skill found, leave skills empty or create minimal custom skill.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Output Format
|
|
178
|
+
|
|
179
|
+
After generating each agent:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
Generated: {agent}.md
|
|
183
|
+
Stack: {detected technologies}
|
|
184
|
+
Patterns: {count} extracted from {files analyzed}
|
|
185
|
+
Skills: {linked skills}
|
|
186
|
+
MCP: {linked mcp servers}
|
|
187
|
+
Path: {globalPath}/agents/{agent}.md
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Critical Rules
|
|
193
|
+
|
|
194
|
+
1. **NO TEMPLATES** - Generate everything from project analysis
|
|
195
|
+
2. **NO HARDCODING** - Every value comes from detection
|
|
196
|
+
3. **REAL PATTERNS** - Include actual code examples from the project
|
|
197
|
+
4. **ACTUAL COMMANDS** - Use real commands from package.json/Makefile
|
|
198
|
+
5. **PROJECT-SPECIFIC** - Each agent is unique to this project
|
|
199
|
+
6. **GLOBAL STORAGE** - Write to `{globalPath}/agents/`, never local
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Example: Generated Backend Agent
|
|
204
|
+
|
|
205
|
+
This is an EXAMPLE of what a generated agent might look like (NOT a template to copy):
|
|
206
|
+
|
|
207
|
+
```markdown
|
|
208
|
+
---
|
|
209
|
+
name: backend
|
|
210
|
+
agentId: p.agent.backend
|
|
211
|
+
description: Backend specialist for Hono + Bun. Use PROACTIVELY for API routes and server logic.
|
|
212
|
+
model: sonnet
|
|
213
|
+
temperature: 0.2
|
|
214
|
+
maxSteps: 75
|
|
215
|
+
tools:
|
|
216
|
+
- Read
|
|
217
|
+
- Write
|
|
218
|
+
- Edit
|
|
219
|
+
- Bash
|
|
220
|
+
- Glob
|
|
221
|
+
- Grep
|
|
222
|
+
permissions:
|
|
223
|
+
Bash: ask
|
|
224
|
+
Write: allow
|
|
225
|
+
Edit: allow
|
|
226
|
+
"rm *": deny
|
|
227
|
+
skills: [javascript-typescript]
|
|
228
|
+
mcp: [context7]
|
|
229
|
+
projectId: abc123
|
|
230
|
+
projectPath: /Users/dev/my-project
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
# Backend Agent for my-project
|
|
234
|
+
|
|
235
|
+
## Stack Detected
|
|
236
|
+
- Runtime: Bun 1.0
|
|
237
|
+
- Framework: Hono 4.x
|
|
238
|
+
- Validation: Zod
|
|
239
|
+
- Database: Drizzle + SQLite
|
|
240
|
+
|
|
241
|
+
## Project Structure
|
|
242
|
+
```
|
|
243
|
+
core/
|
|
244
|
+
├── routes/ # API endpoints
|
|
245
|
+
├── services/ # Business logic
|
|
246
|
+
├── middleware/ # Auth, logging
|
|
247
|
+
└── types/ # TypeScript types
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Code Patterns (FROM THIS PROJECT)
|
|
251
|
+
|
|
252
|
+
### Route Structure
|
|
253
|
+
```typescript
|
|
254
|
+
// Extracted from core/routes/users.ts
|
|
255
|
+
app.get('/users/:id', async (c) => {
|
|
256
|
+
const { id } = c.req.param()
|
|
257
|
+
const user = await userService.findById(id)
|
|
258
|
+
return c.json(user)
|
|
259
|
+
})
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Error Handling
|
|
263
|
+
```typescript
|
|
264
|
+
// Extracted from core/middleware/error.ts
|
|
265
|
+
app.onError((err, c) => {
|
|
266
|
+
console.error(err)
|
|
267
|
+
return c.json({ error: err.message }, 500)
|
|
268
|
+
})
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Commands
|
|
272
|
+
|
|
273
|
+
| Action | Command |
|
|
274
|
+
|--------|---------|
|
|
275
|
+
| Dev | `bun run dev` |
|
|
276
|
+
| Test | `bun test` |
|
|
277
|
+
| Build | `bun run build` |
|
|
278
|
+
| Lint | `bun run lint` |
|
|
131
279
|
|
|
132
280
|
## Critical Rules
|
|
281
|
+
- Use Hono's context (c) pattern
|
|
282
|
+
- Validate with Zod before processing
|
|
283
|
+
- Return proper HTTP status codes
|
|
284
|
+
- Use existing service layer pattern
|
|
285
|
+
```
|
|
133
286
|
|
|
134
|
-
|
|
135
|
-
- **ALWAYS write agents to `{globalPath}/agents/`** (global storage)
|
|
136
|
-
- NEVER hardcode technology detection in TypeScript
|
|
137
|
-
- ALWAYS read and analyze repo-summary.md
|
|
138
|
-
- ADAPT templates to project context
|
|
139
|
-
- Use Claude Code frontmatter format exactly
|
|
140
|
-
- Include "Use PROACTIVELY" in descriptions for auto-invocation
|
|
287
|
+
This agent was GENERATED by analyzing the actual project, not copied from a template.
|