migration-sweep

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Migration Sweep

Migration Sweep

移行コード(
TODO(migration)
)の寿命チェックを機械化するスキル。 期限切れ・情報不足の移行コードを検出し、レポート形式で出力する。
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

  • ユーザーが
    /migration-sweep
    を実行
  • "移行コード", "migration TODO", "期限切れTODO" に言及
  • User executes
    /migration-sweep
  • Mentions of "migration code", "migration TODO", "expired TODO"

実行手順

Execution Steps

1. TODO(migration) の収集

1. Collect TODO(migration) entries

bash
undefined
bash
undefined

repo全体から TODO(migration) を検索

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 "該当なし"
undefined
grep -rn "TODO(migration)" --include=".ts" --include=".tsx" --include="*.py" src/ tests/ e2e/ python_backend/ 2>/dev/null || echo "No matches"
undefined

2. メタデータの解析

2. Metadata parsing

各 TODO(migration) について以下を抽出:
フィールドパターン必須
Issue ID
[ISSUE-XXX]
or
[#XXX]
YES
期限
[expires=YYYY-MM-DD]
YES
削除条件自由記述(TODOコメントの次行以降)YES
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. 判定ルール

3. Judgment Rules

状態条件重要度
EXPIRED
expires
が今日以前
P0 (即対応)
MISSING_METAIssue ID / expires / 削除条件のいずれかが欠落P0 (情報補完)
WARNINGexpires まで30日以内P1 (計画)
OKexpires まで30日超情報のみ
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. レポート出力

4. Report Output

markdown
undefined
markdown
undefined

Migration Sweep Report (YYYY-MM-DD)

Migration Sweep Report (YYYY-MM-DD)

P0: 即対応 (X件)

P0: Immediate Action Required (X entries)

ファイル:行状態期限Issue内容
src/foo.ts:42
EXPIRED2026-01-15#123Remove old admin check
src/bar.ts:88
MISSING_META--TODO(migration) but no metadata
File:LineStatusExpiration DateIssueContent
src/foo.ts:42
EXPIRED2026-01-15#123Remove old admin check
src/bar.ts:88
MISSING_META--TODO(migration) but no metadata

P1: 計画 (X件)

P1: Planned Action (X entries)

ファイル:行期限残日数Issue内容
src/baz.ts:15
2026-03-1521日#456Deprecate legacy API
File:LineExpiration DateDays RemainingIssueContent
src/baz.ts:15
2026-03-1521 days#456Deprecate legacy API

OK (X件)

OK (X entries)

(省略可能)
(Can be omitted)

サマリー

Summary

  • 総数: X件
  • P0 (即対応): X件
  • P1 (計画): X件
  • OK: X件
undefined
  • Total: X entries
  • P0 (Immediate Action Required): X entries
  • P1 (Planned Action): X entries
  • OK: X entries
undefined

5. 追加アクション提案

5. Additional Action Suggestions

  • EXPIRED: 「このコードを削除してよいか?」と確認し、削除を提案
  • MISSING_META: テンプレート形式でメタデータ補完を提案
    typescript
    // TODO(migration)[ISSUE-XXX][expires=YYYY-MM-DD]:
    // <削除条件を記述>
  • WARNING: Issue のステータス確認を促す
  • 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.
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

AI Assistant Instructions

このスキルが有効化された時:
  1. grep で TODO(migration) を全件収集:
    src/
    ,
    tests/
    ,
    e2e/
    ,
    python_backend/
    を対象
  2. メタデータ解析: Issue ID, expires, 削除条件を抽出
  3. 判定ルールに従い分類: EXPIRED / MISSING_META / WARNING / OK
  4. レポート出力: 上記フォーマットに厳密に従う
  5. 追加アクション提案: EXPIRED には削除提案、MISSING_META にはテンプレート提供
Always:
  • 全件レポートする(フィルタしない)
  • P0 は件数ゼロでも「P0: 0件」と明記する
  • EXPIRED の削除提案は「コードを読んで安全性を確認してから」の条件付き
Never:
  • 自動削除しない(レポートのみ、修正はユーザー確認後)
  • TODO(migration) 以外のTODO(TODO(fix), TODO(refactor) 等)をスコープに含めない
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
    — 移行コード管理セクション
  • CLAUDE.md
    — push前Done条件(type-checkが最終防衛線)
  • .claude/rules/dead-code-cleanup.md
    — Migration code management section
  • CLAUDE.md
    — Pre-push done conditions (type-check is the final defense line)