ts-optimize
a claude code plugin that goes through your typescript codebase looking for dead code, unused deps, ai-written slop, weak types, tangled imports, and how ready you are for the native compiler (typescript 7 / tsgo). it writes everything it finds into .ts-optimize/ as plain markdown you can actually review, waits for you to sign off, and only then fixes the approved stuff in waves: one commit per finding, with a verification gate after every wave. in a repo with no typescript it stays completely quiet.
tested on linux, macos and windows with node 18.17, 22 and 26.
install
install
Every plugin of ours is installed once, globally, and off, then turned on per project. Nothing runs and no tokens are spent in chats that don't switch it on. It works the same in Claude Code and Codex.
1. install it globally
Claude Code
claude plugin marketplace add yigitkonur/plugin-typescript-optimizer
claude plugin install ts-optimize@claude-ts-optimize-plugin -s user # stays off: defaultEnabled is false in the manifest
Codex (0.163+)
codex plugin marketplace add yigitkonur/plugin-typescript-optimizer
codex plugin add ts-optimize@claude-ts-optimize-plugin
codex-plugin-project.sh global-off ts-optimize@claude-ts-optimize-plugin # Codex has no enable/disable command; this keeps it off everywhere
All our plugins, both hosts, plus the plugin command and the 6-hourly update job, in one line:
curl -fsSL https://raw.githubusercontent.com/yigitkonur/plugin-kit/main/install.sh | sh -s -- --all
2. turn it on in a project
cd your-project
plugin on ts-optimize # Claude Code and Codex, this folder only
plugin off ts-optimize # undo
plugin # or pick from a list (TUI)
By hand, without the plugin command:
claude plugin enable ts-optimize@claude-ts-optimize-plugin --scope project # undo: claude plugin disable ts-optimize@claude-ts-optimize-plugin --scope project
codex-plugin-project.sh on ts-optimize@claude-ts-optimize-plugin . --trust # undo: codex-plugin-project.sh off ts-optimize@claude-ts-optimize-plugin
Restart claude / codex in that folder afterwards.
Codex reads a folder's .codex/config.toml only when the folder is trusted; --trust adds that, and it also enables the folder's hooks and rules, so use it for your own projects only. plugin and codex-plugin-project.sh come from plugin-kit (the one-line installer above).
3. updates
A plugin updates only when its version changes, and this repo's release workflow bumps it on every shipped change. Machines pick it up with plugin update, or by themselves with the 6-hourly job (plugin autoupdate install). By hand:
claude plugin marketplace update claude-ts-optimize-plugin && claude plugin update ts-optimize@claude-ts-optimize-plugin
codex plugin marketplace upgrade claude-ts-optimize-plugin # then start a new session
No GitHub SSH key on the machine? export CLAUDE_CODE_PLUGIN_PREFER_HTTPS=1 (plugin install sets it in Claude's settings for you).
4. uninstall
claude plugin uninstall ts-optimize@claude-ts-optimize-plugin -s user
claude plugin marketplace remove claude-ts-optimize-plugin
codex plugin remove ts-optimize@claude-ts-optimize-plugin
codex plugin marketplace remove claude-ts-optimize-plugin
codex differences
the skills and the ts-opt cli are the same. call a skill by name, e.g. $ts-optimize:doctor, $ts-optimize:audit (verified: codex loads it from the plugin and runs bin/ts-opt from the plugin folder; if your codex config has include_instructions = false it won't list skills on its own, so name them). there are no plugin subagents, so triage runs inline and deep mode has codex play the architect itself. two hooks run (the tsc/knip --fix command guard and the commit guard, plus the resume pointer); the subagent guard, the audit pre-approval and the after-edit fast check are claude-only. ts-opt is not put on PATH by codex.
the first time, codex asks you to review the plugin's hooks: trust them (if a hook says plugin contents changed; hook approval required, open /hooks and press t once; it sticks after that).
commands
/ts-optimize:audit [path] [--mode sweep|standard|deep] [--domains <csv>] [--diff[=base]] [--triage auto|inline|agents] [--chunk-size <n>]
reads your code and touches no source. writes .ts-optimize/runs/<id>/ (findings, plan.md, SUMMARY.md). default mode is standard; sweep is the cheap quick pass; deep adds structural proposals.