Detailed detection techniques for Phase 3 (Gap Analysis) of the Design Crystallizer skill.
Before analyzing individual classes, prepare the measurement context:
- Record the inferred design statement from Phase 1 — this is the baseline
- List all classes in scope with their file paths
- For each class, note its declared identity — name, interfaces, base class
- Map the class interaction graph within the scope — who calls whom
For each class in scope, execute the following in order.
Read the class declaration line and immediate structure:
[access] [modifiers] class [Name] : [BaseClass], [Interfaces]
Check against design:
- Does the name match the structural role from the inferred design?
- Does the base class align with the pattern expectation?
- Are the implemented interfaces consistent with the contract obligations?
- Are there interfaces the design implies but the class doesn't implement?
- Are there interfaces the class implements that the design doesn't account for?
Gap signals:
- Name suggests one role, interfaces suggest another → Role Confusion
- Missing interface that siblings implement → Missing Element
- Implements interface no sibling does without clear reason → Excess Element
Read all constructors. Examine injected dependencies.
Check against design:
- Do the constructor parameters match the expected dependencies for this structural role?
- Are there dependencies that suggest the class is doing work outside its role?
- Are there missing dependencies that the role would require?
- Multiple constructors — does one bypass required dependencies?
Gap signals:
- Constructor takes a service from a different layer than expected → Structural Deviation
- Constructor takes no dependencies but siblings do → Missing Element or intentional simplicity
- Constructor takes dependencies the role shouldn't need → Role Confusion (may be doing too much)
List all public methods, properties, and events.
Check against design:
- Does the public method set match the expected shape?
- Do method signatures (params, return types) align with contract obligations?
- Are there public methods that should be internal/private?
- Are there methods the contract implies but are missing?
Gap signals:
- Public method that exposes internal mechanics → Structural Deviation
- Missing method that the interface or role implies → Missing Element
- Method that belongs to a different structural role → Role Confusion
- Method no caller uses → Excess Element
Read private/internal methods and fields.
Check against design:
- Do private methods serve the declared public surface, or reveal hidden responsibilities?
- Is there a private method cluster that should be its own class?
- Do fields hold state appropriate to the structural role?
Gap signals:
- Private method cluster with its own coherent responsibility → Structural Deviation (extract candidate)
- Fields tracking state the role shouldn't own → Role Confusion
- Helper methods duplicating logic from a service that should be injected → Missing Element
Read the behavioral complexity of key methods.
Check against design:
- Does the branching complexity match the role's expected complexity?
- Is a coordinator doing transformation? Is a transformer doing routing?
- Are there error handling patterns inconsistent with siblings?
Gap signals:
- Complex branching in what should be a simple pass-through → Role Confusion
- No error handling where siblings have it → Missing Element
- Error handling strategy diverges from sibling pattern → Structural Deviation
Map what the class references and what references it.
Check against design:
- Afferent coupling (who depends on this class) — matches expected consumers?
- Efferent coupling (what this class depends on) — matches expected dependencies?
- Any circular references?
- Any dependencies that skip layers?
Gap signals:
- Referenced by classes in unexpected layers → Structural Deviation
- References classes it shouldn't know about → Role Confusion or Structural Deviation
- Not referenced by anything → Excess Element (unless new/planned)
For each gap found, determine severity:
Is the class's fundamental identity (name + interfaces + role)
contradicted by the finding?
YES → Critical
Does the finding affect the class's public contract
(what callers see and depend on)?
YES → High
Does the finding affect internal structure
(how the class does its work)?
YES → Medium
Is it naming, organization, or style?
YES → Low
After individual class analysis, look for patterns across the scope:
- Consistency check: Do all classes of the same structural role follow the same pattern? Divergent classes get flagged.
- Completeness check: Does the scope have all the structural roles the design implies? Missing roles are gaps.
- Coupling check: Is the interaction graph between classes consistent with the design's expected topology?
Present gaps as a table per class:
### [ClassName] — [Structural Role from Design]
| # | Element | Classification | Severity | Finding | Implication |
|---|---------|---------------|----------|---------|-------------|
| 1 | Constructor | Missing Element | High | No ILogger injected; all siblings have it | Logging gap in error paths |
| 2 | ProcessAsync() | Role Confusion | Medium | Contains routing logic; role is Transformer | Should delegate routing to coordinator |After all classes, present a scope-level summary:
### Scope Summary
| Classification | Critical | High | Medium | Low | Total |
|---------------|----------|------|--------|-----|-------|
| Role Confusion | 0 | 1 | 2 | 0 | 3 |
| Structural Deviation | 1 | 2 | 3 | 1 | 7 |
| Missing Element | 0 | 3 | 1 | 0 | 4 |
| Excess Element | 0 | 0 | 1 | 2 | 3 |
| **Total** | **1** | **6** | **7** | **3** | **17** |