owflow 0.5.0 → 0.7.0

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 (195) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +448 -261
  3. package/dist/agents/bottleneck-analyzer.md +332 -329
  4. package/dist/agents/code-quality-pragmatist.md +353 -354
  5. package/dist/agents/code-reviewer.md +238 -239
  6. package/dist/agents/codebase-analysis-reporter.md +245 -246
  7. package/dist/agents/docs-operator.md +22 -23
  8. package/dist/agents/e2e-test-verifier.md +447 -448
  9. package/dist/agents/gap-analyzer.md +501 -502
  10. package/dist/agents/implementation-completeness-checker.md +219 -220
  11. package/dist/agents/implementation-planner.md +308 -309
  12. package/dist/agents/information-gatherer.md +690 -691
  13. package/dist/agents/production-readiness-checker.md +278 -279
  14. package/dist/agents/project-analyzer.md +403 -403
  15. package/dist/agents/reality-assessor.md +365 -366
  16. package/dist/agents/research-planner.md +449 -450
  17. package/dist/agents/research-synthesizer.md +402 -403
  18. package/dist/agents/solution-brainstormer.md +256 -257
  19. package/dist/agents/solution-designer.md +371 -372
  20. package/dist/agents/spec-auditor.md +297 -298
  21. package/dist/agents/specification-creator.md +333 -334
  22. package/dist/agents/task-classifier.md +449 -450
  23. package/dist/agents/task-group-implementer.md +283 -284
  24. package/dist/agents/test-suite-runner.md +194 -195
  25. package/dist/agents/user-docs-generator.md +508 -509
  26. package/dist/commands/reviews-code.md +90 -90
  27. package/dist/commands/reviews-pragmatic.md +99 -99
  28. package/dist/commands/reviews-production-readiness.md +113 -113
  29. package/dist/commands/reviews-reality-check.md +110 -110
  30. package/dist/commands/reviews-spec-audit.md +114 -114
  31. package/dist/commands/work.md +280 -280
  32. package/dist/configuration/agents-config.d.ts +2 -0
  33. package/dist/configuration/agents-config.js +8 -44
  34. package/dist/configuration/commands-config.d.ts +23 -0
  35. package/dist/configuration/commands-config.js +17 -17
  36. package/dist/configuration/skills-config.d.ts +2 -0
  37. package/dist/configuration/skills-config.js +3 -3
  38. package/dist/hooks/hooks-diagnostics.d.ts +3 -0
  39. package/dist/hooks/hooks-diagnostics.js +21 -0
  40. package/dist/hooks/hooks-persistence.d.ts +17 -0
  41. package/dist/hooks/hooks-persistence.js +207 -0
  42. package/dist/hooks/hooks-registry.d.ts +6 -0
  43. package/dist/hooks/hooks-registry.js +104 -0
  44. package/dist/hooks/hooks-wrapper.d.ts +25 -0
  45. package/dist/hooks/hooks-wrapper.js +318 -0
  46. package/dist/hooks/internal/before-tool.d.ts +6 -0
  47. package/dist/hooks/internal/before-tool.js +13 -0
  48. package/dist/hooks/internal/session-compaction.d.ts +9 -0
  49. package/dist/hooks/{session-compaction.js → internal/session-compaction.js} +9 -7
  50. package/dist/hooks/runtime/circuit-breaker.d.ts +23 -0
  51. package/dist/hooks/runtime/circuit-breaker.js +39 -0
  52. package/dist/hooks/runtime/failure-policy.d.ts +15 -0
  53. package/dist/hooks/runtime/failure-policy.js +49 -0
  54. package/dist/hooks/runtime/process-executor.d.ts +33 -0
  55. package/dist/hooks/runtime/process-executor.js +147 -0
  56. package/dist/hooks/runtime/status-recorder.d.ts +27 -0
  57. package/dist/hooks/runtime/status-recorder.js +111 -0
  58. package/dist/index.d.ts +7 -0
  59. package/dist/index.js +111 -40
  60. package/dist/skills/agents-md-generator/SKILL.md +223 -223
  61. package/dist/skills/codebase-analyzer/SKILL.md +162 -162
  62. package/dist/skills/codebase-analyzer/references/code-analysis.md +63 -63
  63. package/dist/skills/codebase-analyzer/references/combined.md +31 -31
  64. package/dist/skills/codebase-analyzer/references/context-discovery.md +63 -63
  65. package/dist/skills/codebase-analyzer/references/file-discovery.md +51 -51
  66. package/dist/skills/codebase-analyzer/references/migration-target.md +23 -23
  67. package/dist/skills/codebase-analyzer/references/pattern-mining.md +22 -22
  68. package/dist/skills/dev-analyze/SKILL.md +115 -115
  69. package/dist/skills/dev-bugfix/SKILL.md +452 -452
  70. package/dist/skills/dev-finalize/SKILL.md +118 -118
  71. package/dist/skills/dev-implement/SKILL.md +167 -167
  72. package/dist/skills/dev-plan/SKILL.md +147 -147
  73. package/dist/skills/dev-spec/SKILL.md +182 -182
  74. package/dist/skills/dev-tdd-red/SKILL.md +94 -94
  75. package/dist/skills/dev-verify/SKILL.md +153 -153
  76. package/dist/skills/development/SKILL.md +260 -260
  77. package/dist/skills/diagrams-mermaid/SKILL.md +183 -159
  78. package/dist/skills/diagrams-mermaid/references/reference.md +220 -148
  79. package/dist/skills/docs-manager/SKILL.md +379 -379
  80. package/dist/skills/docs-manager/docs/INDEX.md +199 -199
  81. package/dist/skills/docs-manager/docs/standards/backend/api.md +25 -25
  82. package/dist/skills/docs-manager/docs/standards/backend/migrations.md +22 -22
  83. package/dist/skills/docs-manager/docs/standards/backend/models.md +25 -25
  84. package/dist/skills/docs-manager/docs/standards/backend/queries.md +22 -22
  85. package/dist/skills/docs-manager/docs/standards/frontend/accessibility.md +25 -25
  86. package/dist/skills/docs-manager/docs/standards/frontend/components.md +28 -28
  87. package/dist/skills/docs-manager/docs/standards/frontend/css.md +16 -16
  88. package/dist/skills/docs-manager/docs/standards/frontend/responsive.md +28 -28
  89. package/dist/skills/docs-manager/docs/standards/global/coding-style.md +25 -25
  90. package/dist/skills/docs-manager/docs/standards/global/commenting.md +10 -10
  91. package/dist/skills/docs-manager/docs/standards/global/conventions.md +31 -31
  92. package/dist/skills/docs-manager/docs/standards/global/error-handling.md +22 -22
  93. package/dist/skills/docs-manager/docs/standards/global/minimal-implementation.md +22 -22
  94. package/dist/skills/docs-manager/docs/standards/global/validation.md +28 -28
  95. package/dist/skills/docs-manager/docs/standards/testing/test-writing.md +25 -25
  96. package/dist/skills/docs-manager/references/agents-md-template.md +29 -29
  97. package/dist/skills/docs-manager/references/index-md-template.md +73 -73
  98. package/dist/skills/flow-init/SKILL.md +234 -234
  99. package/dist/skills/flow-init/references/architecture-template.md +45 -45
  100. package/dist/skills/flow-init/references/roadmap-templates.md +93 -93
  101. package/dist/skills/flow-init/references/tech-stack-template.md +70 -70
  102. package/dist/skills/flow-init/references/vision-templates.md +75 -75
  103. package/dist/skills/goal-development/SKILL.md +96 -96
  104. package/dist/skills/goal-migration/SKILL.md +114 -114
  105. package/dist/skills/goal-performance/SKILL.md +126 -0
  106. package/dist/skills/goal-research/SKILL.md +118 -118
  107. package/dist/skills/html-renderer/SKILL.md +173 -173
  108. package/dist/skills/html-renderer/references/index.html +318 -318
  109. package/dist/skills/html-renderer/references/styles.css +388 -388
  110. package/dist/skills/html-renderer/references/tokens.json +104 -104
  111. package/dist/skills/implementation-plan-executor/SKILL.md +378 -378
  112. package/dist/skills/implementation-verifier/SKILL.md +307 -307
  113. package/dist/skills/migration/SKILL.md +268 -268
  114. package/dist/skills/migration-analyze/SKILL.md +126 -126
  115. package/dist/skills/migration-finalize/SKILL.md +161 -161
  116. package/dist/skills/migration-fix/SKILL.md +155 -155
  117. package/dist/skills/migration-implement/SKILL.md +131 -131
  118. package/dist/skills/migration-plan/SKILL.md +131 -131
  119. package/dist/skills/migration-spec/SKILL.md +135 -135
  120. package/dist/skills/migration-spec/references/migration-strategies.md +430 -430
  121. package/dist/skills/migration-target/SKILL.md +134 -134
  122. package/dist/skills/migration-target/references/migration-types.md +489 -489
  123. package/dist/skills/migration-verify/SKILL.md +184 -184
  124. package/dist/skills/orchestrator-framework/SKILL.md +65 -65
  125. package/dist/skills/orchestrator-framework/references/command-namespacing.md +7 -7
  126. package/dist/skills/orchestrator-framework/references/confirm-or-revise-exception.md +20 -20
  127. package/dist/skills/orchestrator-framework/references/delegation-rules.md +54 -54
  128. package/dist/skills/orchestrator-framework/references/dispatcher-handoff.md +27 -27
  129. package/dist/skills/orchestrator-framework/references/fix-loop-contract.md +65 -65
  130. package/dist/skills/orchestrator-framework/references/gate-contract.md +122 -117
  131. package/dist/skills/orchestrator-framework/references/orchestrator-creation-checklist.md +51 -51
  132. package/dist/skills/orchestrator-framework/references/orchestrator-patterns.md +235 -235
  133. package/dist/skills/performance/SKILL.md +267 -437
  134. package/dist/skills/performance-analyze/SKILL.md +129 -0
  135. package/dist/skills/{performance → performance-analyze}/references/performance-optimization-guide.md +271 -365
  136. package/dist/skills/performance-finalize/SKILL.md +117 -0
  137. package/dist/skills/performance-implement/SKILL.md +114 -0
  138. package/dist/skills/performance-plan/SKILL.md +112 -0
  139. package/dist/skills/performance-spec/SKILL.md +145 -0
  140. package/dist/skills/performance-verify/SKILL.md +164 -0
  141. package/dist/skills/research/SKILL.md +249 -249
  142. package/dist/skills/research-brainstorm/SKILL.md +120 -120
  143. package/dist/skills/research-brainstorm/references/brainstorming-techniques.md +84 -84
  144. package/dist/skills/research-converge/SKILL.md +130 -130
  145. package/dist/skills/research-design/SKILL.md +146 -146
  146. package/dist/skills/research-design/references/design-techniques.md +40 -40
  147. package/dist/skills/research-finalize/SKILL.md +125 -125
  148. package/dist/skills/research-fork/SKILL.md +190 -190
  149. package/dist/skills/research-gather/SKILL.md +133 -133
  150. package/dist/skills/research-plan/SKILL.md +141 -141
  151. package/dist/skills/research-plan/references/research-methodologies.md +710 -710
  152. package/dist/skills/research-quick/SKILL.md +139 -139
  153. package/dist/skills/research-synthesize/SKILL.md +127 -127
  154. package/dist/skills/rule-reviewer/SKILL.md +334 -334
  155. package/dist/skills/standards-discover/SKILL.md +260 -260
  156. package/dist/skills/standards-discover/references/aggregation-strategy.md +76 -76
  157. package/dist/skills/standards-discover/references/code-pattern-prompt.md +68 -68
  158. package/dist/skills/standards-discover/references/config-analyzer-prompt.md +67 -67
  159. package/dist/skills/standards-discover/references/docs-extractor-prompt.md +65 -65
  160. package/dist/skills/standards-discover/references/external-analyzer-prompt.md +75 -75
  161. package/dist/skills/standards-update/SKILL.md +207 -207
  162. package/dist/templates/orchestrator-state-base.yml +17 -17
  163. package/dist/templates/orchestrator-state-development.yml +95 -95
  164. package/dist/templates/orchestrator-state-migration.yml +95 -95
  165. package/dist/templates/orchestrator-state-performance.yml +64 -53
  166. package/dist/templates/orchestrator-state-research.yml +67 -67
  167. package/dist/tools/fork_task.d.ts +17 -0
  168. package/dist/tools/fork_task.js +21 -11
  169. package/dist/tools/verify_template.d.ts +11 -0
  170. package/dist/tools/verify_template.js +32 -17
  171. package/dist/tui/hooks-dialogs.d.ts +20 -0
  172. package/dist/tui/hooks-dialogs.js +181 -0
  173. package/dist/tui/hooks-presenter.d.ts +15 -0
  174. package/dist/tui/hooks-presenter.js +70 -0
  175. package/dist/tui/hooks-sidebar.d.ts +10 -0
  176. package/dist/tui/hooks-sidebar.js +104 -0
  177. package/dist/tui/primitives.d.ts +21 -0
  178. package/dist/tui/primitives.js +47 -0
  179. package/dist/tui.d.ts +12 -0
  180. package/dist/tui.js +129 -0
  181. package/dist/types/hook-types.d.ts +125 -0
  182. package/dist/types/hook-types.js +76 -0
  183. package/dist/types/opencode-types.d.ts +13 -0
  184. package/dist/utils/file-util.d.ts +2 -0
  185. package/dist/utils/file-util.js +6 -6
  186. package/dist/utils/fork-task.d.ts +27 -0
  187. package/dist/utils/fork-task.js +18 -23
  188. package/dist/utils/plugin-info.d.ts +3 -0
  189. package/dist/utils/plugin-info.js +8 -10
  190. package/dist/utils/workflow-paths.d.ts +17 -0
  191. package/dist/utils/workflow-paths.js +18 -0
  192. package/dist/utils/yaml-structure.d.ts +7 -0
  193. package/dist/utils/yaml-structure.js +7 -11
  194. package/package.json +68 -48
  195. package/dist/hooks/before-tool.js +0 -19
@@ -1,334 +1,334 @@
1
- ---
2
- name: owflow:rule-reviewer
3
- description: "Score a rule-for-AI markdown file (CLAUDE.md, AGENTS.md, or any rules file) on 5 axes and return concrete actionable fixes"
4
- argument-hint: "[path/to/rules.md]"
5
- user-invocable: true
6
- ---
7
-
8
- # Rule reviewer
9
-
10
- Score an AI rules file on five axes and return concrete fixes. The file under review is whatever rule-for-AI markdown the user passes in — this skill does not assume CLAUDE.md, AGENTS.md, or any specific tool.
11
-
12
- The skill never edits the file. It produces a scorecard. The user decides what to act on.
13
-
14
- Gates follow the shared contract in [Gate Contract](../orchestrator-framework/references/gate-contract.md) (confirm-or-revise exception — see the [Confirm-or-Revise Exception](../orchestrator-framework/references/confirm-or-revise-exception.md)).
15
-
16
- ## Entry Gate
17
-
18
- The input resolution below IS this skill's entry gate.
19
-
20
- ## Input resolution
21
-
22
- **Get the path to the rules file:**
23
-
24
- 1. If a path is provided as the skill argument, use it directly
25
- 2. If no path is provided, use question:
26
- ```
27
- "Which rules file should I review? Provide the path."
28
- ```
29
- 3. Do not guess
30
-
31
- Supported path formats — absolute, repo-relative, or `@`-prefixed:
32
-
33
- - `AGENTS.md`
34
- - `.cursor/rules/api.mdc`
35
- - `src/api/AGENTS.md`
36
- - `.github/copilot-instructions.md`
37
- - `~/.claude/CLAUDE.md`
38
-
39
- If the path resolves to a directory, use question to ask which file to review. If it resolves to multiple files (e.g. `**/AGENTS.md`), score them one at a time and report each scorecard separately — do not merge.
40
-
41
- If the file does not exist, stop and report the path. Do not invent content.
42
-
43
- ## What this skill does NOT do
44
-
45
- - Does not edit the rules file _unless the user explicitly approves the reorder proposed by Check 5_. The default output is read-only.
46
- - Does not generate a full "fixed version" of the file. At most, Check 5 may move/regroup sections; it never rewrites rule content.
47
- - Does not assume the file's tool target. CLAUDE.md, AGENTS.md, `.mdc`, `.windsurfrules`, custom names — all treated as "a rules-for-AI file".
48
- - Does not score _project content_ (architecture, tech choices, conventions). It scores the _rule artifact's condition_ — the same way a code review scores code, not the product.
49
-
50
- ## Procedure
51
-
52
- 1. Read the file in full using the Read tool (if it's > 2000 lines, read in chunks until complete).
53
- 2. Compute Checks 1–4.
54
- 3. Run Check 5 in its own multi-step flow (5a list → 5b comment → 5c propose → 5d ask via question → 5e atomic-change reminder). The reorder edit, if any, happens here and only with explicit user approval.
55
- 4. Print the scorecard in the exact format under "Output format". Include the reorder-proposal summary and the user's decision in the Check 5 findings.
56
- 5. Run the Exit Gate (end of "Output format"): results-acceptance question, then stop. Do not propose further follow-up actions unless the user asks.
57
-
58
- ---
59
-
60
- ## The 5 checks
61
-
62
- ### Check 1 — Length
63
-
64
- Count non-empty lines (ignore blank lines and pure separator lines like `---`).
65
-
66
- | Lines | Verdict | Symbol |
67
- | ------- | --------- | ------ |
68
- | 0–200 | fine | OK |
69
- | 201–500 | watch out | WARN |
70
- | 501+ | warn | FAIL |
71
-
72
- Why it matters: long rule files crowd out the user's prompt in the context window, and middle-of-file rules get the weakest attention from the model. Length is a proxy for "you're paying context for things the agent doesn't need every session."
73
-
74
- For WARN/FAIL, suggest:
75
-
76
- - Split per-area rules into nested files closer to their code (e.g. `src/api/AGENTS.md`).
77
- - Replace duplicated docs with `@`-references to the canonical file.
78
- - Drop rules that aren't tied to a recurring agent failure mode.
79
-
80
- ### Check 2 — Direct code/config snippets
81
-
82
- Scan for fenced code blocks (` ``` `) and inline code blocks longer than ~3 lines.
83
-
84
- Flag any block that looks like:
85
-
86
- - An example component, endpoint, migration, schema, query, bash script or test.
87
- - A configuration file (`tsconfig.json`, `eslintrc`, `package.json`, `wrangler.toml`).
88
- - A migration template or boilerplate that lives elsewhere in the repo.
89
-
90
- Do **not** flag:
91
-
92
- - Short structural snippets used to define a _format_ the agent must produce (e.g. a 2–4 line error-shape template).
93
- - Command examples (`npm run dev`, `git rebase`, etc.).
94
- - Mermaid/diagram blocks.
95
-
96
- For each flagged block, suggest:
97
-
98
- - Move the snippet to a real file in the repo.
99
- - Replace the block with a one-line `@`-reference, e.g. `@src/features/users/user.service.ts`, `@docs/api-errors.md`.
100
- - Reason: the example will be wrong in two places at the next refactor; a reference can't drift.
101
-
102
- Verdict: OK if 0 flagged blocks · WARN if 1–2 · FAIL if 3+.
103
-
104
- ### Check 3 — Precise language
105
-
106
- Scan for vague intent that cannot be checked against a diff. Common offenders:
107
-
108
- - "Write clean code"
109
- - "Follow best practices"
110
- - "Care about quality"
111
- - "Be consistent"
112
- - "Use modern patterns"
113
- - "Make it readable / maintainable / robust"
114
- - "Handle errors properly"
115
- - "Keep things simple"
116
-
117
- For every match, **always propose at least one concrete, testable alternative grounded in this project's context**. Never suggest "just delete it" — the author put the line there for a reason; your job is to translate the intent into something a reviewer can check against a diff.
118
-
119
- To ground the suggestion, pull signal from:
120
-
121
- - the file under review (stack mentioned, naming conventions stated elsewhere, hard rules in other sections),
122
- - nearby paragraphs around the vague phrase (what was the author about to say?),
123
- - visible repo context if available (`package.json`, `tsconfig.json`, framework choice, lint config, sibling rule files).
124
-
125
- If the project context truly doesn't suggest anything specific, propose a sensible default for the detected stack and label it **(assumed)** so the author knows to confirm.
126
-
127
- Examples (note how each replacement borrows project-specific names/conventions, not generic advice):
128
-
129
- | Vague phrase in file | Project context signal | Grounded testable replacement |
130
- | --------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
131
- | "Write clean code" | TypeScript + ESLint mentioned in same file | "Avoid `any`. Functions over 40 lines must be split. Run `pnpm lint` before committing." |
132
- | "Handle errors properly" | Hard rule earlier: API returns `{ error: {...} }` shape | "API handlers must return `{ error: { code, message, context } }` per the shape defined above. Never throw raw." |
133
- | "Be consistent with naming" | File mentions `feature.handler.ts` elsewhere | "Use `<feature>.handler.ts` (matching the existing handlers in `src/api/`), not `featureHandler.ts`." |
134
- | "Use modern patterns" | Project uses native JS, no lodash in `package.json` | "Use native `Array`/`Object` methods. Do not add `lodash` — it's not in `package.json` and we keep it that way." |
135
- | "Make components readable" | React + Tailwind project | "Components over 150 lines must be split. Tailwind classes go through `cn()` for conditionals (assumed — confirm if a different helper is used)." |
136
- | "Keep things simple" | Python FastAPI service | "Prefer one Pydantic model per request/response. No nested decorators beyond `@router.post` + `@requires_auth`." |
137
-
138
- Verdict: OK if 0 vague phrases · WARN if 1–3 · FAIL if 4+.
139
-
140
- Verdict: OK if 0 vague phrases · WARN if 1–3 · FAIL if 4+.
141
-
142
- ### Check 4 — Redundant knowledge
143
-
144
- You are the actor agent reviewing this file. Read it the way you'd read it at the start of a session and ask one question after each paragraph:
145
-
146
- > **"Did I already know this before I opened the file?"**
147
-
148
- If the answer is "yes, this is in my training data" or "yes, this is the framework's documented default" or "yes, the README/lint config already says this" — flag it. The author paid context for something you didn't need explained.
149
-
150
- Use these self-checks while scanning:
151
-
152
- - **The "no surprise" test.** Could you have produced this paragraph yourself if asked, with no project access? If yes — redundant.
153
- - **The "framework default" test.** Is the rule restating something the framework, the lint config, the type checker, or the test runner already enforces (e.g. "use TypeScript strict mode", "use `useEffect` cleanup", "FastAPI uses Pydantic for validation", "PostgreSQL supports JSONB")? If yes — redundant. The tool will catch the violation; the prose won't add anything.
154
- - **The "definition" test.** Does the paragraph define a generic engineering term ("what is a service layer", "what REST is", "what hooks are", "what JSX is", "what is `Decimal`")? You know these. Flag and delete.
155
- - **The "could be a link" test.** Does it duplicate `README.md`, `package.json` scripts, the project layout, or `.eslintrc` settings? If yes — replace with `@README.md` / `@package.json` / `@.eslintrc.json`. A reference doesn't drift; copied prose does.
156
- - **The "tutorial smell" test.** If the paragraph reads like a section from the framework's "Getting Started" page or a Medium article — it's tutorial content, not project knowledge. You read those during training.
157
-
158
- What is **not** redundant (don't flag):
159
-
160
- - Project-specific conventions that contradict the framework default ("we use `useEffect` only for non-data side effects").
161
- - Local pitfalls and historical workarounds you couldn't infer from the code ("the `events` table is partitioned by month — bulk inserts to the wrong partition fail silently").
162
- - Internal naming, layout, or workflow rules ("postings live in `<verb>_<noun>.posting.ts`").
163
- - Rules that look generic but are tied to a real incident (the file should mention the incident or link to a failure-modes register).
164
-
165
- For each flagged paragraph, suggest one of:
166
-
167
- - **Delete it** — you already knew it.
168
- - **Replace with `@`-reference** — `@README.md`, `@tsconfig.json`, `@docs/...`.
169
- - **Keep only if backed by an incident** — and if so, ask the author to add the incident note inline so the rule survives future audits.
170
-
171
- Verdict: OK if 0 redundant paragraphs · WARN if 1–3 · FAIL if 4+.
172
-
173
- ### Check 5 — Rule ordering
174
-
175
- Models pay more attention to the start and end of long contexts ("U-shaped attention"). Critical rules buried in the middle of a long file are statistically less likely to be followed. This check has its own multi-step flow because reordering a file is a meaningful edit, not a one-line fix.
176
-
177
- Run the steps in order. The result of this check goes into the scorecard _and_ may trigger an interactive reorder.
178
-
179
- #### Step 5a — List the current high-level order
180
-
181
- Walk the file and print the current top-level structure as a numbered list. Use H1/H2 headings (and H3s only if there are no H2s). Include the line number of each heading. Do **not** comment yet — just lay out what's there.
182
-
183
- Example:
184
-
185
- ```
186
- Current order:
187
- 1. # Welcome to OrderFlow (line 1)
188
- 2. ## About the team (line 5)
189
- 3. ## Project mission (line 9)
190
- 4. ## Our values (line 13)
191
- 5. ## Tech stack (line 22)
192
- 6. ## Setup (line 36)
193
- 7. ## TypeScript (line 78)
194
- ...
195
- N. ## Project conventions (line 312)
196
- ```
197
-
198
- If the file has no headings, say so explicitly: _"No section headings — file is one undifferentiated block."_
199
-
200
- #### Step 5b — Comment on the order
201
-
202
- Now annotate the list. For each section, give it a short tag and a one-line note. Use these tags:
203
-
204
- - **CRITICAL** — load-bearing rule (security, money, irreversibility, project-specific "never do X").
205
- - **USEFUL** — real project knowledge that helps but isn't a tripwire.
206
- - **INTRO** — welcome/mission/team — lowers signal density at the top.
207
- - **REDUNDANT** — already flagged in Check 4 (framework defaults, definitions, tutorial content).
208
- - **VAGUE** — already flagged in Check 3.
209
- - **REFERENCE** — points to other files via `@`-syntax (cheap, fine anywhere).
210
-
211
- Then state the structural problem in one paragraph. Examples:
212
-
213
- > "Critical security and tenancy rules are at the bottom (line 312). The first 35 lines are INTRO/values/marketing, which the model will weight heavily but which contain no actionable rules. Risk: the agent reads the bloat fully and skims past the rules that actually matter."
214
-
215
- > "Order is roughly correct — hard rules at top, conventions in the middle, references at the bottom. One INTRO paragraph at line 1 could be tightened, but no structural reshuffle needed."
216
-
217
- #### Step 5c — Propose a better order (only if needed)
218
-
219
- If the comment in 5b identified a real problem, propose a target order. Frame it as _"sections moved to top / kept / moved to bottom / removed"_, not as a full rewrite of every line.
220
-
221
- Example:
222
-
223
- ```
224
- Proposed order:
225
- 1. ## Hard rules (was: line 312) ← moved to top
226
- 2. ## Project conventions (was: line 312, split) ← moved up
227
- 3. ## Tech stack (was: line 22) ← kept
228
- 4. ## Setup (was: line 36) ← kept, replace with @README.md if possible
229
- 5. ## Failure modes (new section) ← collect incident-driven rules here
230
- — ## About the team / Mission / Values ← remove (Check 3/4 already flagged these)
231
- ```
232
-
233
- If 5b found no problem, skip 5c entirely — say _"Order is sound; no reshuffle needed."_
234
-
235
- #### Step 5d — Ask before reordering
236
-
237
- If 5c produced a proposal, use question before touching the file:
238
-
239
- - Question: "Check 5 proposes reordering sections. How would you like to proceed?"
240
- - Options:
241
- 1. "Yes, reorder the file now" — apply the proposed structure, preserve all rule content, only move/regroup sections.
242
- 2. "Only move the critical rules to the top" — minimal change: lift hard rules to the top, leave the rest alone.
243
- 3. "Show me the diff first" — produce the reordered file as a preview block in chat, no write.
244
- 4. "No, just leave the suggestion in the report" — don't edit the file; the scorecard stands.
245
-
246
- If the user picks an editing option, apply it with care: preserve every byte of rule content (only headings and section blocks move), and write a single edit. If the user picks "leave the suggestion", do nothing.
247
-
248
- #### Step 5e — Atomic-change reminder
249
-
250
- Always end Check 5 with this reminder, regardless of whether a reorder happened:
251
-
252
- > **Test each change in your next agent session.** Reordering a rules file is a context-shape change — its effect on agent behavior only shows up the next time you run a real task. Apply changes one at a time (atomic): reorder, then run a representative task, then move on to the next change (split, dedupe, rewrite). Bundling multiple structural changes makes it impossible to attribute a behavior shift to a specific edit.
253
-
254
- #### Verdict
255
-
256
- Score the file before any reorder happens, based on the original order:
257
-
258
- - **OK** — top of file is dense with CRITICAL/USEFUL rules, clear headings, no INTRO bloat at the start.
259
- - **WARN** — structure is mixed: some critical rules at top, others buried; or non-trivial INTRO at the start.
260
- - **FAIL** — critical rules appear after line 200, or the file has no headings at all, or the top 30+ lines are pure INTRO/marketing.
261
-
262
- ---
263
-
264
- ## Output format
265
-
266
- Print exactly this, in this order. Use Polish or English matching the user's prompt language. Reference `path:line` for every concrete finding so the user can jump straight to it.
267
-
268
- ```
269
- # Rule Review — <path>
270
-
271
- **Overall:** <one-line summary, e.g. "Healthy file with two redundancy hotspots" or "Long, vague, and bottom-heavy — needs a split">
272
-
273
- ## Scorecard
274
-
275
- | # | Check | Verdict | Score |
276
- |---|---|---|---|
277
- | 1 | Length | OK/WARN/FAIL | <n> non-blank lines |
278
- | 2 | Direct snippets | OK/WARN/FAIL | <n> flagged blocks |
279
- | 3 | Precise language | OK/WARN/FAIL | <n> vague phrases |
280
- | 4 | Redundant knowledge | OK/WARN/FAIL | <n> redundant rules |
281
- | 5 | Rule ordering | OK/WARN/FAIL | <one-line reason> |
282
-
283
- ## Findings
284
-
285
- ### 1. Length — <verdict>
286
- - <n> non-blank lines.
287
- - <suggestion if WARN/FAIL, otherwise omit>
288
-
289
- ### 2. Direct snippets — <verdict>
290
- - `path:line-range` — <what kind of snippet> → suggest `@<file>` reference.
291
- - ...
292
-
293
- ### 3. Precise language — <verdict>
294
- - `path:line` — "<vague phrase>" → "<testable rewrite>"
295
- - ...
296
-
297
- ### 4. Redundant knowledge — <verdict>
298
- - `path:line` — <what's redundant> → <delete | replace with @reference | keep only if backed by an incident>
299
- - ...
300
-
301
- ### 5. Rule ordering — <verdict>
302
- - <structural observation, e.g. "Critical security rule at line 287, intro fluff lines 1–42">
303
- - <suggestion>
304
-
305
- ## Top 3 actions
306
- 1. <highest-leverage fix>
307
- 2. <second>
308
- 3. <third>
309
- ```
310
-
311
- If a check is OK, still list it in the table but skip the "Findings" subsection (write `### N. <name> — OK` and one short line, nothing more).
312
-
313
- The "Top 3 actions" must be ordered by leverage, not by check number. Pick from across all five checks.
314
-
315
- ### Exit Gate (confirm-or-revise form)
316
-
317
- Per the shared contract's exception for no-follow-up skills, after printing the scorecard use `question` — "Is the scorecard correct?" with options:
318
-
319
- - **Accept** — keep it. Stop here; act on "Top 3 actions" whenever you like.
320
- - **Adjust** — re-run a specific check with different criteria or (Check 5) redo the reorder after re-deciding.
321
- - **Discuss** — justify a specific verdict or finding (evidence cited, why it matters); then re-ask.
322
- - **Stop here** — nothing further.
323
-
324
- If Check 5 produced a reorder proposal the user has not yet decided on, include a "Run Check 5 now" option in the question. After the user's response, stop. Do not propose further follow-ups unless the user asks.
325
-
326
- ---
327
-
328
- ## Edge cases
329
-
330
- - **File under 50 lines:** still run all five checks. Short files often fail Check 3 (vague) and Check 4 (redundant) the most.
331
- - **File is mostly references (`@…`) and few inline rules:** that's a good sign for Checks 2 and 4. Don't penalize it.
332
- - **File is a `.mdc` with frontmatter (`globs:`, `alwaysApply:`):** count rule lines from after the frontmatter. The frontmatter itself is configuration, not rule content.
333
- - **File is a generated stub from `/init` and untouched:** still review it. Often Check 4 (redundant) will dominate — that's the signal to clean it.
334
- - **Multiple rule files in the project:** review the one passed in. Mention sibling files in "Top 3 actions" only if relevant (e.g. duplication between root `AGENTS.md` and a nested one).
1
+ ---
2
+ name: owflow:rule-reviewer
3
+ description: "Score a rule-for-AI markdown file (CLAUDE.md, AGENTS.md, or any rules file) on 5 axes and return concrete actionable fixes"
4
+ argument-hint: "[path/to/rules.md]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # Rule reviewer
9
+
10
+ Score an AI rules file on five axes and return concrete fixes. The file under review is whatever rule-for-AI markdown the user passes in — this skill does not assume CLAUDE.md, AGENTS.md, or any specific tool.
11
+
12
+ The skill never edits the file. It produces a scorecard. The user decides what to act on.
13
+
14
+ Gates follow the shared contract in [Gate Contract](../orchestrator-framework/references/gate-contract.md) (confirm-or-revise exception — see the [Confirm-or-Revise Exception](../orchestrator-framework/references/confirm-or-revise-exception.md)).
15
+
16
+ ## Entry Gate
17
+
18
+ The input resolution below IS this skill's entry gate.
19
+
20
+ ## Input resolution
21
+
22
+ **Get the path to the rules file:**
23
+
24
+ 1. If a path is provided as the skill argument, use it directly
25
+ 2. If no path is provided, use question:
26
+ ```
27
+ "Which rules file should I review? Provide the path."
28
+ ```
29
+ 3. Do not guess
30
+
31
+ Supported path formats — absolute, repo-relative, or `@`-prefixed:
32
+
33
+ - `AGENTS.md`
34
+ - `.cursor/rules/api.mdc`
35
+ - `src/api/AGENTS.md`
36
+ - `.github/copilot-instructions.md`
37
+ - `~/.claude/CLAUDE.md`
38
+
39
+ If the path resolves to a directory, use question to ask which file to review. If it resolves to multiple files (e.g. `**/AGENTS.md`), score them one at a time and report each scorecard separately — do not merge.
40
+
41
+ If the file does not exist, stop and report the path. Do not invent content.
42
+
43
+ ## What this skill does NOT do
44
+
45
+ - Does not edit the rules file _unless the user explicitly approves the reorder proposed by Check 5_. The default output is read-only.
46
+ - Does not generate a full "fixed version" of the file. At most, Check 5 may move/regroup sections; it never rewrites rule content.
47
+ - Does not assume the file's tool target. CLAUDE.md, AGENTS.md, `.mdc`, `.windsurfrules`, custom names — all treated as "a rules-for-AI file".
48
+ - Does not score _project content_ (architecture, tech choices, conventions). It scores the _rule artifact's condition_ — the same way a code review scores code, not the product.
49
+
50
+ ## Procedure
51
+
52
+ 1. Read the file in full using the Read tool (if it's > 2000 lines, read in chunks until complete).
53
+ 2. Compute Checks 1–4.
54
+ 3. Run Check 5 in its own multi-step flow (5a list → 5b comment → 5c propose → 5d ask via question → 5e atomic-change reminder). The reorder edit, if any, happens here and only with explicit user approval.
55
+ 4. Print the scorecard in the exact format under "Output format". Include the reorder-proposal summary and the user's decision in the Check 5 findings.
56
+ 5. Run the Exit Gate (end of "Output format"): results-acceptance question, then stop. Do not propose further follow-up actions unless the user asks.
57
+
58
+ ---
59
+
60
+ ## The 5 checks
61
+
62
+ ### Check 1 — Length
63
+
64
+ Count non-empty lines (ignore blank lines and pure separator lines like `---`).
65
+
66
+ | Lines | Verdict | Symbol |
67
+ | ------- | --------- | ------ |
68
+ | 0–200 | fine | OK |
69
+ | 201–500 | watch out | WARN |
70
+ | 501+ | warn | FAIL |
71
+
72
+ Why it matters: long rule files crowd out the user's prompt in the context window, and middle-of-file rules get the weakest attention from the model. Length is a proxy for "you're paying context for things the agent doesn't need every session."
73
+
74
+ For WARN/FAIL, suggest:
75
+
76
+ - Split per-area rules into nested files closer to their code (e.g. `src/api/AGENTS.md`).
77
+ - Replace duplicated docs with `@`-references to the canonical file.
78
+ - Drop rules that aren't tied to a recurring agent failure mode.
79
+
80
+ ### Check 2 — Direct code/config snippets
81
+
82
+ Scan for fenced code blocks (` ``` `) and inline code blocks longer than ~3 lines.
83
+
84
+ Flag any block that looks like:
85
+
86
+ - An example component, endpoint, migration, schema, query, bash script or test.
87
+ - A configuration file (`tsconfig.json`, `eslintrc`, `package.json`, `wrangler.toml`).
88
+ - A migration template or boilerplate that lives elsewhere in the repo.
89
+
90
+ Do **not** flag:
91
+
92
+ - Short structural snippets used to define a _format_ the agent must produce (e.g. a 2–4 line error-shape template).
93
+ - Command examples (`npm run dev`, `git rebase`, etc.).
94
+ - Mermaid/diagram blocks.
95
+
96
+ For each flagged block, suggest:
97
+
98
+ - Move the snippet to a real file in the repo.
99
+ - Replace the block with a one-line `@`-reference, e.g. `@src/features/users/user.service.ts`, `@docs/api-errors.md`.
100
+ - Reason: the example will be wrong in two places at the next refactor; a reference can't drift.
101
+
102
+ Verdict: OK if 0 flagged blocks · WARN if 1–2 · FAIL if 3+.
103
+
104
+ ### Check 3 — Precise language
105
+
106
+ Scan for vague intent that cannot be checked against a diff. Common offenders:
107
+
108
+ - "Write clean code"
109
+ - "Follow best practices"
110
+ - "Care about quality"
111
+ - "Be consistent"
112
+ - "Use modern patterns"
113
+ - "Make it readable / maintainable / robust"
114
+ - "Handle errors properly"
115
+ - "Keep things simple"
116
+
117
+ For every match, **always propose at least one concrete, testable alternative grounded in this project's context**. Never suggest "just delete it" — the author put the line there for a reason; your job is to translate the intent into something a reviewer can check against a diff.
118
+
119
+ To ground the suggestion, pull signal from:
120
+
121
+ - the file under review (stack mentioned, naming conventions stated elsewhere, hard rules in other sections),
122
+ - nearby paragraphs around the vague phrase (what was the author about to say?),
123
+ - visible repo context if available (`package.json`, `tsconfig.json`, framework choice, lint config, sibling rule files).
124
+
125
+ If the project context truly doesn't suggest anything specific, propose a sensible default for the detected stack and label it **(assumed)** so the author knows to confirm.
126
+
127
+ Examples (note how each replacement borrows project-specific names/conventions, not generic advice):
128
+
129
+ | Vague phrase in file | Project context signal | Grounded testable replacement |
130
+ | --------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
131
+ | "Write clean code" | TypeScript + ESLint mentioned in same file | "Avoid `any`. Functions over 40 lines must be split. Run `pnpm lint` before committing." |
132
+ | "Handle errors properly" | Hard rule earlier: API returns `{ error: {...} }` shape | "API handlers must return `{ error: { code, message, context } }` per the shape defined above. Never throw raw." |
133
+ | "Be consistent with naming" | File mentions `feature.handler.ts` elsewhere | "Use `<feature>.handler.ts` (matching the existing handlers in `src/api/`), not `featureHandler.ts`." |
134
+ | "Use modern patterns" | Project uses native JS, no lodash in `package.json` | "Use native `Array`/`Object` methods. Do not add `lodash` — it's not in `package.json` and we keep it that way." |
135
+ | "Make components readable" | React + Tailwind project | "Components over 150 lines must be split. Tailwind classes go through `cn()` for conditionals (assumed — confirm if a different helper is used)." |
136
+ | "Keep things simple" | Python FastAPI service | "Prefer one Pydantic model per request/response. No nested decorators beyond `@router.post` + `@requires_auth`." |
137
+
138
+ Verdict: OK if 0 vague phrases · WARN if 1–3 · FAIL if 4+.
139
+
140
+ Verdict: OK if 0 vague phrases · WARN if 1–3 · FAIL if 4+.
141
+
142
+ ### Check 4 — Redundant knowledge
143
+
144
+ You are the actor agent reviewing this file. Read it the way you'd read it at the start of a session and ask one question after each paragraph:
145
+
146
+ > **"Did I already know this before I opened the file?"**
147
+
148
+ If the answer is "yes, this is in my training data" or "yes, this is the framework's documented default" or "yes, the README/lint config already says this" — flag it. The author paid context for something you didn't need explained.
149
+
150
+ Use these self-checks while scanning:
151
+
152
+ - **The "no surprise" test.** Could you have produced this paragraph yourself if asked, with no project access? If yes — redundant.
153
+ - **The "framework default" test.** Is the rule restating something the framework, the lint config, the type checker, or the test runner already enforces (e.g. "use TypeScript strict mode", "use `useEffect` cleanup", "FastAPI uses Pydantic for validation", "PostgreSQL supports JSONB")? If yes — redundant. The tool will catch the violation; the prose won't add anything.
154
+ - **The "definition" test.** Does the paragraph define a generic engineering term ("what is a service layer", "what REST is", "what hooks are", "what JSX is", "what is `Decimal`")? You know these. Flag and delete.
155
+ - **The "could be a link" test.** Does it duplicate `README.md`, `package.json` scripts, the project layout, or `.eslintrc` settings? If yes — replace with `@README.md` / `@package.json` / `@.eslintrc.json`. A reference doesn't drift; copied prose does.
156
+ - **The "tutorial smell" test.** If the paragraph reads like a section from the framework's "Getting Started" page or a Medium article — it's tutorial content, not project knowledge. You read those during training.
157
+
158
+ What is **not** redundant (don't flag):
159
+
160
+ - Project-specific conventions that contradict the framework default ("we use `useEffect` only for non-data side effects").
161
+ - Local pitfalls and historical workarounds you couldn't infer from the code ("the `events` table is partitioned by month — bulk inserts to the wrong partition fail silently").
162
+ - Internal naming, layout, or workflow rules ("postings live in `<verb>_<noun>.posting.ts`").
163
+ - Rules that look generic but are tied to a real incident (the file should mention the incident or link to a failure-modes register).
164
+
165
+ For each flagged paragraph, suggest one of:
166
+
167
+ - **Delete it** — you already knew it.
168
+ - **Replace with `@`-reference** — `@README.md`, `@tsconfig.json`, `@docs/...`.
169
+ - **Keep only if backed by an incident** — and if so, ask the author to add the incident note inline so the rule survives future audits.
170
+
171
+ Verdict: OK if 0 redundant paragraphs · WARN if 1–3 · FAIL if 4+.
172
+
173
+ ### Check 5 — Rule ordering
174
+
175
+ Models pay more attention to the start and end of long contexts ("U-shaped attention"). Critical rules buried in the middle of a long file are statistically less likely to be followed. This check has its own multi-step flow because reordering a file is a meaningful edit, not a one-line fix.
176
+
177
+ Run the steps in order. The result of this check goes into the scorecard _and_ may trigger an interactive reorder.
178
+
179
+ #### Step 5a — List the current high-level order
180
+
181
+ Walk the file and print the current top-level structure as a numbered list. Use H1/H2 headings (and H3s only if there are no H2s). Include the line number of each heading. Do **not** comment yet — just lay out what's there.
182
+
183
+ Example:
184
+
185
+ ```
186
+ Current order:
187
+ 1. # Welcome to OrderFlow (line 1)
188
+ 2. ## About the team (line 5)
189
+ 3. ## Project mission (line 9)
190
+ 4. ## Our values (line 13)
191
+ 5. ## Tech stack (line 22)
192
+ 6. ## Setup (line 36)
193
+ 7. ## TypeScript (line 78)
194
+ ...
195
+ N. ## Project conventions (line 312)
196
+ ```
197
+
198
+ If the file has no headings, say so explicitly: _"No section headings — file is one undifferentiated block."_
199
+
200
+ #### Step 5b — Comment on the order
201
+
202
+ Now annotate the list. For each section, give it a short tag and a one-line note. Use these tags:
203
+
204
+ - **CRITICAL** — load-bearing rule (security, money, irreversibility, project-specific "never do X").
205
+ - **USEFUL** — real project knowledge that helps but isn't a tripwire.
206
+ - **INTRO** — welcome/mission/team — lowers signal density at the top.
207
+ - **REDUNDANT** — already flagged in Check 4 (framework defaults, definitions, tutorial content).
208
+ - **VAGUE** — already flagged in Check 3.
209
+ - **REFERENCE** — points to other files via `@`-syntax (cheap, fine anywhere).
210
+
211
+ Then state the structural problem in one paragraph. Examples:
212
+
213
+ > "Critical security and tenancy rules are at the bottom (line 312). The first 35 lines are INTRO/values/marketing, which the model will weight heavily but which contain no actionable rules. Risk: the agent reads the bloat fully and skims past the rules that actually matter."
214
+
215
+ > "Order is roughly correct — hard rules at top, conventions in the middle, references at the bottom. One INTRO paragraph at line 1 could be tightened, but no structural reshuffle needed."
216
+
217
+ #### Step 5c — Propose a better order (only if needed)
218
+
219
+ If the comment in 5b identified a real problem, propose a target order. Frame it as _"sections moved to top / kept / moved to bottom / removed"_, not as a full rewrite of every line.
220
+
221
+ Example:
222
+
223
+ ```
224
+ Proposed order:
225
+ 1. ## Hard rules (was: line 312) ← moved to top
226
+ 2. ## Project conventions (was: line 312, split) ← moved up
227
+ 3. ## Tech stack (was: line 22) ← kept
228
+ 4. ## Setup (was: line 36) ← kept, replace with @README.md if possible
229
+ 5. ## Failure modes (new section) ← collect incident-driven rules here
230
+ — ## About the team / Mission / Values ← remove (Check 3/4 already flagged these)
231
+ ```
232
+
233
+ If 5b found no problem, skip 5c entirely — say _"Order is sound; no reshuffle needed."_
234
+
235
+ #### Step 5d — Ask before reordering
236
+
237
+ If 5c produced a proposal, use question before touching the file:
238
+
239
+ - Question: "Check 5 proposes reordering sections. How would you like to proceed?"
240
+ - Options:
241
+ 1. "Yes, reorder the file now" — apply the proposed structure, preserve all rule content, only move/regroup sections.
242
+ 2. "Only move the critical rules to the top" — minimal change: lift hard rules to the top, leave the rest alone.
243
+ 3. "Show me the diff first" — produce the reordered file as a preview block in chat, no write.
244
+ 4. "No, just leave the suggestion in the report" — don't edit the file; the scorecard stands.
245
+
246
+ If the user picks an editing option, apply it with care: preserve every byte of rule content (only headings and section blocks move), and write a single edit. If the user picks "leave the suggestion", do nothing.
247
+
248
+ #### Step 5e — Atomic-change reminder
249
+
250
+ Always end Check 5 with this reminder, regardless of whether a reorder happened:
251
+
252
+ > **Test each change in your next agent session.** Reordering a rules file is a context-shape change — its effect on agent behavior only shows up the next time you run a real task. Apply changes one at a time (atomic): reorder, then run a representative task, then move on to the next change (split, dedupe, rewrite). Bundling multiple structural changes makes it impossible to attribute a behavior shift to a specific edit.
253
+
254
+ #### Verdict
255
+
256
+ Score the file before any reorder happens, based on the original order:
257
+
258
+ - **OK** — top of file is dense with CRITICAL/USEFUL rules, clear headings, no INTRO bloat at the start.
259
+ - **WARN** — structure is mixed: some critical rules at top, others buried; or non-trivial INTRO at the start.
260
+ - **FAIL** — critical rules appear after line 200, or the file has no headings at all, or the top 30+ lines are pure INTRO/marketing.
261
+
262
+ ---
263
+
264
+ ## Output format
265
+
266
+ Print exactly this, in this order. Use Polish or English matching the user's prompt language. Reference `path:line` for every concrete finding so the user can jump straight to it.
267
+
268
+ ```
269
+ # Rule Review — <path>
270
+
271
+ **Overall:** <one-line summary, e.g. "Healthy file with two redundancy hotspots" or "Long, vague, and bottom-heavy — needs a split">
272
+
273
+ ## Scorecard
274
+
275
+ | # | Check | Verdict | Score |
276
+ |---|---|---|---|
277
+ | 1 | Length | OK/WARN/FAIL | <n> non-blank lines |
278
+ | 2 | Direct snippets | OK/WARN/FAIL | <n> flagged blocks |
279
+ | 3 | Precise language | OK/WARN/FAIL | <n> vague phrases |
280
+ | 4 | Redundant knowledge | OK/WARN/FAIL | <n> redundant rules |
281
+ | 5 | Rule ordering | OK/WARN/FAIL | <one-line reason> |
282
+
283
+ ## Findings
284
+
285
+ ### 1. Length — <verdict>
286
+ - <n> non-blank lines.
287
+ - <suggestion if WARN/FAIL, otherwise omit>
288
+
289
+ ### 2. Direct snippets — <verdict>
290
+ - `path:line-range` — <what kind of snippet> → suggest `@<file>` reference.
291
+ - ...
292
+
293
+ ### 3. Precise language — <verdict>
294
+ - `path:line` — "<vague phrase>" → "<testable rewrite>"
295
+ - ...
296
+
297
+ ### 4. Redundant knowledge — <verdict>
298
+ - `path:line` — <what's redundant> → <delete | replace with @reference | keep only if backed by an incident>
299
+ - ...
300
+
301
+ ### 5. Rule ordering — <verdict>
302
+ - <structural observation, e.g. "Critical security rule at line 287, intro fluff lines 1–42">
303
+ - <suggestion>
304
+
305
+ ## Top 3 actions
306
+ 1. <highest-leverage fix>
307
+ 2. <second>
308
+ 3. <third>
309
+ ```
310
+
311
+ If a check is OK, still list it in the table but skip the "Findings" subsection (write `### N. <name> — OK` and one short line, nothing more).
312
+
313
+ The "Top 3 actions" must be ordered by leverage, not by check number. Pick from across all five checks.
314
+
315
+ ### Exit Gate (confirm-or-revise form)
316
+
317
+ Per the shared contract's exception for no-follow-up skills, after printing the scorecard use `question` — "Is the scorecard correct?" with options:
318
+
319
+ - **Accept** — keep it. Stop here; act on "Top 3 actions" whenever you like.
320
+ - **Adjust** — re-run a specific check with different criteria or (Check 5) redo the reorder after re-deciding.
321
+ - **Discuss** — justify a specific verdict or finding (evidence cited, why it matters); then re-ask.
322
+ - **Stop here** — nothing further.
323
+
324
+ If Check 5 produced a reorder proposal the user has not yet decided on, include a "Run Check 5 now" option in the question. After the user's response, stop. Do not propose further follow-ups unless the user asks.
325
+
326
+ ---
327
+
328
+ ## Edge cases
329
+
330
+ - **File under 50 lines:** still run all five checks. Short files often fail Check 3 (vague) and Check 4 (redundant) the most.
331
+ - **File is mostly references (`@…`) and few inline rules:** that's a good sign for Checks 2 and 4. Don't penalize it.
332
+ - **File is a `.mdc` with frontmatter (`globs:`, `alwaysApply:`):** count rule lines from after the frontmatter. The frontmatter itself is configuration, not rule content.
333
+ - **File is a generated stub from `/init` and untouched:** still review it. Often Check 4 (redundant) will dominate — that's the signal to clean it.
334
+ - **Multiple rule files in the project:** review the one passed in. Mention sibling files in "Top 3 actions" only if relevant (e.g. duplication between root `AGENTS.md` and a nested one).