@nklisch/pi-agile-workflow 0.15.3

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.
Files changed (203) hide show
  1. package/.claude-plugin/plugin.json +10 -0
  2. package/.codex-plugin/plugin.json +28 -0
  3. package/CHANGELOG.md +591 -0
  4. package/README.md +107 -0
  5. package/docs/ARCHITECTURE.md +716 -0
  6. package/docs/MIGRATION.md +419 -0
  7. package/docs/PRINCIPLES.md +464 -0
  8. package/docs/ROADMAP.md +95 -0
  9. package/docs/SPEC.md +855 -0
  10. package/docs/VISION.md +106 -0
  11. package/extensions/agile-workflow.test.ts +419 -0
  12. package/extensions/agile-workflow.ts +467 -0
  13. package/hooks/hooks.json +52 -0
  14. package/hooks/scripts/prompt-context.py +628 -0
  15. package/hooks/scripts/substrate-maintainer.py +359 -0
  16. package/hooks/scripts/test_prompt_context.py +757 -0
  17. package/package.json +30 -0
  18. package/scripts/install-work-view.sh +165 -0
  19. package/scripts/tests/agent-metadata.test.sh +75 -0
  20. package/scripts/tests/bump-version.test.sh +552 -0
  21. package/scripts/tests/channel-parity.test.sh +117 -0
  22. package/scripts/tests/convert-content-integrity.test.sh +246 -0
  23. package/scripts/tests/convert-install-routing.test.sh +159 -0
  24. package/scripts/tests/install-work-view.test.sh +411 -0
  25. package/scripts/tests/pi-package-metadata.test.sh +119 -0
  26. package/scripts/tests/work-board-shim.test.sh +239 -0
  27. package/scripts/tests/work-view-dist-version.test.sh +105 -0
  28. package/scripts/work-board.sh +64 -0
  29. package/scripts/work-view.sh +423 -0
  30. package/skills/autopilot/SKILL.md +330 -0
  31. package/skills/autopilot/agents/openai.yaml +6 -0
  32. package/skills/board/SKILL.md +62 -0
  33. package/skills/board/agents/openai.yaml +6 -0
  34. package/skills/bold-refactor/SKILL.md +244 -0
  35. package/skills/bold-refactor/agents/openai.yaml +6 -0
  36. package/skills/bug-scan/SKILL.md +378 -0
  37. package/skills/bug-scan/agents/openai.yaml +6 -0
  38. package/skills/bug-scan/references/async-promises.md +119 -0
  39. package/skills/bug-scan/references/concurrency-races.md +148 -0
  40. package/skills/bug-scan/references/data-layer.md +167 -0
  41. package/skills/bug-scan/references/error-handling.md +197 -0
  42. package/skills/bug-scan/references/gate-item-template.md +94 -0
  43. package/skills/bug-scan/references/language-footguns.md +219 -0
  44. package/skills/bug-scan/references/parked-item-template.md +103 -0
  45. package/skills/bug-scan/references/report-template.md +115 -0
  46. package/skills/bug-scan/references/resource-leaks.md +199 -0
  47. package/skills/bug-scan/references/state-closures.md +148 -0
  48. package/skills/bug-scan/references/time-numbers.md +158 -0
  49. package/skills/convert/SKILL.md +1463 -0
  50. package/skills/convert/agents/openai.yaml +6 -0
  51. package/skills/convert/references/legacy-overlap-migration.md +179 -0
  52. package/skills/deep-code-scan/SKILL.md +378 -0
  53. package/skills/deep-code-scan/agents/openai.yaml +6 -0
  54. package/skills/deep-code-scan/references/artifact-ledger.md +148 -0
  55. package/skills/deep-code-scan/references/consolidation.md +91 -0
  56. package/skills/deep-code-scan/references/decomposition.md +127 -0
  57. package/skills/deep-code-scan/references/item-templates.md +263 -0
  58. package/skills/deep-code-scan/references/lane-catalog.md +129 -0
  59. package/skills/deep-code-scan/references/review-gauntlet.md +108 -0
  60. package/skills/deep-code-scan/references/scanner-brief.md +152 -0
  61. package/skills/e2e-test-design/SKILL.md +517 -0
  62. package/skills/e2e-test-design/references/anti-tautology.md +261 -0
  63. package/skills/e2e-test-design/references/service-mocks.md +234 -0
  64. package/skills/e2e-test-design/references/test-taxonomy.md +211 -0
  65. package/skills/epic-design/SKILL.md +476 -0
  66. package/skills/epicize/SKILL.md +210 -0
  67. package/skills/epicize/agents/openai.yaml +6 -0
  68. package/skills/feature-design/SKILL.md +472 -0
  69. package/skills/fix/SKILL.md +173 -0
  70. package/skills/gate-cruft/SKILL.md +258 -0
  71. package/skills/gate-docs/SKILL.md +278 -0
  72. package/skills/gate-patterns/SKILL.md +389 -0
  73. package/skills/gate-refactor/SKILL.md +408 -0
  74. package/skills/gate-security/SKILL.md +275 -0
  75. package/skills/gate-tests/SKILL.md +367 -0
  76. package/skills/groom/SKILL.md +162 -0
  77. package/skills/groom/agents/openai.yaml +6 -0
  78. package/skills/ideate/SKILL.md +185 -0
  79. package/skills/ideate/agents/openai.yaml +6 -0
  80. package/skills/implement/SKILL.md +288 -0
  81. package/skills/implement-orchestrator/SKILL.md +604 -0
  82. package/skills/park/SKILL.md +111 -0
  83. package/skills/perf-design/SKILL.md +427 -0
  84. package/skills/perf-scout/SKILL.md +404 -0
  85. package/skills/perf-scout/agents/openai.yaml +6 -0
  86. package/skills/perf-scout/references/algorithmic-and-data-structures.md +126 -0
  87. package/skills/perf-scout/references/approximation-and-precomputation.md +136 -0
  88. package/skills/perf-scout/references/caching-and-memoization.md +123 -0
  89. package/skills/perf-scout/references/compiler-runtime-and-language.md +136 -0
  90. package/skills/perf-scout/references/database-and-storage-internals.md +144 -0
  91. package/skills/perf-scout/references/distributed-systems.md +150 -0
  92. package/skills/perf-scout/references/game-engine-and-realtime.md +136 -0
  93. package/skills/perf-scout/references/gpu-and-accelerators.md +130 -0
  94. package/skills/perf-scout/references/idea-ranking.md +75 -0
  95. package/skills/perf-scout/references/io-and-batching.md +135 -0
  96. package/skills/perf-scout/references/memory-and-data-locality.md +137 -0
  97. package/skills/perf-scout/references/parallelism-and-vectorization.md +126 -0
  98. package/skills/perf-scout/references/parked-item-template.md +117 -0
  99. package/skills/perf-scout/references/peer-review-pass.md +150 -0
  100. package/skills/perf-scout/references/report-template.md +148 -0
  101. package/skills/principles/SKILL.md +678 -0
  102. package/skills/principles/references/models.md +191 -0
  103. package/skills/principles/references/subagents.md +158 -0
  104. package/skills/prose-author/SKILL.md +185 -0
  105. package/skills/refactor-conventions-creator/SKILL.md +359 -0
  106. package/skills/refactor-conventions-creator/agents/openai.yaml +6 -0
  107. package/skills/refactor-conventions-creator/references/common-structures.md +91 -0
  108. package/skills/refactor-conventions-creator/references/common-styles.md +90 -0
  109. package/skills/refactor-design/SKILL.md +384 -0
  110. package/skills/release-deploy/SKILL.md +667 -0
  111. package/skills/release-deploy/agents/openai.yaml +6 -0
  112. package/skills/research/SKILL.md +166 -0
  113. package/skills/research/agents/openai.yaml +6 -0
  114. package/skills/review/SKILL.md +267 -0
  115. package/skills/review/references/deep-review.md +98 -0
  116. package/skills/review/references/review-lenses.md +68 -0
  117. package/skills/review/references/substrate-side-effects.md +161 -0
  118. package/skills/review/references/target-resolution.md +52 -0
  119. package/skills/scope/SKILL.md +486 -0
  120. package/work-view/Cargo.lock +486 -0
  121. package/work-view/Cargo.toml +9 -0
  122. package/work-view/crates/cli/.work-view-version +1 -0
  123. package/work-view/crates/cli/Cargo.toml +18 -0
  124. package/work-view/crates/cli/src/actionable.rs +500 -0
  125. package/work-view/crates/cli/src/args.rs +792 -0
  126. package/work-view/crates/cli/src/board/assets/board.css +855 -0
  127. package/work-view/crates/cli/src/board/assets/board.js +259 -0
  128. package/work-view/crates/cli/src/board/assets/card.js +139 -0
  129. package/work-view/crates/cli/src/board/assets/components.css +290 -0
  130. package/work-view/crates/cli/src/board/assets/dependency.js +1193 -0
  131. package/work-view/crates/cli/src/board/assets/detail.js +256 -0
  132. package/work-view/crates/cli/src/board/assets/filters.js +389 -0
  133. package/work-view/crates/cli/src/board/assets/index.html +77 -0
  134. package/work-view/crates/cli/src/board/assets/kanban.js +231 -0
  135. package/work-view/crates/cli/src/board/assets/markdown.js +260 -0
  136. package/work-view/crates/cli/src/board/assets/motion.css +131 -0
  137. package/work-view/crates/cli/src/board/assets/state.js +245 -0
  138. package/work-view/crates/cli/src/board/assets/table.js +304 -0
  139. package/work-view/crates/cli/src/board/assets/tokens.css +602 -0
  140. package/work-view/crates/cli/src/board/assets/views.js +41 -0
  141. package/work-view/crates/cli/src/board/assets.rs +162 -0
  142. package/work-view/crates/cli/src/board/feed.rs +204 -0
  143. package/work-view/crates/cli/src/board/mod.rs +246 -0
  144. package/work-view/crates/cli/src/board/open.rs +144 -0
  145. package/work-view/crates/cli/src/board/server.rs +407 -0
  146. package/work-view/crates/cli/src/main.rs +195 -0
  147. package/work-view/crates/cli/src/render.rs +354 -0
  148. package/work-view/crates/cli/src/scope.rs +157 -0
  149. package/work-view/crates/cli/src/stale.rs +581 -0
  150. package/work-view/crates/cli/tests/board-js/dependency-table.test.mjs +64 -0
  151. package/work-view/crates/cli/tests/board-js/expanded-browsing.test.mjs +79 -0
  152. package/work-view/crates/cli/tests/board-js/harness-smoke.test.mjs +11 -0
  153. package/work-view/crates/cli/tests/board-js/harness.mjs +437 -0
  154. package/work-view/crates/cli/tests/board-js/kanban-detail.test.mjs +75 -0
  155. package/work-view/crates/cli/tests/board-js/markdown-filter.test.mjs +60 -0
  156. package/work-view/crates/cli/tests/fixtures/golden/.work/CONVENTIONS.md +3 -0
  157. package/work-view/crates/cli/tests/fixtures/golden/.work/active/epics/epic-alpha.md +16 -0
  158. package/work-view/crates/cli/tests/fixtures/golden/.work/active/features/feat-a.md +16 -0
  159. package/work-view/crates/cli/tests/fixtures/golden/.work/active/features/feat-b.md +16 -0
  160. package/work-view/crates/cli/tests/fixtures/golden/.work/active/stories/story-alpha-1.md +16 -0
  161. package/work-view/crates/cli/tests/fixtures/golden/.work/active/stories/story-research-1.md +19 -0
  162. package/work-view/crates/cli/tests/fixtures/golden/.work/archive/feat-done.md +16 -0
  163. package/work-view/crates/cli/tests/fixtures/golden/.work/archive/feat-shipped.md +18 -0
  164. package/work-view/crates/cli/tests/fixtures/golden/.work/backlog/idea-backlog.md +7 -0
  165. package/work-view/crates/cli/tests/fixtures/golden/.work/releases/v1.0/v1.0.md +16 -0
  166. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/CONVENTIONS.md +6 -0
  167. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-dep-done.md +17 -0
  168. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-design-ready.md +17 -0
  169. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-impl-ready.md +17 -0
  170. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/stories/story-review-ready.md +17 -0
  171. package/work-view/crates/cli/tests/fixtures/with-malformed/.work/CONVENTIONS.md +4 -0
  172. package/work-view/crates/cli/tests/fixtures/with-malformed/.work/active/epics/malformed-no-closing-fence.md +8 -0
  173. package/work-view/crates/cli/tests/fixtures/with-malformed/.work/active/features/good-item.md +16 -0
  174. package/work-view/crates/cli/tests/integration.rs +2833 -0
  175. package/work-view/crates/core/Cargo.toml +13 -0
  176. package/work-view/crates/core/src/error.rs +61 -0
  177. package/work-view/crates/core/src/filter.rs +804 -0
  178. package/work-view/crates/core/src/graph.rs +324 -0
  179. package/work-view/crates/core/src/index.rs +590 -0
  180. package/work-view/crates/core/src/lib.rs +54 -0
  181. package/work-view/crates/core/src/model.rs +202 -0
  182. package/work-view/crates/core/src/parse.rs +494 -0
  183. package/work-view/crates/core/tests/fixtures/golden/.work/CONVENTIONS.md +15 -0
  184. package/work-view/crates/core/tests/fixtures/golden/.work/active/epics/epic-core.md +16 -0
  185. package/work-view/crates/core/tests/fixtures/golden/.work/active/features/feat-parser.md +16 -0
  186. package/work-view/crates/core/tests/fixtures/golden/.work/active/features/feat-query.md +16 -0
  187. package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/malformed-no-id.md +15 -0
  188. package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/story-parse-unit.md +16 -0
  189. package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/story-security-gate.md +16 -0
  190. package/work-view/crates/core/tests/fixtures/golden/.work/archive/feat-old.md +16 -0
  191. package/work-view/crates/core/tests/fixtures/golden/.work/archive/feat-parser.md +17 -0
  192. package/work-view/crates/core/tests/fixtures/golden/.work/backlog/idea-future-board.md +7 -0
  193. package/work-view/crates/core/tests/fixtures/golden/.work/releases/v1.0/v1.0.md +16 -0
  194. package/work-view/crates/core/tests/fixtures/precedence/.work/CONVENTIONS.md +10 -0
  195. package/work-view/crates/core/tests/fixtures/precedence/.work/archive/dup-item.md +18 -0
  196. package/work-view/crates/core/tests/fixtures/precedence/.work/releases/v2.0/dup-item.md +18 -0
  197. package/work-view/crates/core/tests/integration.rs +541 -0
  198. package/work-view/dist/.gitattributes +1 -0
  199. package/work-view/dist/README.md +42 -0
  200. package/work-view/dist/aarch64-apple-darwin/work-view +0 -0
  201. package/work-view/dist/aarch64-unknown-linux-musl/work-view +0 -0
  202. package/work-view/dist/x86_64-apple-darwin/work-view +0 -0
  203. package/work-view/dist/x86_64-unknown-linux-musl/work-view +0 -0
@@ -0,0 +1,359 @@
1
+ ---
2
+ name: refactor-conventions-creator
3
+ description: >
4
+ Create or update a project-specific refactor-conventions catalog for agile-workflow. Explores the
5
+ repo, researches stack-specific best practices, interviews the user about stylistic preferences and
6
+ structural refactor preferences, writes concise style rules into the canonical AGENTS.md, writes
7
+ detailed refactor convention references under .agents/skills/refactor-conventions/, maintains
8
+ optional Claude mirrors, and leaves refactor execution to /agile-workflow:refactor-design. The
9
+ generated catalog extends refactor-design's sensible defaults; it does not replace them or create
10
+ standalone plan docs.
11
+ ---
12
+
13
+ # Refactor Conventions Creator
14
+
15
+ You create or update a project-specific **refactor-conventions** catalog that
16
+ extends `refactor-design` with the team's preferred code style and organization
17
+ rules. The catalog is reference material. It does not replace
18
+ `refactor-design`'s built-in smell scan, and it does not write standalone
19
+ refactoring plan documents.
20
+
21
+ Keep these sources of truth separate:
22
+
23
+ - **Style conventions** — concise project rules live in the selected
24
+ `AGENTS.md` target. Examples: early returns, error handling, preferred
25
+ function shape, naming intent. These are not formatter/linter rules.
26
+ - **Structural/refactor conventions** — richer rule docs live in
27
+ `.agents/skills/refactor-conventions/` with optional Claude mirror. Examples:
28
+ module boundaries, file split triggers, co-location, import direction.
29
+ - **Reusable code patterns** — `.agents/skills/patterns/`, maintained by
30
+ `gate-patterns`. Do not duplicate them here.
31
+ - **Architecture principles** — `principles` skill and foundation docs. Do not
32
+ restate ports/adapters, generated contracts, or other architectural doctrine
33
+ unless the user is choosing a project-specific refactor convention.
34
+
35
+ The goal is a unified, navigable codebase. Convention-driven refactors should
36
+ still earn their keep: less duplication, clearer boundaries, easier scanning, or
37
+ lower coordination cost.
38
+
39
+ ## Phase 1: Check for Existing Artifacts
40
+
41
+ Detect all relevant artifacts before writing:
42
+
43
+ ```text
44
+ Glob: .agents/skills/refactor-conventions/SKILL.md
45
+ Glob: .claude/skills/refactor-conventions/SKILL.md
46
+ Glob: AGENTS.md
47
+ Glob: .agents/AGENTS.md
48
+ Glob: .claude/AGENTS.md
49
+ Glob: CLAUDE.md
50
+ Glob: .claude/CLAUDE.md
51
+ Glob: .agents/CLAUDE.md
52
+ ```
53
+
54
+ Canonical locations:
55
+
56
+ - Selected `AGENTS.md` target is the source of truth for style rules.
57
+ - `.agents/skills/refactor-conventions/` is the source of truth for detailed
58
+ refactor convention references.
59
+ - `.claude/skills/refactor-conventions/` is only a compatibility mirror.
60
+
61
+ If only a Claude copy exists, read it and migrate it into `.agents/skills/`
62
+ instead of treating Claude as canonical. Preserve user-authored content. If both
63
+ copies exist and differ, present the differences and ask whether to merge,
64
+ prefer `.agents`, or keep both for now.
65
+
66
+ If an existing generated skill still says to write a separate `.md` refactoring
67
+ plan, treat that as an old generated template and update the workflow wrapper.
68
+ Do not discard the user's actual rule references.
69
+
70
+ ## Phase 2: Explore the Codebase
71
+
72
+ Scan the repo to understand current coding style and organization. Start with
73
+ direct Read/Glob/Grep over manifests, entry points, representative source
74
+ directories, and existing tests. Use one read-only exploratory sub-agent for breadth
75
+ only when the codebase is too broad to characterize from those reads:
76
+
77
+ - Use the host's generic/general-purpose subagent prompted with the explorer capsule from
78
+ `../principles/references/subagents.md`, at medium reasoning by default.
79
+ - Use high or strongest reviewer reasoning for large or complex codebases.
80
+ - If no generic subagent adapter is available, keep direct host-local scanning.
81
+
82
+ Look for both dimensions.
83
+
84
+ **Style signals:**
85
+ 1. Paradigm — classes, functions, components, data-first modules, mixed style.
86
+ 2. Control flow — early returns, nesting depth, guard clauses, switch/match use.
87
+ 3. Error handling — exceptions, result types, boundary catches, fail-fast guards.
88
+ 4. Composition — inheritance, hooks/composables, middleware, pipelines.
89
+ 5. Function shape — long procedural blocks vs small named units.
90
+ 6. Abstraction posture — pragmatic duplication, thin wrappers, heavy frameworks.
91
+
92
+ **Structural signals:**
93
+ 1. File size distribution and obvious split points.
94
+ 2. Folder layout — feature-based, layer-based, package-based, hybrid.
95
+ 3. Module boundaries — public APIs, deep imports, cross-feature imports.
96
+ 4. Co-location — tests, fixtures, types, styles, docs.
97
+ 5. Import direction and cycles.
98
+ 6. Documentation and generated-artifact placement.
99
+
100
+ Note consistencies and inconsistencies. Summarize findings in 10-15 bullets
101
+ covering both axes.
102
+
103
+ ## Phase 3: Research Stack-Specific Conventions
104
+
105
+ Based on Phase 2, research the stack:
106
+
107
+ 1. Identify languages, frameworks, build tools, and domain.
108
+ 2. Search authoritative guides for relevant style and structure conventions:
109
+ official language guides, framework docs, package layout recommendations,
110
+ testing conventions, and domain-specific organization.
111
+ 3. Read in-repo docs: `AGENTS.md`, `CONTRIBUTING.md`, linter configs,
112
+ architecture docs, ADRs, and existing `.agents/skills/patterns/`.
113
+
114
+ Use research as interview input, not as an automatic rule source. The user's
115
+ confirmed preference wins unless it conflicts with correctness or toolchain
116
+ requirements.
117
+
118
+ ## Phase 4: Interview the User
119
+
120
+ Use `structured question tool`. Weave together repo findings, stack research, and the
121
+ generic prompts in:
122
+
123
+ - `references/common-styles.md`
124
+ - `references/common-structures.md`
125
+
126
+ Ask about concrete tradeoffs, not abstract preferences:
127
+
128
+ - "This repo mixes guard clauses and nested conditionals in service code. Should
129
+ we codify early returns for boundary validation?"
130
+ - "Several modules exceed 600 lines but only split cleanly around parser vs
131
+ renderer responsibilities. Do you want a hard line limit or split-at-boundary
132
+ rule?"
133
+ - "Some features deep-import from sibling internals. Should refactors introduce
134
+ curated module exports, or is deep import acceptable here?"
135
+
136
+ For each confirmed preference, capture:
137
+
138
+ - **Rule** — one sentence.
139
+ - **Axis** — style or structural/refactor.
140
+ - **Why** — readability, navigability, consistency, maintenance cost, etc.
141
+ - **Exceptions** — when not to apply.
142
+ - **Scope** — packages, layers, file types, or "whole repo".
143
+
144
+ Aim for 3-8 style rules and 4-10 structural/refactor rules. Fewer good rules
145
+ are better than a catalog that turns every preference into churn.
146
+
147
+ ## Phase 5: Write Canonical Artifacts
148
+
149
+ ### 5a. Update AGENTS.md style section
150
+
151
+ Resolve the selected `AGENTS.md` target using the same precedence as
152
+ `convert`: root `AGENTS.md`, then `.agents/AGENTS.md`, then
153
+ `.claude/AGENTS.md`, else create root `AGENTS.md`.
154
+
155
+ Write or refresh a short section outside the agile-workflow managed markers:
156
+
157
+ ```markdown
158
+ ## Refactor Style Conventions
159
+
160
+ These project-specific rules extend agile-workflow refactor/design behavior.
161
+ They are not formatter settings.
162
+
163
+ - **<rule name>**: <one-sentence rule>. Exceptions: <short exception>.
164
+ ```
165
+
166
+ If a matching section exists, merge without duplicating rules. If a user-edited
167
+ rule conflicts with a new answer, ask before overwriting.
168
+
169
+ ### 5b. Generate `.agents/skills/refactor-conventions/SKILL.md`
170
+
171
+ The generated `SKILL.md` must stay short — under 100 lines. It is an index and
172
+ consumer guide for `refactor-design`, not a standalone workflow.
173
+
174
+ ```markdown
175
+ ---
176
+ name: refactor-conventions
177
+ description: >
178
+ Project-specific refactor conventions for [language/stack]. Auto-loads when
179
+ agile-workflow refactor-design scans or designs refactors. Extends
180
+ refactor-design's default smell scan with team-confirmed style and structural
181
+ preferences; does not replace the defaults and does not create standalone plan
182
+ docs.
183
+ user-invocable: false
184
+ allowed-tools: Read, Glob, Grep
185
+ ---
186
+
187
+ # Refactor Conventions
188
+
189
+ This is a reference catalog consumed by `/agile-workflow:refactor-design`.
190
+ Run refactor-design's built-in scan first, then use these conventions as an
191
+ additional lens for project-specific consistency.
192
+
193
+ ## Style Rules
194
+
195
+ Source of truth: `AGENTS.md` → `## Refactor Style Conventions`.
196
+ Summaries here are an index only; if this file conflicts with AGENTS, AGENTS wins.
197
+
198
+ | Rule | Summary | Reference |
199
+ |---|---|---|
200
+ | {name} | {one-sentence rule} | [details](references/style/{slug}.md) |
201
+
202
+ ## Structural Refactor Rules
203
+
204
+ | Rule | Summary | Reference |
205
+ |---|---|---|
206
+ | {name} | {one-sentence rule} | [details](references/structure/{slug}.md) |
207
+
208
+ ## How To Use
209
+
210
+ - Do not emit work just because a rule is technically violated.
211
+ - High-value convention drift can become substrate items through
212
+ `/agile-workflow:refactor-design`.
213
+ - Small/surgical fixes become stories at `stage: implementing`.
214
+ - Multi-file or policy-heavy changes become `[refactor]` features at
215
+ `stage: drafting`.
216
+ - Marginal churn belongs in "not worth it" notes, not in `.work/`.
217
+ ```
218
+
219
+ ### 5c. Generate reference files
220
+
221
+ For each style rule, create `references/style/{slug}.md`. These expand the
222
+ AGENTS summary but do not replace it.
223
+
224
+ For each structural/refactor rule, create `references/structure/{slug}.md`.
225
+
226
+ Use this template:
227
+
228
+ ```markdown
229
+ # {Style|Structure} Rule: {Name}
230
+
231
+ > {One-sentence rule}
232
+
233
+ ## Motivation
234
+
235
+ {Why this matters — 2-3 sentences, stack-specific}
236
+
237
+ ## Signals
238
+
239
+ - {What to look for before proposing a refactor}
240
+
241
+ ## Before / After
242
+
243
+ ### From this codebase: {scenario}
244
+
245
+ **Before:**
246
+ \`\`\`{lang}
247
+ {real example or directory tree}
248
+ \`\`\`
249
+
250
+ **After:**
251
+ \`\`\`{lang}
252
+ {preferred version}
253
+ \`\`\`
254
+
255
+ ### Synthetic example: {scenario}
256
+
257
+ **Before:**
258
+ \`\`\`{lang}
259
+ {synthetic anti-pattern}
260
+ \`\`\`
261
+
262
+ **After:**
263
+ \`\`\`{lang}
264
+ {synthetic preferred pattern}
265
+ \`\`\`
266
+
267
+ ## Exceptions
268
+
269
+ - {When this rule should NOT apply}
270
+
271
+ ## Scope
272
+
273
+ - Applies to: {areas, layers, file types}
274
+ - Does NOT apply to: {exclusions}
275
+ ```
276
+
277
+ Use both real and synthetic examples when possible. If a real example would
278
+ expose sensitive code or force a huge excerpt, use file:line references plus a
279
+ short paraphrase.
280
+
281
+ ### 5d. Maintain Claude mirror
282
+
283
+ If `.claude/skills/` exists, create or refresh a compatibility mirror:
284
+
285
+ ```bash
286
+ mkdir -p .claude/skills
287
+ ln -sfn ../../.agents/skills/refactor-conventions .claude/skills/refactor-conventions
288
+ ```
289
+
290
+ If symlinks are unavailable, copy the `.agents` catalog as a mirror and note in
291
+ the output that `.agents/skills/refactor-conventions/` is canonical.
292
+
293
+ ## Phase 6: Convert Alignment Hook
294
+
295
+ `/agile-workflow:convert --update` owns whole-project artifact alignment. After
296
+ creating or materially updating the conventions catalog, make sure convert's
297
+ sync model can repair these artifacts in one pass:
298
+
299
+ - selected `AGENTS.md` has `## Refactor Style Conventions`;
300
+ - `.agents/skills/refactor-conventions/` exists and is canonical;
301
+ - `.claude/skills/refactor-conventions/` is absent, a symlink, or a mirror;
302
+ - old generated catalogs that write standalone `.md` plans are upgraded without
303
+ losing user-authored rules;
304
+ - `.agents/skills/patterns/` remains separate from refactor conventions.
305
+
306
+ If the project already has a messy mix of `.agents` and `.claude` artifacts,
307
+ recommend running `/agile-workflow:convert --update` after this skill finishes.
308
+ Do not duplicate convert's full sync workflow here.
309
+
310
+ ## Phase 7: Present and Confirm
311
+
312
+ Show the user:
313
+
314
+ 1. The style rules written to AGENTS.
315
+ 2. The structural/refactor rules written to the catalog.
316
+ 3. The created or updated file tree.
317
+ 4. Any migration or mirror action taken.
318
+ 5. Whether `/agile-workflow:convert --update` is recommended for one-pass
319
+ artifact alignment.
320
+
321
+ Ask if they want adjustments before the final commit.
322
+
323
+ ## Phase 8: Commit
324
+
325
+ After the user confirms, commit the artifact update:
326
+
327
+ ```bash
328
+ git add AGENTS.md .agents/AGENTS.md .claude/AGENTS.md
329
+ git add .agents/skills/refactor-conventions .claude/skills/refactor-conventions
330
+ git commit -m "refactor-conventions: update project catalog"
331
+ ```
332
+
333
+ Adjust the `git add` paths to only include files that exist or changed. Do not
334
+ commit unrelated working-tree changes.
335
+
336
+ ## Anti-Patterns
337
+
338
+ - NEVER write a standalone refactoring plan file. Refactor work belongs in
339
+ `.work/` items through `refactor-design`.
340
+ - NEVER let the generated catalog replace `refactor-design`'s built-in scan.
341
+ It is an extension layer.
342
+ - NEVER include formatting rules; linters and formatters own those.
343
+ - NEVER duplicate reusable code patterns from `.agents/skills/patterns/`.
344
+ - NEVER include broad architecture theory from the principles skill.
345
+ - NEVER generate more than 10 style rules or 12 structural/refactor rules.
346
+ - NEVER overwrite user-authored AGENTS or catalog content without confirmation.
347
+ - NEVER suggest refactoring that causes massive import churn for marginal value.
348
+
349
+ ## Quality Checklist
350
+
351
+ Before finishing:
352
+
353
+ - [ ] Style summaries are in the selected `AGENTS.md` target.
354
+ - [ ] `.agents/skills/refactor-conventions/SKILL.md` is under 100 lines.
355
+ - [ ] `.agents/skills/refactor-conventions/` is canonical.
356
+ - [ ] Claude mirror exists only as compatibility, not as source of truth.
357
+ - [ ] Each rule has rationale, examples or file references, exceptions, and scope.
358
+ - [ ] The generated catalog tells consumers to emit substrate items, not plan docs.
359
+ - [ ] `refactor-design` can still run sensibly when the catalog is absent.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Refactor Conventions Creator"
3
+ short_description: "Use Refactor Conventions Creator for repo workflows"
4
+ default_prompt: "Use $refactor-conventions-creator for this repository."
5
+ policy:
6
+ allow_implicit_invocation: false
@@ -0,0 +1,91 @@
1
+ # Common Structural Preferences
2
+
3
+ Generic structural choices to weave into the interview naturally alongside repo findings and
4
+ stack-specific research. These are conversation starters, not a checklist — skip anything
5
+ irrelevant to the project's stack or domain.
6
+
7
+ ## File Size
8
+
9
+ | Rule | Description |
10
+ |------|-------------|
11
+ | max-300-lines | Files should not exceed ~300 lines; split at natural boundaries |
12
+ | max-500-lines | Files should not exceed ~500 lines; only split when clearly too large |
13
+ | split-at-boundaries | No hard limit — split when a file covers multiple distinct concerns |
14
+ | one-concept-per-file | Each file should contain exactly one class, component, or logical unit |
15
+
16
+ ## Folder Layout
17
+
18
+ | Rule | Description |
19
+ |------|-------------|
20
+ | feature-based | Group by feature/domain (user/, billing/, auth/) not by layer |
21
+ | layer-based | Group by layer (controllers/, services/, models/) not by feature |
22
+ | hybrid | Top-level by feature, internal organization by layer |
23
+ | domain-driven | Bounded contexts as top-level folders, shared kernel separate |
24
+ | flat-until-painful | Start flat, only create folders when a directory exceeds ~10 files |
25
+
26
+ ## Module Boundaries
27
+
28
+ | Rule | Description |
29
+ |------|-------------|
30
+ | explicit-public-api | Every module folder has an index/barrel that defines its public exports |
31
+ | no-deep-imports | Consumers import from the module root, never from internal files |
32
+ | one-export-per-file | Each file exports exactly one thing (class, function, component, type) |
33
+ | group-by-lifecycle | Files that change together should live together |
34
+
35
+ ## Class and Type Size
36
+
37
+ | Rule | Description |
38
+ |------|-------------|
39
+ | single-responsibility | Each class/module handles one responsibility; split when it does two |
40
+ | max-5-methods | Classes should rarely exceed 5 public methods; split at that threshold |
41
+ | types-with-implementation | Type definitions live in the same file as their primary implementation |
42
+ | types-centralized | All shared types live in a dedicated types/ or models/ directory |
43
+
44
+ ## Co-location
45
+
46
+ | Rule | Description |
47
+ |------|-------------|
48
+ | tests-beside-source | Test files sit next to the file they test (user.ts, user.test.ts) |
49
+ | tests-in-tree | Tests mirror source structure in a separate __tests__/ or test/ tree |
50
+ | styles-beside-component | Style files (CSS/SCSS) sit next to the component they style |
51
+ | styles-centralized | All styles live in a dedicated styles/ directory |
52
+ | stories-beside-component | Storybook stories sit next to the component (Button.stories.tsx) |
53
+
54
+ ## Barrel / Index Files
55
+
56
+ | Rule | Description |
57
+ |------|-------------|
58
+ | barrel-at-boundaries | Index files only at module/package boundaries, not every folder |
59
+ | barrel-everywhere | Every folder has an index file re-exporting its public API |
60
+ | no-barrels | Never use barrel/index files — import directly from source files |
61
+ | curated-barrels | Index files exist but only re-export the intentional public API, not everything |
62
+
63
+ ## File and Folder Naming
64
+
65
+ | Rule | Description |
66
+ |------|-------------|
67
+ | kebab-case-files | All file and folder names use kebab-case (my-component.ts) |
68
+ | pascal-case-components | Component files use PascalCase (MyComponent.tsx), others use kebab-case |
69
+ | suffix-by-role | Files use role suffixes: .service.ts, .controller.ts, .util.ts, .hook.ts |
70
+ | no-suffix | File names describe what they contain without role suffixes |
71
+ | plural-folders | Folder names are plural (controllers/, models/) not singular |
72
+
73
+ ## Import Direction
74
+
75
+ | Rule | Description |
76
+ |------|-------------|
77
+ | no-upward-imports | Files never import from parent directories outside their module |
78
+ | no-cross-feature | Features never import directly from other features — use shared/ |
79
+ | dependency-layers | Clear layer order (ui → domain → infra); never import against the grain |
80
+ | no-circular | Circular imports are never acceptable; restructure to eliminate them |
81
+
82
+ ## Documentation Layout
83
+
84
+ | Rule | Description |
85
+ |------|-------------|
86
+ | docs-centralized | All documentation lives in a top-level docs/ directory |
87
+ | docs-co-located | Documentation lives next to the code it describes (README.md per feature) |
88
+ | readme-per-package | Each package/module has its own README with usage and API docs |
89
+ | consistent-doc-structure | All doc files follow the same template (Purpose, Usage, API, Examples) |
90
+ | changelog-per-package | Each package maintains its own CHANGELOG.md |
91
+ | adr-folder | Architecture Decision Records live in docs/adr/ or docs/decisions/ |
@@ -0,0 +1,90 @@
1
+ # Common Stylistic Preferences
2
+
3
+ Generic stylistic choices to weave into the interview naturally alongside repo findings and
4
+ stack-specific research. These are conversation starters, not a checklist — skip anything
5
+ irrelevant to the project's language or domain.
6
+
7
+ ## Paradigm
8
+
9
+ | Style | Rule |
10
+ |-------|------|
11
+ | functional-first | Prefer pure functions and immutable data over classes and mutable state |
12
+ | class-based | Use classes for stateful entities; functions for stateless transforms |
13
+ | mixed-pragmatic | Use whatever fits — classes for complex state, functions for everything else |
14
+
15
+ ## Control Flow
16
+
17
+ | Style | Rule |
18
+ |-------|------|
19
+ | early-return | Use guard clauses and early returns instead of nested if/else |
20
+ | single-return | Each function has one return point at the end |
21
+ | no-else-after-return | Never use else when the if branch returns |
22
+ | ternary-for-assignment | Use ternaries for simple value assignment, if/else for side effects |
23
+
24
+ ## Error Handling
25
+
26
+ | Style | Rule |
27
+ |-------|------|
28
+ | result-types | Return Result/Either types instead of throwing exceptions |
29
+ | throw-early-catch-late | Throw at the point of failure, catch at the boundary |
30
+ | error-as-values | Treat errors as data — return them, don't throw them |
31
+ | exhaustive-matching | Handle every error variant explicitly, never use catch-all |
32
+
33
+ ## Composition
34
+
35
+ | Style | Rule |
36
+ |-------|------|
37
+ | composition-over-inheritance | Build behavior by composing small units, not extending base classes |
38
+ | pipe-chain | Chain operations via pipe/flow rather than nested function calls |
39
+ | hooks-over-hocs | Prefer hooks (or composables) over higher-order components |
40
+ | mixin-free | Never use mixins — use composition or utility functions instead |
41
+
42
+ ## Function Design
43
+
44
+ | Style | Rule |
45
+ |-------|------|
46
+ | small-functions | Functions do one thing and fit on one screen (~20 lines max) |
47
+ | descriptive-names | Function names describe what they return or what side effect they perform |
48
+ | no-boolean-params | Replace boolean parameters with two named functions or an options object |
49
+ | prefer-named-params | Use objects for 3+ parameters instead of positional arguments |
50
+
51
+ ## Immutability
52
+
53
+ | Style | Rule |
54
+ |-------|------|
55
+ | const-by-default | Use const/readonly/final everywhere; let/var only when mutation is required |
56
+ | no-reassignment | Never reassign variables — use new bindings instead |
57
+ | spread-over-mutate | Create new objects/arrays via spread instead of mutating in place |
58
+
59
+ ## Declarations
60
+
61
+ | Style | Rule |
62
+ |-------|------|
63
+ | arrow-functions | Use arrow functions for all function expressions |
64
+ | function-declarations | Use function declarations for named functions (hoisting, readability) |
65
+ | type-inference | Let the compiler infer types when obvious; annotate at boundaries |
66
+ | explicit-types | Always annotate function signatures, even when inference would work |
67
+
68
+ ## Iteration
69
+
70
+ | Style | Rule |
71
+ |-------|------|
72
+ | declarative-iteration | Use map/filter/reduce instead of for loops |
73
+ | for-of-over-foreach | Prefer for...of over .forEach() for side-effectful iteration |
74
+ | no-reduce-abuse | Only use reduce for actual accumulation — not as a general loop replacement |
75
+
76
+ ## Conditionals
77
+
78
+ | Style | Rule |
79
+ |-------|------|
80
+ | lookup-over-switch | Use object/map lookups instead of switch statements |
81
+ | exhaustive-switch | If using switch, handle every case — never rely on default for known variants |
82
+ | optional-chaining | Use ?. and ?? instead of manual null checks |
83
+
84
+ ## Async
85
+
86
+ | Style | Rule |
87
+ |-------|------|
88
+ | async-await | Use async/await instead of .then() chains |
89
+ | concurrent-by-default | Use Promise.all for independent async operations, never sequential awaits |
90
+ | no-floating-promises | Every promise must be awaited, returned, or explicitly voided |