@massa-ai/claude-plugin 1.6.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.
- package/.claude-plugin/plugin.json +18 -0
- package/README.md +74 -0
- package/agents/massa-ai-architecture-specialist.md +65 -0
- package/agents/massa-ai-audit-specialist.md +81 -0
- package/agents/massa-ai-builder.md +67 -0
- package/agents/massa-ai-context-curator.md +67 -0
- package/agents/massa-ai-documentation-agent.md +65 -0
- package/agents/massa-ai-furps-analyst.md +71 -0
- package/agents/massa-ai-investigator.md +68 -0
- package/agents/massa-ai-mobile-specialist.md +82 -0
- package/agents/massa-ai-navigator.md +75 -0
- package/agents/massa-ai-plan-critic.md +90 -0
- package/agents/massa-ai-planner.md +65 -0
- package/agents/massa-ai-requirements-analyst.md +64 -0
- package/agents/massa-ai-reviewer.md +66 -0
- package/agents/massa-ai-test-engineer.md +66 -0
- package/agents/massa-ai-verification-agent.md +65 -0
- package/commands/def.md +17 -0
- package/commands/find.md +19 -0
- package/commands/graph.md +16 -0
- package/commands/index.md +19 -0
- package/commands/map.md +24 -0
- package/commands/status.md +15 -0
- package/hooks/README.md +52 -0
- package/hooks/_pin.sh +64 -0
- package/hooks/_post.sh +77 -0
- package/hooks/hooks.json +54 -0
- package/hooks/massa-ai-hook.ts +298 -0
- package/hooks/post-tool-use.sh +4 -0
- package/hooks/pre-compact.sh +70 -0
- package/hooks/session-start.sh +5 -0
- package/hooks/stop.sh +4 -0
- package/hooks/user-prompt-submit.sh +4 -0
- package/install.sh +435 -0
- package/package.json +32 -0
- package/skills/agents/architecture-specialist/SKILL.md +69 -0
- package/skills/agents/audit-specialist/SKILL.md +85 -0
- package/skills/agents/builder/SKILL.md +71 -0
- package/skills/agents/context-curator/SKILL.md +71 -0
- package/skills/agents/documentation-agent/SKILL.md +69 -0
- package/skills/agents/furps-analyst/SKILL.md +74 -0
- package/skills/agents/investigator/SKILL.md +72 -0
- package/skills/agents/mobile-specialist/SKILL.md +86 -0
- package/skills/agents/navigator/SKILL.md +79 -0
- package/skills/agents/plan-critic/SKILL.md +93 -0
- package/skills/agents/planner/SKILL.md +69 -0
- package/skills/agents/requirements-analyst/SKILL.md +68 -0
- package/skills/agents/reviewer/SKILL.md +70 -0
- package/skills/agents/test-engineer/SKILL.md +70 -0
- package/skills/agents/verification-agent/SKILL.md +69 -0
- package/skills/massa-ai/SKILL.md +315 -0
- package/skills/massa-ai/personas/README.md +35 -0
- package/skills/massa-ai/personas/ai-native-nodejs-cli-architect.md +76 -0
- package/skills/massa-ai/personas/catalog.json +157 -0
- package/skills/massa-ai/personas/context-skill-harness-engineer-architect.md +74 -0
- package/skills/massa-ai/personas/product-manager.md +67 -0
- package/skills/massa-ai/personas/senior-mobile-engineer.md +74 -0
- package/skills/massa-ai/personas/senior-mobile-qa-automation-engineer.md +75 -0
- package/skills/massa-ai/references/adr-authoring.md +189 -0
- package/skills/massa-ai/references/agent-orchestration.md +221 -0
- package/skills/massa-ai/references/architecture-coupling-lens.md +239 -0
- package/skills/massa-ai/references/architecture-deepening-lens.md +136 -0
- package/skills/massa-ai/references/architecture-domain-lens.md +186 -0
- package/skills/massa-ai/references/architecture-lenses.md +108 -0
- package/skills/massa-ai/references/audit-report-io.md +459 -0
- package/skills/massa-ai/references/audit-scope.md +103 -0
- package/skills/massa-ai/references/code-annotation.md +111 -0
- package/skills/massa-ai/references/codebase-investigation.md +96 -0
- package/skills/massa-ai/references/context-firewall.md +62 -0
- package/skills/massa-ai/references/conversation-feedback.md +104 -0
- package/skills/massa-ai/references/debug-diagnosis-loop.md +140 -0
- package/skills/massa-ai/references/decision-engine.md +73 -0
- package/skills/massa-ai/references/evidence-gate.md +53 -0
- package/skills/massa-ai/references/furps/analyst-role.md +49 -0
- package/skills/massa-ai/references/furps/checklist.md +92 -0
- package/skills/massa-ai/references/furps/intake.md +104 -0
- package/skills/massa-ai/references/furps/report-contract.md +140 -0
- package/skills/massa-ai/references/hook-enforcement.md +137 -0
- package/skills/massa-ai/references/implementation-delivery.md +101 -0
- package/skills/massa-ai/references/installation.md +110 -0
- package/skills/massa-ai/references/lessons.md +119 -0
- package/skills/massa-ai/references/maestro/artifacts-reports.md +69 -0
- package/skills/massa-ai/references/maestro/cli-device.md +65 -0
- package/skills/massa-ai/references/maestro/cloud.md +67 -0
- package/skills/massa-ai/references/maestro/config-env-output.md +76 -0
- package/skills/massa-ai/references/maestro/fact-ledger.md +71 -0
- package/skills/massa-ai/references/maestro/js-scripting.md +70 -0
- package/skills/massa-ai/references/maestro/mcp.md +59 -0
- package/skills/massa-ai/references/maestro/patterns.md +96 -0
- package/skills/massa-ai/references/maestro/selectors.md +91 -0
- package/skills/massa-ai/references/maestro/workspace-execution.md +81 -0
- package/skills/massa-ai/references/maestro/yaml-commands.md +203 -0
- package/skills/massa-ai/references/maestro.md +47 -0
- package/skills/massa-ai/references/mcp-tools.md +296 -0
- package/skills/massa-ai/references/memory-policy.md +103 -0
- package/skills/massa-ai/references/mobile-context.md +113 -0
- package/skills/massa-ai/references/mobile-diagnosis.md +106 -0
- package/skills/massa-ai/references/mobile-figma-matcher/ATTRIBUTION.md +5 -0
- package/skills/massa-ai/references/mobile-figma-matcher/android-compose.md +13 -0
- package/skills/massa-ai/references/mobile-figma-matcher/android-views.md +13 -0
- package/skills/massa-ai/references/mobile-figma-matcher/core.md +117 -0
- package/skills/massa-ai/references/mobile-figma-matcher/ios-swiftui.md +12 -0
- package/skills/massa-ai/references/mobile-figma-matcher/ios-uikit.md +12 -0
- package/skills/massa-ai/references/mobile-figma-matcher/kmp-compose-multiplatform.md +14 -0
- package/skills/massa-ai/references/mobile-figma-matcher/repository-detection.md +77 -0
- package/skills/massa-ai/references/naming-standards.md +47 -0
- package/skills/massa-ai/references/pr-task-fix.md +80 -0
- package/skills/massa-ai/references/project-context.md +76 -0
- package/skills/massa-ai/references/rfc/ATTRIBUTION.md +5 -0
- package/skills/massa-ai/references/rfc/discovery-and-sizing.md +120 -0
- package/skills/massa-ai/references/rfc/document-contract.md +85 -0
- package/skills/massa-ai/references/rfc/quality-and-lifecycle.md +101 -0
- package/skills/massa-ai/references/root-cause-scripts.md +97 -0
- package/skills/massa-ai/references/spec-driven/artifact-store.md +98 -0
- package/skills/massa-ai/references/spec-driven/code-analysis.md +119 -0
- package/skills/massa-ai/references/spec-driven/coding-principles.md +80 -0
- package/skills/massa-ai/references/spec-driven/context-limits.md +64 -0
- package/skills/massa-ai/references/spec-driven/design.md +257 -0
- package/skills/massa-ai/references/spec-driven/discuss.md +182 -0
- package/skills/massa-ai/references/spec-driven/execute.md +471 -0
- package/skills/massa-ai/references/spec-driven/lessons.md +5 -0
- package/skills/massa-ai/references/spec-driven/memory.md +214 -0
- package/skills/massa-ai/references/spec-driven/specify.md +283 -0
- package/skills/massa-ai/references/spec-driven/sub-agents.md +151 -0
- package/skills/massa-ai/references/spec-driven/tasks.md +494 -0
- package/skills/massa-ai/references/spec-driven/validate.md +397 -0
- package/skills/massa-ai/references/subagent-design.md +132 -0
- package/skills/massa-ai/references/synapse-policy.md +160 -0
- package/skills/massa-ai/references/tdd/calibrated-examples.md +54 -0
- package/skills/massa-ai/references/tdd/discovery-and-sizing.md +83 -0
- package/skills/massa-ai/references/tdd/document-contract.md +136 -0
- package/skills/massa-ai/references/tdd/quality-and-lifecycle.md +83 -0
- package/skills/massa-ai/references/the-fool/cognitive-bias-inventory.md +103 -0
- package/skills/massa-ai/references/the-fool/dialectic-synthesis.md +170 -0
- package/skills/massa-ai/references/the-fool/evidence-audit.md +202 -0
- package/skills/massa-ai/references/the-fool/mode-selection-guide.md +113 -0
- package/skills/massa-ai/references/the-fool/pre-mortem-analysis.md +200 -0
- package/skills/massa-ai/references/the-fool/red-team-adversarial.md +206 -0
- package/skills/massa-ai/references/the-fool/socratic-questioning.md +153 -0
- package/skills/massa-ai/references/ticket/atlassian-fix.md +130 -0
- package/skills/massa-ai/references/ticket/intake-and-sources.md +65 -0
- package/skills/massa-ai/references/ticket/templates-and-quality.md +129 -0
- package/skills/massa-ai/references/verification-ladder.md +62 -0
- package/skills/massa-ai/scripts/lessons.py +590 -0
- package/skills/massa-ai/workflows/adr.md +33 -0
- package/skills/massa-ai/workflows/architecture/architecture-audit.md +125 -0
- package/skills/massa-ai/workflows/architecture/architecture-fix.md +110 -0
- package/skills/massa-ai/workflows/bugs/bugs-audit.md +113 -0
- package/skills/massa-ai/workflows/bugs/bugs-fix.md +97 -0
- package/skills/massa-ai/workflows/code-quality/code-quality-audit.md +154 -0
- package/skills/massa-ai/workflows/code-quality/code-quality-fix.md +99 -0
- package/skills/massa-ai/workflows/commit.md +61 -0
- package/skills/massa-ai/workflows/debug.md +86 -0
- package/skills/massa-ai/workflows/design.md +54 -0
- package/skills/massa-ai/workflows/exploration.md +119 -0
- package/skills/massa-ai/workflows/feature.md +52 -0
- package/skills/massa-ai/workflows/general.md +46 -0
- package/skills/massa-ai/workflows/implementation/implementation-audit.md +87 -0
- package/skills/massa-ai/workflows/implementation/implementation-fix.md +90 -0
- package/skills/massa-ai/workflows/long-session.md +44 -0
- package/skills/massa-ai/workflows/maestro/maestro-audit.md +56 -0
- package/skills/massa-ai/workflows/maestro/maestro-fix.md +74 -0
- package/skills/massa-ai/workflows/maestro/maestro.md +68 -0
- package/skills/massa-ai/workflows/mobile-figma/mobile-figma-audit.md +68 -0
- package/skills/massa-ai/workflows/mobile-figma/mobile-figma-fix.md +74 -0
- package/skills/massa-ai/workflows/onboarding.md +23 -0
- package/skills/massa-ai/workflows/refactor.md +47 -0
- package/skills/massa-ai/workflows/refinement/furps-refinement.md +81 -0
- package/skills/massa-ai/workflows/requirements/requirements-audit.md +114 -0
- package/skills/massa-ai/workflows/requirements/requirements-fix.md +93 -0
- package/skills/massa-ai/workflows/rfc.md +55 -0
- package/skills/massa-ai/workflows/security/security-audit.md +113 -0
- package/skills/massa-ai/workflows/security/security-fix.md +97 -0
- package/skills/massa-ai/workflows/spec-driven.md +217 -0
- package/skills/massa-ai/workflows/tdd.md +71 -0
- package/skills/massa-ai/workflows/tests/tests-audit.md +114 -0
- package/skills/massa-ai/workflows/tests/tests-fix.md +96 -0
- package/skills/massa-ai/workflows/the-fool.md +82 -0
- package/skills/massa-ai/workflows/ticket.md +42 -0
- package/skills/persona-router/SKILL.md +158 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Architecture Deepening Lens
|
|
2
|
+
|
|
3
|
+
Use this detail reference when an architecture audit or execution task needs module depth, seams, adapters, testability, locality, or AI-navigability analysis.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- Vocabulary
|
|
8
|
+
- Deepening Signals
|
|
9
|
+
- Deletion Test
|
|
10
|
+
- Dependency Categories
|
|
11
|
+
- Recommendation Template
|
|
12
|
+
- Interface Design Method
|
|
13
|
+
- Rejected Framings
|
|
14
|
+
- Seam Discipline
|
|
15
|
+
- Test Surface
|
|
16
|
+
- Fix Direction
|
|
17
|
+
|
|
18
|
+
## Vocabulary
|
|
19
|
+
|
|
20
|
+
Use these terms exactly:
|
|
21
|
+
|
|
22
|
+
- Module: anything with an interface and an implementation.
|
|
23
|
+
- Interface: everything a caller must know, including types, invariants, ordering, errors, configuration, and performance.
|
|
24
|
+
- Implementation: code inside the module.
|
|
25
|
+
- Seam: where an interface lives and behavior can be varied without editing callers.
|
|
26
|
+
- Adapter: concrete thing satisfying an interface at a seam.
|
|
27
|
+
- Depth: leverage at the interface.
|
|
28
|
+
- Leverage: capability callers get per unit of interface learned.
|
|
29
|
+
- Locality: change, bugs, knowledge, and verification concentrated in one place.
|
|
30
|
+
|
|
31
|
+
Avoid using `boundary` for module seams; reserve bounded context language for the domain lens.
|
|
32
|
+
|
|
33
|
+
## Deepening Signals
|
|
34
|
+
|
|
35
|
+
Flag candidates when evidence shows:
|
|
36
|
+
|
|
37
|
+
- module interface is nearly as complex as its implementation
|
|
38
|
+
- pass-through wrappers or one-use helpers add navigation cost
|
|
39
|
+
- one concept is split across many files without leverage
|
|
40
|
+
- callers must know ordering, invariants, config, or error modes that should be hidden
|
|
41
|
+
- tests reach past the interface into internals because the interface is the wrong shape
|
|
42
|
+
- extracted pure functions improve unit-test access but lose locality for real bugs
|
|
43
|
+
- seams exist only for hypothetical future adapters
|
|
44
|
+
|
|
45
|
+
## Deletion Test
|
|
46
|
+
|
|
47
|
+
Ask what happens if the module is deleted:
|
|
48
|
+
|
|
49
|
+
- If complexity disappears, the module was likely shallow.
|
|
50
|
+
- If complexity spreads across callers, the module was probably earning its keep.
|
|
51
|
+
- If behavior becomes harder to verify through one surface, the module likely has useful depth.
|
|
52
|
+
|
|
53
|
+
Use this as evidence, not as a mechanical rule.
|
|
54
|
+
|
|
55
|
+
## Dependency Categories
|
|
56
|
+
|
|
57
|
+
Classify dependencies before recommending seams:
|
|
58
|
+
|
|
59
|
+
- In-process: pure computation or in-memory state. Usually deepen by merging and testing through the new interface.
|
|
60
|
+
- Local-substitutable: dependency has a local test stand-in. Keep seam internal when possible and test the deep module with the stand-in.
|
|
61
|
+
- Remote but owned: own service across network. Define a port only when it keeps domain logic local and production/test adapters are both real.
|
|
62
|
+
- True external: third-party dependency. Inject a port and use mock/fake adapters for tests when behavior cannot be run locally.
|
|
63
|
+
|
|
64
|
+
### Recommendation Template
|
|
65
|
+
|
|
66
|
+
For each dependency, state: Category → recommended seam → stand-in used in tests.
|
|
67
|
+
|
|
68
|
+
| Category | Recommended seam | Stand-in example |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| In-process | deepen by merging | none — test through the new interface |
|
|
71
|
+
| Local-substitutable | keep seam internal | in-memory fake |
|
|
72
|
+
| Remote but owned | port only if domain stays local | owned-service test adapter |
|
|
73
|
+
| True external | inject a port | PGLite (database), Stripe test mode (payment) |
|
|
74
|
+
|
|
75
|
+
A stand-in is required evidence before introducing a port: "inject a port for
|
|
76
|
+
Stripe, with the Stripe test-mode adapter as the production-shape stand-in" —
|
|
77
|
+
not "add a port because it is cleaner."
|
|
78
|
+
|
|
79
|
+
## Interface Design Method
|
|
80
|
+
|
|
81
|
+
When a deepening candidate has two or more viable interface shapes, do not pick
|
|
82
|
+
one by instinct. Design it twice: draft two parallel implementations (two
|
|
83
|
+
sub-agents, or two sides authored yourself), each behind a different interface
|
|
84
|
+
against the same caller need, then choose by leverage and locality.
|
|
85
|
+
|
|
86
|
+
Four canned design constraints force distinct shapes:
|
|
87
|
+
|
|
88
|
+
1. Minimal surface: hide every field and ordering the caller does not name.
|
|
89
|
+
2. Batchable: one call serves many items, not one call per item.
|
|
90
|
+
3. Policy-free: the interface states what, not how; no strategy leaks out.
|
|
91
|
+
4. Substitutable: a second adapter can satisfy it without caller edits.
|
|
92
|
+
|
|
93
|
+
Load this method from `architecture-fix.md` or `refactor.md` only when a
|
|
94
|
+
candidate has >= 2 viable interface shapes; otherwise deepen directly.
|
|
95
|
+
|
|
96
|
+
## Rejected Framings
|
|
97
|
+
|
|
98
|
+
Avoid these misreadings of depth; record the rejection so it is not re-litigated:
|
|
99
|
+
|
|
100
|
+
- Depth is NOT a lines-of-code ratio. A deep module can be tiny; a shallow
|
|
101
|
+
wrapper can be long. Padding an implementation to raise a "depth" metric is
|
|
102
|
+
exactly the anti-pattern this lens exists to find.
|
|
103
|
+
- Interface is NOT a language keyword (`interface`, `protocol`, `trait`). It is
|
|
104
|
+
everything a caller must know — types, invariants, ordering, errors.
|
|
105
|
+
- Seam is NOT a class boundary. Reserve `seam` for where behavior can vary
|
|
106
|
+
without editing callers; reserve bounded-context language for the domain lens.
|
|
107
|
+
|
|
108
|
+
## Seam Discipline
|
|
109
|
+
|
|
110
|
+
- One adapter means a hypothetical seam. Two adapters means a real seam.
|
|
111
|
+
- Production plus test adapter can justify a seam when the dependency is remote or external.
|
|
112
|
+
- Internal seams can exist inside the implementation without becoming part of the module interface.
|
|
113
|
+
- Do not expose internal seams just because tests use them.
|
|
114
|
+
- Do not introduce ports/adapters to decorate one local concrete call.
|
|
115
|
+
|
|
116
|
+
## Test Surface
|
|
117
|
+
|
|
118
|
+
The interface is the test surface:
|
|
119
|
+
|
|
120
|
+
- prefer behavior tests through the module interface
|
|
121
|
+
- delete or replace shallow-module tests once deep-module tests cover observable behavior
|
|
122
|
+
- tests should survive implementation refactors
|
|
123
|
+
- if tests must change for implementation-only movement, they are probably testing past the interface
|
|
124
|
+
|
|
125
|
+
## Fix Direction
|
|
126
|
+
|
|
127
|
+
Prefer:
|
|
128
|
+
|
|
129
|
+
- delete shallow pass-through modules
|
|
130
|
+
- inline one-use abstractions
|
|
131
|
+
- merge split concepts when locality improves
|
|
132
|
+
- deepen a useful module by hiding invariants and ordering
|
|
133
|
+
- move validation and transformation behind the interface when callers should not know it
|
|
134
|
+
- add a seam only where variation, dependency direction, external I/O, or test substitution is real
|
|
135
|
+
|
|
136
|
+
Avoid broad rewrites, VSA migrations, or new service boundaries unless audit evidence shows current module shape blocks change or verification.
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Architecture Domain Lens
|
|
2
|
+
|
|
3
|
+
Use this detail reference when an architecture audit or execution task needs domain boundaries, bounded contexts, subdomain classification, ubiquitous language, or cohesion analysis.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- Inputs
|
|
8
|
+
- Concept Inventory
|
|
9
|
+
- Language Grouping
|
|
10
|
+
- Subdomain Classification
|
|
11
|
+
- Cohesion Score
|
|
12
|
+
- Rubric Anchors
|
|
13
|
+
- Worked Examples
|
|
14
|
+
- Low-Cohesion Rules
|
|
15
|
+
- Bounded Context Size
|
|
16
|
+
- Findings To Report
|
|
17
|
+
- Integration Pattern Selection
|
|
18
|
+
- Anti-Patterns
|
|
19
|
+
- Guardrails
|
|
20
|
+
|
|
21
|
+
## Inputs
|
|
22
|
+
|
|
23
|
+
Prefer current project evidence in this order:
|
|
24
|
+
|
|
25
|
+
- `CONTEXT.md`, glossary files, product docs, issue/spec text, and user-provided business context
|
|
26
|
+
- ADRs and architecture docs for accepted boundaries or rejected refactors
|
|
27
|
+
- code names, route names, schemas, tests, fixtures, and use-case names
|
|
28
|
+
- git history only as supporting evidence for change cohesion
|
|
29
|
+
|
|
30
|
+
Code vocabulary is evidence, not truth. Mark conclusions as `suspect` when business intent is inferred only from names.
|
|
31
|
+
|
|
32
|
+
## Concept Inventory
|
|
33
|
+
|
|
34
|
+
Extract business concepts, not technical plumbing:
|
|
35
|
+
|
|
36
|
+
- Entities: domain models with identity or lifecycle
|
|
37
|
+
- Services: business operations, not generic helpers
|
|
38
|
+
- Use cases: workflows, commands, handlers, jobs, or policies
|
|
39
|
+
- Entry points: routes, resolvers, CLIs, events, screens, or cron jobs that expose business capabilities
|
|
40
|
+
- Contracts: DTOs, events, schemas, published language, or anti-corruption layers
|
|
41
|
+
|
|
42
|
+
Skip pure infrastructure unless it is mixed into core business behavior.
|
|
43
|
+
|
|
44
|
+
## Language Grouping
|
|
45
|
+
|
|
46
|
+
Group concepts by ubiquitous language:
|
|
47
|
+
|
|
48
|
+
- same terms with the same meaning usually belong together
|
|
49
|
+
- same term with different meanings signals separate bounded contexts
|
|
50
|
+
- different vocabularies in one module signal a possible boundary mismatch
|
|
51
|
+
- generic terms such as `User`, `Account`, `Customer`, `Order`, or `Policy` need local definitions before judging
|
|
52
|
+
|
|
53
|
+
When a domain term is unclear, report the ambiguity instead of inventing a context.
|
|
54
|
+
|
|
55
|
+
## Subdomain Classification
|
|
56
|
+
|
|
57
|
+
Use this decision rule:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
Competitive advantage or fast-evolving proprietary business logic -> Core
|
|
61
|
+
Business-specific but not differentiating -> Supporting
|
|
62
|
+
Commodity or replaceable capability -> Generic
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Static indicators:
|
|
66
|
+
|
|
67
|
+
- Core: complex business rules, frequent domain changes, domain expert language, differentiating algorithms
|
|
68
|
+
- Supporting: CRUD or workflow support with business-specific vocabulary
|
|
69
|
+
- Generic: auth, logging, email, storage, payment gateway plumbing, metrics, generic notification transport
|
|
70
|
+
|
|
71
|
+
Do not classify something as Core just because it is central in the import graph.
|
|
72
|
+
|
|
73
|
+
## Cohesion Score
|
|
74
|
+
|
|
75
|
+
Use scoring only when enough evidence exists:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
Linguistic cohesion: 0-3
|
|
79
|
+
Usage cohesion: 0-3
|
|
80
|
+
Data cohesion: 0-2
|
|
81
|
+
Change cohesion: 0-2
|
|
82
|
+
Total: 0-10
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Interpretation:
|
|
86
|
+
|
|
87
|
+
- 8-10: strong subdomain candidate
|
|
88
|
+
- 5-7: mixed or evolving boundary
|
|
89
|
+
- 0-4: likely wrong grouping or generic utility cluster
|
|
90
|
+
|
|
91
|
+
If git history is absent or too expensive, score change cohesion as `unknown` and explain the gap.
|
|
92
|
+
|
|
93
|
+
### Rubric Anchors
|
|
94
|
+
|
|
95
|
+
Score each axis against these anchors (highest row that fits):
|
|
96
|
+
|
|
97
|
+
| Axis | 3 | 2 | 1 | 0 |
|
|
98
|
+
|---|---|---|---|---|
|
|
99
|
+
| Linguistic | one shared ubiquitous term, one meaning | mostly shared terms | some shared terms | unrelated vocabularies |
|
|
100
|
+
| Usage | all concepts used in the same use cases | most concepts co-used | partly co-used | rarely co-used |
|
|
101
|
+
| Data | shared identity or aggregate root | shared attributes | read-only overlap | no shared data |
|
|
102
|
+
| Change | always change together | usually change together | sometimes change together | change independently |
|
|
103
|
+
|
|
104
|
+
Data and Change max at 2; Linguistic and Usage max at 3. The anchors make the
|
|
105
|
+
0-10 total reproducible across auditors.
|
|
106
|
+
|
|
107
|
+
### Worked Examples
|
|
108
|
+
|
|
109
|
+
- Same term, three contexts: `Patient` in scheduling (availability), billing
|
|
110
|
+
(invoice line), and clinical (record) is three bounded contexts sharing a
|
|
111
|
+
published language — not one `Patient` model. Score linguistic 1 (shared term)
|
|
112
|
+
but usage 0 and change 0; the total flags a boundary, not a single aggregate.
|
|
113
|
+
- Identity-leak fix: an order DTO field `user: User` leaks the auth context's
|
|
114
|
+
model into billing. Replace it with `customerId: CustomerId`, a value object
|
|
115
|
+
owned by billing, so billing no longer depends on `User`'s shape or lifecycle.
|
|
116
|
+
|
|
117
|
+
## Low-Cohesion Rules
|
|
118
|
+
|
|
119
|
+
A grouping is likely wrong when:
|
|
120
|
+
|
|
121
|
+
1. Mixed vocabulary: one module speaks two or more ubiquitous languages (for
|
|
122
|
+
example `Invoice` beside `RenderFrame`). Action: split by language.
|
|
123
|
+
2. Shotgun change: one business change edits many modules that share no domain
|
|
124
|
+
term. Action: find the missing boundary, or merge the co-changing parts.
|
|
125
|
+
3. God aggregate: one root owns unrelated data (orders + notifications + audit).
|
|
126
|
+
Action: split into per-language aggregates.
|
|
127
|
+
4. Technical grouping: modules clustered by layer ("all controllers", "all
|
|
128
|
+
repositories") instead of by language. Action: re-group vertically.
|
|
129
|
+
5. Cross-context ownership: one context reads or writes another's tables or
|
|
130
|
+
invariants directly. Action: expose an owned contract or anti-corruption layer.
|
|
131
|
+
|
|
132
|
+
## Bounded Context Size
|
|
133
|
+
|
|
134
|
+
| Signal | Meaning |
|
|
135
|
+
|---|---|
|
|
136
|
+
| 1-2 aggregates, single use-case family | too small — likely a layer, not a context; merge or drop |
|
|
137
|
+
| coherent language, 3-8 aggregates, clear integration contract | right-sized |
|
|
138
|
+
| 12+ aggregates or multiple unrelated languages | too large — split along the next language boundary |
|
|
139
|
+
|
|
140
|
+
## Findings To Report
|
|
141
|
+
|
|
142
|
+
Report domain findings when evidence shows:
|
|
143
|
+
|
|
144
|
+
- mixed vocabularies in one module create change friction
|
|
145
|
+
- one context directly owns another context's model, persistence, or invariants
|
|
146
|
+
- generic/supporting infrastructure is embedded in core business logic
|
|
147
|
+
- a bounded context lacks an explicit integration contract
|
|
148
|
+
- a term has colliding meanings across modules and causes bugs or coordination cost
|
|
149
|
+
|
|
150
|
+
Useful integration directions:
|
|
151
|
+
|
|
152
|
+
- Published Language: documented DTO/event/schema shared across contexts
|
|
153
|
+
- Anti-Corruption Layer: translation when upstream language should not leak downstream
|
|
154
|
+
- Open Host Service: stable public interface for multiple consumers
|
|
155
|
+
- Shared Kernel: shared model only when ownership is explicit and scope is tiny
|
|
156
|
+
- Customer/Supplier or Conformist: acceptable only when dependency direction and ownership are intentional
|
|
157
|
+
|
|
158
|
+
## Integration Pattern Selection
|
|
159
|
+
|
|
160
|
+
Pick the integration pattern from the need, not from familiarity:
|
|
161
|
+
|
|
162
|
+
| Need | Pattern |
|
|
163
|
+
|---|---|
|
|
164
|
+
| upstream is legacy or external; its language must not leak downstream | Anti-Corruption Layer |
|
|
165
|
+
| upstream publishes a stable API many consumers depend on | Open Host Service / Published Language |
|
|
166
|
+
| many consumers need the same domain occurrence | Domain Events (published language) |
|
|
167
|
+
| two contexts must share a tiny, co-owned slice | Shared Kernel (only with explicit shared ownership) |
|
|
168
|
+
| downstream must conform to an upstream it cannot influence | Conformist |
|
|
169
|
+
|
|
170
|
+
## Anti-Patterns
|
|
171
|
+
|
|
172
|
+
- ❌ Grouping by technical layer ("all controllers", "all services", "all
|
|
173
|
+
repositories") instead of by ubiquitous language — hides boundaries and
|
|
174
|
+
causes shotgun change.
|
|
175
|
+
- ❌ One bounded context per directory — boundaries follow language, not folders.
|
|
176
|
+
- ❌ Service extraction from language evidence alone — requires change and
|
|
177
|
+
ownership evidence.
|
|
178
|
+
- ❌ Re-litigating an ADR-backed boundary without new concrete friction.
|
|
179
|
+
|
|
180
|
+
## Guardrails
|
|
181
|
+
|
|
182
|
+
- Do not force one bounded context per directory.
|
|
183
|
+
- Do not propose service extraction from language evidence alone.
|
|
184
|
+
- Do not relitigate ADR-backed boundaries unless current friction is concrete.
|
|
185
|
+
- Do not mutate `CONTEXT.md`, ADRs, or docs during an audit.
|
|
186
|
+
- Prefer move, rename, or contract clarification before new layers.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Architecture Lenses
|
|
2
|
+
|
|
3
|
+
Use this reference for architecture audits, architecture-focused reviews, and refactor planning. It is the shared index and vocabulary guard; load the detail references only when a workflow needs that lens:
|
|
4
|
+
|
|
5
|
+
- `references/architecture-domain-lens.md` for bounded contexts, ubiquitous language, subdomain classification, cohesion, and integration patterns.
|
|
6
|
+
- `references/architecture-coupling-lens.md` for dependency graphs, strength/distance/volatility, dependency direction, and contract health.
|
|
7
|
+
- `references/architecture-deepening-lens.md` for module depth, seams, adapters, deletion tests, locality, and interface-as-test-surface analysis.
|
|
8
|
+
|
|
9
|
+
Do not load all detail references by default. Pick the smallest lens set that can prove or disprove the architecture claim.
|
|
10
|
+
|
|
11
|
+
## Domain Lens
|
|
12
|
+
|
|
13
|
+
Map problem-space boundaries before proposing structural changes.
|
|
14
|
+
|
|
15
|
+
Load `references/architecture-domain-lens.md` when the audit target includes domain language, bounded contexts, subdomain classification, cross-domain ownership, or integration pattern choices.
|
|
16
|
+
|
|
17
|
+
Check:
|
|
18
|
+
|
|
19
|
+
- subdomains: Core, Supporting, Generic
|
|
20
|
+
- bounded contexts and ubiquitous language
|
|
21
|
+
- concept cohesion: language, usage, data, change
|
|
22
|
+
- cross-domain dependencies
|
|
23
|
+
- generic functionality mixed into core logic
|
|
24
|
+
|
|
25
|
+
Report:
|
|
26
|
+
|
|
27
|
+
- domain or subdomain
|
|
28
|
+
- type: Core, Supporting, or Generic
|
|
29
|
+
- key terms and concepts
|
|
30
|
+
- cohesion score when useful
|
|
31
|
+
- dependency direction
|
|
32
|
+
- boundary or language mismatch
|
|
33
|
+
- simplest corrective direction
|
|
34
|
+
- mark as `suspect` when business intent is inferred only from code names
|
|
35
|
+
|
|
36
|
+
## Coupling Lens
|
|
37
|
+
|
|
38
|
+
Analyze dependency cost with strength, distance, and volatility.
|
|
39
|
+
|
|
40
|
+
Load `references/architecture-coupling-lens.md` when the audit target includes dependencies, imports, service calls, shared schemas/models, direct persistence access, co-change, or contract leakage.
|
|
41
|
+
|
|
42
|
+
Strength levels:
|
|
43
|
+
|
|
44
|
+
- Intrusive: downstream depends on internals not designed for integration.
|
|
45
|
+
- Functional: sequential, transactional, or duplicated symmetric business rules.
|
|
46
|
+
- Model: upstream exposes internal domain model to downstream.
|
|
47
|
+
- Contract: integration-specific DTO/protocol hides internals.
|
|
48
|
+
|
|
49
|
+
Distance levels:
|
|
50
|
+
|
|
51
|
+
- same function or class
|
|
52
|
+
- same package
|
|
53
|
+
- same module/library
|
|
54
|
+
- different service
|
|
55
|
+
- external system or team
|
|
56
|
+
|
|
57
|
+
Volatility signals:
|
|
58
|
+
|
|
59
|
+
- core business logic
|
|
60
|
+
- frequent git changes or co-change
|
|
61
|
+
- TODO/FIXME clusters
|
|
62
|
+
- evolving API versions
|
|
63
|
+
- fragile tests or recurring regressions
|
|
64
|
+
|
|
65
|
+
Flag highest risk when high strength, high distance, and high volatility combine.
|
|
66
|
+
|
|
67
|
+
Do not flag strong local coupling as bad when the modules change together and locality is better than separation.
|
|
68
|
+
|
|
69
|
+
## Deepening Lens
|
|
70
|
+
|
|
71
|
+
Use these terms exactly:
|
|
72
|
+
|
|
73
|
+
- Module: anything with an interface and implementation.
|
|
74
|
+
- Interface: everything a caller must know, including invariants, ordering, errors, config, and performance.
|
|
75
|
+
- Seam: where an interface lives.
|
|
76
|
+
- Adapter: concrete thing satisfying an interface at a seam.
|
|
77
|
+
- Depth: leverage at the interface.
|
|
78
|
+
- Leverage: capability callers get per unit of interface learned.
|
|
79
|
+
- Locality: change, bugs, and verification concentrated in one place.
|
|
80
|
+
|
|
81
|
+
Load `references/architecture-deepening-lens.md` when the audit target includes shallow modules, pass-through abstractions, seams, adapters, tests that reach past interfaces, or AI-navigability concerns.
|
|
82
|
+
|
|
83
|
+
Check:
|
|
84
|
+
|
|
85
|
+
- shallow modules whose interface is nearly as complex as implementation
|
|
86
|
+
- pass-through wrappers
|
|
87
|
+
- seams with only one adapter and no actual variation
|
|
88
|
+
- test-only extraction that loses locality
|
|
89
|
+
- concepts split across many files without leverage
|
|
90
|
+
|
|
91
|
+
Use the deletion test:
|
|
92
|
+
|
|
93
|
+
- If deleting a module removes complexity, it was probably shallow.
|
|
94
|
+
- If deleting it spreads complexity across callers, it was probably earning its keep.
|
|
95
|
+
|
|
96
|
+
Only recommend a new seam when variation, dependency direction, external I/O, or test substitution is real.
|
|
97
|
+
|
|
98
|
+
## Findings Format
|
|
99
|
+
|
|
100
|
+
```md
|
|
101
|
+
Severity: Critical | High | Medium | Low | Suspect
|
|
102
|
+
Lens: Domain | Coupling | Deepening
|
|
103
|
+
Location: path:line or module
|
|
104
|
+
Evidence: concrete source, dependency, or history signal
|
|
105
|
+
Impact: maintenance, change-risk, testability, or AI-navigability cost
|
|
106
|
+
Recommendation: simplest sufficient action
|
|
107
|
+
Tradeoff: what improves and what gets worse
|
|
108
|
+
```
|