forge-orkes 0.3.8 → 0.3.10
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/package.json +1 -1
- package/template/.claude/agents/executor.md +37 -50
- package/template/.claude/agents/planner.md +33 -41
- package/template/.claude/agents/researcher.md +24 -26
- package/template/.claude/agents/reviewer.md +45 -53
- package/template/.claude/agents/verifier.md +30 -50
- package/template/.claude/skills/architecting/SKILL.md +32 -46
- package/template/.claude/skills/beads-integration/SKILL.md +27 -43
- package/template/.claude/skills/debugging/SKILL.md +34 -35
- package/template/.claude/skills/designing/SKILL.md +33 -52
- package/template/.claude/skills/discussing/SKILL.md +139 -180
- package/template/.claude/skills/executing/SKILL.md +85 -157
- package/template/.claude/skills/forge/SKILL.md +101 -148
- package/template/.claude/skills/initializing/SKILL.md +104 -144
- package/template/.claude/skills/planning/SKILL.md +65 -67
- package/template/.claude/skills/quick-tasking/SKILL.md +25 -31
- package/template/.claude/skills/researching/SKILL.md +22 -32
- package/template/.claude/skills/reviewing/SKILL.md +406 -0
- package/template/.claude/skills/securing/SKILL.md +19 -19
- package/template/.claude/skills/upgrading/SKILL.md +19 -27
- package/template/.claude/skills/verifying/SKILL.md +53 -81
- package/template/CLAUDE.md +7 -10
- package/template/.claude/skills/auditing/SKILL.md +0 -314
- package/template/.claude/skills/refactoring/SKILL.md +0 -168
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: refactoring
|
|
3
|
-
description: "Review code built during a milestone for refactoring opportunities. Runs after auditing passes. Produces a structured backlog of improvements the user can work through via quick-tasking. Soft gate — review items, add to backlog, complete milestone."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Refactoring: Post-Milestone Code Review for Improvement Opportunities
|
|
7
|
-
|
|
8
|
-
You review the code built during a milestone and catalog opportunities for improvement. This is not about correctness (that's `verifying`) or health (that's `auditing`) — it's about identifying code that works but could be cleaner, simpler, or more consistent.
|
|
9
|
-
|
|
10
|
-
## When to Trigger
|
|
11
|
-
|
|
12
|
-
- **Automatically** after `auditing` completes (all three paths: HEALTHY, NEEDS ATTENTION after fix, ACCEPTABLE WITH CAVEATS after accept)
|
|
13
|
-
- **On-demand** at any time via user request
|
|
14
|
-
|
|
15
|
-
## Step 1: Read Context
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
Read: .forge/project.yml → tech stack, conventions
|
|
19
|
-
Read: .forge/state/milestone-{id}.yml → milestone ID, name, phases completed
|
|
20
|
-
Read: .forge/audits/milestone-{id}-health-report.md → health findings (avoid overlap)
|
|
21
|
-
Read: .forge/refactor-backlog.yml → existing backlog items (if any)
|
|
22
|
-
Read: .forge/constitution.md → active architectural gates (if exists)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Determine the milestone's starting point for the git diff:
|
|
26
|
-
- Check git log for the commit tagged or noted as the milestone start
|
|
27
|
-
- If unavailable, use the first commit after the previous milestone's completion date
|
|
28
|
-
- Fallback: ask the user for the starting commit or branch
|
|
29
|
-
|
|
30
|
-
## Step 2: Scan Milestone Code
|
|
31
|
-
|
|
32
|
-
Spawn a fresh agent with isolated context. Pass it:
|
|
33
|
-
- The explicit list of files changed during the milestone (from `git diff --name-only {start}..HEAD`)
|
|
34
|
-
- The tech stack from `project.yml`
|
|
35
|
-
- The health report findings (so it doesn't duplicate auditing's work)
|
|
36
|
-
- The constitution (so it respects intentional decisions)
|
|
37
|
-
|
|
38
|
-
**The agent scans for 6 categories:**
|
|
39
|
-
|
|
40
|
-
| # | Category | What to Look For |
|
|
41
|
-
|---|----------|-----------------|
|
|
42
|
-
| 1 | **Duplication** | Similar logic in 2+ places that could be extracted into a shared function, hook, or utility |
|
|
43
|
-
| 2 | **Complexity hotspots** | Functions >50 lines, nesting >3 levels deep, high cyclomatic complexity, overly long files |
|
|
44
|
-
| 3 | **Naming & clarity** | Unclear variable/function names, misleading abstractions, functions that do more than their name suggests |
|
|
45
|
-
| 4 | **Pattern inconsistency** | Same thing done differently across the milestone's files (e.g., error handling, data fetching, state management) |
|
|
46
|
-
| 5 | **Dead code** | Unused functions, unreachable branches, commented-out code left behind, unused imports |
|
|
47
|
-
| 6 | **Abstraction issues** | Over-engineered helpers used once, repeated inline code that warrants extraction, premature or missing abstractions |
|
|
48
|
-
|
|
49
|
-
**Agent behavior rules:**
|
|
50
|
-
- Read every file in the diff. No sampling.
|
|
51
|
-
- Every finding must reference a specific file and line range.
|
|
52
|
-
- Understand context — don't flag intentional patterns documented in the constitution.
|
|
53
|
-
- Don't duplicate findings already in the health report from auditing.
|
|
54
|
-
- Estimate effort for each item: `quick` (< 30 min, under 50 lines) or `standard` (needs planning).
|
|
55
|
-
- Suggest a concrete approach for each finding, not just "refactor this."
|
|
56
|
-
- Prefer fewer high-quality findings over many low-signal ones.
|
|
57
|
-
|
|
58
|
-
**Output format** (return to orchestrator):
|
|
59
|
-
|
|
60
|
-
```yaml
|
|
61
|
-
findings:
|
|
62
|
-
- category: duplication
|
|
63
|
-
file: "src/api/users.ts"
|
|
64
|
-
lines: "42-67"
|
|
65
|
-
description: "Duplicate validation logic — same email check in createUser and updateUser"
|
|
66
|
-
effort: quick
|
|
67
|
-
suggested_approach: "Extract shared validateEmail() helper to src/utils/validation.ts"
|
|
68
|
-
- category: complexity
|
|
69
|
-
file: "src/components/Dashboard.tsx"
|
|
70
|
-
lines: "120-245"
|
|
71
|
-
description: "Dashboard render function is 125 lines with 4 levels of nesting"
|
|
72
|
-
effort: standard
|
|
73
|
-
suggested_approach: "Extract stat cards, chart section, and filter bar into subcomponents"
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Step 3: Present Findings to User
|
|
77
|
-
|
|
78
|
-
Group findings by category. Show each with:
|
|
79
|
-
- File and line range
|
|
80
|
-
- What the issue is
|
|
81
|
-
- Estimated effort
|
|
82
|
-
- Suggested approach
|
|
83
|
-
|
|
84
|
-
Present top findings (max 10 initially). If there are more, mention the count.
|
|
85
|
-
|
|
86
|
-
*"I found {N} refactoring opportunities in the code built during this milestone:"*
|
|
87
|
-
|
|
88
|
-
Then for each category with findings:
|
|
89
|
-
|
|
90
|
-
*"**Duplication** ({N} items):*
|
|
91
|
-
*1. `src/api/users.ts:42-67` — Duplicate email validation in createUser and updateUser. Quick fix: extract shared helper. [Accept / Dismiss]*
|
|
92
|
-
*2. ...*"
|
|
93
|
-
|
|
94
|
-
## Step 4: User Triage
|
|
95
|
-
|
|
96
|
-
The user can respond with:
|
|
97
|
-
- **Accept** (individual item) → add to backlog
|
|
98
|
-
- **Dismiss** (individual item) → skip, not a real issue or intentional
|
|
99
|
-
- **Accept all** → bulk add all remaining items to backlog
|
|
100
|
-
- **Dismiss all** → skip everything, no backlog items added
|
|
101
|
-
|
|
102
|
-
For dismissed items, optionally ask for a brief reason (helps calibrate future scans).
|
|
103
|
-
|
|
104
|
-
## Step 5: Write Backlog
|
|
105
|
-
|
|
106
|
-
Read existing `.forge/refactor-backlog.yml` (if any). Determine the next item ID by incrementing from the highest existing ID.
|
|
107
|
-
|
|
108
|
-
Append accepted items to `.forge/refactor-backlog.yml`:
|
|
109
|
-
|
|
110
|
-
```yaml
|
|
111
|
-
items:
|
|
112
|
-
- id: R001
|
|
113
|
-
milestone: 1
|
|
114
|
-
category: duplication
|
|
115
|
-
file: "src/api/users.ts"
|
|
116
|
-
lines: "42-67"
|
|
117
|
-
description: "Duplicate validation logic — same email check in createUser and updateUser"
|
|
118
|
-
effort: quick
|
|
119
|
-
suggested_approach: "Extract shared validateEmail() helper"
|
|
120
|
-
status: pending
|
|
121
|
-
added: "2026-03-18"
|
|
122
|
-
completed: null
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
If the file doesn't exist yet, create it from the template at `.forge/templates/refactor-backlog.yml`.
|
|
126
|
-
|
|
127
|
-
Present summary:
|
|
128
|
-
*"Added {N} items to the refactor backlog. {M} dismissed. You can work these anytime — pending items with `effort: quick` will show up as available Quick tasks when you start a session."*
|
|
129
|
-
|
|
130
|
-
## Step 6: Route
|
|
131
|
-
|
|
132
|
-
Update `.forge/state/milestone-{id}.yml`:
|
|
133
|
-
- Set `current.status` to `complete`
|
|
134
|
-
|
|
135
|
-
Update `.forge/state/index.yml`:
|
|
136
|
-
- Set milestone status to `complete`
|
|
137
|
-
- Update `last_updated` timestamp
|
|
138
|
-
|
|
139
|
-
Present to user:
|
|
140
|
-
*"Milestone [{name}] is complete. {N} refactoring items are in the backlog for whenever you want to tackle them."*
|
|
141
|
-
|
|
142
|
-
If Beads is installed, run `bd complete` to update the dependency graph.
|
|
143
|
-
|
|
144
|
-
## Gate Type: Soft Gate
|
|
145
|
-
|
|
146
|
-
This is a soft gate — it presents opportunities but never blocks milestone completion. Rationale:
|
|
147
|
-
- Refactoring is improvement, not correctness. The code already works (verified) and is healthy (audited).
|
|
148
|
-
- Users should review opportunities but aren't forced to act on them immediately.
|
|
149
|
-
- Backlog items persist across sessions and can be worked whenever it makes sense.
|
|
150
|
-
- Some items may become irrelevant as the codebase evolves — that's fine.
|
|
151
|
-
|
|
152
|
-
## Backlog Lifecycle
|
|
153
|
-
|
|
154
|
-
Backlog items follow this lifecycle:
|
|
155
|
-
|
|
156
|
-
```
|
|
157
|
-
pending → in_progress → done
|
|
158
|
-
pending → dismissed (during triage or later review)
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
Items with `effort: quick` can be picked up directly via `quick-tasking`.
|
|
162
|
-
Items with `effort: standard` should go through the Standard tier flow.
|
|
163
|
-
|
|
164
|
-
When working a backlog item:
|
|
165
|
-
1. `forge` surfaces it as an available task
|
|
166
|
-
2. User selects it
|
|
167
|
-
3. Route to `quick-tasking` or Standard tier based on effort
|
|
168
|
-
4. On completion, update the item's `status` to `done` and set `completed` date
|