Obsolete code cleanup
Removes obsolete implementation only after checking real callers, runtime configuration and persisted compatibility needs.
dead-code-compatibility-cleanup
See how it helpsWhen is it useful?
Use it when retired flags, old adapters or apparently unused exports complicate maintenance and you need evidence they can go.
What does it help you do?
- Checks dynamic references before declaring code unused.
- Verifies retired flags across actual environments.
- Removes compatibility adapters only after callers and stored payloads migrate.
Try asking this
Determine whether our old import adapter can be removed safely. Inspect dynamic configuration and stored jobs as well as imports. Remove the adapter only after proving none of those paths still require its format.
Detailed documentation
Read the skill’s original instructions, examples and checks in their authored language.
Show less
Dead Code & Compatibility Cleanup
Unreachable branches, stale feature flags, abandoned v1 adapters and unused exports impose a constant cognitive tax on every developer reading or refactoring the codebase. However, deleting code that only looks unused to static search can break dynamic dispatch, reflection, external consumers or operational runbooks. Verify reachability rigorously before deleting.
1. Why Static Search Alone Is Not Enough
Before concluding that a symbol, file, route or config key is dead, check all non-static reference channels:
- Static imports and call sites: search across the entire repository (including workspaces, packages, scripts, tests and templates).
- Dynamic & string-based resolution:
- Dependency injection containers, service providers, event/command buses, queue job handlers, webhook routers and ORM model/migration registries.
- Dynamic property access (
handlers[actionType]), dynamicimport(), template partials, CLI command auto-loaders and localization/i18n keys (data-i18n, dynamic key prefixes).
- External & cross-version boundaries:
- Public package exports (
package.jsonexports/main, barrelindex.tsfiles). - HTTP/RPC routes still called by mobile/desktop clients, webhooks, cron jobs or third-party integrations.
- Persisted job payloads or database records that still reference a legacy class/type name.
- Public package exports (
- Build, CI & operational scripts: Dockerfiles, CI workflows,
package.jsonscripts, deployment hooks and database seeders.
2. Cleaning Up Feature Flags & Compatibility Shims
Temporary shims and feature flags introduced during migrations or rollouts must be retired cleanly once cutover is complete:
- Determine the active branch: check configuration defaults, environment variables and flag definitions to confirm which branch (
trueorfalse,v1orv2) is permanently active across environments. - Collapse the conditional: remove the flag check and the dead branch, simplify the control flow, and update tests that were testing the retired branch.
- Retire Expand-and-Contract adapters: once all callers and persisted payloads use the new contract, remove dual-write/dual-read fallback logic, deprecated aliases and translation wrappers.
3. Safe Deletion & Orphan Sweeping
When removing a verified dead entry point, follow the dependency chain inward so you do not leave newly orphaned helpers behind:
- Remove the dead entry point (unused route, obsolete handler, retired component or deprecated adapter).
- Sweep newly orphaned internals: check whether private helpers, types, styles, i18n keys, test fixtures, mocks or third-party dependencies were referenced only by the deleted code, and remove them in the same cleanup.
- Distinguish dead code from unfinished work: if an unreferenced module looks like an intentionally staged or partially implemented feature from a recent task, check git history and task context before deleting it; if uncertain, flag it rather than deleting silently.
- Verify cleanly: run the full typecheck, linter, test suite and production build to confirm nothing references the removed symbols.
Included files 1
SKILL.md
About this skill package
dead-code-compatibility-cleanup
dead-code-compatibility-cleanup: Improve legacy code in small, verifiable steps while preserving existing behavior and keeping complexity proportionate.
Show less
dead-code-compatibility-cleanup
dead-code-compatibility-cleanup: Improve legacy code in small, verifiable steps while preserving existing behavior and keeping complexity proportionate.
Includes the complete skill and its supporting files (1 files). The exact authored scope is preserved below.
Original skill description (source language)
Use when safely verifying and removing dead code, obsolete feature flags, deprecated compatibility shims, unused exports and orphaned configuration.
Install the skill, review its source and trust settings, then enable it for the relevant project or agent.
Requirements
- Orqestria installed on your computer.
