type-design-analyzer
Skill4 starsChanged 7 months agoMITView on GitHub
Analyzes type design quality by rating encapsulation, invariant expression, usefulness, and enforcement. Helps design types that make invalid states unrepresentable. Use when reviewing new types or data models.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- PaulKinlan/Co-dotheir own version, first seen Oct 8, 2026
- neronain/ClaudeSkills-Neronaintheir own version, first seen Aug 9, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- PaulKinlan/Co-do★ 78same name
- neronain/ClaudeSkills-Neronain★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- code-reviewSkill
- code-simplifierSkill
- comment-analyzerSkill
- conventions-improverSkill
- feature-devSkill
- frontend-designSkill
- frontend-layoutSkill
- gh-address-commentsSkill
- gh-fix-ciSkill
- mcp-server-devSkill
- review-toolkitSkill
- security-threat-modelSkill
- silent-failure-hunterSkill
- test-analyzerSkill
The file
Files
Type Design Analyzer
Evaluate the quality of type definitions, interfaces, and data models. The goal is to identify types that allow invalid states and suggest improvements that make invalid states unrepresentable.
What Makes a Good Type
- Encapsulation: For class-backed or opaque types, the internal structure is hidden; external code interacts through a defined interface. For structural types (interfaces, type aliases), encapsulation is achieved by keeping types unexported or by wrapping them in opaque branded types.
- Invariant expression: The type's constraints are expressed in its structure, not in documentation or runtime checks.
- Invariant usefulness: The expressed invariants represent meaningful domain constraints.
- Invariant enforcement: The type system (not the programmer) ensures invariants are maintained.
Analysis Steps
- Locate all type definitions in scope: interfaces, type aliases, classes, enums, discriminated unions.
- Identify invariants for each type — constraints that must always be true:
- Relationships between fields (e.g., "if
statusisdone,completedAtmust be set") - Valid value ranges or formats
- Mutual exclusivity constraints
- Ordering or structural requirements
- Relationships between fields (e.g., "if
- Rate each type across four dimensions (1–10 scale):
- Encapsulation (1–10): Can external code access and mutate internals that should be private?
- Invariant Expression (1–10): Are the invariants visible in the type definition itself, or only in documentation?
- Invariant Usefulness (1–10): Do the expressed invariants represent meaningful real-world constraints?
- Invariant Enforcement (1–10): Does the type system prevent violations at compile time?
- Identify specific improvements: discriminated unions, branded types, opaque types, readonly modifiers, wrapper types.
Output Per Type
### TypeName
**Location**: file:line
**Invariants Identified**:
- [list of constraints that should always hold]
**Ratings**:
- Encapsulation: X/10 — [justification]
- Invariant Expression: X/10 — [justification]
- Invariant Usefulness: X/10 — [justification]
- Invariant Enforcement: X/10 — [justification]
- **Overall**: X/10 — [weighted judgment: Invariant Enforcement counts most; Encapsulation least for structural types]
**Strengths**:
- [what the type does well]
**Concerns**:
- [specific problems with the current design]
**Recommended Improvements**:
[concrete code examples showing better type design]Analysis and feedback only — do not modify code directly.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

