5-phase-workflow 3.0.0 → 3.1.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 (56) hide show
  1. package/README.md +31 -101
  2. package/bin/install.js +168 -176
  3. package/bin/sync-agents.js +59 -54
  4. package/docs/workflow-guide.md +35 -79
  5. package/package.json +2 -2
  6. package/src/agents/step-executor-agent.md +5 -4
  7. package/src/agents/step-orchestrator-agent.md +12 -12
  8. package/src/agents/verification-agent.md +7 -8
  9. package/src/codex-commands/plan.md +65 -0
  10. package/src/commands/5/address-review-findings.md +43 -52
  11. package/src/commands/5/analyze-feature.md +1 -1
  12. package/src/commands/5/configure.md +75 -179
  13. package/src/commands/5/eject.md +0 -1
  14. package/src/commands/5/implement.md +78 -68
  15. package/src/commands/5/lean-check.md +75 -0
  16. package/src/commands/5/reconfigure.md +48 -129
  17. package/src/commands/5/review.md +42 -14
  18. package/src/commands/5/synchronize-agents.md +1 -1
  19. package/src/commands/5/update.md +2 -2
  20. package/src/hooks/dependency-guard.js +150 -0
  21. package/src/hooks/statusline.js +5 -3
  22. package/src/references/configure-tables.md +0 -33
  23. package/src/settings.json +3 -4
  24. package/src/skills/baseline-conventions/SKILL.md +37 -0
  25. package/src/skills/cognitive-load/SKILL.md +52 -0
  26. package/src/skills/configure-agents-md/SKILL.md +72 -0
  27. package/src/skills/configure-rules/SKILL.md +146 -0
  28. package/src/skills/documentation-style/SKILL.md +32 -0
  29. package/src/skills/fowler-code-smells/SKILL.md +25 -0
  30. package/src/skills/review-style/SKILL.md +142 -0
  31. package/src/templates/AGENTS.md +31 -31
  32. package/src/templates/workflow/REVIEW-FINDINGS.md +2 -9
  33. package/src/workflows/5-implement.js +67 -92
  34. package/docs/findings.md +0 -361
  35. package/docs/progress.md +0 -102
  36. package/src/commands/5/apply-review-findings.md +0 -66
  37. package/src/commands/5/commit.md +0 -43
  38. package/src/commands/5/plan.md +0 -189
  39. package/src/commands/5/reply-pr-comments.md +0 -48
  40. package/src/commands/5/split.md +0 -86
  41. package/src/commands/5/triage-pr-comments.md +0 -70
  42. package/src/hooks/config-guard.js +0 -30
  43. package/src/skills/configure-docs-index/SKILL.md +0 -243
  44. package/src/skills/configure-skills/SKILL.md +0 -311
  45. package/src/skills/generate-readme/EXAMPLES.md +0 -168
  46. package/src/skills/generate-readme/SKILL.md +0 -122
  47. package/src/skills/generate-readme/TEMPLATE.md +0 -141
  48. package/src/skills/use-index/SKILL.md +0 -49
  49. package/src/templates/ARCHITECTURE.md +0 -33
  50. package/src/templates/CONCERNS.md +0 -33
  51. package/src/templates/CONVENTIONS.md +0 -74
  52. package/src/templates/TESTING.md +0 -24
  53. package/src/templates/workflow/FIX-PLAN.md +0 -55
  54. package/src/templates/workflow/PLAN-COMPACT.md +0 -42
  55. package/src/templates/workflow/PLAN.md +0 -76
  56. package/src/templates/workflow/REVIEW-SUMMARY.md +0 -53
@@ -0,0 +1,146 @@
1
+ ---
2
+ name: configure-rules
3
+ description: Generates file-scoped `.claude/rules/` from the conventions the codebase actually follows. Used during /5:implement CONFIGURE and /5:reconfigure.
4
+ allowed-tools: Read, Write, Bash, Glob, Grep
5
+ model: sonnet
6
+ user-invocable: false
7
+ ---
8
+
9
+ # Configure Rules Skill
10
+
11
+ Generates `.claude/rules/*.md`: short directives that load only when Claude works on matching files. Claude explores the code on its own, so rules carry only what exploration gets wrong: conventions that tooling does not enforce and that differ from common defaults.
12
+
13
+ - **Full mode (default):** used by `/5:implement CONFIGURE`. Runs when `rules.generate` is `true` in `.5/config.json`.
14
+ - **Refresh mode:** used by `/5:reconfigure`. The prompt includes "REFRESH MODE" and points at `.5/reconfigure-manifest.json`.
15
+
16
+ **On Codex** (this skill runs as part of `$5-configure` or `$5-reconfigure`), write no rule files: Codex reads only `AGENTS.md`. Write the same rules, in the same order, into the foifi block of `AGENTS.md` instead — see [Codex: rules in AGENTS.md](#codex-rules-in-agentsmd).
17
+
18
+ Rules are **concise directives** (15-40 lines each), not documentation. Rules tell Claude what to do when working with specific file types.
19
+
20
+ The repository's own standards win over rules. These are the files `.claude/skills/review-style/SKILL.md` step 2 lists, such as `CONTRIBUTING.md`. A rule never restates or contradicts them.
21
+
22
+ ## 1. Determine Which Rules to Generate
23
+
24
+ Scan the codebase for the file types each rule needs, then pick the rules that apply:
25
+
26
+ | Rule File | Generate When | What to Analyze |
27
+ |-----------|---------------|-----------------|
28
+ | `code-style.md` | Always (if source files exist) | 2-3 source files: naming, imports, exports, and structure that tooling does not enforce |
29
+ | `testing.md` | Test files detected | 3-5 test files: organization, assertions, mocking, fixtures, setup gotchas |
30
+ | `api-patterns.md` | Controller/route/handler patterns detected | 2-3 handlers: validation, error responses, auth checks |
31
+ | `dependencies.md` | External integrations detected | Clients for external services, env var access, required setup |
32
+
33
+ **Skip** any rule whose prerequisite patterns were not detected. Do not generate empty or placeholder rule files.
34
+
35
+ ## 2. Extract Directives and Write Rules
36
+
37
+ For each applicable rule:
38
+
39
+ 1. **Derive `paths:` globs** from detected file locations (e.g., if tests are at `src/**/*.test.ts` and `tests/**/*.spec.ts`, use those patterns)
40
+ 2. **Convert analysis observations into imperative directives** — "Use X", "Always Y", "Never Z"
41
+ 3. **Keep each file 15-40 lines** — be concise and actionable
42
+ 4. **Do not repeat** the general guidance sections from `AGENTS.md`, the style skills, or the repository's own standards
43
+
44
+ Write files to `.claude/rules/`:
45
+
46
+ ```bash
47
+ mkdir -p .claude/rules
48
+ ```
49
+
50
+ ## 3. Rule File Format
51
+
52
+ Each rule file uses YAML frontmatter with `paths:` for scoping, followed by the marker line `<!-- foifi:generated -->` as the first body line. Rules without `paths:` load unconditionally.
53
+
54
+ **Example — `testing.md`:**
55
+
56
+ ```markdown
57
+ ---
58
+ paths:
59
+ - "**/*.test.ts"
60
+ - "**/*.spec.ts"
61
+ ---
62
+ <!-- foifi:generated -->
63
+
64
+ # Testing Conventions
65
+
66
+ - Use `describe`/`it` blocks with descriptive names
67
+ - Mock external dependencies with jest.mock, never mock internal modules
68
+ - Use factory functions from `tests/factories/` for test data
69
+ - Each test file mirrors its source file path: `src/foo/Bar.ts` → `src/foo/__tests__/Bar.test.ts`
70
+ - Assert one behavior per test
71
+ ```
72
+
73
+ **Example — `code-style.md`:**
74
+
75
+ ```markdown
76
+ ---
77
+ paths:
78
+ - "src/**/*.{ts,tsx}"
79
+ ---
80
+ <!-- foifi:generated -->
81
+
82
+ # Code Style
83
+
84
+ - Use PascalCase for classes and types, camelCase for functions and variables
85
+ - Import order: external packages → internal modules → relative imports
86
+ - Use absolute imports with `@/` alias
87
+ - Prefer named exports over default exports
88
+ ```
89
+
90
+ **Example — `dependencies.md` (unconditional):**
91
+
92
+ ```markdown
93
+ <!-- foifi:generated -->
94
+ # Dependency Conventions
95
+
96
+ - Database access through Prisma client only, never raw SQL
97
+ - HTTP requests use axios instance from `src/lib/http.ts`
98
+ - Environment variables accessed via `src/config/env.ts`, never `process.env` directly
99
+ ```
100
+
101
+ ## Codex: rules in AGENTS.md
102
+
103
+ Put one section just before the `<!-- foifi:end -->` line of `AGENTS.md`, replacing an existing one:
104
+
105
+ ```markdown
106
+ <!-- 5-sync:rules-start -->
107
+ ## File-Scoped Rules
108
+
109
+ ### testing
110
+ Applies to: `**/*.test.ts`, `**/*.spec.ts`
111
+
112
+ - Use `describe`/`it` blocks with descriptive names
113
+ <!-- 5-sync:rules-end -->
114
+ ```
115
+
116
+ One `###` subsection per rule, named like the rule file, starting with `Applies to:` and its globs (`Applies to: all files` for an unconditional rule). Change nothing else in `AGENTS.md`. Without a foifi block, stop and report that `configure-agents-md` must run first.
117
+
118
+ ## Refresh Mode
119
+
120
+ When running in REFRESH MODE:
121
+ - Refresh, create, and remove only the rule files `.5/reconfigure-manifest.json` lists.
122
+ - A rule file counts as workflow-generated only when it contains the `<!-- foifi:generated -->` marker line, or, for files from earlier versions without the marker, when the manifest lists it. Never modify or remove any other rule file.
123
+ - On Codex, rewrite the `File-Scoped Rules` section with the manifest's refreshed and new rules, minus the removed ones.
124
+
125
+ ---
126
+
127
+ ## Output Contract
128
+
129
+ ```
130
+ Component B (Rules): SUCCESS - Generated 3 rule files (code-style, testing, dependencies)
131
+ ```
132
+
133
+ Or:
134
+
135
+ ```
136
+ Component B (Rules): SKIPPED - rules.generate is false in config
137
+ ```
138
+
139
+ ## DO NOT
140
+
141
+ - DO NOT generate rules for file types that do not exist in the project.
142
+ - DO NOT generate empty or placeholder rule files.
143
+ - DO NOT hardcode conventions - always derive them from the actual code.
144
+ - DO NOT repeat the general guidance from `AGENTS.md` in rule files.
145
+ - DO NOT restate or contradict the repository's own standards.
146
+ - DO NOT generate skills. Earlier versions generated pattern and `run-*` skills; leave any that exist untouched.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: documentation-style
3
+ description: How to write documents, Javadoc and code comments. Short plain sentences, one idea each. Use when writing or reviewing comments, doc comments or Markdown.
4
+ ---
5
+
6
+ # Communication and Documentation Style
7
+
8
+ When communicating or documenting anything (a document, JavaDoc, comments in the code, etc.),
9
+ write it as short, plain sentences, without jargon, and one idea per sentence.
10
+ Never chain multiple ideas into a single sentence with semicolons or em-dashes.
11
+ If a comment covers more than one concern (e.g., "why this setup looks odd" vs.
12
+ "what this test actually checks"), split it into separate sentences, or separate
13
+ paragraphs (blank `//` line) if the concerns are distinct enough. A comment should
14
+ read like a short explanation to a colleague, not a dense clause-stacked run-on.
15
+
16
+ For reference, here's the failure mode it's meant to block, and the fix, so you can sanity-check the wording still points at the right thing:
17
+
18
+ Bad (what I wrote first):
19
+ // These two are the "projected new missions" the mocked projection returns for this saga run;
20
+ // they must be move participants (i.e. targets of a movedOrder from sourceMissionId) so the
21
+ // reprojector's participant filter keeps them — the hard fail this test exercises is that
22
+ // NEITHER has a corresponding entry in newMissionRequest's OWN movedOrders (which target an
23
+ // unrelated random MissionId), not that they were pruned as non-participants.
24
+
25
+ Good (the rewrite):
26
+ // These two missions are what the mocked projection returns as the new missions for this run.
27
+ // They must be move participants, so give them entries in the stubbed movedOrders as targets
28
+ // of sourceMissionId. Otherwise the reprojector's participant filter would prune them, and the
29
+ // test would no longer exercise the hard fail it's meant to check.
30
+ //
31
+ // The hard fail itself comes from something else: newMissionRequest's own movedOrders target
32
+ // an unrelated random MissionId, so neither mission has a matching entry there.
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: fowler-code-smells
3
+ description: Martin Fowler's code smells (Refactoring, ch. 3), each with its fix. Use when writing, refactoring or reviewing code.
4
+ ---
5
+
6
+ # Fowler code smells
7
+
8
+ A smell is a heuristic, never a hard rule. It hints that the design could be better. Each smell reads
9
+ _what it is_ → _how to fix_:
10
+
11
+ - **Mysterious Name**: a function, variable, or type whose name doesn't reveal what it does or holds. → Rename it. If no honest name comes, the design is murky.
12
+ - **Duplicated Code**: the same logic shape appears in more than one place. → Extract the shared shape and call it from both.
13
+ - **Feature Envy**: a method that reaches into another object's data more than its own. → Move the method onto the data it envies.
14
+ - **Data Clumps**: the same few fields or parameters keep travelling together. A type wants to be born. → Bundle them into one type and pass that.
15
+ - **Primitive Obsession**: a primitive or string standing in for a domain concept that deserves its own type. → Give the concept its own small type.
16
+ - **Repeated Switches**: the same `switch` or `if` cascade on the same type recurs in several places. → Replace it with polymorphism, or with one map all sites share.
17
+ - **Shotgun Surgery**: one logical change forces scattered edits across many files. → Gather what changes together into one module.
18
+ - **Divergent Change**: one file or module is edited for several unrelated reasons. → Split it so each module changes for one reason.
19
+ - **Speculative Generality**: abstraction, parameters, or hooks that nothing in the code uses yet. → Delete them. Inline back until a real need shows.
20
+ - **Message Chains**: long `a.b().c().d()` navigation the caller shouldn't depend on. → Hide the walk behind one method on the first object.
21
+ - **Middle Man**: a class or function that mostly just delegates onward. → Cut it and call the real target directly.
22
+ - **Refused Bequest**: a subclass or implementer that ignores or overrides most of what it inherits. → Drop the inheritance and use composition.
23
+
24
+ Source: Martin Fowler, _Refactoring_ (2nd ed.), chapter 3. The selection and wording follow Matt Pocock's
25
+ [code-review skill](https://github.com/mattpocock/skills/blob/main/skills/engineering/code-review/SKILL.md).
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: review-style
3
+ description: Review changes against coding and documentation standards (repo standards plus a list of style skills), then optionally fix the findings. Use when the user wants a style, standards or conventions review of a branch, a commit range or uncommitted work.
4
+ ---
5
+
6
+ # Review style
7
+
8
+ Review a change against two kinds of standards:
9
+
10
+ - **Repo standards**: whatever the repository documents about how code is written.
11
+ - **Styles**: the style skills listed below. They apply in every repository.
12
+
13
+ Repo standards always win. Where a repo standard endorses something a style would flag, the style finding is
14
+ **suppressed**.
15
+
16
+ ## Styles
17
+
18
+ Each path is relative to this skill's base directory. Add a style by adding one line.
19
+
20
+ - `../fowler-code-smells/SKILL.md`
21
+ - `../cognitive-load/SKILL.md`
22
+ - `../documentation-style/SKILL.md`. It applies only to code comments, doc comments and Markdown files.
23
+ - `../baseline-conventions/SKILL.md`
24
+
25
+ ## Process
26
+
27
+ ### 1. Pin the scope
28
+
29
+ The caller's words pick one of these modes:
30
+
31
+ | Mode | Example | Diff |
32
+ |------|---------|------|
33
+ | Since fixed point plus uncommitted (default) | `/review-style master` | `git diff $(git merge-base <fixed-point> HEAD)`, plus untracked files |
34
+ | Committed only | `/review-style master committed only` | `git diff <fixed-point>...HEAD` |
35
+ | Uncommitted only | `/review-style uncommitted` | `git diff HEAD`, plus untracked files |
36
+ | Staged only | `/review-style staged` | `git diff --cached` |
37
+ | Unstaged only | `/review-style unstaged` | `git diff`, plus untracked files |
38
+
39
+ When the words don't clearly name a mode, ask. When a mode needs a fixed point and none is given, ask for it.
40
+ Offer the merge-base with the default branch (`master` or `main`) as the suggested answer.
41
+
42
+ When the caller names files, limit the diff to them, for example `git diff <fixed-point> -- <files>`. Other
43
+ changed files stay out of the review and out of the fixes.
44
+
45
+ Untracked files are those from `git ls-files --others --exclude-standard`. In the modes whose diff says "plus
46
+ untracked files", add each one to the diff as a new file whose every line is added. The other modes leave them out.
47
+
48
+ Confirm the fixed point resolves with `git rev-parse`. Stop when the diff is empty. Write the diff to one temp
49
+ file, in the scratchpad when there is one. Also note `git log <fixed-point>..HEAD --oneline` when the mode
50
+ includes commits.
51
+
52
+ The step is done when one diff file exists and every reviewer will read that same file.
53
+
54
+ ### 2. Collect the repo standards
55
+
56
+ Search the repository for every file that documents how code is written:
57
+
58
+ - `CODING_STANDARDS.md`, `CONTRIBUTING.md`, `CODESTYLE.md`, `STYLEGUIDE.md`, and docs about style or conventions.
59
+ Look at the repository root, `.github/` and `docs/`.
60
+ - `CLAUDE.md` and `AGENTS.md` at every level, plus every file they link to about code, tests or docs.
61
+ The block between `<!-- foifi:start` and `<!-- foifi:end -->` holds workflow rules, not repository
62
+ standards; count only the files it links under "Standards". In a legacy file that says a workflow generated it
63
+ from a template, count only the parts it names as repository standards.
64
+
65
+ Skip linter and formatter configs. Tooling enforces them already.
66
+
67
+ ### 3. Resolve the styles
68
+
69
+ Turn each path in [Styles](#styles) into an absolute path from this skill's base directory. Reviewers don't
70
+ know that directory, so they only get absolute paths.
71
+
72
+ ### 4. Review in parallel
73
+
74
+ Start both reviewers in one message, as foreground sub-agents:
75
+
76
+ - One **repo reviewer** for all repo standards together, when step 2 found any.
77
+ - One **style reviewer** for all styles together. Two reviewers keep the token cost flat as styles are added.
78
+
79
+ Each prompt carries:
80
+
81
+ - The diff file path and the commit list.
82
+ - Its standards: the repo standard files, or the absolute paths of every style's `SKILL.md`. The style
83
+ reviewer reads each `SKILL.md` and every file it links to, and applies each style only where it says it
84
+ applies.
85
+ - For the style reviewer, the repo standard files too, so they can suppress overridden findings.
86
+ - The **context rule**: before judging a hunk, read its whole enclosing method and type. Follow the calls,
87
+ types and parents it touches whenever a rule needs them. Search the repository when a rule asks about
88
+ duplication.
89
+ - The **scope rule**: anchor every finding on a changed line. Flag a problem in surrounding code only when the
90
+ change creates or worsens it, such as adding a fourth level of nesting. Leave problems that already existed
91
+ alone. Lift this rule only when the caller asked for it.
92
+ - The brief:
93
+
94
+ > Apply every rule of your standard to every changed hunk. Report each finding as:
95
+ > `path:line`, a title of a few words, the quoted code, the rule (standard file plus rule name), hard or judgement, and a suggested
96
+ > fix in a few words. Every finding gets a suggested fix. Use one sentence when a few words can't carry it. A breach of a repo standard may be hard. A style finding is always a judgement call. Skip anything
97
+ > tooling enforces.
98
+ >
99
+ > Style reviewer only: when a repo standard endorses what your style would flag, report it under
100
+ > **Suppressed**, citing the repo rule that overrides it.
101
+
102
+ ### 5. Merge and report
103
+
104
+ - Merge findings that flag the same line for the same reason. Cite every rule involved.
105
+ - Number the findings `F1`, `F2`, … and group them by file.
106
+ - Write each finding in this shape. ⛔️ marks a hard breach of a repo standard. ⚠️ marks a judgement call.
107
+ The title names the problem in a few words.
108
+ ```
109
+ - <icon> **<ID> <title>** _(<lines>)_
110
+ <what is wrong and why>
111
+ → <fix> _(<standards>)_
112
+ ```
113
+ For example:
114
+ ```
115
+ - ⛔️ **F1 Javadoc repeats the accessor** _(:71)_
116
+ `@return the entity links.` adds nothing the method name doesn't say.
117
+ → Drop the line. _(Repo comment rules, Doc)_
118
+ - ⚠️ **F7 Plural name on an invariant checker** _(:12)_
119
+ The plural name suggests a collection, but the class checks an invariant.
120
+ → Rename to `DocumentEntityLinkInvariantHelper`. _(Cog)_
121
+ ```
122
+ - Every finding shows its fix. When a reviewer sent none, write one.
123
+ - List suppressed findings in a separate **Suppressed** section, each with its overriding repo rule.
124
+ - End with one line: findings per standard, hard violations count, and the worst issue.
125
+
126
+ ### 6. Fix
127
+
128
+ When the caller asked for a report only, stop after step 5. When the caller asked for fixes up front, fix every
129
+ finding. Otherwise, and only when there are findings, ask: fix all, fix hard violations only, fix the IDs I list,
130
+ or fix nothing.
131
+
132
+ Start one **fixer** sub-agent with:
133
+
134
+ - The selected findings, verbatim, with their rule references.
135
+ - The absolute paths of all standards, so it can look a rule up.
136
+ - The brief:
137
+
138
+ > Fix each finding in the working tree. Then run the repository's documented cheap check, such as compile
139
+ > and format, the way its `CLAUDE.md` or `CONTRIBUTING.md` says. Leave the changes uncommitted. Report
140
+ > each ID as fixed or skipped, with the reason for every skip.
141
+
142
+ Suppressed findings are never fixed. Relay the fixer's report.
@@ -1,48 +1,49 @@
1
- # Repository Guide
1
+ <!-- foifi:start — Managed by foifi. /5:reconfigure rewrites everything up to foifi:end. Everything outside this block belongs to the repository and ranks above it: it is part of the repository's own standards. -->
2
2
 
3
- {PROJECT_OVERVIEW}
3
+ # Workflow Rules (foifi)
4
4
 
5
5
  ## Build & Run Commands
6
6
 
7
7
  {BUILD_RUN_COMMANDS}
8
8
 
9
- ## Skill Usage
9
+ ## Commit Messages
10
10
 
11
- Before implementing changes, always check the available skills for relevant implementation guidance.
11
+ {COMMIT_MESSAGE_RULE}
12
12
 
13
- Use skills to understand project-specific workflows, commands, testing expectations, and implementation conventions before editing code.
13
+ ## Standards
14
14
 
15
- ## Commit Messages
15
+ These rules decide how code is written here, in this order:
16
+
17
+ 1. **This repository's own standards always win.** They are everything in `AGENTS.md` and `CLAUDE.md` outside this block, plus these files:
16
18
 
17
- Use the `/5:commit` command or `$5-commit` skill when creating commits. It reads `.5/config.json` and applies the configured `git.commitMessage.pattern`, including ticket IDs from branch names when configured.
19
+ {REPO_STANDARDS_LINKS}
18
20
 
19
- ## Workflow Rules
21
+ 2. **The workflow's style skills set the baseline** wherever the repository's standards say nothing: `fowler-code-smells`, `cognitive-load`, `documentation-style`, and `baseline-conventions`. Follow them when you write or review code. Where a repository standard endorses something a style would flag, the repository standard wins.
22
+ 3. **The workflow rules below** (Simplicity First, Testing, Surgical Changes, Goal-Driven Execution) apply as well. When a repository standard asks for more, such as a changelog entry or a test, do what it asks.
20
23
 
21
- When running `/5:` workflow commands, follow the command instructions exactly as written.
22
- Do not skip steps, combine phases, or proceed to actions not specified in the current command.
23
- Each phase produces a specific artifact - do not create artifacts belonging to other phases.
24
+ Run the `review-style` skill to check a change against all of them.
24
25
 
25
- ## Coding Guidelines
26
+ ## Planning
26
27
 
27
- {CONVENTIONS_REFERENCE}
28
+ Plan non-trivial changes in plan mode (Codex: run `$5-plan`). Shape each plan as the change needs; add a mermaid diagram when a flow, state machine, or component relationships explain the change better than text, and plan what the repository standards require, such as tests or a changelog entry.
28
29
 
29
- 1. Prefer explicit types or contracts for public APIs, data transfer shapes, service methods, hooks, and async return values where the language supports them.
30
- 2. Keep comments and docs concise; document constraints and non-obvious behavior, not the obvious.
31
- 3. Keep files focused and bounded; split broad controllers, services, hooks, and components early.
32
- 4. Extract helpers or classes when logic starts mixing orchestration, parsing, IO, and mapping in one place.
33
- 5. Favor SRP and DRY, but follow surrounding module conventions before introducing new abstractions.
34
- 6. Keep features modular: wire backend providers in feature modules, keep UI state in hooks, and avoid cross-layer shortcuts.
30
+ When the request names a ticket, fetch it (Jira MCP or `gh issue view`) and confirm its content with the user before planning.
31
+
32
+ After the user approves a plan, run `/5:implement {plan-path}` (Codex: `$5-implement {plan-path}`). Do not implement the plan any other way.
35
33
 
36
34
  ## Simplicity First
37
35
 
38
36
  Before writing code, walk this decision hierarchy and stop at the first step that solves the problem:
39
37
 
40
38
  1. **Does this need to exist at all?** If the requirement is speculative, don't build it (YAGNI).
41
- 2. Does the **language or standard library** already solve it?
42
- 3. Is there a **native platform or framework** feature for it?
43
- 4. Does an **already-installed dependency** cover it? Don't add a new dependency for this.
44
- 5. Can it be a **single, clear expression** instead of a new abstraction?
45
- 6. Only then: write the **minimum viable implementation**.
39
+ 2. Does it **already exist in this codebase**? Search before you write — reuse the helper, util, type, or pattern that is already here instead of re-implementing it.
40
+ 3. Does the **language or standard library** already solve it?
41
+ 4. Is there a **native platform or framework** feature for it?
42
+ 5. Does an **already-installed dependency** cover it? Don't add a new dependency for this.
43
+ 6. Can it be a **single, clear expression** instead of a new abstraction?
44
+ 7. Only then: write the **minimum viable implementation**.
45
+
46
+ The hierarchy shortens the solution, never the reading: understand the code the change touches before picking a step.
46
47
 
47
48
  Non-negotiable regardless of the above: security, data integrity, correctness, and accessibility.
48
49
 
@@ -53,6 +54,9 @@ Then apply these rules:
53
54
  - No flexibility or configurability that was not requested.
54
55
  - No error handling for impossible scenarios.
55
56
  - If you write 200 lines and it could be 50, rewrite it.
57
+ - Bug fix = root cause, not symptom: find every caller of the function you touch and fix the shared code path once.
58
+ - Large or ambiguous request: build the smallest version that satisfies it and ask about the rest in the same response instead of building it speculatively.
59
+ - When you finish, name what you deliberately left out in one line each (`skipped: X — add when Y`). No essays defending the simplification.
56
60
 
57
61
  Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
58
62
 
@@ -80,6 +84,8 @@ When your changes create orphans:
80
84
 
81
85
  The test: Every changed line should trace directly to the user's request.
82
86
 
87
+ Before you report a task as done, check your own diff (`git status --short` and `git diff --stat`): revert files and changes that do not trace to the request. For every dependency the diff adds: keep it and name it in your reply if the user asked for it; otherwise remove it with the package manager and use existing code, the standard library, or an installed dependency instead. For a deeper pass, run `/5:lean-check` (Codex: `$5-lean-check`).
88
+
83
89
  ## Goal-Driven Execution
84
90
 
85
91
  Define success criteria. Loop until verified.
@@ -102,10 +108,4 @@ Strong success criteria let you loop independently. Weak criteria ("make it work
102
108
 
103
109
  {PROJECT_DOCUMENTATION_LINKS}
104
110
 
105
- ## Codebase Index
106
-
107
- {CODEBASE_INDEX_LINKS}
108
-
109
- Use the `use-index` skill before running broad Glob/Grep scans. It handles freshness checks, file selection by task type, and fallback strategies. If index files are more than one day old, regenerate them by running `.5/index/rebuild-index.sh` before relying on them.
110
-
111
- {CUSTOM_DOCUMENTATION}
111
+ <!-- foifi:end -->
@@ -8,12 +8,7 @@
8
8
 
9
9
  ## How to Use This File
10
10
 
11
- 1. Review this file if you want context before applying fixes
12
- 2. Run: `/5:address-review-findings`
13
- 3. The command will present each finding one by one with a recommendation
14
- 4. Choose `fix`, `wont_fix`, `wait`, or provide textual instructions
15
-
16
- The command records your decisions separately and applies only findings marked `fix`.
11
+ `/5:review` hands this file to `/5:address-review-findings`, which fixes the clear findings on its own and asks you, one question at a time, about the rest. Run `/5:address-review-findings --interactive` to decide on every finding yourself.
17
12
 
18
13
  ---
19
14
 
@@ -44,6 +39,4 @@ The command records your decisions separately and applies only findings marked `
44
39
  - Questions: {N}
45
40
  - Manual Review: {N}
46
41
 
47
- **Next Steps:**
48
- 1. Run: `/5:address-review-findings`
49
- 2. Decide on each finding interactively
42
+ **Next Step:** `/5:address-review-findings` (runs automatically after `/5:review`)