prjct-cli 0.10.9 → 0.10.11
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 +88 -0
- package/CLAUDE.md +121 -996
- package/core/__tests__/agentic/prompt-builder.test.js +7 -3
- package/core/agentic/prompt-builder.js +57 -56
- package/core/commands.js +29 -452
- package/core/domain/architecture-generator.js +51 -519
- package/core/domain/task-analyzer.js +11 -36
- package/package.json +1 -1
- package/templates/analysis/bug-severity.md +74 -0
- package/templates/analysis/complexity.md +54 -0
- package/templates/analysis/health.md +66 -0
- package/templates/analysis/intent.md +66 -0
- package/templates/analysis/patterns.md +27 -173
- package/templates/analysis/task-breakdown.md +53 -0
- package/templates/architect/discovery.md +67 -0
- package/templates/architect/phases.md +59 -0
- package/templates/commands/done.md +129 -15
- package/templates/commands/feature.md +262 -21
- package/templates/commands/ship.md +244 -23
- package/templates/commands/sync.md +235 -44
- package/templates/design/api.md +95 -0
- package/templates/design/architecture.md +77 -0
- package/templates/design/component.md +89 -0
- package/templates/design/database.md +78 -0
- package/templates/design/flow.md +94 -0
|
@@ -1,35 +1,256 @@
|
|
|
1
1
|
---
|
|
2
|
-
allowed-tools: [Read, Write, Bash
|
|
3
|
-
description: 'Ship feature workflow'
|
|
4
|
-
timestamp-rule: 'GetTimestamp() and GetDate() for timestamps'
|
|
5
|
-
think-triggers: [git_decision, report_complete]
|
|
2
|
+
allowed-tools: [Read, Write, Bash]
|
|
3
|
+
description: 'Ship feature with automated workflow'
|
|
4
|
+
timestamp-rule: 'GetTimestamp() and GetDate() for ALL timestamps'
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
# /p:ship
|
|
7
|
+
# /p:ship - Ship Feature Workflow
|
|
9
8
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
## Context Variables
|
|
10
|
+
- `{projectId}`: From `.prjct/prjct.config.json`
|
|
11
|
+
- `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
|
|
12
|
+
- `{shippedPath}`: `{globalPath}/progress/shipped.md`
|
|
13
|
+
- `{memoryPath}`: `{globalPath}/memory/context.jsonl`
|
|
14
|
+
- `{feature}`: User-provided feature name
|
|
16
15
|
|
|
17
|
-
##
|
|
18
|
-
1. Lint → Tests → Docs update
|
|
19
|
-
2. Version bump → CHANGELOG
|
|
20
|
-
3. Commit + push (prjct footer)
|
|
21
|
-
4. Log: `progress/sessions/{YY-MM}/{DD}.jsonl`
|
|
22
|
-
5. Update: `progress/shipped.md` (30 days)
|
|
23
|
-
6. Recommend: compact
|
|
16
|
+
## Step 1: Read Config
|
|
24
17
|
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
READ: `.prjct/prjct.config.json`
|
|
19
|
+
EXTRACT: `projectId`
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
IF file not found:
|
|
22
|
+
OUTPUT: "No prjct project. Run /p:init first."
|
|
23
|
+
STOP
|
|
24
|
+
|
|
25
|
+
## Step 2: Validate Prerequisites
|
|
26
|
+
|
|
27
|
+
BASH: `git status --porcelain`
|
|
28
|
+
|
|
29
|
+
IF output empty (no changes):
|
|
30
|
+
OUTPUT: "⚠️ No changes to ship. Make some commits first."
|
|
31
|
+
STOP
|
|
32
|
+
|
|
33
|
+
BASH: `git rev-parse --is-inside-work-tree`
|
|
34
|
+
|
|
35
|
+
IF not a git repo:
|
|
36
|
+
OUTPUT: "⚠️ Not a git repository. Initialize git first."
|
|
37
|
+
STOP
|
|
38
|
+
|
|
39
|
+
## Step 3: Quality Checks (Non-Blocking)
|
|
40
|
+
|
|
41
|
+
### Lint Check
|
|
42
|
+
BASH: `npm run lint 2>&1 || echo "LINT_SKIP"`
|
|
43
|
+
|
|
44
|
+
CAPTURE output as {lintResult}
|
|
45
|
+
|
|
46
|
+
IF contains "LINT_SKIP" OR contains "missing script":
|
|
47
|
+
{lintStatus} = "skipped"
|
|
48
|
+
ELSE IF contains "error":
|
|
49
|
+
{lintStatus} = "warnings"
|
|
50
|
+
ELSE:
|
|
51
|
+
{lintStatus} = "passed"
|
|
52
|
+
|
|
53
|
+
### Test Check
|
|
54
|
+
BASH: `npm test 2>&1 || echo "TEST_SKIP"`
|
|
55
|
+
|
|
56
|
+
CAPTURE output as {testResult}
|
|
57
|
+
|
|
58
|
+
IF contains "TEST_SKIP" OR contains "missing script":
|
|
59
|
+
{testStatus} = "skipped"
|
|
60
|
+
ELSE IF contains "failed" OR contains "FAIL":
|
|
61
|
+
{testStatus} = "failed"
|
|
62
|
+
ELSE:
|
|
63
|
+
{testStatus} = "passed"
|
|
64
|
+
|
|
65
|
+
**Note**: These are NON-BLOCKING. Continue even if they fail.
|
|
66
|
+
|
|
67
|
+
## Step 4: Version Bump
|
|
68
|
+
|
|
69
|
+
READ: `package.json`
|
|
70
|
+
EXTRACT: current version as {currentVersion}
|
|
71
|
+
|
|
72
|
+
### Determine Bump Type
|
|
73
|
+
|
|
74
|
+
BASH: `git log --oneline -10`
|
|
75
|
+
|
|
76
|
+
ANALYZE commit messages:
|
|
77
|
+
|
|
78
|
+
IF any commit contains "BREAKING" OR "major:":
|
|
79
|
+
{bumpType} = "major"
|
|
80
|
+
{newVersion} = increment X in X.Y.Z, set Y=0, Z=0
|
|
81
|
+
|
|
82
|
+
ELSE IF any commit contains "feat:" OR "feature:":
|
|
83
|
+
{bumpType} = "minor"
|
|
84
|
+
{newVersion} = increment Y in X.Y.Z, set Z=0
|
|
85
|
+
|
|
86
|
+
ELSE:
|
|
87
|
+
{bumpType} = "patch"
|
|
88
|
+
{newVersion} = increment Z in X.Y.Z
|
|
89
|
+
|
|
90
|
+
### Update package.json
|
|
91
|
+
|
|
92
|
+
READ: `package.json`
|
|
93
|
+
REPLACE: `"version": "{currentVersion}"` with `"version": "{newVersion}"`
|
|
94
|
+
WRITE: `package.json`
|
|
95
|
+
|
|
96
|
+
## Step 5: Update CHANGELOG
|
|
97
|
+
|
|
98
|
+
READ: `CHANGELOG.md` (create if not exists)
|
|
99
|
+
|
|
100
|
+
### Format New Entry
|
|
101
|
+
|
|
102
|
+
```markdown
|
|
103
|
+
## [{newVersion}] - {GetDate()}
|
|
104
|
+
|
|
105
|
+
### {feature}
|
|
106
|
+
- Shipped by prjct-cli
|
|
107
|
+
- Lint: {lintStatus}
|
|
108
|
+
- Tests: {testStatus}
|
|
29
109
|
```
|
|
110
|
+
|
|
111
|
+
INSERT at top of file (after # Changelog header)
|
|
112
|
+
|
|
113
|
+
WRITE: `CHANGELOG.md`
|
|
114
|
+
|
|
115
|
+
## Step 6: Git Commit
|
|
116
|
+
|
|
117
|
+
### Stage Changes
|
|
118
|
+
BASH: `git add .`
|
|
119
|
+
|
|
120
|
+
### Create Commit
|
|
121
|
+
BASH: `git commit -m "$(cat <<'EOF'
|
|
122
|
+
feat: Ship {feature}
|
|
123
|
+
|
|
124
|
+
- Version: {newVersion}
|
|
125
|
+
- Lint: {lintStatus}
|
|
126
|
+
- Tests: {testStatus}
|
|
127
|
+
|
|
30
128
|
🤖 Generated with [p/](https://www.prjct.app/)
|
|
31
129
|
Designed for [Claude](https://www.anthropic.com/claude)
|
|
130
|
+
EOF
|
|
131
|
+
)"`
|
|
132
|
+
|
|
133
|
+
## Step 7: Git Push
|
|
134
|
+
|
|
135
|
+
BASH: `git push 2>&1`
|
|
136
|
+
|
|
137
|
+
CAPTURE output as {pushResult}
|
|
138
|
+
|
|
139
|
+
IF contains "rejected" OR contains "failed":
|
|
140
|
+
OUTPUT: "⚠️ Push failed. Try: git pull --rebase && git push"
|
|
141
|
+
CONTINUE (don't stop)
|
|
142
|
+
|
|
143
|
+
IF contains "no upstream":
|
|
144
|
+
BASH: `git push -u origin HEAD`
|
|
145
|
+
|
|
146
|
+
## Step 8: Log to Session
|
|
147
|
+
|
|
148
|
+
GET: {date} = GetDate()
|
|
149
|
+
EXTRACT: {yearMonth} = YYYY-MM from {date}
|
|
150
|
+
|
|
151
|
+
ENSURE directory exists:
|
|
152
|
+
BASH: `mkdir -p {globalPath}/progress/sessions/{yearMonth}`
|
|
153
|
+
|
|
154
|
+
APPEND to: `{globalPath}/progress/sessions/{yearMonth}/{date}.jsonl`
|
|
155
|
+
|
|
156
|
+
Single line (JSONL):
|
|
157
|
+
```json
|
|
158
|
+
{"ts":"{GetTimestamp()}","type":"feature_ship","name":"{feature}","version":"{newVersion}","lint":"{lintStatus}","tests":"{testStatus}"}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Step 9: Update Shipped Index
|
|
162
|
+
|
|
163
|
+
READ: `{shippedPath}` (create if not exists)
|
|
164
|
+
|
|
165
|
+
### Format New Entry
|
|
166
|
+
|
|
167
|
+
```markdown
|
|
168
|
+
## {GetDate()} - {feature}
|
|
169
|
+
- Version: {newVersion}
|
|
170
|
+
- Lint: {lintStatus} | Tests: {testStatus}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
INSERT at top (after # Shipped header)
|
|
174
|
+
|
|
175
|
+
### Archive Old Entries
|
|
176
|
+
IF file has entries older than 30 days:
|
|
177
|
+
MOVE old entries to: `{globalPath}/progress/archive/shipped-{yearMonth}.md`
|
|
178
|
+
|
|
179
|
+
WRITE: `{shippedPath}`
|
|
180
|
+
|
|
181
|
+
## Step 10: Log to Memory
|
|
182
|
+
|
|
183
|
+
APPEND to: `{memoryPath}`
|
|
184
|
+
|
|
185
|
+
Single line (JSONL):
|
|
186
|
+
```json
|
|
187
|
+
{"timestamp":"{GetTimestamp()}","action":"feature_shipped","feature":"{feature}","version":"{newVersion}"}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Output
|
|
191
|
+
|
|
192
|
+
SUCCESS:
|
|
193
|
+
```
|
|
194
|
+
🚀 Shipped: {feature}
|
|
195
|
+
|
|
196
|
+
Version: {currentVersion} → {newVersion}
|
|
197
|
+
Lint: {lintStatus}
|
|
198
|
+
Tests: {testStatus}
|
|
199
|
+
Commit: {commitHash}
|
|
200
|
+
|
|
201
|
+
Next:
|
|
202
|
+
• /p:feature - Plan next feature
|
|
203
|
+
• /p:recap - See progress
|
|
204
|
+
• compact - Clean up conversation
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Error Handling
|
|
208
|
+
|
|
209
|
+
| Error | Response | Action |
|
|
210
|
+
|-------|----------|--------|
|
|
211
|
+
| No git repo | "Not a git repository" | STOP |
|
|
212
|
+
| No changes | "No changes to ship" | STOP |
|
|
213
|
+
| Lint fails | Show warning | CONTINUE |
|
|
214
|
+
| Tests fail | Show warning | CONTINUE |
|
|
215
|
+
| Push fails | Show fix command | CONTINUE |
|
|
216
|
+
| No package.json | Skip version bump | CONTINUE |
|
|
217
|
+
|
|
218
|
+
## Examples
|
|
219
|
+
|
|
220
|
+
### Example 1: Full Success
|
|
221
|
+
```
|
|
222
|
+
🚀 Shipped: user authentication
|
|
223
|
+
|
|
224
|
+
Version: 1.2.0 → 1.3.0
|
|
225
|
+
Lint: passed
|
|
226
|
+
Tests: passed
|
|
227
|
+
Commit: abc1234
|
|
228
|
+
|
|
229
|
+
Next: /p:feature | /p:recap | compact
|
|
32
230
|
```
|
|
33
231
|
|
|
34
|
-
|
|
35
|
-
|
|
232
|
+
### Example 2: With Warnings
|
|
233
|
+
```
|
|
234
|
+
🚀 Shipped: bug fixes
|
|
235
|
+
|
|
236
|
+
Version: 1.2.0 → 1.2.1
|
|
237
|
+
Lint: warnings (non-blocking)
|
|
238
|
+
Tests: skipped
|
|
239
|
+
Commit: def5678
|
|
240
|
+
|
|
241
|
+
⚠️ Consider fixing lint warnings
|
|
242
|
+
|
|
243
|
+
Next: /p:feature | /p:recap | compact
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Example 3: No Tests/Lint
|
|
247
|
+
```
|
|
248
|
+
🚀 Shipped: documentation update
|
|
249
|
+
|
|
250
|
+
Version: 1.2.0 → 1.2.1
|
|
251
|
+
Lint: skipped (no script)
|
|
252
|
+
Tests: skipped (no script)
|
|
253
|
+
Commit: ghi9012
|
|
254
|
+
|
|
255
|
+
Next: /p:feature | /p:recap | compact
|
|
256
|
+
```
|
|
@@ -1,71 +1,262 @@
|
|
|
1
1
|
---
|
|
2
|
-
allowed-tools: [Read, Write, Bash, Glob, Grep
|
|
2
|
+
allowed-tools: [Read, Write, Bash, Glob, Grep]
|
|
3
3
|
description: 'Sync state + generate agents + detect patterns'
|
|
4
|
+
timestamp-rule: 'GetTimestamp() for all timestamps'
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# /p:sync
|
|
7
|
+
# /p:sync - Sync Project State
|
|
7
8
|
|
|
8
|
-
##
|
|
9
|
+
## Context Variables
|
|
10
|
+
- `{projectId}`: From `.prjct/prjct.config.json`
|
|
11
|
+
- `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
|
|
12
|
+
- `{analysisPath}`: `{globalPath}/analysis`
|
|
13
|
+
- `{agentsPath}`: `{globalPath}/agents`
|
|
14
|
+
- `{memoryPath}`: `{globalPath}/memory/context.jsonl`
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
2. Execute pattern analysis → generates `analysis/patterns.md`
|
|
12
|
-
3. Read both analysis files
|
|
13
|
-
4. Generate agents per technology → `agents/`
|
|
14
|
-
5. Update `CLAUDE.md` with patterns summary
|
|
15
|
-
6. Log to memory
|
|
16
|
+
## Step 1: Read Config
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
READ: `.prjct/prjct.config.json`
|
|
19
|
+
EXTRACT: `projectId`
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
IF file not found:
|
|
22
|
+
OUTPUT: "No prjct project. Run /p:init first."
|
|
23
|
+
STOP
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
2. **Detect design patterns**: SOLID, DRY, factories, etc.
|
|
23
|
-
3. **Extract conventions**: naming, style, structure
|
|
24
|
-
4. **Flag anti-patterns**: god classes, duplication, mixed concerns
|
|
25
|
-
5. **Generate recommendations**: immediate fixes + best practices
|
|
25
|
+
## Step 2: Analyze Repository
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### Detect Stack
|
|
28
|
+
GLOB: `**/*.{js,ts,jsx,tsx,py,rb,go,rs,java}`
|
|
29
|
+
GLOB: `**/package.json`, `**/Cargo.toml`, `**/go.mod`, `**/requirements.txt`
|
|
30
|
+
|
|
31
|
+
EXTRACT:
|
|
32
|
+
- {languages}: List of languages found
|
|
33
|
+
- {frameworks}: Detected frameworks (React, Express, Django, etc.)
|
|
34
|
+
- {packageManager}: npm, yarn, pnpm, pip, cargo, etc.
|
|
35
|
+
|
|
36
|
+
### Analyze File Structure
|
|
37
|
+
BASH: `find . -type f -name "*.{ext}" | head -50`
|
|
38
|
+
|
|
39
|
+
DETERMINE:
|
|
40
|
+
- {sourceDir}: Main source directory (src/, lib/, app/)
|
|
41
|
+
- {testDir}: Test directory (test/, tests/, __tests__/)
|
|
42
|
+
- {configFiles}: Config files found
|
|
43
|
+
|
|
44
|
+
### Generate repo-summary.md
|
|
45
|
+
|
|
46
|
+
WRITE: `{analysisPath}/repo-summary.md`
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
# Repository Summary
|
|
50
|
+
|
|
51
|
+
> Generated: {GetTimestamp()}
|
|
52
|
+
|
|
53
|
+
## Stack
|
|
54
|
+
- Languages: {languages}
|
|
55
|
+
- Frameworks: {frameworks}
|
|
56
|
+
- Package Manager: {packageManager}
|
|
57
|
+
|
|
58
|
+
## Structure
|
|
59
|
+
- Source: {sourceDir}
|
|
60
|
+
- Tests: {testDir}
|
|
61
|
+
- Entry: {entryPoint}
|
|
62
|
+
|
|
63
|
+
## Files
|
|
64
|
+
- Total: {fileCount}
|
|
65
|
+
- Source: {sourceCount}
|
|
66
|
+
- Tests: {testCount}
|
|
28
67
|
```
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
68
|
+
|
|
69
|
+
## Step 3: Pattern Analysis
|
|
70
|
+
|
|
71
|
+
### Sample Files
|
|
72
|
+
READ 5-10 representative source files:
|
|
73
|
+
- Main entry point
|
|
74
|
+
- Largest files (potential complexity)
|
|
75
|
+
- Utility/helper files
|
|
76
|
+
- Test files
|
|
77
|
+
- Config files
|
|
78
|
+
|
|
79
|
+
### Detect Patterns
|
|
80
|
+
|
|
81
|
+
Analyze for:
|
|
82
|
+
1. **SOLID Principles**: Evidence of each
|
|
83
|
+
2. **DRY**: Shared utilities, constants
|
|
84
|
+
3. **Design Patterns**: Factory, singleton, observer, repository
|
|
85
|
+
4. **Code Style**: Naming, formatting, imports
|
|
86
|
+
|
|
87
|
+
### Detect Anti-Patterns
|
|
88
|
+
|
|
89
|
+
Flag:
|
|
90
|
+
- God classes (files > 300 lines)
|
|
91
|
+
- Deep nesting (> 4 levels)
|
|
92
|
+
- Code duplication
|
|
93
|
+
- Magic numbers
|
|
94
|
+
- Mixed concerns
|
|
95
|
+
|
|
96
|
+
### Generate patterns.md
|
|
97
|
+
|
|
98
|
+
WRITE: `{analysisPath}/patterns.md`
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
# Code Patterns - {project}
|
|
102
|
+
|
|
103
|
+
> Generated: {GetTimestamp()}
|
|
104
|
+
|
|
105
|
+
## Patterns Detected
|
|
106
|
+
- {pattern}: {where} - {example}
|
|
107
|
+
|
|
108
|
+
## Conventions (MUST FOLLOW)
|
|
109
|
+
- Functions: {convention}
|
|
110
|
+
- Classes: {convention}
|
|
111
|
+
- Files: {convention}
|
|
112
|
+
- Async: {pattern}
|
|
113
|
+
|
|
114
|
+
## Anti-Patterns ⚠️
|
|
115
|
+
1. **{issue}**: {file:line} - Fix: {action}
|
|
116
|
+
|
|
117
|
+
## Recommendations
|
|
118
|
+
1. {action}
|
|
34
119
|
```
|
|
35
120
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- Recommendations (for quality)
|
|
121
|
+
## Step 4: Generate Agents
|
|
122
|
+
|
|
123
|
+
Based on detected stack, generate specialized agents:
|
|
124
|
+
|
|
125
|
+
### Agent Generation Rules
|
|
42
126
|
|
|
43
|
-
|
|
127
|
+
IF {languages} includes JavaScript/TypeScript:
|
|
128
|
+
IF React/Vue/Angular detected:
|
|
129
|
+
GENERATE: `agents/fe.md` (Frontend Specialist)
|
|
130
|
+
IF Express/Fastify/Nest detected:
|
|
131
|
+
GENERATE: `agents/be.md` (Backend Specialist)
|
|
44
132
|
|
|
45
|
-
|
|
133
|
+
IF {languages} includes Python:
|
|
134
|
+
GENERATE: `agents/py.md` (Python Specialist)
|
|
46
135
|
|
|
47
|
-
|
|
136
|
+
IF tests detected:
|
|
137
|
+
GENERATE: `agents/qa.md` (Quality Specialist)
|
|
138
|
+
|
|
139
|
+
ALWAYS GENERATE:
|
|
140
|
+
- `agents/coordinator.md` (Orchestration)
|
|
141
|
+
|
|
142
|
+
### Agent Template
|
|
143
|
+
|
|
144
|
+
For each agent, WRITE to `{agentsPath}/{name}.md`:
|
|
48
145
|
|
|
49
|
-
Add patterns summary section:
|
|
50
146
|
```markdown
|
|
51
|
-
|
|
147
|
+
# {Name} Agent
|
|
148
|
+
|
|
149
|
+
## Role
|
|
150
|
+
{Specialized role description}
|
|
52
151
|
|
|
53
|
-
|
|
54
|
-
- {
|
|
55
|
-
- {
|
|
152
|
+
## Skills
|
|
153
|
+
- {skill1}
|
|
154
|
+
- {skill2}
|
|
56
155
|
|
|
57
|
-
|
|
58
|
-
|
|
156
|
+
## Patterns to Follow
|
|
157
|
+
{From patterns.md}
|
|
158
|
+
|
|
159
|
+
## Files I Own
|
|
160
|
+
{Directories/patterns this agent handles}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Step 5: Update Project CLAUDE.md
|
|
164
|
+
|
|
165
|
+
READ: `{globalPath}/CLAUDE.md`
|
|
166
|
+
|
|
167
|
+
IF exists:
|
|
168
|
+
### Add Patterns Summary
|
|
169
|
+
|
|
170
|
+
INSERT section:
|
|
171
|
+
```markdown
|
|
172
|
+
## Code Patterns
|
|
173
|
+
|
|
174
|
+
**Follow in ALL new code:**
|
|
175
|
+
- {key conventions}
|
|
176
|
+
- {design patterns}
|
|
177
|
+
|
|
178
|
+
**Avoid:**
|
|
179
|
+
- {anti-patterns}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
WRITE: `{globalPath}/CLAUDE.md`
|
|
183
|
+
|
|
184
|
+
## Step 6: Log to Memory
|
|
185
|
+
|
|
186
|
+
APPEND to: `{memoryPath}`
|
|
187
|
+
|
|
188
|
+
Single line (JSONL):
|
|
189
|
+
```json
|
|
190
|
+
{"timestamp":"{GetTimestamp()}","action":"sync","stack":"{languages}","agents":{agentCount},"patterns":{patternCount}}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Output
|
|
194
|
+
|
|
195
|
+
SUCCESS:
|
|
196
|
+
```
|
|
197
|
+
🔄 Synced
|
|
198
|
+
|
|
199
|
+
Stack:
|
|
200
|
+
├── Languages: {languages}
|
|
201
|
+
├── Frameworks: {frameworks}
|
|
202
|
+
└── Package Manager: {packageManager}
|
|
203
|
+
|
|
204
|
+
Generated:
|
|
205
|
+
├── Agents: {agentCount}
|
|
206
|
+
├── Patterns: {patternCount} detected
|
|
207
|
+
└── Anti-patterns: {antiPatternCount} flagged
|
|
208
|
+
|
|
209
|
+
Files:
|
|
210
|
+
├── analysis/repo-summary.md
|
|
211
|
+
├── analysis/patterns.md
|
|
212
|
+
└── agents/*.md
|
|
213
|
+
|
|
214
|
+
Next:
|
|
215
|
+
• /p:feature - Start building
|
|
216
|
+
• /p:context - See full context
|
|
217
|
+
• /p:now - Set current task
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Error Handling
|
|
221
|
+
|
|
222
|
+
| Error | Response | Action |
|
|
223
|
+
|-------|----------|--------|
|
|
224
|
+
| No config | "No prjct project" | STOP |
|
|
225
|
+
| No source files | "Empty project" | WARN, continue |
|
|
226
|
+
| Write fails | Log warning | CONTINUE |
|
|
227
|
+
|
|
228
|
+
## Examples
|
|
229
|
+
|
|
230
|
+
### Example 1: Node.js Project
|
|
59
231
|
```
|
|
232
|
+
🔄 Synced
|
|
233
|
+
|
|
234
|
+
Stack:
|
|
235
|
+
├── Languages: JavaScript, TypeScript
|
|
236
|
+
├── Frameworks: Express, React
|
|
237
|
+
└── Package Manager: npm
|
|
60
238
|
|
|
61
|
-
|
|
239
|
+
Generated:
|
|
240
|
+
├── Agents: 4 (coordinator, fe, be, qa)
|
|
241
|
+
├── Patterns: 8 detected
|
|
242
|
+
└── Anti-patterns: 2 flagged
|
|
62
243
|
|
|
244
|
+
Next: /p:feature | /p:context
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Example 2: Python Project
|
|
63
248
|
```
|
|
64
249
|
🔄 Synced
|
|
65
|
-
├── Stack: {languages/frameworks}
|
|
66
|
-
├── Agents: {count} generated
|
|
67
|
-
├── Patterns: {count} detected
|
|
68
|
-
└── Anti-patterns: {count} flagged
|
|
69
250
|
|
|
70
|
-
|
|
251
|
+
Stack:
|
|
252
|
+
├── Languages: Python
|
|
253
|
+
├── Frameworks: Django
|
|
254
|
+
└── Package Manager: pip
|
|
255
|
+
|
|
256
|
+
Generated:
|
|
257
|
+
├── Agents: 3 (coordinator, py, qa)
|
|
258
|
+
├── Patterns: 5 detected
|
|
259
|
+
└── Anti-patterns: 1 flagged
|
|
260
|
+
|
|
261
|
+
Next: /p:feature | /p:context
|
|
71
262
|
```
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-design
|
|
3
|
+
description: Design API endpoints and contracts
|
|
4
|
+
allowed-tools: [Read, Glob, Grep]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# API Design
|
|
8
|
+
|
|
9
|
+
Design RESTful API endpoints for the given feature.
|
|
10
|
+
|
|
11
|
+
## Input
|
|
12
|
+
- Target: {{target}}
|
|
13
|
+
- Requirements: {{requirements}}
|
|
14
|
+
|
|
15
|
+
## Analysis Steps
|
|
16
|
+
|
|
17
|
+
1. **Identify Resources**
|
|
18
|
+
- What entities are involved?
|
|
19
|
+
- What operations are needed?
|
|
20
|
+
- What relationships exist?
|
|
21
|
+
|
|
22
|
+
2. **Review Existing APIs**
|
|
23
|
+
- Read existing route files
|
|
24
|
+
- Match naming conventions
|
|
25
|
+
- Use consistent patterns
|
|
26
|
+
|
|
27
|
+
3. **Design Endpoints**
|
|
28
|
+
- RESTful resource naming
|
|
29
|
+
- Appropriate HTTP methods
|
|
30
|
+
- Request/response shapes
|
|
31
|
+
|
|
32
|
+
4. **Define Validation**
|
|
33
|
+
- Input validation rules
|
|
34
|
+
- Error responses
|
|
35
|
+
- Edge cases
|
|
36
|
+
|
|
37
|
+
## Output Format
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
# API Design: {target}
|
|
41
|
+
|
|
42
|
+
## Endpoints
|
|
43
|
+
|
|
44
|
+
### GET /api/{resource}
|
|
45
|
+
**Description**: List all resources
|
|
46
|
+
|
|
47
|
+
**Query Parameters**:
|
|
48
|
+
- `limit`: number (default: 20)
|
|
49
|
+
- `offset`: number (default: 0)
|
|
50
|
+
|
|
51
|
+
**Response** (200):
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"data": [...],
|
|
55
|
+
"total": 100,
|
|
56
|
+
"limit": 20,
|
|
57
|
+
"offset": 0
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### POST /api/{resource}
|
|
62
|
+
**Description**: Create resource
|
|
63
|
+
|
|
64
|
+
**Request Body**:
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"field": "value"
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Response** (201):
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"id": "...",
|
|
75
|
+
"field": "value"
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Errors**:
|
|
80
|
+
- 400: Invalid input
|
|
81
|
+
- 401: Unauthorized
|
|
82
|
+
- 409: Conflict
|
|
83
|
+
|
|
84
|
+
## Authentication
|
|
85
|
+
- Method: Bearer token / API key
|
|
86
|
+
- Required for: POST, PUT, DELETE
|
|
87
|
+
|
|
88
|
+
## Rate Limiting
|
|
89
|
+
- 100 requests/minute per user
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Guidelines
|
|
93
|
+
- Follow REST conventions
|
|
94
|
+
- Use consistent error format
|
|
95
|
+
- Document all parameters
|