migration-sweep

Original🇨🇳 Chinese
Translated

Automate lifecycle checks for migration code (TODO(migration)). Detect expired or insufficiently documented migration code and output results in report format. It is used for checking remaining TODO(migration) entries in the codebase, cleaning up expired migration code, and taking inventory of technical debt. This is a mechanism to prevent leaving "to be deleted later" code unattended.

1installs
Added on

NPX Install

npx skill4agent add yusuketsunoda/ppt-trans migration-sweep

SKILL.md Content (Chinese)

View Translation Comparison →

Migration Sweep

A skill that automates lifecycle checks for migration code (
TODO(migration)
). It detects expired or insufficiently documented migration code and outputs results in report format.

Triggers

  • User executes
    /migration-sweep
  • Mentions of "migration code", "migration TODO", "expired TODO"

Execution Steps

1. Collect TODO(migration) entries

bash
# Search for TODO(migration) across the entire repo
grep -rn "TODO(migration)" --include="*.ts" --include="*.tsx" --include="*.py" src/ tests/ e2e/ python_backend/ 2>/dev/null || echo "No matches"

2. Metadata parsing

Extract the following information for each TODO(migration):
FieldPatternRequired
Issue ID
[ISSUE-XXX]
or
[#XXX]
YES
Expiration Date
[expires=YYYY-MM-DD]
YES
Deletion ConditionFree description (lines following the TODO comment)YES

3. Judgment Rules

StatusConditionSeverity
EXPIRED
expires
is on or before today
P0 (Immediate action required)
MISSING_METAAny of Issue ID / expiration date / deletion condition is missingP0 (Information completion required)
WARNINGWithin 30 days before expiration dateP1 (Plan required)
OKMore than 30 days before expiration dateInfo only

4. Report Output

markdown
## Migration Sweep Report (YYYY-MM-DD)

### P0: Immediate Action Required (X entries)

| File:Line | Status | Expiration Date | Issue | Content |
|------------|------|------|-------|------|
| `src/foo.ts:42` | EXPIRED | 2026-01-15 | #123 | Remove old admin check |
| `src/bar.ts:88` | MISSING_META | - | - | TODO(migration) but no metadata |

### P1: Planned Action (X entries)

| File:Line | Expiration Date | Days Remaining | Issue | Content |
|------------|------|--------|-------|------|
| `src/baz.ts:15` | 2026-03-15 | 21 days | #456 | Deprecate legacy API |

### OK (X entries)
(Can be omitted)

### Summary
- Total: X entries
- P0 (Immediate Action Required): X entries
- P1 (Planned Action): X entries
- OK: X entries

5. Additional Action Suggestions

  • EXPIRED: Confirm "Is it acceptable to delete this code?" and propose deletion
  • MISSING_META: Propose metadata completion using the template format
    typescript
    // TODO(migration)[ISSUE-XXX][expires=YYYY-MM-DD]:
    // <Describe deletion conditions>
  • WARNING: Prompt to check the status of the associated Issue

Template (for new migration code)

typescript
// TODO(migration)[ISSUE-1234][expires=2026-05-31]:
// Remove after role-based admin check is fully deployed
// and logs show 0 hits for 14 days.

AI Assistant Instructions

When this skill is enabled:
  1. Collect all TODO(migration) entries with grep: Target directories
    src/
    ,
    tests/
    ,
    e2e/
    ,
    python_backend/
  2. Metadata parsing: Extract Issue ID, expiration date, deletion conditions
  3. Classify per judgment rules: EXPIRED / MISSING_META / WARNING / OK
  4. Output report: Strictly follow the format specified above
  5. Propose additional actions: Suggest deletion for EXPIRED entries, provide completion template for MISSING_META entries
Always:
  • Report all entries (do not filter)
  • Explicitly state "P0: 0 entries" even if there are no P0 items
  • Deletion suggestions for EXPIRED entries must be conditional on "confirm safety after reviewing the code"
Never:
  • Do not delete code automatically (only generate reports, modifications require user confirmation)
  • Do not include TODO entries other than TODO(migration) (e.g. TODO(fix), TODO(refactor)) in the scope

Related Rules

  • .claude/rules/dead-code-cleanup.md
    — Migration code management section
  • CLAUDE.md
    — Pre-push done conditions (type-check is the final defense line)