@laitszkin/apollo-toolkit 3.1.3 → 3.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ All notable changes to this repository are documented in this file.
7
7
  ### Changed
8
8
  - None yet.
9
9
 
10
+ ## [v3.1.4] - 2026-04-23
11
+
12
+ ### Changed
13
+ - Refine `iterative-code-quality` so it now treats naming, abstraction, module boundaries, logging, and tests as selectable execution directions under continuous full-codebase rescans, guiding agents to choose the highest-confidence, highest-leverage gradual refactors that prepare the ground for deeper later cleanup while preserving behavior under green guardrails and a precise system-level definition of macro architecture.
14
+
10
15
  ## [v3.1.3] - 2026-04-23
11
16
 
12
17
  ### Changed
@@ -1,17 +1,21 @@
1
1
  # iterative-code-quality
2
2
 
3
- Improve an existing repository through repeated, evidence-backed code-quality passes while preserving intended business behavior and macro architecture.
3
+ Improve an existing repository through repeated, evidence-backed full-iteration refactors while preserving intended business behavior and the system's top-level macro architecture.
4
4
 
5
5
  ## Core capabilities
6
6
 
7
7
  - Scans the full codebase and builds a prioritized quality backlog before editing.
8
+ - Treats naming, abstraction, module boundaries, logging, and tests as selectable execution directions rather than a fixed sequence.
8
9
  - Clarifies ambiguous variable, parameter, field, helper, and test-data names.
9
10
  - Simplifies complex functions and extracts reusable helpers only when they centralize real behavior.
10
11
  - Splits mixed-responsibility code into narrower modules without changing macro architecture.
11
12
  - Repairs stale or missing logs and adds tests for important observability contracts.
12
13
  - Adds high-value unit, property-based, integration, or E2E tests based on risk.
13
14
  - Uses those tests and other guardrails to justify more aggressive refactors, instead of leaving known issues in place for subjective confidence reasons.
15
+ - Re-scans the full repository after every iteration and picks the next highest-confidence, highest-leverage directions.
16
+ - Uses small safe refactors to prepare the ground for larger later refactors, progressing gradually from outside to inside.
14
17
  - Repeats the pass cycle while any known in-scope actionable quality issue remains, and forbids a completion report until the latest scan is clear or remaining items are explicitly deferred with a valid reason.
18
+ - Targets as many inherited repository quality problems as can be solved safely, and expects the guarded test surface to remain green after the refactor.
15
19
  - Synchronizes project docs and `AGENTS.md` through `align-project-documents` and `maintain-project-constraints` after implementation.
16
20
 
17
21
  ## Repository structure
@@ -5,7 +5,7 @@ description: >-
5
5
  passes: clarify poor variable names, simplify or extract reusable functions,
6
6
  split oversized code into single-responsibility modules, repair stale or
7
7
  missing logs, and add high-value tests while preserving business behavior and
8
- macro architecture. Use when users ask for comprehensive refactoring, code
8
+ system-level macro architecture. Use when users ask for comprehensive refactoring, code
9
9
  cleanup, maintainability hardening, naming cleanup, log alignment, or test
10
10
  coverage improvement across a repository.
11
11
  ---
@@ -22,15 +22,17 @@ description: >-
22
22
  ## Standards
23
23
 
24
24
  - Evidence: Read repository docs, project constraints, source, tests, logs, and entrypoints before editing; every rename, extraction, split, log update, or test must be backed by code context.
25
- - Execution: Work in bounded passes, prioritize behavior-neutral improvements with the highest maintainability and test value, validate after each pass, and keep iterating while any known in-scope codebase quality issue remains unresolved; when tests or other reliable guardrails can prove equivalence, prefer taking the refactor instead of deferring it for subjective confidence reasons; do not produce the completion report while the scan still contains actionable gaps.
26
- - Quality: Preserve business behavior and macro architecture unless tests expose an existing logic defect; avoid style-only churn, compatibility theater, broad rewrites, and unverified "cleanup", but do not reject a worthwhile refactor purely because it feels risky when existing or newly added guardrails can verify it safely.
25
+ - Execution: Continuously re-scan the full codebase, treat naming, abstraction, module boundaries, logging, and tests as selectable execution directions rather than a fixed sequence, choose the highest-confidence directions that can safely land now, and use those smaller refactors to prepare the ground for larger future refactors; validate after each iteration, then keep iterating while any known in-scope codebase quality issue remains unresolved; when tests or other reliable guardrails can prove equivalence, prefer taking the refactor instead of deferring it for subjective confidence reasons; do not produce the completion report while the scan still contains actionable gaps.
26
+ - Quality: Solve as many inherited code-quality problems as safely possible without changing intended behavior or the system's macro architecture; avoid style-only churn, compatibility theater, broad rewrites, and unverified "cleanup", but do not reject a worthwhile refactor purely because it feels risky when existing or newly added guardrails can verify it safely.
27
27
  - Output: Deliver a concise pass-by-pass summary, changed behavior-neutral surfaces, test coverage added, validation results, and documentation/`AGENTS.md` sync status only after every known in-scope quality issue is resolved or explicitly classified as blocked, unsafe, low-value, speculative, or requiring user approval.
28
28
 
29
29
  ## Goal
30
30
 
31
- Raise code quality across an existing repository without changing intended product behavior or the system's macro architecture.
31
+ Resolve as many inherited repository quality problems as possible without breaking intended behavior, and use tests plus other reliable guardrails to prove that the refactor leaves the project in a fully green state.
32
32
 
33
- This skill is intentionally implementation-oriented, not report-only. It should identify high-value improvements, apply them, test them, and keep iterating across the codebase until there are no unresolved known in-scope quality issues. If a post-pass scan finds remaining actionable gaps, continue the next pass instead of writing a completion report.
33
+ This skill is intentionally implementation-oriented, not report-only. It should keep scanning the full codebase, choose the best available refactor directions at each moment, apply as much safe cleanup as the repository can support, add or strengthen tests to guard the refactor, and use incremental cleanup to unlock deeper improvements over time. If a post-iteration scan finds remaining actionable gaps, continue the next iteration instead of writing a completion report.
34
+
35
+ For this skill, `macro architecture` means the system's top-level runtime shape and overall operating logic: major subsystems, top-level execution model, deployment/runtime boundaries, persistence model, service boundaries, and the end-to-end way the whole system works. Ordinary module interactions, helper extraction, local responsibility moves, and internal call-boundary cleanup do not count as macro-architecture changes by themselves.
34
36
 
35
37
  ## Required Reference Loading
36
38
 
@@ -54,9 +56,11 @@ Load references only when they match the active pass:
54
56
  - Build an initial quality backlog with concrete file/function/test targets before changing code.
55
57
  - Use `references/repository-scan.md` for the scan checklist and backlog scoring.
56
58
 
57
- ### 2) Execute bounded improvement passes
59
+ ### 2) Execute continuous full scans with selectable directions
60
+
61
+ Do not force one fixed order such as "finish naming first, then abstraction, then modules". Instead, keep re-scanning the whole codebase and select the execution directions that are highest-confidence and highest-leverage right now.
58
62
 
59
- Run focused passes in the order that fits the repository evidence. A typical order is:
63
+ Treat these as multi-select execution directions, not mandatory sequential stages:
60
64
 
61
65
  1. Naming clarity for variables, parameters, fields, local helpers, and test data.
62
66
  2. Function simplification and reusable extraction for duplicated or hard-coded workflows.
@@ -64,15 +68,22 @@ Run focused passes in the order that fits the repository evidence. A typical ord
64
68
  4. Logging alignment for stale, misleading, missing, or low-context diagnostics.
65
69
  5. Risk-based test coverage for high-value business logic and boundary cases.
66
70
 
67
- For each pass:
71
+ Direction-selection rules:
72
+
73
+ - Prefer the directions with the strongest current evidence and best guardrails.
74
+ - Prefer smaller, higher-confidence refactors that unlock or de-risk larger later refactors.
75
+ - Prefer outside-in progress: stabilize boundaries, callers, naming, logs, and tests around a subsystem before attempting deeper internal rewrites.
76
+ - Re-evaluate the whole backlog after every landed iteration; the next best direction may change because the previous cleanup improved the local safety or clarity.
77
+
78
+ For each iteration:
68
79
 
69
80
  - Read all directly affected callers, tests, and public interfaces before editing.
70
- - Keep the pass small enough to validate and review; split broad cleanups into multiple passes.
81
+ - Keep the scope small enough to validate and review, and select whichever directions are most justified for that scope instead of forcing every direction to appear in every iteration.
71
82
  - Prefer repository-native abstractions over new parallel frameworks.
72
83
  - Preserve public behavior, data contracts, side effects, error classes, and macro architecture.
73
- - Add or update tests in the same pass when the change touches non-trivial logic, observability contracts, or extracted helpers.
84
+ - Add or update tests in the same iteration when the change touches non-trivial logic, observability contracts, or extracted helpers.
74
85
  - If strong guardrails exist or can be added cheaply, prefer the clearer or more maintainable refactor instead of leaving a known issue in place due to subjective caution alone.
75
- - Validate the touched scope before starting another pass.
86
+ - Validate the touched scope before starting another iteration.
76
87
 
77
88
  ### 3) Rename for clarity without churn
78
89
 
@@ -96,7 +107,7 @@ For each pass:
96
107
  - Split code only when one file/module owns multiple change reasons, domain boundaries, external integrations, or lifecycle stages.
97
108
  - Define the new module's responsibility before moving code.
98
109
  - Keep interfaces narrow, explicit, and consistent with existing project style.
99
- - Avoid macro-architecture changes such as new layers, new service boundaries, new persistence strategies, or framework swaps unless the user explicitly expands scope.
110
+ - Avoid macro-architecture changes such as new top-level layers, new service boundaries, new persistence strategies, deployment/runtime model changes, or framework swaps unless the user explicitly expands scope.
100
111
  - When module boundaries are currently poor but can be protected by focused tests or other guardrails, choose the cleaner split instead of preserving a mixed-responsibility file out of caution alone.
101
112
  - Use `references/module-boundaries.md` for extraction rules and anti-patterns.
102
113
 
@@ -118,11 +129,13 @@ For each pass:
118
129
  - If a new test exposes an existing business-logic bug, invoke `systematic-debug`, fix the true owner, and keep the regression test.
119
130
  - Use `references/testing-strategy.md` for coverage selection and required `N/A` reasoning.
120
131
 
121
- ### 8) Iterate until quality gates pass
132
+ ### 8) Iterate gradually from outside to inside until the repository is clear of known actionable issues
122
133
 
123
- - After each pass, run the narrowest relevant tests first, then broaden validation when confidence increases.
124
- - Re-scan both touched areas and the known quality backlog for new naming drift, duplicated helper candidates, module-boundary cracks, logging drift, and missing tests.
125
- - Repeat the full pass cycle whenever any known in-scope actionable gap remains and can be fixed safely without changing business behavior or macro architecture.
134
+ - After each iteration, run the narrowest relevant tests first, then broaden validation until the changed scope and final repository state are adequately guarded.
135
+ - Re-scan the full codebase, not only the touched area, because the best next direction may have shifted after the last cleanup.
136
+ - Re-rank the backlog after every iteration and choose the next highest-confidence, highest-leverage direction set.
137
+ - Use small external or boundary-level cleanups to make later deeper refactors safer; treat that groundwork as progress toward a thorough long-horizon refactor, not as a distraction from it.
138
+ - Repeat the full iteration whenever any known in-scope actionable gap remains and can be fixed safely without changing business behavior or macro architecture.
126
139
  - Do not write the completion report, summarize the task as done, or hand back as complete while the latest scan still contains known actionable quality issues.
127
140
  - Stop only when every known in-scope issue has been resolved, or each remaining candidate is explicitly classified as low-value, speculative, blocked, unsafe, or requiring product/architecture approval.
128
141
  - Use `references/iteration-gates.md` for stopping criteria.
@@ -138,7 +151,7 @@ After code and tests are complete:
138
151
  ## Hard Guardrails
139
152
 
140
153
  - Do not change intended business logic while refactoring.
141
- - Do not change macro architecture, framework choice, storage model, deployment model, or service boundaries unless the user explicitly approves that expanded scope.
154
+ - Do not change the system's macro architecture—its top-level runtime shape, deployment/runtime model, persistence model, major service boundaries, or overall operating logic—unless the user explicitly approves that expanded scope.
142
155
  - Do not use one-off scripts to rewrite product code.
143
156
  - Do not perform style-only churn that does not improve naming, reuse, modularity, observability, or test confidence.
144
157
  - Do not weaken tests to make refactors pass; update tests to stable invariants or fix the implementation defect.
@@ -146,11 +159,11 @@ After code and tests are complete:
146
159
 
147
160
  ## Completion Report
148
161
 
149
- Only write this report after the latest scan confirms there are no known actionable in-scope quality issues remaining. If any such issue remains, continue iterating instead of reporting completion.
162
+ Only write this report after the latest scan confirms there are no known actionable in-scope quality issues remaining and the relevant test/guardrail suite is green. If any such issue remains, continue iterating instead of reporting completion.
150
163
 
151
164
  Return:
152
165
 
153
- 1. Passes completed and why they were ordered that way.
166
+ 1. Iterations completed and which execution directions were selected in each one.
154
167
  2. Key files changed and the quality issue each change resolved.
155
168
  3. Business behavior preservation evidence.
156
169
  4. Tests added or updated, including property/integration/E2E `N/A` reasons where relevant.
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "Iterative Code Quality"
3
3
  short_description: "Refactor names, functions, modules, logs, and tests in repeated behavior-safe passes"
4
- default_prompt: "Use $iterative-code-quality to scan this repository, build an evidence-backed quality backlog, then iteratively clarify variable names, simplify or extract reusable functions, split code into single-responsibility modules, repair stale or missing logs, and add high-value unit/property/integration/E2E tests while preserving business behavior and macro architecture; when tests or other reliable guardrails exist or can be added cheaply, use them to justify a more aggressive refactor instead of deferring worthwhile cleanup for subjective confidence reasons; if the latest scan still contains any known in-scope actionable quality issue, do not write a completion report and continue the next bounded iteration instead; after all known actionable issues are resolved or explicitly classified as blocked, unsafe, low-value, speculative, or requiring approval, run $align-project-documents and $maintain-project-constraints to synchronize docs and AGENTS.md."
4
+ default_prompt: "Use $iterative-code-quality to keep scanning the full repository, treat naming, simplification, reusable extraction, module-boundary cleanup, logging alignment, and testing as selectable execution directions rather than a fixed sequence, and choose the highest-confidence, highest-leverage directions available at each moment; use small safe refactors to prepare the ground for larger later refactors, progress gradually from outside to inside, use tests or other reliable guardrails to justify aggressive cleanup without breaking intended behavior or the system's top-level runtime architecture, and do not write a completion report while any known in-scope actionable issue remains; only finish after the latest full-codebase scan is clear or remaining items are explicitly classified as blocked, unsafe, low-value, speculative, or approval-dependent, and the guarded test surface is green; then run $align-project-documents and $maintain-project-constraints to synchronize docs and AGENTS.md."
@@ -2,15 +2,18 @@
2
2
 
3
3
  ## Pass discipline
4
4
 
5
- Each pass must have:
5
+ Each iteration must have:
6
6
 
7
7
  - a concrete quality target,
8
8
  - a bounded file/symbol scope,
9
+ - one or more selected execution directions,
9
10
  - expected behavior-neutral outcome,
10
11
  - validation plan,
11
12
  - rollback point if evidence contradicts the change.
12
13
 
13
- Avoid starting a broad second pass before validating the first, but do not stop after a validated pass if known actionable quality issues remain anywhere in the in-scope codebase.
14
+ An iteration is not "one work type", and it also does not need to include every direction every time. Within the selected scope, choose the subset of directions that has the best current confidence and leverage: naming, simplification, module boundaries, logging, and/or tests.
15
+
16
+ Avoid starting a broad second iteration before validating the first, but do not stop after a validated iteration if known actionable quality issues remain anywhere in the in-scope codebase.
14
17
 
15
18
  ## Validation cadence
16
19
 
@@ -30,9 +33,11 @@ If validation fails:
30
33
 
31
34
  If validation passes and the guardrails meaningfully cover the changed behavior, do not keep a known quality issue in place purely because of subjective confidence concerns.
32
35
 
33
- ## Re-scan after each pass
36
+ The final stopping condition also requires the relevant guarded test surface to be green; a partially red repository is not a completed refactor outcome.
37
+
38
+ ## Re-scan after each iteration
34
39
 
35
- Inspect touched areas and the full known quality backlog for:
40
+ Inspect the full known quality backlog for:
36
41
 
37
42
  - new naming drift from moved or extracted concepts,
38
43
  - duplicated logic that remains after extraction,
@@ -41,6 +46,12 @@ Inspect touched areas and the full known quality backlog for:
41
46
  - tests that cover only the happy path,
42
47
  - documentation or `AGENTS.md` drift.
43
48
 
49
+ Then choose the next execution directions with these priorities:
50
+
51
+ 1. highest confidence under current guardrails,
52
+ 2. strongest leverage for later deeper cleanup,
53
+ 3. lowest business-risk path toward broader system improvement.
54
+
44
55
  ## Continue when
45
56
 
46
57
  Repeat the cycle when:
@@ -52,7 +63,9 @@ Repeat the cycle when:
52
63
  - logs are still misleading or missing at critical decisions,
53
64
  - high-value business logic remains untested and is testable.
54
65
 
55
- Do not produce a final completion report while any item in this section is true. Continue with the next bounded pass instead.
66
+ Do not produce a final completion report while any item in this section is true. Continue with the next bounded iteration instead.
67
+
68
+ Prefer gradual outside-in progress: boundary cleanup, naming clarity, and guardrail strengthening should often come before deeper internal rewrites because they make the deeper work safer later.
56
69
 
57
70
  ## Stop when
58
71
 
@@ -73,7 +86,9 @@ If a remaining candidate cannot be placed in one of these categories, it is stil
73
86
  The final report should make the stopping point auditable:
74
87
 
75
88
  - passes completed,
89
+ - execution directions selected per iteration,
76
90
  - validation commands and outcomes,
91
+ - confirmation that the guarded test surface is green after the refactor,
77
92
  - tests added by risk category,
78
93
  - behavior-preservation evidence,
79
94
  - docs and constraints sync status,
@@ -21,6 +21,26 @@ Define:
21
21
  - which interfaces must remain stable,
22
22
  - which tests prove behavior did not change.
23
23
 
24
+ ## Macro architecture boundary
25
+
26
+ For this skill, `macro architecture` means the whole system's runtime shape and operating model, such as:
27
+
28
+ - major subsystems and their top-level responsibilities,
29
+ - deployment/runtime boundaries,
30
+ - persistence model and data ownership model,
31
+ - inter-service or inter-process boundaries,
32
+ - the overall execution logic by which the system operates end to end.
33
+
34
+ The following do **not** count as macro-architecture changes by themselves:
35
+
36
+ - moving logic between ordinary internal modules,
37
+ - extracting helpers,
38
+ - splitting a mixed-responsibility file into narrower local modules,
39
+ - clarifying call boundaries inside one subsystem,
40
+ - replacing duplicated local control flow with a shared internal abstraction.
41
+
42
+ Treat those changes as ordinary refactoring work unless they also alter the top-level system model above.
43
+
24
44
  ## Safe split patterns
25
45
 
26
46
  - Move pure domain logic into a domain-owned helper module.
@@ -8,6 +8,8 @@ For every non-trivial pass, ask what could regress silently if the cleanup were
8
8
 
9
9
  Use the resulting guardrails aggressively: when tests or equivalent verification can prove behavior preservation, they should unlock bolder refactors rather than merely justify small cosmetic edits.
10
10
 
11
+ The intended end state is not merely "some tests passed for touched files". The refactor is complete only when the relevant guarded test surface for the repository remains green after the cleanup.
12
+
11
13
  ## Unit tests
12
14
 
13
15
  Use for:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laitszkin/apollo-toolkit",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "Apollo Toolkit npm installer for managed skill copying across Codex, OpenClaw, and Trae.",
5
5
  "license": "MIT",
6
6
  "author": "LaiTszKin",