@${CLAUDE_SKILL_DIR}/../../meta/ase-control.md
@${CLAUDE_SKILL_DIR}/../../meta/ase-skill.md
@${CLAUDE_SKILL_DIR}/../../meta/ase-getopt.md
*Determine* the *target programming language* and the *declared
architecture style* (if any) - e.g., Layered, Hexagonal
(Ports & Adapters), Onion, Clean, CQRS, Microservices,
Event-Driven, Modular Monolith - from code, project documentation,
README files, or folder structure.
Investigate the following architecture quality aspects across
7 thematic blocks:
**Block 1 - Component Boundaries**:
- **SA01 COMPONENT-RESPONSIBILITY**: each component (module,
class, package) addresses exactly *one single concern* -
i.e., has exactly *one reason to change*.
- **SA02 COMPONENT-GRANULARITY**: components have *appropriate
size* - neither monolithic nor fragmented.
- **SA03 COMPONENT-HIERARCHY**: components placed at the *correct
level* of the component hierarchy (system / program / module /
class / function).
**Block 2 - Structural Organization**:
- **SA04 LAYERING**: *layers* (horizontal cuts) clearly
separated, named, and ranked; no upward dependencies.
- **SA05 SLICING**: *slices* (vertical cuts - e.g., feature
modules, bounded contexts) clearly separated and *cycle-free*.
- **SA06 DEPENDENCY-DIRECTION**: dependencies flow in exactly
*one direction*; no *circular dependencies*.
- **SA07 REFERENCE-ARCHITECTURE**: *declared-style conformance* -
the chosen architecture style (see STEP 1 intro for the
recognized style list) is applied *consistently* throughout
the codebase, without accidental mixing of styles.
**Block 3 - Architecture Principles**:
- **SA08 COUPLING**: *loose data coupling* between components -
no *concrete-type dependencies* where abstractions exist, no
shared data structures leaking across boundaries, communication
via defined ports / facades / DTOs. (Runtime coupling such as
races and shared mutable state is covered by SA17.)
- **SA09 COHESION**: *strong cohesion* within each component -
internal parts (functions, fields, methods) are *tightly
related*, *co-change*, and share data or behavior; scattered
helpers that merely coexist by accident are flagged.
- **SA10 EXTENSIBILITY**: components are *open for extension*
(plugins, SPIs, hooks) but *closed for modification*.
- **SA11 SEPARATION**: *cross-cutting concerns* (logging,
security, caching, transactions, tracing) isolated from
domain logic; trace context propagated across component
boundaries.
- **SA12 ENCAPSULATION**: unavoidable complexity *encapsulated*
behind a simple interface that *shields* its implementation
details.
**Block 4 - Interface Quality**:
- **SA13 INTERFACE-SIZE**: each interface *proportional in size*
to its functionality.
- **SA14 INTERFACE-COMPOSABILITY**: interface methods are
*orthogonal* and enable combinatorial use-cases without
boilerplate.
- **SA15 INTERFACE-CONTRACT**: each interface declares clear
*syntactic* and *semantic* contracts (pre/post-conditions,
invariants, idempotency, thread-safety).
**Block 5 - Quality Attributes**:
- **SA16 TESTABILITY**: architectural *seams* enable testing in
isolation - dependency injection at component boundaries,
mockable interfaces, side effects (DB, filesystem, network,
time, randomness) hidden behind abstractions.
- **SA17 CONCURRENCY**: the *concurrency model* (event loop,
threads, goroutines, async/await, actors, ...) is *explicitly
chosen* and applied *consistently*. *Runtime coupling* -
thread-safety boundaries, shared mutable state, races, lock
hold times, async/sync boundaries - is explicit and localized;
shared mutable state is protected.
**Block 6 - Architecture Governance**:
- **SA18 DECISION-RECORDS**: non-trivial architectural decisions
are *documented* with rationale (Architecture Decision Records
/ ADRs, README sections, or in-code comments capturing *why*).
The chosen style, deviations from defaults, and trade-offs are
traceable.
**Block 7 - Package Cohesion**:
- **SA19 PACKAGE-COHESION**: each first-party package has a
coherent role *and* topical theme - its members serve a
common purpose, share a dominant noun-cluster, and have
non-trivial cross-package use. Flag:
- *grab-bag*: members split into ≥3 unrelated topical
clusters (e.g. a `util` package mixing date-parsing,
network-retry, and string-formatting helpers)
- *misplaced class*: a class only imported once cross-package
but referenced *≥3 times* inside the consumer (likely
belongs in the consumer or in a shared utility package)
- *topical outlier*: a class whose name-tokens share *<30%*
overlap with the package's dominant noun-cluster, or with
its `package-info` / `README` declaration when present
- **SA20 PACKAGE-CYCLE**: no *cyclic dependencies* between
first-party packages - neither direct (`A → B` and `B → A`)
nor transitive (via *Tarjan SCC* or pairwise scan). Each
cycle is reported with the exact import lines that close it.
- **SA21 PACKAGE-SIZE**: package size and coupling shape are
justified - flag packages at either extreme:
- *god-package*: *incoming ≥ 5* and *outgoing ≥ 3* -
coordinator dumping ground that should be split along its
internal topical clusters
- *fragment*: 1–2 files under a sibling parent that share a
*name prefix* or *imported interface* with that sibling -
consolidation candidate
Hints:
- During investigation, do *not* output anything else,
especially do not give any further explanations or information.
- Focus on *practically relevant* problems and especially do
*not* investigate theoretical or fictive cases.
- Focus on the *problem only* and do *not* investigate any
possible *solution*.
- For the *target programming language*, apply each aspect
according to its *idiomatic conventions* and *best practices*.
- *Control-flow verification* (SA17, SA08, SA06, SA11): for
any claim about *ordering*, *lock hold time*, *thread
boundary*, or *call from context X*, trace the actual
acquire/release and call order line-by-line. Do not
pattern-match on "loop inside method with lock" - verify
which operations sit *between* the specific acquire and
release in source order.
- *Package-graph construction (SA19–SA21)*: parse each file's
import (or equivalent language construct) statement, keep
only first-party packages within the analyzed scope, and
persist two intermediate structures: the per-package
incoming/outgoing class-edge map (drives SA20, SA21) and
the per-package noun-token frequency table extracted from
class names in camelCase / snake_case (drives SA19 topical
analysis). No external NLP - pure tokens. Cite each finding
with the exact import lines or class-name evidence.
- *Block 7 severity ladder*: SA20 (cycle) → HIGH; SA21
(size/shape) → MEDIUM; SA19 (cohesion) → LOW. Mark ACCEPTED
when `CLAUDE.md`, `AGENTS.md`, `package-info`, or class
Javadoc explicitly justifies the pattern (per skill-meta
contract-already-addressed rule).
</step>
Use the following output :
Detected style:
Target language:
Hints:
For , name the detected architecture style or
"undeclared" if none is documented.
For , build a Mermaid
specification for a flowchart TB of the
high-level component or layer structure and dispatch the rendering
to the ase-meta-diagram sub-agent by calling the tool
Agent(name: "ase-meta-diagram", description: "Diagram Rendering", subagent_type: "ase:ase-meta-diagram", prompt: <mermaid-spec/>),
using its returned fenced code block verbatim. Show layers /
slices / major components and their dependency direction.
Mark detected anomalies directly in the Mermaid source.
Because ! and ? are Mermaid special characters, always
quote anomaly-bearing node labels:
- Problem node - prefix label with
! inside quotes:
A["!ComponentA"].
- Unclear node - suffix label with
(?) inside quotes:
B["ComponentB (?)"].
- Cyclic edge - annotate the edge (not a node) with a
cycle label on a bidirectional arrow:
A <-- "cycle" --> B (or two labelled one-way edges if
the renderer rejects <-->).
The renderer preserves these glyphs verbatim inside the
boxes and along the edges.
- Unpaired - single aspect violated, no partner in the
tension matrix hit → emit
PROBLEM template.
- Paired - exactly two aspects of a single tension pair hit
→ emit
TRADEOFF template (cluster of size 2).
- Clustered - an aspect appears in multiple triggered
tensions (e.g., SA10 hit against both SA12 and SA13) →
collapse into one
TRADEOFF with the recurring aspect
as focal aspect and the others as partners. One
direction for the whole cluster.
Tension matrix (use to detect paired/clustered findings):
┌─────────────┬───────────────────────────────────────────────┐
│ Pair │ Tension │
├─────────────┼───────────────────────────────────────────────┤
│ SA01 ↔ SA02 │ single concern/responsibility vs. granularity │
│ SA08 ↔ SA09 │ loose coupling vs. strong cohesion │
│ SA10 ↔ SA12 │ extensibility vs. encapsulation │
│ SA10 ↔ SA13 │ extensibility vs. interface size │
│ SA11 ↔ SA08 │ cross-cutting separation vs. coupling │
│ SA12 ↔ SA14 │ encapsulation vs. composability │
│ SA16 ↔ SA12 │ testability vs. encapsulation │
│ SA16 ↔ SA13 │ testability vs. interface size │
│ SA05 ↔ SA09 │ slice cycle-freeness vs. cohesion │
│ SA06 ↔ SA10 │ single dependency direction vs. extensibility │
└─────────────┴───────────────────────────────────────────────┘
Report each unpaired finding with the following :
Report each paired or clustered finding with the following :
- Focal aspect: -
- In tension with:
RECOMMENDED: lean toward
Reason:
Implies:
For each partner in , repeat the *Implies* line,
set to the partner aspect, and set
to its brief implication. Set
to the aspect direction the recommendation favors (the focal
aspect or the partners).
Hints:
For the final results, do not output anything else,
especially do not give any further explanations or
information.
For , and every entry in
, name the aspect (e.g., SA06 DEPENDENCY-DIRECTION).
The is the aspect that participates in
all tensions of the cluster. In a size-2 cluster both
aspects participate equally in the single tension, so this
rule cannot disambiguate; instead pick the focal aspect by
the first applicable tiebreaker: (1) the aspect whose
direction is more constrained by the detected style; else
(2) the aspect carrying the higher finding severity; else
(3) the aspect listed first in the tension matrix pair.
Brevity and precision: all free-form placeholders
(, , partner-implications)
are very brief but precise. is exactly
one sentence grounded in the detected style, domain
constraints, or language idioms - never generic
principles.
Highlight code as <code/>
and key aspects as .
Add inline references to related code positions in the
form of either
(<filename/>:<line-number/>),
(<filename/>:<line-number/>-<line-number/>) or
(<filename/>#<function-or-method/>).
Classify each finding with a of
LOW, MEDIUM,
HIGH, or ACCEPTED.
Use ACCEPTED when the
contract-already-addressed check applies (see skill meta
rules on Findings).
Per-aspect consistency (mandatory): every aspect may
appear in at most one output. Collapse both halves of
a hit tension pair into a single TRADEOFF; if an aspect
participates in multiple hit tensions, collapse all of
them into one clustered TRADEOFF with that aspect as the
focal aspect. Never emit contradictory recommendations
for the same aspect, and never emit both halves of a
tension pair as separate PROBLEMs.
Additionally, persist all reported findings in a single
ase_kv_batch call to the ase MCP server with transactional
set to true. The commands parameter array of this call
starts with one { command: "clear", prefix: "ase-issue-" }
entry (which removes only the previously persisted ase-issue-*
keys, leaving any unrelated keys in the shared store intact),
followed by one { command: "set", key: "ase-issue-P<n/>", val: "<title/>: <description/>" } entry per reported PROBLEM and one
{ command: "set", key: "ase-issue-T<n/>", val: "<title/>: <description/>" } entry per reported TRADEOFF.
1---2name: ase-arch-analyze3description: Review software architecture, including package cohesion and inter-package coupling4---5
6@${CLAUDE_SKILL_DIR}/../../meta/ase-control.md
7@${CLAUDE_SKILL_DIR}/../../meta/ase-skill.md
8@${CLAUDE_SKILL_DIR}/../../meta/ase-getopt.md
9
10<skill name="ase-arch-analyze">
11Review Software Architecture
12</skill>
13
14<expand name="getopt" arg1="ase-arch-analyze">
15 $ARGUMENTS
16</expand>
17
18<objective>
19With the mindset of an *expert-level software architect*,
20*review* the *software architecture* of <getopt-arguments/>, and its directly
21related source code, for *potential problems* across component
22boundaries, structural organization, architecture principles,
23interface quality, quality attributes, and architecture governance.
24</objective>
25
26<flow>
271. <step id="STEP 1: Investigate Code Base">
28 Investigate the code from an *architectural* perspective. If the
29 code base is large, you *MUST* use the `Agent` tool (not inline
30 work) to create multiple sub-agents to split the investigation
31 task into appropriate chunks.
32
33 *Determine* the *target programming language* and the *declared
34 architecture style* (if any) - e.g., Layered, Hexagonal
35 (Ports & Adapters), Onion, Clean, CQRS, Microservices,
36 Event-Driven, Modular Monolith - from code, project documentation,
37 README files, or folder structure.
38
39 Investigate the following architecture quality aspects across
40 7 thematic blocks:
41
42 **Block 1 - Component Boundaries**:
43
44 - **SA01 COMPONENT-RESPONSIBILITY**: each component (module,
45 class, package) addresses exactly *one single concern* -
46 i.e., has exactly *one reason to change*.
47 - **SA02 COMPONENT-GRANULARITY**: components have *appropriate
48 size* - neither monolithic nor fragmented.
49 - **SA03 COMPONENT-HIERARCHY**: components placed at the *correct
50 level* of the component hierarchy (system / program / module /
51 class / function).
52
53 **Block 2 - Structural Organization**:
54
55 - **SA04 LAYERING**: *layers* (horizontal cuts) clearly
56 separated, named, and ranked; no upward dependencies.
57 - **SA05 SLICING**: *slices* (vertical cuts - e.g., feature
58 modules, bounded contexts) clearly separated and *cycle-free*.
59 - **SA06 DEPENDENCY-DIRECTION**: dependencies flow in exactly
60 *one direction*; no *circular dependencies*.
61 - **SA07 REFERENCE-ARCHITECTURE**: *declared-style conformance* -
62 the chosen architecture style (see STEP 1 intro for the
63 recognized style list) is applied *consistently* throughout
64 the codebase, without accidental mixing of styles.
65
66 **Block 3 - Architecture Principles**:
67
68 - **SA08 COUPLING**: *loose data coupling* between components -
69 no *concrete-type dependencies* where abstractions exist, no
70 shared data structures leaking across boundaries, communication
71 via defined ports / facades / DTOs. (Runtime coupling such as
72 races and shared mutable state is covered by SA17.)
73 - **SA09 COHESION**: *strong cohesion* within each component -
74 internal parts (functions, fields, methods) are *tightly
75 related*, *co-change*, and share data or behavior; scattered
76 helpers that merely coexist by accident are flagged.
77 - **SA10 EXTENSIBILITY**: components are *open for extension*
78 (plugins, SPIs, hooks) but *closed for modification*.
79 - **SA11 SEPARATION**: *cross-cutting concerns* (logging,
80 security, caching, transactions, tracing) isolated from
81 domain logic; trace context propagated across component
82 boundaries.
83 - **SA12 ENCAPSULATION**: unavoidable complexity *encapsulated*
84 behind a simple interface that *shields* its implementation
85 details.
86
87 **Block 4 - Interface Quality**:
88
89 - **SA13 INTERFACE-SIZE**: each interface *proportional in size*
90 to its functionality.
91 - **SA14 INTERFACE-COMPOSABILITY**: interface methods are
92 *orthogonal* and enable combinatorial use-cases without
93 boilerplate.
94 - **SA15 INTERFACE-CONTRACT**: each interface declares clear
95 *syntactic* and *semantic* contracts (pre/post-conditions,
96 invariants, idempotency, thread-safety).
97
98 **Block 5 - Quality Attributes**:
99
100 - **SA16 TESTABILITY**: architectural *seams* enable testing in
101 isolation - dependency injection at component boundaries,
102 mockable interfaces, side effects (DB, filesystem, network,
103 time, randomness) hidden behind abstractions.
104 - **SA17 CONCURRENCY**: the *concurrency model* (event loop,
105 threads, goroutines, async/await, actors, ...) is *explicitly
106 chosen* and applied *consistently*. *Runtime coupling* -
107 thread-safety boundaries, shared mutable state, races, lock
108 hold times, async/sync boundaries - is explicit and localized;
109 shared mutable state is protected.
110
111 **Block 6 - Architecture Governance**:
112
113 - **SA18 DECISION-RECORDS**: non-trivial architectural decisions
114 are *documented* with rationale (Architecture Decision Records
115 / ADRs, README sections, or in-code comments capturing *why*).
116 The chosen style, deviations from defaults, and trade-offs are
117 traceable.
118
119 **Block 7 - Package Cohesion**:
120
121 - **SA19 PACKAGE-COHESION**: each first-party package has a
122 coherent role *and* topical theme - its members serve a
123 common purpose, share a dominant noun-cluster, and have
124 non-trivial cross-package use. Flag:
125 - *grab-bag*: members split into ≥3 unrelated topical
126 clusters (e.g. a `util` package mixing date-parsing,
127 network-retry, and string-formatting helpers)
128 - *misplaced class*: a class only imported once cross-package
129 but referenced *≥3 times* inside the consumer (likely
130 belongs in the consumer or in a shared utility package)
131 - *topical outlier*: a class whose name-tokens share *<30%*
132 overlap with the package's dominant noun-cluster, or with
133 its `package-info` / `README` declaration when present
134 - **SA20 PACKAGE-CYCLE**: no *cyclic dependencies* between
135 first-party packages - neither direct (`A → B` and `B → A`)
136 nor transitive (via *Tarjan SCC* or pairwise scan). Each
137 cycle is reported with the exact import lines that close it.
138 - **SA21 PACKAGE-SIZE**: package size and coupling shape are
139 justified - flag packages at either extreme:
140 - *god-package*: *incoming ≥ 5* and *outgoing ≥ 3* -
141 coordinator dumping ground that should be split along its
142 internal topical clusters
143 - *fragment*: 1–2 files under a sibling parent that share a
144 *name prefix* or *imported interface* with that sibling -
145 consolidation candidate
146
147 Hints:
148
149 - During investigation, do *not* output anything else,
150 especially do not give any further explanations or information.
151
152 - Focus on *practically relevant* problems and especially do
153 *not* investigate theoretical or fictive cases.
154
155 - Focus on the *problem only* and do *not* investigate any
156 possible *solution*.
157
158 - For the *target programming language*, apply each aspect
159 according to its *idiomatic conventions* and *best practices*.
160
161 - *Control-flow verification* (SA17, SA08, SA06, SA11): for
162 any claim about *ordering*, *lock hold time*, *thread
163 boundary*, or *call from context X*, trace the actual
164 acquire/release and call order line-by-line. Do not
165 pattern-match on "loop inside method with lock" - verify
166 which operations sit *between* the specific acquire and
167 release in source order.
168
169 - *Package-graph construction (SA19–SA21)*: parse each file's
170 import (or equivalent language construct) statement, keep
171 only first-party packages within the analyzed scope, and
172 persist two intermediate structures: the per-package
173 incoming/outgoing class-edge map (drives SA20, SA21) and
174 the per-package noun-token frequency table extracted from
175 class names in camelCase / snake_case (drives SA19 topical
176 analysis). No external NLP - pure tokens. Cite each finding
177 with the exact import lines or class-name evidence.
178
179 - *Block 7 severity ladder*: SA20 (cycle) → HIGH; SA21
180 (size/shape) → MEDIUM; SA19 (cohesion) → LOW. Mark ACCEPTED
181 when `CLAUDE.md`, `AGENTS.md`, `package-info`, or class
182 Javadoc explicitly justifies the pattern (per skill-meta
183 contract-already-addressed rule).
184 </step>
185
1862. <step id="STEP 2: Show Architecture Overview">
187 Render the *discovered architecture* as a concise *diagram*
188 so the user can verify what you understood as the architecture
189 before reading the findings.
190
191 Use the following output <template/>:
192
193 <template>
194 📐 **ARCHITECTURE OVERVIEW**
195
196 *Detected style*: <style/>
197 *Target language*: <language/>
198
199 <rendered-diagram-as-fenced-code-block/>
200 </template>
201
202 Hints:
203
204 - For <style/>, name the detected architecture style or
205 "*undeclared*" if none is documented.
206
207 - For <rendered-diagram-as-fenced-code-block/>, build a Mermaid
208 specification <mermaid-spec/> for a `flowchart TB` of the
209 high-level component or layer structure and dispatch the rendering
210 to the `ase-meta-diagram` sub-agent by calling the tool
211 `Agent(name: "ase-meta-diagram", description: "Diagram Rendering",
212 subagent_type: "ase:ase-meta-diagram", prompt: <mermaid-spec/>)`,
213 using its returned fenced code block verbatim. Show layers /
214 slices / major components and their dependency direction.
215
216 - Mark detected *anomalies* directly in the Mermaid source.
217 Because `!` and `?` are Mermaid special characters, *always
218 quote* anomaly-bearing node labels:
219
220 - *Problem node* - prefix label with `!` inside quotes:
221 `A["!ComponentA"]`.
222 - *Unclear node* - suffix label with `(?)` inside quotes:
223 `B["ComponentB (?)"]`.
224 - *Cyclic edge* - annotate the *edge* (not a node) with a
225 `cycle` label on a bidirectional arrow:
226 `A <-- "cycle" --> B` (or two labelled one-way edges if
227 the renderer rejects `<-->`).
228
229 The renderer preserves these glyphs verbatim inside the
230 boxes and along the edges.
231 </step>
232
2333. <step id="STEP 3: Reconcile and Show Results">
234 Before reporting, classify every finding into one of three
235 categories:
236
237 - *Unpaired* - single aspect violated, no partner in the
238 tension matrix hit → emit `PROBLEM` template.
239 - *Paired* - exactly two aspects of a single tension pair hit
240 → emit `TRADEOFF` template (cluster of size 2).
241 - *Clustered* - an aspect appears in *multiple* triggered
242 tensions (e.g., SA10 hit against both SA12 and SA13) →
243 collapse into *one* `TRADEOFF` with the recurring aspect
244 as *focal aspect* and the others as *partners*. One
245 direction for the whole cluster.
246
247 **Tension matrix** (use to detect paired/clustered findings):
248
249 ```
250 ┌─────────────┬───────────────────────────────────────────────┐
251 │ Pair │ Tension │
252 ├─────────────┼───────────────────────────────────────────────┤
253 │ SA01 ↔ SA02 │ single concern/responsibility vs. granularity │
254 │ SA08 ↔ SA09 │ loose coupling vs. strong cohesion │
255 │ SA10 ↔ SA12 │ extensibility vs. encapsulation │
256 │ SA10 ↔ SA13 │ extensibility vs. interface size │
257 │ SA11 ↔ SA08 │ cross-cutting separation vs. coupling │
258 │ SA12 ↔ SA14 │ encapsulation vs. composability │
259 │ SA16 ↔ SA12 │ testability vs. encapsulation │
260 │ SA16 ↔ SA13 │ testability vs. interface size │
261 │ SA05 ↔ SA09 │ slice cycle-freeness vs. cohesion │
262 │ SA06 ↔ SA10 │ single dependency direction vs. extensibility │
263 └─────────────┴───────────────────────────────────────────────┘
264 ```
265
266 Report each unpaired finding with the following <template/>:
267
268 <template>
269 <ase-tpl-bullet-signal/> **PROBLEM** P<n/> (Severity: <severity/>, Aspect: <aspect-id/>): **<title/>**
270
271 <description/>
272 </template>
273
274 Report each paired or clustered finding with the following <template/>:
275
276 <template>
277 <ase-tpl-bullet-normal/> **TRADEOFF** T<n/> (Severity: <severity/>): **<title/>**
278
279 - *Focal aspect*: <focal-aspect/> - <focal-state/>
280 - *In tension with*: <partner-list/>
281
282 **RECOMMENDED**: lean toward *<lean-toward/>*
283 *Reason*: <rationale/>
284 *Implies*:
285 - <partner-aspect/>: <partner-implication/>
286 - ...
287 </template>
288
289 For each partner in <partner-list/>, repeat the `*Implies*` line,
290 set <partner-aspect/> to the partner aspect, and set
291 <partner-implication/> to its brief implication. Set <lean-toward/>
292 to the aspect direction the recommendation favors (the *focal
293 aspect* or the *partners*).
294
295 Hints:
296
297 - For the final results, do *not* output anything else,
298 especially do *not* give any further explanations or
299 information.
300
301 - For <aspect-id/>, <focal-aspect/> and every entry in
302 <partner-list/>, name the aspect (e.g., `SA06
303 DEPENDENCY-DIRECTION`).
304
305 - The <focal-aspect/> is the aspect that participates in
306 *all* tensions of the cluster. In a size-2 cluster both
307 aspects participate equally in the single tension, so this
308 rule cannot disambiguate; instead pick the focal aspect by
309 the first applicable tiebreaker: (1) the aspect whose
310 direction is more constrained by the detected style; else
311 (2) the aspect carrying the *higher* finding severity; else
312 (3) the aspect listed *first* in the tension matrix pair.
313
314 - *Brevity and precision*: all free-form placeholders
315 (<description/>, <focal-state/>, partner-implications)
316 are *very brief* but *precise*. <rationale/> is exactly
317 *one sentence* grounded in the detected style, domain
318 constraints, or language idioms - never generic
319 principles.
320
321 - Highlight *code* as <template>`<code/>`</template>
322 and *key aspects* as <template>*<aspect/>*</template>.
323
324 - Add inline *references* to related code positions in the
325 form of either
326 <template>(`<filename/>:<line-number/>`)</template>,
327 <template>(`<filename/>:<line-number/>-<line-number/>`)</template> or
328 <template>(`<filename/>#<function-or-method/>`)</template>.
329
330 - Classify each finding with a <severity/> of
331 <template>LOW</template>, <template>MEDIUM</template>,
332 <template>HIGH</template>, or <template>ACCEPTED</template>.
333 Use <template>ACCEPTED</template> when the
334 contract-already-addressed check applies (see skill meta
335 rules on Findings).
336
337 - *Per-aspect consistency (mandatory)*: every aspect may
338 appear in *at most one* output. Collapse both halves of
339 a hit tension pair into a single TRADEOFF; if an aspect
340 participates in *multiple* hit tensions, collapse all of
341 them into one clustered TRADEOFF with that aspect as the
342 focal aspect. Never emit contradictory recommendations
343 for the same aspect, and never emit both halves of a
344 tension pair as separate PROBLEMs.
345
346 - *Additionally*, persist all reported findings in a *single*
347 `ase_kv_batch` call to the `ase` MCP server with `transactional`
348 set to `true`. The `commands` parameter array of this call
349 starts with one `{ command: "clear", prefix: "ase-issue-" }`
350 entry (which removes only the previously persisted `ase-issue-*`
351 keys, leaving any unrelated keys in the shared store intact),
352 followed by one `{ command: "set", key: "ase-issue-P<n/>", val:
353 "<title/>: <description/>" }` entry per reported PROBLEM and one
354 `{ command: "set", key: "ase-issue-T<n/>", val: "<title/>:
355 <description/>" }` entry per reported TRADEOFF.
356 </step>
357
3584. <step id="STEP 4: Give Final Hint">
359 Finally, output the following <template/> to give a final hint:
360
361 <template>
362 ⧉ **ASE**: ↪ hint: **For deeper analysis, suggestions on solution approaches and then final source code changes, use `/ase-code-resolve P{n}` or `/ase-code-resolve T{n}` in the same or even a different session.**
363 </template>
364 </step>
365</flow>
366