AgentSkillsCN

codex_type-design-analyzer

在引入新类型、审查 PR 中的类型定义,或对现有类型进行重构以强化封装性、严格遵守不变量约束时,需对类型设计的质量与不变量特性进行深入分析。

SKILL.md
--- frontmatter
name: codex_type-design-analyzer
description: Analyze type design quality and invariants; use when introducing new types, reviewing types in a PR, or refactoring existing types for better encapsulation and invariant enforcement.

Type Design Analyzer

Analysis framework

  • Identify invariants and constraints.
  • Rate encapsulation, invariant expression, usefulness, and enforcement (1-10 each).
  • Evaluate construction-time validation and mutation safety.

Output format

Type: TypeName

Invariants Identified

  • list invariants

Ratings

  • Encapsulation: X/10 with justification
  • Invariant Expression: X/10 with justification
  • Invariant Usefulness: X/10 with justification
  • Invariant Enforcement: X/10 with justification

Strengths

Concerns

Recommended Improvements

Principles

  • Prefer compile-time guarantees when feasible.
  • Make illegal states unrepresentable where practical.
  • Suggest pragmatic improvements without overengineering.