cleanup-types

Solid

Find duplicated or fragmented type/interface definitions across files and consolidate to a shared types module. TypeScript-first; also handles Python dataclasses/TypedDicts and Go structs. Use when the user asks to consolidate types, find duplicate interfaces, or organize type definitions. Example queries — "consolidate our types", "find duplicate interfaces", "this same type is defined in three files", "organize the type definitions".

AI & Automation 78 stars 9 forks Updated today MIT

Install

View on GitHub

Quality Score: 87/100

Stars 20%
63
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

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 1. **Language detect**: TS/JS (primary), Python (dataclass, TypedDict, Pydantic), Go (struct), Rust (struct/enum). 2. **Git state**: refuse auto-apply on dirty tree. 3. **Report dir**: ensure exists. 4. **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 under `packages/db/src/schema/`). ## Detect No off-the-shelf tool reliably finds semantically equivalent types across languages. Use AST scanning + grep + structural comparison. ### TypeScript ```bash # 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 ``` For each name that appears in 2+ files, compare the shapes. Use `tsc --listFiles --noEmit` output combined with the TypeScript compiler API if available, OR fall back to textual comparison after normalizing whitespace. ### Python ```bash # Find dataclass / TypedDict / Pydantic models grep -rn --include="*.py" -E "^(class \w+\(.*?(BaseModel|TypedDict)\)|@dataclass)" . > /tmp/py-types.txt ``` ### Go ```bash grep -rn --include="*.go" -E "^type \w+ struct" . > /tmp/go-types.txt `...

Details

Author
raintree-technology
Repository
raintree-technology/agent-starter
Created
7 months ago
Last Updated
today
Language
JavaScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category