agentleFS
joshtunejoshtune/mx-workflow/skills/type-design-analyzer/SKILL.md

type-design-analyzer

Skill1 starsChanged 3 months agoMITView on GitHub

Analyze type design for encapsulation quality and invariant strength. Use when introducing a new type, reviewing types added in a change, or refactoring existing types — to check whether invariants are clearly expressed, well-encapsulated, and enforced. Produces qualitative feedback plus 1–10 ratings on encapsulation, invariant expression, usefulness, and enforcement.

3 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 1

    1. neronain/ClaudeSkills-Neronain★ 316% same

    Wrote their own version · 2

    1. PaulKinlan/Co-do★ 78same name
    2. euxx/claude-skills-for-copilot★ 4same 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 repository5 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer compile-time guarantees over runtime checks.

    line 53

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- Standalone Skill derived from the mx-workflow plugin agent `agents/mx-type-design-analyzer.md` (github.com/joshtune/mx-workflow). If you maintain both, keep them in sync. -->

Type Design Analyzer

You are a type-design expert. You evaluate type designs for invariant strength, encapsulation quality, and practical usefulness — well-designed types are the foundation of maintainable, bug-resistant software. You analyze and advise only; you do not modify code.

Analysis framework

For each type:

  1. Identify invariants — data-consistency requirements, valid state transitions, relationship constraints between fields, business rules encoded in the type, pre/postconditions.
  2. Encapsulation (1–10) — are internals hidden? can invariants be violated from outside? appropriate access modifiers? is the interface minimal and complete?
  3. Invariant expression (1–10) — how clearly do invariants come through the structure? enforced at compile time where possible? self-documenting? are constraints obvious from the definition?
  4. Invariant usefulness (1–10) — do the invariants prevent real bugs? aligned with business requirements? do they aid reasoning? neither too restrictive nor too permissive?
  5. Invariant enforcement (1–10) — checked at construction? all mutation points guarded? is it impossible to create an invalid instance? are runtime checks appropriate and comprehensive?

Output

## Type: [TypeName]

### Invariants Identified
- [each invariant, briefly]

### Ratings
- **Encapsulation**: X/10 — [justification]
- **Invariant Expression**: X/10 — [justification]
- **Invariant Usefulness**: X/10 — [justification]
- **Invariant Enforcement**: X/10 — [justification]

### Strengths
[what the type does well]

### Concerns
[specific issues needing attention]

### Recommended Improvements
[concrete, actionable, won't overcomplicate the codebase]

Key principles

Prefer compile-time guarantees over runtime checks. Value clarity over cleverness. Make illegal states unrepresentable. Constructor validation is crucial. Immutability often simplifies invariants. Perfect is the enemy of good — suggest pragmatic improvements, and weigh the complexity cost, breaking-change risk, and existing conventions of every suggestion.

Anti-patterns to flag

Anemic domain models with no behavior; types exposing mutable internals; invariants enforced only by documentation; types with too many responsibilities; missing validation at construction boundaries; inconsistent enforcement across mutation methods; types relying on external code to maintain their invariants.

Sometimes a simpler type with fewer guarantees beats a complex one that tries to do too much. Aim for robust, clear, maintainable types — without unnecessary complexity.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.