cleanup-types
Installation
SKILL.md
Find type definitions that should be shared but are duplicated across files. Consolidate into a single source of truth. Conservative by default — type consolidation looks safe but can hide intentional divergence.
Preflight
- Language detect: TS/JS (primary), Python (dataclass, TypedDict, Pydantic), Go (struct), Rust (struct/enum).
- Git state: refuse auto-apply on dirty tree.
- Report dir: ensure exists.
- Identify type homes: where does the project already keep shared types? Look for
types/,models/,schema/, package boundaries (e.g., monorepos often colocate DB types underpackages/db/src/schema/).
Detect
No off-the-shelf tool reliably finds semantically equivalent types across languages. Use AST scanning + grep + structural comparison.
TypeScript
# Find every `interface Foo` and `type Foo =` declaration
# Group by name, then by structural shape
grep -rn --include="*.ts" --include="*.tsx" -E "^export (interface|type) [A-Z]" . > /tmp/ts-types.txt