@cliangdev/flux-plugin 0.2.0-dev.2b9c207 → 0.2.0-dev.8414d82

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 CHANGED
@@ -20,41 +20,30 @@ You receive only:
20
20
 
21
21
  This keeps your context clean for high-quality code output.
22
22
 
23
- ## Step 1: Apply Project Skill
23
+ ## Step 1: Detect Project Type & Apply Skill
24
24
 
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:
25
+ Before coding, detect the project type and apply the matching skill:
34
26
 
35
27
  ```bash
36
- # 1. Detect project type
28
+ # Check for project indicators
37
29
  ls -la | head -20
38
-
39
- # 2. Check for matching skill in .claude/skills/
40
- ls .claude/skills/ 2>/dev/null
41
30
  ```
42
31
 
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-*` |
51
-
52
- ```bash
53
- # 3. Read matching skill
54
- cat .claude/skills/{matched-skill}/SKILL.md
55
- ```
32
+ | File Found | Project Type | Skill to Apply |
33
+ |------------|--------------|----------------|
34
+ | `pom.xml` | Java/Spring Boot | `springboot-patterns` |
35
+ | `build.gradle` | Java/Gradle | `springboot-patterns` |
36
+ | `tsconfig.json` | TypeScript | `typescript-patterns` |
37
+ | `package.json` + `react` | React | `ui-patterns` |
38
+ | `go.mod` | Go | Go idioms |
39
+ | `Cargo.toml` | Rust | Rust idioms |
40
+ | `requirements.txt` / `pyproject.toml` | Python | Python idioms |
56
41
 
57
- **Apply the loaded skill patterns** - if no matching skill exists, use general best practices for that language.
42
+ **Apply the skill mentally** - follow its patterns for:
43
+ - Code structure and organization
44
+ - Error handling conventions
45
+ - Testing patterns
46
+ - Naming conventions
58
47
 
59
48
  ## Step 2: Understand the Task
60
49
 
@@ -72,11 +61,10 @@ Acceptance Criteria:
72
61
 
73
62
  ## Step 3: Write Tests First (TDD)
74
63
 
75
- ### 3.1 Tests for Acceptance Criteria
76
-
77
64
  For each `[auto]` criterion, write a failing test:
78
65
 
79
66
  ```typescript
67
+ // Example for TypeScript
80
68
  describe('Login API', () => {
81
69
  it('returns 401 for invalid credentials', async () => {
82
70
  const response = await api.post('/login', {
@@ -94,34 +82,6 @@ describe('Login API', () => {
94
82
  });
95
83
  ```
96
84
 
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
-
125
85
  Run tests to confirm they fail:
126
86
  ```bash
127
87
  bun test login.test.ts
@@ -143,81 +103,6 @@ Write minimal code to make tests pass:
143
103
  bun test
144
104
  ```
145
105
 
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
-
221
106
  ## Step 5: Handle Manual Criteria
222
107
 
223
108
  For `[manual]` criteria, add a comment or doc noting verification steps:
@@ -289,23 +174,13 @@ Needs:
289
174
 
290
175
  ## Boundaries
291
176
 
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
177
+ - **DO** focus only on the assigned task
178
+ - **DO** write tests before implementation
179
+ - **DO** follow detected skill patterns
180
+ - **DON'T** refactor unrelated code
181
+ - **DON'T** add features not in acceptance criteria
182
+ - **DON'T** skip tests for `[auto]` criteria
183
+ - **DON'T** make commits without running tests
309
184
 
310
185
  ## Context Escalation
311
186
 
@@ -21,21 +21,7 @@ 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:
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.
24
+ - If multiple approved PRDs, use AskUserQuestion to let user select which one
39
25
 
40
26
  3. If ref provided, call `get_entity` with the ref
41
27
  - Verify status is APPROVED
@@ -92,21 +78,9 @@ Which approach do you prefer?
92
78
 
93
79
  1. Get PRD entity with `get_entity` including `include: ['epics']`
94
80
  2. Read full PRD content from `folder_path + '/prd.md'` using Read tool
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
- ```
81
+ 3. If PRD already has epics, inform user:
82
+ - "This PRD already has {count} epics. Continue adding more or start fresh?"
83
+ - Use AskUserQuestion with options: "Add more epics", "View existing", "Start fresh (delete existing)"
110
84
 
111
85
  ### Step 2: Analyze & Identify Epics
112
86
 
@@ -168,20 +142,9 @@ Ready to create these epics?
168
142
  ```
169
143
 
170
144
  Use AskUserQuestion only when uncertain:
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
- ```
145
+ - Create all epics (Recommended)
146
+ - Modify structure first
147
+ - Add/remove epics
185
148
 
186
149
  ### Step 4: Create Epics
187
150
 
@@ -61,100 +61,8 @@ 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
-
69
64
  ## Workflow
70
65
 
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
-
158
66
  ### Step 1: Gather Context
159
67
 
160
68
  Resolve all refs to a unified task list:
@@ -276,87 +184,31 @@ When spawning a coding subagent, provide this context:
276
184
  - Epic: {epic.ref} - {epic.title}
277
185
  - PRD: {prd.ref} (read if more context needed)
278
186
 
279
- ## Project Skill (APPLY THESE PATTERNS)
280
- {skillContent || "No project-specific skill found. Use general best practices for this language."}
281
-
282
187
  ## Workflow
283
- 1. Apply the project skill patterns above (if provided)
188
+ 1. Auto-detect project type and apply matching skill
284
189
  2. Write tests for each [auto] criterion FIRST
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
190
+ 3. Implement until all tests pass
191
+ 4. For [manual] criteria, document verification steps
192
+ 5. Commit with message: "{task.ref}: {brief description}"
193
+ 6. Report back: COMPLETED or BLOCKED (with reason)
298
194
 
299
195
  ## Files to Focus On
300
196
  {relevantFiles}
301
197
  ```
302
198
 
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
- ```
199
+ ## Skill Auto-Detection
354
200
 
355
- ### Step 4: Pass Skill to Subagent
201
+ The coding subagent detects project type and applies matching skills:
356
202
 
357
- Include the skill content in the coding subagent prompt (see template below).
203
+ | Detection | Skill | Patterns Applied |
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 |
358
210
 
359
- **Important:** If no matching skill is found, the subagent falls back to general best practices for that language.
211
+ Detection happens at subagent spawn time by checking project root files.
360
212
 
361
213
  ## Status Management
362
214
 
@@ -460,5 +312,3 @@ Action needed: Resolve blockers, then run `/flux:implement FP-T45`
460
312
  - **Fail fast**: Report blockers immediately
461
313
  - **One commit per task**: Keep history clean
462
314
  - **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, Write, Glob, Grep, Task, WebSearch, Bash
4
+ allowed-tools: mcp__flux__*, AskUserQuestion, Read, Glob, Grep, Task, WebSearch
5
5
  ---
6
6
 
7
7
  # PRD Creation Command
@@ -216,181 +216,6 @@ 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
-
394
219
  #### Step 2.1: Codebase Research
395
220
 
396
221
  Check if there's an existing codebase to analyze:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cliangdev/flux-plugin",
3
- "version": "0.2.0-dev.2b9c207",
3
+ "version": "0.2.0-dev.8414d82",
4
4
  "description": "Claude Code plugin for AI-first workflow orchestration with MCP server",
5
5
  "type": "module",
6
6
  "main": "./dist/server/index.js",
@@ -497,190 +497,6 @@ After PRD approval, ask based on project type:
497
497
 
498
498
  **Goal**: Gather technical context to inform the PRD.
499
499
 
500
- #### Step 2.0: Greenfield Detection & Setup
501
-
502
- **Before exploring the codebase, check if this is a greenfield project.**
503
-
504
- ##### Detection
505
-
506
- Check for project indicators:
507
- ```
508
- - .git directory exists?
509
- - package.json / go.mod / pyproject.toml / Cargo.toml / etc.?
510
- - src/ or lib/ directories with code files?
511
- - Any meaningful source files?
512
- ```
513
-
514
- **If ALL indicators are missing → Greenfield project → Trigger setup flow**
515
-
516
- ##### Essential Setup Flow
517
-
518
- When greenfield is detected, present:
519
-
520
- ```
521
- This looks like a new project without existing setup.
522
-
523
- Before we create the PRD, let's establish the foundation:
524
-
525
- **Git Setup**
526
- - Initialize repository with .gitignore
527
- - Create branching structure: main + develop (git flow ready)
528
- - Initial commit with project structure
529
-
530
- **Project Structure** (based on {detected project type from Phase 1})
531
- {Show recommended minimal structure for the project type}
532
-
533
- **Package Setup**
534
- - Initialize {package.json / pyproject.toml / go.mod / etc.}
535
- - Add essential dev dependencies
536
-
537
- Proceed with this setup?
538
- ```
539
-
540
- Use AskUserQuestion:
541
- - "Yes, set up essentials" (Recommended)
542
- - "Customize setup first"
543
- - "Skip - I'll set up manually"
544
-
545
- ##### Essential Setup by Project Type
546
-
547
- | Project Type | Git | Structure | Package Init |
548
- |--------------|-----|-----------|--------------|
549
- | **Web App (Node)** | .gitignore (node) | `src/`, `tests/`, `public/` | package.json with scripts |
550
- | **Web App (Python)** | .gitignore (python) | `src/`, `tests/` | pyproject.toml |
551
- | **CLI Tool (Node)** | .gitignore (node) | `src/`, `bin/`, `tests/` | package.json with bin |
552
- | **CLI Tool (Go)** | .gitignore (go) | `cmd/`, `internal/`, `pkg/` | go.mod |
553
- | **API/Backend** | .gitignore (lang) | `src/`, `tests/`, `config/` | Language-specific |
554
- | **Library** | .gitignore (lang) | `src/`, `tests/`, `examples/` | Language-specific |
555
-
556
- ##### Executing Essential Setup
557
-
558
- When user confirms, execute these commands:
559
-
560
- ```bash
561
- # Git initialization
562
- git init
563
- git checkout -b main
564
- git checkout -b develop
565
-
566
- # Create .gitignore (language-appropriate)
567
- # Create initial directory structure
568
- # Initialize package manager
569
-
570
- # Initial commit
571
- git add .
572
- git commit -m "Initial project setup
573
-
574
- - Initialize git with main/develop branches
575
- - Add .gitignore for {language}
576
- - Create project structure
577
- - Initialize {package manager}
578
-
579
- Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
580
-
581
- # Return to develop for feature work
582
- git checkout develop
583
- ```
584
-
585
- ##### Foundation PRD Offer
586
-
587
- After essential setup completes (or if user skipped), offer comprehensive setup as a tracked PRD:
588
-
589
- ```
590
- Foundation is ready. Would you like to track additional setup as a PRD?
591
-
592
- A Foundation PRD would include:
593
- - CI/CD pipeline (GitHub Actions / GitLab CI)
594
- - Linting & formatting (ESLint+Prettier / Ruff / etc.)
595
- - Testing framework setup
596
- - Environment configuration (.env patterns)
597
- - Pre-commit hooks
598
- - Documentation structure
599
-
600
- This gets tracked in Flux so you can implement it systematically.
601
- ```
602
-
603
- Use AskUserQuestion:
604
- - "Create Foundation PRD" - Creates PRD with [tag: foundation], then continues to feature PRD
605
- - "Skip - continue to feature PRD" (Recommended for simple projects)
606
-
607
- ##### Foundation PRD Template
608
-
609
- If user wants a Foundation PRD, create it with this structure:
610
-
611
- ```markdown
612
- # Project Foundation
613
-
614
- > **Tag**: foundation
615
- > **Depends on**: None
616
- > **Blocks**: All feature PRDs
617
-
618
- ## Problem
619
-
620
- New projects without proper tooling lead to inconsistent code quality,
621
- manual testing overhead, and deployment friction.
622
-
623
- ## Users
624
-
625
- Developers working on this codebase.
626
-
627
- ## Solution
628
-
629
- Establish development infrastructure: CI/CD, code quality tools, testing
630
- framework, and environment management.
631
-
632
- ## Features
633
-
634
- ### P0: Must Have
635
-
636
- - **CI Pipeline**: Automated testing on push/PR
637
- - **What**: GitHub Actions (or GitLab CI) workflow for test/lint/build
638
- - **Not**: Deployment pipelines (separate PRD), complex matrix builds
639
- - **Acceptance Criteria**:
640
- - [ ] Push to any branch triggers CI
641
- - [ ] PR cannot merge if CI fails
642
- - [ ] CI runs tests, linting, and type checking
643
-
644
- - **Code Quality**: Linting and formatting
645
- - **What**: {ESLint+Prettier / Biome / Ruff / etc.} with pre-commit hooks
646
- - **Not**: Custom rules beyond standard configs
647
- - **Acceptance Criteria**:
648
- - [ ] `{lint command}` runs without errors on codebase
649
- - [ ] Pre-commit hook prevents committing unlinted code
650
- - [ ] Editor integration documented in README
651
-
652
- - **Testing Framework**: Test infrastructure
653
- - **What**: {Jest/Vitest / Pytest / Go test} configured with coverage
654
- - **Not**: E2E tests, integration test infrastructure
655
- - **Acceptance Criteria**:
656
- - [ ] `{test command}` runs and reports coverage
657
- - [ ] Example test file demonstrates testing patterns
658
- - [ ] Coverage threshold configured (suggest 70%)
659
-
660
- ### P1: Should Have
661
-
662
- - **Environment Config**: .env management
663
- - .env.example with all required variables documented
664
- - Validation on startup for required env vars
665
-
666
- - **Documentation**: README and contributing guide
667
- - Setup instructions
668
- - Development workflow
669
- - How to run tests
670
-
671
- ### Out of Scope
672
- - Deployment pipelines (separate DevOps PRD)
673
- - Production infrastructure
674
- - Monitoring and observability
675
- ```
676
-
677
- After creating Foundation PRD, continue to the user's feature PRD with proper dependency:
678
- - Set feature PRD's `Depends on: {Foundation PRD ref}`
679
-
680
- ---
681
-
682
- #### Step 2.1: Codebase Exploration
683
-
684
500
  Spawn a research agent to:
685
501
  1. **Explore the codebase** (if exists):
686
502
  - Project structure and patterns