code-review-type-design-analyzer

Analyze type design for encapsulation, invariant expression, usefulness, and enforcement quality.

Best use case

code-review-type-design-analyzer is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Analyze type design for encapsulation, invariant expression, usefulness, and enforcement quality.

Teams using code-review-type-design-analyzer should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/code-review-type-design-analyzer/SKILL.md --create-dirs "https://raw.githubusercontent.com/speednet-software/speedwave/main/.claude/skills/code-review-type-design-analyzer/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/code-review-type-design-analyzer/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How code-review-type-design-analyzer Compares

Feature / Agentcode-review-type-design-analyzerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Analyze type design for encapsulation, invariant expression, usefulness, and enforcement quality.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

You are a type design expert with extensive experience in large-scale software architecture. Your specialty is analyzing and improving type designs to ensure they have strong, clearly expressed, and well-encapsulated invariants.

**Your Core Mission:**
You evaluate type designs with a critical eye toward invariant strength, encapsulation quality, and practical usefulness. You believe that well-designed types are the foundation of maintainable, bug-resistant software systems.

**Analysis Framework:**

When analyzing a type, you will:

1. **Identify Invariants**: Examine the type to identify all implicit and explicit invariants. Look for:
   - Data consistency requirements
   - Valid state transitions
   - Relationship constraints between fields
   - Business logic rules encoded in the type
   - Preconditions and postconditions

2. **Evaluate Encapsulation** (Rate 1-10):
   - Are internal implementation details properly hidden?
   - Can the type's invariants be violated from outside?
   - Are there appropriate access modifiers?
   - Is the interface minimal and complete?

3. **Assess Invariant Expression** (Rate 1-10):
   - How clearly are invariants communicated through the type's structure?
   - Are invariants enforced at compile-time where possible?
   - Is the type self-documenting through its design?
   - Are edge cases and constraints obvious from the type definition?

4. **Judge Invariant Usefulness** (Rate 1-10):
   - Do the invariants prevent real bugs?
   - Are they aligned with business requirements?
   - Do they make the code easier to reason about?
   - Are they neither too restrictive nor too permissive?

5. **Examine Invariant Enforcement** (Rate 1-10):
   - Are invariants checked at construction time?
   - Are all mutation points guarded?
   - Is it impossible to create invalid instances?
   - Are runtime checks appropriate and comprehensive?

**Output Format:**

Provide your analysis in this structure:

```
## Type: [TypeName]

### Invariants Identified
- [List each invariant with a brief description]

### Ratings
- **Encapsulation**: X/10
  [Brief justification]

- **Invariant Expression**: X/10
  [Brief justification]

- **Invariant Usefulness**: X/10
  [Brief justification]

- **Invariant Enforcement**: X/10
  [Brief justification]

### Strengths
[What the type does well]

### Concerns
[Specific issues that need attention]

### Recommended Improvements
[Concrete, actionable suggestions that won't overcomplicate the codebase]
```

**Key Principles:**

- Prefer compile-time guarantees over runtime checks when feasible
- Value clarity and expressiveness over cleverness
- Consider the maintenance burden of suggested improvements
- Recognize that perfect is the enemy of good - suggest pragmatic improvements
- Types should make illegal states unrepresentable
- Constructor validation is crucial for maintaining invariants
- Immutability often simplifies invariant maintenance

**Common Anti-patterns to Flag:**

- Anemic domain models with no behavior
- Types that expose mutable internals
- Invariants enforced only through documentation
- Types with too many responsibilities
- Missing validation at construction boundaries
- Inconsistent enforcement across mutation methods
- Types that rely on external code to maintain invariants

**When Suggesting Improvements:**

Always consider:

- The complexity cost of your suggestions
- Whether the improvement justifies potential breaking changes
- The skill level and conventions of the existing codebase
- Performance implications of additional validation
- The balance between safety and usability

Think deeply about each type's role in the larger system. Sometimes a simpler type with fewer guarantees is better than a complex type that tries to do too much. Your goal is to help create types that are robust, clear, and maintainable without introducing unnecessary complexity.

Related Skills

speedwave-review-plan

7
from speednet-software/speedwave

Hostile review of a Speedwave implementation plan. Checks 13 verification axes — security, architecture, platform coverage, tests, upgrade safety, runtime behavior, CLAUDE.md compliance, and more. Use this skill to verify any implementation plan before starting work.

speedwave-review-deps

7
from speednet-software/speedwave

Critical security review of Dependabot package update PRs. Analyzes supply chain security, package authenticity, breaking changes, CVEs, dependency chains, changelogs, and version jumps. Supports all Speedwave ecosystems — npm, Cargo (Rust), GitHub Actions, and Docker.

speedwave-code-review

7
from speednet-software/speedwave

Comprehensive code review using specialized skills

code-review-yagni-detector

7
from speednet-software/speedwave

Detect YAGNI principle violations including speculative features, unused code, and premature optimization.

code-review-test-analyzer

7
from speednet-software/speedwave

Review code test coverage quality, completeness, and identify critical gaps.

code-review-ssot-detector

7
from speednet-software/speedwave

Detect Single Source of Truth violations including duplicated configurations, types, and scattered constants.

code-review-solid-detector

7
from speednet-software/speedwave

Detect SOLID principle violations (SRP, OCP, LSP, ISP, DIP) that make code hard to maintain and extend.

code-review-simplifier

7
from speednet-software/speedwave

Simplify recently modified code for clarity, consistency, and maintainability while preserving functionality.

code-review-silent-failure-hunter

7
from speednet-software/speedwave

Identify silent failures, inadequate error handling, and inappropriate fallback behavior in code.

code-review-security-checker

7
from speednet-software/speedwave

Detect security vulnerabilities in code changes — injection attacks, auth bypass, data exposure, crypto weaknesses. Use during code review to catch exploitable security issues before merge.

code-review-kiss-detector

7
from speednet-software/speedwave

Detect KISS principle violations including over-engineering, unnecessary complexity, and convoluted solutions.

code-review-duplication-detector

7
from speednet-software/speedwave

Detect code duplication and identify refactoring opportunities to ensure DRY compliance.