cleanup-weak-types

Solid

Replace weak types (any, unknown, interface{}, untyped Python) with strong, inferable types. Researches actual usage to determine the correct type, runs typecheck after each change, reverts individual changes that fail. Use when the user asks to remove any/unknown, strengthen typing, fix weak types, or make code more type-safe. Example queries — "remove all the `any` types", "strengthen our typing", "stop using unknown everywhere", "make this more type-safe".

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

Replace weak escape-hatch types with strong types inferred from actual usage. Per-occurrence verification — each replacement is typechecked individually, reverted if it breaks. Conservative on public APIs. ## Preflight 1. **Language detect**: TS/JS (`any`, `unknown`, `as unknown as`, `Function`, `Object`), Python (`Any`, missing type hints), Go (`interface{}`, `any` since 1.18), Rust (`Box<dyn Any>` is rare; mostly look for `Box<dyn Trait>` where a concrete type would do). 2. **Git state**: refuse on dirty tree. 3. **Report dir**: ensure exists. 4. **Read project conventions**: check for a `check:weak-types` (or similar) script in package.json. Check `tsconfig.json` for `strict`/`noImplicitAny` flags. Check `mypy.ini` / `pyproject.toml [tool.mypy]` for strictness. 5. **Read allow-list**: many projects allow weak types in specific files (e.g., `*.test.ts`, generated code, third-party shim files). Find and respect them. ## Detect ### TypeScript / JavaScript ```bash # Explicit `any` grep -rn --include="*.ts" --include="*.tsx" -E "\b(: any\b|<any>|as any\b|as unknown as)" \ --exclude-dir=node_modules --exclude-dir=dist --exclude-dir=.next . > /tmp/ts-weak.txt # Compiler-derived implicit-any (more accurate than grep) npx tsc --noImplicitAny --noEmit 2>&1 | grep "implicitly has an 'any' type" > /tmp/ts-implicit-any.txt ``` For each occurrence, capture the surrounding context (function signature, callers). ### Python ```bash # Explicit Any imports + usage grep -rn --include...

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