@cliangdev/flux-plugin 0.2.0-dev.e34d43b → 0.2.0-dev.f718bcf
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/agents/coder.md +150 -25
- package/commands/breakdown.md +44 -7
- package/commands/implement.md +165 -15
- package/commands/prd.md +176 -1
- package/manifest.json +2 -1
- package/package.json +4 -2
- package/skills/prd-writer/SKILL.md +184 -0
- package/skills/ux-ui-design/SKILL.md +346 -0
- package/skills/ux-ui-design/references/design-tokens.md +359 -0
- package/src/dashboard/__tests__/api.test.ts +211 -0
- package/src/dashboard/browser.ts +35 -0
- package/src/dashboard/public/app.js +869 -0
- package/src/dashboard/public/index.html +90 -0
- package/src/dashboard/public/styles.css +807 -0
- package/src/dashboard/public/vendor/highlight.css +10 -0
- package/src/dashboard/public/vendor/highlight.min.js +8422 -0
- package/src/dashboard/public/vendor/marked.min.js +2210 -0
- package/src/dashboard/server.ts +296 -0
- package/src/dashboard/watchers.ts +83 -0
- package/src/server/adapters/__tests__/dependency-ops.test.ts +52 -18
- package/src/server/adapters/linear/adapter.ts +19 -14
- package/src/server/adapters/local-adapter.ts +48 -7
- package/src/server/db/__tests__/queries.test.ts +2 -1
- package/src/server/db/schema.ts +9 -0
- package/src/server/tools/__tests__/crud.test.ts +111 -1
- package/src/server/tools/__tests__/mcp-interface.test.ts +2 -1
- package/src/server/tools/__tests__/query.test.ts +73 -2
- package/src/server/tools/__tests__/z-configure-linear.test.ts +1 -1
- package/src/server/tools/__tests__/z-get-linear-url.test.ts +1 -1
- package/src/server/tools/create-epic.ts +11 -2
- package/src/server/tools/create-prd.ts +11 -2
- package/src/server/tools/create-task.ts +11 -2
- package/src/server/tools/dependencies.ts +2 -2
- package/src/server/tools/get-entity.ts +12 -10
- package/src/server/tools/render-status.ts +38 -20
- package/src/status-line/__tests__/status-line.test.ts +1 -1
- package/src/utils/status-renderer.ts +32 -6
package/agents/coder.md
CHANGED
|
@@ -20,30 +20,41 @@ You receive only:
|
|
|
20
20
|
|
|
21
21
|
This keeps your context clean for high-quality code output.
|
|
22
22
|
|
|
23
|
-
## Step 1:
|
|
23
|
+
## Step 1: Apply Project Skill
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
The orchestrator should provide a **Project Skill** section in your prompt with patterns to follow. If provided, strictly follow those patterns for:
|
|
26
|
+
- Code structure and organization
|
|
27
|
+
- Error handling conventions
|
|
28
|
+
- Testing patterns
|
|
29
|
+
- Naming conventions
|
|
30
|
+
|
|
31
|
+
### Fallback: Discover Skill Yourself
|
|
32
|
+
|
|
33
|
+
If no skill was provided in your prompt, discover and load it:
|
|
26
34
|
|
|
27
35
|
```bash
|
|
28
|
-
#
|
|
36
|
+
# 1. Detect project type
|
|
29
37
|
ls -la | head -20
|
|
38
|
+
|
|
39
|
+
# 2. Check for matching skill in .claude/skills/
|
|
40
|
+
ls .claude/skills/ 2>/dev/null
|
|
30
41
|
```
|
|
31
42
|
|
|
32
|
-
| File Found | Project Type | Skill
|
|
33
|
-
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `package.json` +
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `requirements.txt` / `pyproject.toml` | Python | Python idioms |
|
|
43
|
+
| File Found | Project Type | Skill Search Pattern |
|
|
44
|
+
|------------|--------------|---------------------|
|
|
45
|
+
| `go.mod` | Go | `golang*`, `go-*` |
|
|
46
|
+
| `tsconfig.json` | TypeScript | `typescript*`, `ts-*` |
|
|
47
|
+
| `pom.xml` / `build.gradle` | Java/Spring | `java*`, `spring*` |
|
|
48
|
+
| `package.json` + react | React | `react*`, `ui-*` |
|
|
49
|
+
| `Cargo.toml` | Rust | `rust*` |
|
|
50
|
+
| `requirements.txt` | Python | `python*`, `py-*` |
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
```bash
|
|
53
|
+
# 3. Read matching skill
|
|
54
|
+
cat .claude/skills/{matched-skill}/SKILL.md
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Apply the loaded skill patterns** - if no matching skill exists, use general best practices for that language.
|
|
47
58
|
|
|
48
59
|
## Step 2: Understand the Task
|
|
49
60
|
|
|
@@ -61,10 +72,11 @@ Acceptance Criteria:
|
|
|
61
72
|
|
|
62
73
|
## Step 3: Write Tests First (TDD)
|
|
63
74
|
|
|
75
|
+
### 3.1 Tests for Acceptance Criteria
|
|
76
|
+
|
|
64
77
|
For each `[auto]` criterion, write a failing test:
|
|
65
78
|
|
|
66
79
|
```typescript
|
|
67
|
-
// Example for TypeScript
|
|
68
80
|
describe('Login API', () => {
|
|
69
81
|
it('returns 401 for invalid credentials', async () => {
|
|
70
82
|
const response = await api.post('/login', {
|
|
@@ -82,6 +94,34 @@ describe('Login API', () => {
|
|
|
82
94
|
});
|
|
83
95
|
```
|
|
84
96
|
|
|
97
|
+
### 3.2 Tests for Critical Components
|
|
98
|
+
|
|
99
|
+
Beyond acceptance criteria, also test:
|
|
100
|
+
|
|
101
|
+
- **Core business logic**: Functions that make important decisions
|
|
102
|
+
- **Data transformations**: Parsing, validation, mapping functions
|
|
103
|
+
- **Error paths**: Edge cases and failure scenarios
|
|
104
|
+
- **Integration points**: API handlers, database operations
|
|
105
|
+
- **Utilities used in multiple places**: Shared helpers and utils
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
describe('SessionManager', () => {
|
|
109
|
+
it('expires sessions after TTL', async () => {
|
|
110
|
+
const session = await sessionManager.create(userId);
|
|
111
|
+
await advanceTime(SESSION_TTL + 1000);
|
|
112
|
+
expect(await sessionManager.isValid(session.id)).toBe(false);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('handles concurrent session creation', async () => {
|
|
116
|
+
const results = await Promise.all([
|
|
117
|
+
sessionManager.create(userId),
|
|
118
|
+
sessionManager.create(userId),
|
|
119
|
+
]);
|
|
120
|
+
expect(results[0].id).not.toBe(results[1].id);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
85
125
|
Run tests to confirm they fail:
|
|
86
126
|
```bash
|
|
87
127
|
bun test login.test.ts
|
|
@@ -103,6 +143,81 @@ Write minimal code to make tests pass:
|
|
|
103
143
|
bun test
|
|
104
144
|
```
|
|
105
145
|
|
|
146
|
+
## Code Quality Standards
|
|
147
|
+
|
|
148
|
+
### Write Clean, Modular, Testable Code
|
|
149
|
+
|
|
150
|
+
**Modularity**
|
|
151
|
+
- Small, focused functions that do one thing well
|
|
152
|
+
- Clear separation of concerns (business logic vs I/O vs presentation)
|
|
153
|
+
- Dependencies injected, not hardcoded - makes testing easy
|
|
154
|
+
- Extract reusable logic into well-named helper functions
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
// ✅ Good: Modular, testable
|
|
158
|
+
function validateCredentials(email: string, password: string): ValidationResult {
|
|
159
|
+
if (!isValidEmail(email)) return { valid: false, error: 'Invalid email' };
|
|
160
|
+
if (password.length < 8) return { valid: false, error: 'Password too short' };
|
|
161
|
+
return { valid: true };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function login(credentials: Credentials, userRepo: UserRepository) {
|
|
165
|
+
const validation = validateCredentials(credentials.email, credentials.password);
|
|
166
|
+
if (!validation.valid) throw new ValidationError(validation.error);
|
|
167
|
+
return userRepo.findByEmail(credentials.email);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// ❌ Bad: Monolithic, hard to test
|
|
171
|
+
async function login(email: string, password: string) {
|
|
172
|
+
// validation mixed with business logic mixed with database calls
|
|
173
|
+
const db = getDatabase();
|
|
174
|
+
if (!email.includes('@')) throw new Error('bad email');
|
|
175
|
+
const user = await db.query('SELECT * FROM users WHERE email = ?', [email]);
|
|
176
|
+
// ... more mixed concerns
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Testability**
|
|
181
|
+
- Pure functions where possible (same input → same output)
|
|
182
|
+
- Side effects isolated and explicit
|
|
183
|
+
- Avoid global state
|
|
184
|
+
- Use interfaces/types for dependencies
|
|
185
|
+
|
|
186
|
+
### No Unnecessary Comments
|
|
187
|
+
|
|
188
|
+
Let code be self-documenting. Comments should explain **why**, not **what**.
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
// ❌ Bad: Comments that restate the code
|
|
192
|
+
// Check if user is admin
|
|
193
|
+
if (user.role === 'admin') {
|
|
194
|
+
// Grant admin access
|
|
195
|
+
grantAdminAccess(user);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ✅ Good: Code explains itself
|
|
199
|
+
if (user.role === 'admin') {
|
|
200
|
+
grantAdminAccess(user);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// ✅ Good: Comment explains non-obvious "why"
|
|
204
|
+
// Rate limit bypass for internal services to prevent cascade failures
|
|
205
|
+
if (request.source === 'internal') {
|
|
206
|
+
skipRateLimit = true;
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**When to comment:**
|
|
211
|
+
- Non-obvious business rules or edge cases
|
|
212
|
+
- Workarounds for external bugs/limitations
|
|
213
|
+
- Performance optimizations that sacrifice readability
|
|
214
|
+
- Public API documentation (JSDoc for library interfaces)
|
|
215
|
+
|
|
216
|
+
**Never comment:**
|
|
217
|
+
- What the code does (let naming convey this)
|
|
218
|
+
- Obvious operations
|
|
219
|
+
- Commented-out code (delete it, git has history)
|
|
220
|
+
|
|
106
221
|
## Step 5: Handle Manual Criteria
|
|
107
222
|
|
|
108
223
|
For `[manual]` criteria, add a comment or doc noting verification steps:
|
|
@@ -174,13 +289,23 @@ Needs:
|
|
|
174
289
|
|
|
175
290
|
## Boundaries
|
|
176
291
|
|
|
177
|
-
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
292
|
+
**DO:**
|
|
293
|
+
- Focus only on the assigned task
|
|
294
|
+
- Apply project skill patterns from your prompt (or discover them from `.claude/skills/`)
|
|
295
|
+
- Write tests before implementation
|
|
296
|
+
- Test critical components beyond just acceptance criteria
|
|
297
|
+
- Write clean, modular, testable code
|
|
298
|
+
- Use clear naming that makes code self-documenting
|
|
299
|
+
|
|
300
|
+
**DON'T:**
|
|
301
|
+
- Ignore provided skill patterns - they contain project-specific conventions
|
|
302
|
+
- Refactor unrelated code
|
|
303
|
+
- Add features not in acceptance criteria
|
|
304
|
+
- Skip tests for `[auto]` criteria
|
|
305
|
+
- Make commits without running tests
|
|
306
|
+
- Add comments that restate what code does
|
|
307
|
+
- Add unnecessary JSDoc/docstrings for simple functions
|
|
308
|
+
- Leave commented-out code
|
|
184
309
|
|
|
185
310
|
## Context Escalation
|
|
186
311
|
|
package/commands/breakdown.md
CHANGED
|
@@ -21,7 +21,21 @@ Check if arguments were provided:
|
|
|
21
21
|
|
|
22
22
|
2. If query successful but no approved PRDs found:
|
|
23
23
|
- If no approved PRDs, tell user: "No approved PRDs found. Approve a PRD first or run `/flux:prd` to create one."
|
|
24
|
-
- If multiple approved PRDs, use AskUserQuestion to let user select
|
|
24
|
+
- If multiple approved PRDs, use AskUserQuestion to let user select:
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"questions": [{
|
|
28
|
+
"question": "Which PRD would you like to break down?",
|
|
29
|
+
"header": "Select PRD",
|
|
30
|
+
"options": [
|
|
31
|
+
{"label": "{PRD-1 title}", "description": "{ref} - {brief description}"},
|
|
32
|
+
{"label": "{PRD-2 title}", "description": "{ref} - {brief description}"}
|
|
33
|
+
],
|
|
34
|
+
"multiSelect": false
|
|
35
|
+
}]
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
Note: Dynamically populate options from the query results.
|
|
25
39
|
|
|
26
40
|
3. If ref provided, call `get_entity` with the ref
|
|
27
41
|
- Verify status is APPROVED
|
|
@@ -78,9 +92,21 @@ Which approach do you prefer?
|
|
|
78
92
|
|
|
79
93
|
1. Get PRD entity with `get_entity` including `include: ['epics']`
|
|
80
94
|
2. Read full PRD content from `folder_path + '/prd.md'` using Read tool
|
|
81
|
-
3. If PRD already has epics, inform user:
|
|
82
|
-
|
|
83
|
-
|
|
95
|
+
3. If PRD already has epics, inform user and use AskUserQuestion:
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"questions": [{
|
|
99
|
+
"question": "This PRD already has {count} epics. What would you like to do?",
|
|
100
|
+
"header": "Epics",
|
|
101
|
+
"options": [
|
|
102
|
+
{"label": "Add more epics", "description": "Keep existing epics and add new ones"},
|
|
103
|
+
{"label": "View existing", "description": "See current epic structure before deciding"},
|
|
104
|
+
{"label": "Start fresh", "description": "Delete existing epics and recreate from scratch"}
|
|
105
|
+
],
|
|
106
|
+
"multiSelect": false
|
|
107
|
+
}]
|
|
108
|
+
}
|
|
109
|
+
```
|
|
84
110
|
|
|
85
111
|
### Step 2: Analyze & Identify Epics
|
|
86
112
|
|
|
@@ -142,9 +168,20 @@ Ready to create these epics?
|
|
|
142
168
|
```
|
|
143
169
|
|
|
144
170
|
Use AskUserQuestion only when uncertain:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"questions": [{
|
|
174
|
+
"question": "Ready to create these epics?",
|
|
175
|
+
"header": "Confirm",
|
|
176
|
+
"options": [
|
|
177
|
+
{"label": "Create all epics (Recommended)", "description": "Proceed with the proposed structure"},
|
|
178
|
+
{"label": "Modify structure first", "description": "Adjust epic boundaries or dependencies"},
|
|
179
|
+
{"label": "Add/remove epics", "description": "Change the number of epics"}
|
|
180
|
+
],
|
|
181
|
+
"multiSelect": false
|
|
182
|
+
}]
|
|
183
|
+
}
|
|
184
|
+
```
|
|
148
185
|
|
|
149
186
|
### Step 4: Create Epics
|
|
150
187
|
|
package/commands/implement.md
CHANGED
|
@@ -61,8 +61,100 @@ The orchestrator resolves all refs to tasks, builds a dependency-ordered queue,
|
|
|
61
61
|
- Mixed refs: Resolve each, deduplicate, merge
|
|
62
62
|
- `tag:{name}`: Query PRDs by tag → expand all
|
|
63
63
|
|
|
64
|
+
2. Git state check (REQUIRED before any implementation):
|
|
65
|
+
- Run `git status` to check for uncommitted changes
|
|
66
|
+
- If dirty working tree: Ask user whether to commit, stash, or abort
|
|
67
|
+
- Never proceed with uncommitted changes
|
|
68
|
+
|
|
64
69
|
## Workflow
|
|
65
70
|
|
|
71
|
+
### Step 0: Git Branch Setup
|
|
72
|
+
|
|
73
|
+
**Always start from latest main with a fresh branch.** This ensures clean PRs and avoids merge conflicts.
|
|
74
|
+
|
|
75
|
+
#### 0.1 Ensure Clean State
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Check for uncommitted changes
|
|
79
|
+
git status --porcelain
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If output is non-empty, use AskUserQuestion:
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"questions": [{
|
|
86
|
+
"question": "You have uncommitted changes. How would you like to proceed?",
|
|
87
|
+
"header": "Git Status",
|
|
88
|
+
"options": [
|
|
89
|
+
{"label": "Commit them first", "description": "Stage and commit current changes before starting"},
|
|
90
|
+
{"label": "Stash them", "description": "Stash changes temporarily, restore after implementation"},
|
|
91
|
+
{"label": "Abort implementation", "description": "Stop here and handle changes manually"}
|
|
92
|
+
],
|
|
93
|
+
"multiSelect": false
|
|
94
|
+
}]
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### 0.2 Create Feature Branch from Latest Main
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Fetch latest and create branch
|
|
102
|
+
git fetch origin main
|
|
103
|
+
git checkout -b {branch-name} origin/main
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### 0.3 Branch Naming Convention
|
|
107
|
+
|
|
108
|
+
| Scope | Branch Name | Example |
|
|
109
|
+
|-------|-------------|---------|
|
|
110
|
+
| `tag:xxx` | `feat/tag-{tag}` | `feat/tag-phase-3` |
|
|
111
|
+
| Single PRD | `feat/{prd-ref}` | `feat/FLUX-P3` |
|
|
112
|
+
| Multiple PRDs | `feat/{first-prd-ref}` | `feat/FLUX-P3` |
|
|
113
|
+
| Single Epic | `feat/{epic-ref}` | `feat/FLUX-E14` |
|
|
114
|
+
| Multiple Epics | `feat/{first-epic-ref}` | `feat/FLUX-E14` |
|
|
115
|
+
| Single Task | `feat/{task-ref}` | `feat/FLUX-T31` |
|
|
116
|
+
| Multiple Tasks | `feat/{first-task-ref}` | `feat/FLUX-T31` |
|
|
117
|
+
| No args (next task) | `feat/{task-ref}` | `feat/FLUX-T42` |
|
|
118
|
+
| Mixed refs | `feat/{highest-level-ref}` | `feat/FLUX-P3` (PRD > Epic > Task) |
|
|
119
|
+
|
|
120
|
+
**Priority for mixed refs**: Use the highest-level entity (PRD > Epic > Task). If multiple of the same level, use the first one alphabetically.
|
|
121
|
+
|
|
122
|
+
#### 0.4 Handle Existing Branch
|
|
123
|
+
|
|
124
|
+
If the branch already exists:
|
|
125
|
+
```bash
|
|
126
|
+
# Check if branch exists
|
|
127
|
+
git rev-parse --verify feat/FLUX-P3 2>/dev/null
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
If branch exists, use AskUserQuestion:
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"questions": [{
|
|
134
|
+
"question": "Branch 'feat/FLUX-P3' already exists. What would you like to do?",
|
|
135
|
+
"header": "Branch",
|
|
136
|
+
"options": [
|
|
137
|
+
{"label": "Continue on existing (Recommended)", "description": "Resume work on the existing branch"},
|
|
138
|
+
{"label": "Delete and recreate", "description": "Start fresh from latest main"},
|
|
139
|
+
{"label": "Use different name", "description": "Create a new branch with a different name"}
|
|
140
|
+
],
|
|
141
|
+
"multiSelect": false
|
|
142
|
+
}]
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Example Output
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
Git Setup:
|
|
150
|
+
✓ Working tree clean
|
|
151
|
+
✓ Fetched origin/main
|
|
152
|
+
✓ Created branch: feat/tag-phase-3
|
|
153
|
+
└── Based on: origin/main (abc1234)
|
|
154
|
+
|
|
155
|
+
Ready to implement 3 PRDs (tag: phase-3)
|
|
156
|
+
```
|
|
157
|
+
|
|
66
158
|
### Step 1: Gather Context
|
|
67
159
|
|
|
68
160
|
Resolve all refs to a unified task list:
|
|
@@ -184,31 +276,87 @@ When spawning a coding subagent, provide this context:
|
|
|
184
276
|
- Epic: {epic.ref} - {epic.title}
|
|
185
277
|
- PRD: {prd.ref} (read if more context needed)
|
|
186
278
|
|
|
279
|
+
## Project Skill (APPLY THESE PATTERNS)
|
|
280
|
+
{skillContent || "No project-specific skill found. Use general best practices for this language."}
|
|
281
|
+
|
|
187
282
|
## Workflow
|
|
188
|
-
1.
|
|
283
|
+
1. Apply the project skill patterns above (if provided)
|
|
189
284
|
2. Write tests for each [auto] criterion FIRST
|
|
190
|
-
3.
|
|
191
|
-
4.
|
|
192
|
-
5.
|
|
193
|
-
6.
|
|
285
|
+
3. Write tests for critical components (business logic, data transformations, error paths)
|
|
286
|
+
4. Implement until all tests pass
|
|
287
|
+
5. For [manual] criteria, document verification steps
|
|
288
|
+
6. Commit with message: "{task.ref}: {brief description}"
|
|
289
|
+
7. Report back: COMPLETED or BLOCKED (with reason)
|
|
290
|
+
|
|
291
|
+
## Code Quality Requirements
|
|
292
|
+
- Write clean, modular, testable code
|
|
293
|
+
- Small focused functions with clear separation of concerns
|
|
294
|
+
- Inject dependencies for testability
|
|
295
|
+
- NO unnecessary comments - let code be self-documenting
|
|
296
|
+
- Comments only for non-obvious "why", never for "what"
|
|
297
|
+
- No commented-out code
|
|
194
298
|
|
|
195
299
|
## Files to Focus On
|
|
196
300
|
{relevantFiles}
|
|
197
301
|
```
|
|
198
302
|
|
|
199
|
-
|
|
303
|
+
**Note:** The orchestrator MUST discover and include skill content before spawning. See "Skill Discovery & Application" section above.
|
|
304
|
+
|
|
305
|
+
## Skill Discovery & Application
|
|
306
|
+
|
|
307
|
+
Before spawning a coding subagent, discover and load relevant project skills.
|
|
308
|
+
|
|
309
|
+
### Step 1: Detect Project Type
|
|
310
|
+
|
|
311
|
+
Check for project indicator files:
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
ls -la | head -20
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
| File Found | Project Type |
|
|
318
|
+
|------------|--------------|
|
|
319
|
+
| `go.mod` | Go |
|
|
320
|
+
| `tsconfig.json` | TypeScript |
|
|
321
|
+
| `pom.xml` / `build.gradle` | Java/Spring |
|
|
322
|
+
| `package.json` + react | React |
|
|
323
|
+
| `Cargo.toml` | Rust |
|
|
324
|
+
| `requirements.txt` / `pyproject.toml` | Python |
|
|
325
|
+
|
|
326
|
+
### Step 2: Search for Matching Skills
|
|
327
|
+
|
|
328
|
+
Check `.claude/skills/` for project-specific skills:
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
# List available skills
|
|
332
|
+
ls .claude/skills/ 2>/dev/null || echo "No skills directory"
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**Skill matching patterns:**
|
|
336
|
+
|
|
337
|
+
| Project Type | Skill Search Patterns |
|
|
338
|
+
|--------------|----------------------|
|
|
339
|
+
| Go | `golang*`, `go-*`, `go_*` |
|
|
340
|
+
| TypeScript | `typescript*`, `ts-*`, `ts_*` |
|
|
341
|
+
| Java/Spring | `java*`, `spring*`, `springboot*` |
|
|
342
|
+
| React | `react*`, `ui-*`, `frontend*` |
|
|
343
|
+
| Rust | `rust*` |
|
|
344
|
+
| Python | `python*`, `py-*` |
|
|
345
|
+
|
|
346
|
+
### Step 3: Load Skill Content
|
|
347
|
+
|
|
348
|
+
If a matching skill is found, read its content:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
# Read skill content
|
|
352
|
+
cat .claude/skills/{skill-name}/SKILL.md
|
|
353
|
+
```
|
|
200
354
|
|
|
201
|
-
|
|
355
|
+
### Step 4: Pass Skill to Subagent
|
|
202
356
|
|
|
203
|
-
|
|
204
|
-
|-----------|-------|------------------|
|
|
205
|
-
| `pom.xml` | `springboot-patterns` | DDD, transactions, Java style |
|
|
206
|
-
| `tsconfig.json` | `typescript-patterns` | Async/await, typed errors |
|
|
207
|
-
| `package.json` + React | `ui-patterns` | Components, Tailwind, dark mode |
|
|
208
|
-
| `go.mod` | Go patterns | Error handling, interfaces |
|
|
209
|
-
| `Cargo.toml` | Rust patterns | Result types, ownership |
|
|
357
|
+
Include the skill content in the coding subagent prompt (see template below).
|
|
210
358
|
|
|
211
|
-
|
|
359
|
+
**Important:** If no matching skill is found, the subagent falls back to general best practices for that language.
|
|
212
360
|
|
|
213
361
|
## Status Management
|
|
214
362
|
|
|
@@ -312,3 +460,5 @@ Action needed: Resolve blockers, then run `/flux:implement FP-T45`
|
|
|
312
460
|
- **Fail fast**: Report blockers immediately
|
|
313
461
|
- **One commit per task**: Keep history clean
|
|
314
462
|
- **TDD always**: Tests before implementation
|
|
463
|
+
- **Test critical components**: Not just acceptance criteria - test business logic, transformations, error paths
|
|
464
|
+
- **Clean code**: Modular, testable, self-documenting - no unnecessary comments
|
package/commands/prd.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: flux:prd
|
|
3
3
|
description: Create comprehensive PRDs through discovery, research, and guided writing
|
|
4
|
-
allowed-tools: mcp__flux__*, AskUserQuestion, Read, Glob, Grep, Task, WebSearch
|
|
4
|
+
allowed-tools: mcp__flux__*, AskUserQuestion, Read, Write, Glob, Grep, Task, WebSearch, Bash
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# PRD Creation Command
|
|
@@ -216,6 +216,181 @@ Use AskUserQuestion:
|
|
|
216
216
|
|
|
217
217
|
**Goal**: Gather technical context to make the PRD specific and implementable.
|
|
218
218
|
|
|
219
|
+
#### Step 2.0: Greenfield Detection & Essential Setup
|
|
220
|
+
|
|
221
|
+
**Before exploring the codebase, check if this is a greenfield project.**
|
|
222
|
+
|
|
223
|
+
##### Detection
|
|
224
|
+
|
|
225
|
+
Check for project indicators using Glob:
|
|
226
|
+
```
|
|
227
|
+
- .git directory exists?
|
|
228
|
+
- package.json / go.mod / pyproject.toml / Cargo.toml / etc.?
|
|
229
|
+
- src/ or lib/ directories with code files?
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**If ALL indicators are missing → Greenfield project → Trigger setup flow**
|
|
233
|
+
|
|
234
|
+
##### Essential Setup Flow
|
|
235
|
+
|
|
236
|
+
When greenfield is detected, present:
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
This looks like a new project without existing setup.
|
|
240
|
+
|
|
241
|
+
Before we create the PRD, let's establish the foundation:
|
|
242
|
+
|
|
243
|
+
**Git Setup**
|
|
244
|
+
- Initialize repository with .gitignore for {detected/chosen tech stack}
|
|
245
|
+
- Create branching structure: main + develop (git flow ready)
|
|
246
|
+
- Initial commit with project structure
|
|
247
|
+
|
|
248
|
+
**Project Structure** (based on {project type from Phase 1})
|
|
249
|
+
{Show recommended minimal structure}
|
|
250
|
+
|
|
251
|
+
**Package Setup**
|
|
252
|
+
- Initialize {package.json / pyproject.toml / go.mod / etc.}
|
|
253
|
+
|
|
254
|
+
Proceed with this setup?
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Use AskUserQuestion:
|
|
258
|
+
- "Yes, set up essentials" (Recommended)
|
|
259
|
+
- "Customize setup first"
|
|
260
|
+
- "Skip - I'll set up manually"
|
|
261
|
+
|
|
262
|
+
##### Essential Setup by Project Type
|
|
263
|
+
|
|
264
|
+
| Project Type | Git | Structure | Package Init |
|
|
265
|
+
|--------------|-----|-----------|--------------|
|
|
266
|
+
| **Web App (Node)** | .gitignore (node) | `src/`, `tests/`, `public/` | package.json |
|
|
267
|
+
| **Web App (Python)** | .gitignore (python) | `src/`, `tests/` | pyproject.toml |
|
|
268
|
+
| **CLI Tool (Node)** | .gitignore (node) | `src/`, `bin/`, `tests/` | package.json with bin |
|
|
269
|
+
| **CLI Tool (Go)** | .gitignore (go) | `cmd/`, `internal/`, `pkg/` | go.mod |
|
|
270
|
+
| **API/Backend** | .gitignore (lang) | `src/`, `tests/`, `config/` | Language-specific |
|
|
271
|
+
| **Library** | .gitignore (lang) | `src/`, `tests/`, `examples/` | Language-specific |
|
|
272
|
+
|
|
273
|
+
##### Executing Essential Setup
|
|
274
|
+
|
|
275
|
+
When user confirms, execute via Bash:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Git initialization
|
|
279
|
+
git init
|
|
280
|
+
git checkout -b main
|
|
281
|
+
git checkout -b develop
|
|
282
|
+
|
|
283
|
+
# Create .gitignore (use appropriate template for language)
|
|
284
|
+
# Create initial directory structure (mkdir -p)
|
|
285
|
+
# Initialize package manager (npm init -y / go mod init / etc.)
|
|
286
|
+
|
|
287
|
+
# Initial commit
|
|
288
|
+
git add .
|
|
289
|
+
git commit -m "Initial project setup
|
|
290
|
+
|
|
291
|
+
- Initialize git with main/develop branches
|
|
292
|
+
- Add .gitignore for {language}
|
|
293
|
+
- Create project structure
|
|
294
|
+
- Initialize {package manager}
|
|
295
|
+
|
|
296
|
+
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
|
|
297
|
+
|
|
298
|
+
# Return to develop for feature work
|
|
299
|
+
git checkout develop
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
##### Foundation PRD Offer
|
|
303
|
+
|
|
304
|
+
After essential setup completes (or if user skipped), offer comprehensive setup as a tracked PRD:
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
Foundation is ready. Would you like to track additional setup as a PRD?
|
|
308
|
+
|
|
309
|
+
A Foundation PRD would cover:
|
|
310
|
+
- CI/CD pipeline (GitHub Actions / GitLab CI)
|
|
311
|
+
- Linting & formatting (ESLint+Prettier / Biome / Ruff)
|
|
312
|
+
- Testing framework setup
|
|
313
|
+
- Environment configuration (.env patterns)
|
|
314
|
+
- Pre-commit hooks
|
|
315
|
+
|
|
316
|
+
This gets tracked in Flux so you can implement it systematically.
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Use AskUserQuestion:
|
|
320
|
+
- "Create Foundation PRD" - Creates PRD with [tag: foundation], then continues to feature PRD
|
|
321
|
+
- "Skip - continue to feature PRD" (Recommended for simple projects)
|
|
322
|
+
|
|
323
|
+
##### Foundation PRD Template
|
|
324
|
+
|
|
325
|
+
If user wants a Foundation PRD, create it with this structure:
|
|
326
|
+
|
|
327
|
+
```markdown
|
|
328
|
+
# Project Foundation
|
|
329
|
+
|
|
330
|
+
> **Tag**: foundation
|
|
331
|
+
> **Depends on**: None
|
|
332
|
+
> **Blocks**: All feature PRDs
|
|
333
|
+
|
|
334
|
+
## Problem
|
|
335
|
+
|
|
336
|
+
New projects without proper tooling lead to inconsistent code quality,
|
|
337
|
+
manual testing overhead, and deployment friction.
|
|
338
|
+
|
|
339
|
+
## Users
|
|
340
|
+
|
|
341
|
+
Developers working on this codebase.
|
|
342
|
+
|
|
343
|
+
## Solution
|
|
344
|
+
|
|
345
|
+
Establish development infrastructure: CI/CD, code quality tools, testing
|
|
346
|
+
framework, and environment management.
|
|
347
|
+
|
|
348
|
+
## Features
|
|
349
|
+
|
|
350
|
+
### P0: Must Have
|
|
351
|
+
|
|
352
|
+
- **CI Pipeline**: Automated testing on push/PR
|
|
353
|
+
- **What**: GitHub Actions workflow for test/lint/build
|
|
354
|
+
- **Not**: Deployment pipelines, complex matrix builds
|
|
355
|
+
- **Acceptance Criteria**:
|
|
356
|
+
- [ ] Push to any branch triggers CI
|
|
357
|
+
- [ ] PR cannot merge if CI fails
|
|
358
|
+
- [ ] CI runs tests, linting, and type checking
|
|
359
|
+
|
|
360
|
+
- **Code Quality**: Linting and formatting
|
|
361
|
+
- **What**: {ESLint+Prettier / Biome / Ruff} with pre-commit hooks
|
|
362
|
+
- **Not**: Custom rules beyond standard configs
|
|
363
|
+
- **Acceptance Criteria**:
|
|
364
|
+
- [ ] Lint command runs without errors
|
|
365
|
+
- [ ] Pre-commit hook prevents unlinted commits
|
|
366
|
+
- [ ] Editor integration documented
|
|
367
|
+
|
|
368
|
+
- **Testing Framework**: Test infrastructure
|
|
369
|
+
- **What**: {Jest/Vitest / Pytest / Go test} with coverage
|
|
370
|
+
- **Not**: E2E tests, integration infrastructure
|
|
371
|
+
- **Acceptance Criteria**:
|
|
372
|
+
- [ ] Test command runs and reports coverage
|
|
373
|
+
- [ ] Example test demonstrates patterns
|
|
374
|
+
- [ ] Coverage threshold set (70%)
|
|
375
|
+
|
|
376
|
+
### P1: Should Have
|
|
377
|
+
|
|
378
|
+
- **Environment Config**: .env management
|
|
379
|
+
- **Documentation**: README with setup instructions
|
|
380
|
+
|
|
381
|
+
### Out of Scope
|
|
382
|
+
- Deployment pipelines
|
|
383
|
+
- Production infrastructure
|
|
384
|
+
- Monitoring/observability
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
After creating Foundation PRD:
|
|
388
|
+
1. Save it with `tag: foundation`
|
|
389
|
+
2. Continue to the user's feature PRD
|
|
390
|
+
3. Set feature PRD's `Depends on: {Foundation PRD ref}`
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
219
394
|
#### Step 2.1: Codebase Research
|
|
220
395
|
|
|
221
396
|
Check if there's an existing codebase to analyze:
|