ワンクリックで
remove-deadcode
// Remove unused code from this project with ultrawork mode, LSP-verified safety, atomic commits. Triggers: remove dead code, dead code, cleanup, remove unused.
// Remove unused code from this project with ultrawork mode, LSP-verified safety, atomic commits. Triggers: remove dead code, dead code, cleanup, remove unused.
Debug broken OpenCode sessions by locating sessions from an id, title, or directory, recursively inspecting child sessions, correlating transcripts, logs, background tasks, and current OpenCode source, then driving a TDD fix in an isolated PR worktree when code changes are needed. Use whenever the user mentions OpenCode session corruption, background task completion, child sessions, session ids, or a broken session transcript.
Full PR lifecycle: always create a new git worktree, implement there, make atomic commits, open a PR to dev, and keep iterating until CI, review-work, Cubic, and GPT-5.2 xhigh PR review all pass. Never merge early. After a merge commit, delete the worktree. Use whenever implementation work needs PR delivery: create a PR, implement and PR, work-with-pr, land this, or implement end to end.
Team Mode security research skill. Orchestrates 3 vulnerability hunters and 2 PoC engineers to audit a codebase in parallel, prove exploitability, classify root causes, and calibrate severity by actual exploitability. Use for security review, vulnerability research, exploitability audit, pre-release security check, threat model validation, and `/security-research`. Triggers: 'security-research', 'security research', 'security review', 'vulnerability audit', 'exploitability audit', '보안 리뷰', '취약점 감사'.
Publish oh-my-opencode to npm via GitHub Actions workflow. Argument: <patch|minor|major>. Triggers: publish, release, deploy, npm publish.
Compare HEAD with the latest published npm version and list all unpublished changes. Triggers: unpublished changes, changelog, what changed, whats new.
Easter egg command - about oh-my-opencode. Triggers: omomomo, about, easter egg.
| name | remove-deadcode |
| description | Remove unused code from this project with ultrawork mode, LSP-verified safety, atomic commits. Triggers: remove dead code, dead code, cleanup, remove unused. |
Dead code removal via massively parallel deep agents. You are the ORCHESTRATOR — you scan, verify, batch, then delegate ALL removals to parallel agents.
- **LSP is law.** Verify with `LspFindReferences(includeDeclaration=false)` before ANY removal decision. - **Never remove entry points.** `src/index.ts`, `src/cli/index.ts`, test files, config files, `packages/` — off-limits. - **You do NOT remove code yourself.** You scan, verify, batch, then fire deep agents. They do the work. NEVER mark as dead: - Symbols in `src/index.ts` or barrel `index.ts` re-exports - Symbols referenced in test files (tests are valid consumers) - Symbols with `@public` / `@api` JSDoc tags - Hook factories (`createXXXHook`), tool factories (`createXXXTool`), agent definitions in `agentSources` - Command templates, skill definitions, MCP configs - Symbols in `package.json` exportsRun ALL of these in parallel:
TypeScript strict mode (your primary scanner — run this FIRST):
bunx tsc --noEmit --noUnusedLocals --noUnusedParameters 2>&1
This gives you the definitive list of unused locals, imports, parameters, and types with exact file:line locations.
Explore agents (fire ALL simultaneously as background):
task(subagent_type="explore", run_in_background=true, load_skills=[],
description="Find orphaned files",
prompt="Find files in src/ NOT imported by any other file. Check all import statements. EXCLUDE: index.ts, *.test.ts, entry points, .md, packages/. Return: file paths.")
task(subagent_type="explore", run_in_background=true, load_skills=[],
description="Find unused exported symbols",
prompt="Find exported functions/types/constants in src/ that are never imported by other files. Cross-reference: for each export, grep the symbol name across src/ — if it only appears in its own file, it's a candidate. EXCLUDE: src/index.ts exports, test files. Return: file path, line, symbol name, export type.")
Collect all results into a master candidate list.
For EACH candidate from Phase 1:
LspFindReferences(filePath, line, character, includeDeclaration=false)
// 0 references → CONFIRMED dead
// 1+ references → NOT dead, drop from list
Also apply the false-positive-guards above. Produce a confirmed list:
| # | File | Symbol | Type | Action |
|---|------|--------|------|--------|
| 1 | src/foo.ts:42 | unusedFunc | function | REMOVE |
| 2 | src/bar.ts:10 | OldType | type | REMOVE |
| 3 | src/baz.ts:7 | ctx | parameter | PREFIX _ |
Action types:
REMOVE — delete the symbol/import/file entirelyPREFIX _ — unused function parameter required by signature → rename to _paramNameIf ZERO confirmed: report "No dead code found" and STOP.
Goal: maximize parallel agents with ZERO git conflicts.
Example batching:
Batch A: [src/hooks/foo/hook.ts — 3 unused imports]
Batch B: [src/features/bar/manager.ts — 2 unused constants, 1 dead function]
Batch C: [src/tools/baz/tool.ts — 1 unused param, src/tools/baz/types.ts — 1 unused type]
Batch D: [src/dead-file.ts — entire file deletion]
Files in the same directory CAN be batched together (they won't conflict as long as no two agents edit the same file). Maximize batch count for parallelism.
For EACH batch, fire a deep agent:
task(
category="deep",
load_skills=["typescript-programmer", "git-master"],
run_in_background=true,
description="Remove dead code batch N: [brief description]",
prompt="[see template below]"
)
Every deep agent gets this prompt structure (fill in the specifics per batch):
## TASK: Remove dead code from [file list]
## DEAD CODE TO REMOVE
### [file path] line [N]
- Symbol: `[name]` — [type: unused import / unused constant / unused function / unused parameter / dead file]
- Action: [REMOVE entirely / REMOVE from import list / PREFIX with _]
### [file path] line [N]
- ...
## PROTOCOL
1. Read each file to understand exact syntax at the target lines
2. For each symbol, run LspFindReferences to RE-VERIFY it's still dead (another agent may have changed things)
3. Apply the change:
- Unused import (only symbol in line): remove entire import line
- Unused import (one of many): remove only that symbol from the import list
- Unused constant/function/type: remove the declaration. Clean up trailing blank lines.
- Unused parameter: prefix with `_` (do NOT remove — required by signature)
- Dead file: delete with `rm`
4. After ALL edits in this batch, run: `bun run typecheck`
5. If typecheck fails: `git checkout -- [files]` and report failure
6. If typecheck passes: stage ONLY your files and commit:
`git add [your-specific-files] && git commit -m "refactor: remove dead code from [brief file list]"`
7. Report what you removed and the commit hash
## CRITICAL
- Stage ONLY your batch's files (`git add [specific files]`). NEVER `git add -A` — other agents are working in parallel.
- If typecheck fails after your edits, REVERT all changes and report. Do not attempt to fix.
- Pre-existing test failures in other files are expected. Only typecheck matters for your batch.
Fire ALL batches simultaneously. Wait for all to complete.
After ALL agents complete:
bun run typecheck # must pass
bun test # note any NEW failures vs pre-existing
bun run build # must pass
Produce summary:
## Dead Code Removal Complete
### Removed
| # | Symbol | File | Type | Commit | Agent |
|---|--------|------|------|--------|-------|
| 1 | unusedFunc | src/foo.ts | function | abc1234 | Batch A |
### Skipped (agent reported failure)
| # | Symbol | File | Reason |
|---|--------|------|--------|
### Verification
- Typecheck: PASS/FAIL
- Tests: X passing, Y failing (Z pre-existing)
- Build: PASS/FAIL
- Total removed: N symbols across M files
- Total commits: K atomic commits
- Parallel agents used: P
If $ARGUMENTS is provided, narrow the scan:
all or empty → full project scan (default)STOP and report if: