tc-tracker
alirezarezvani/claude-skills
構造化されたJSONレコード、強制された状態マシン、およびAIの継続性を確保するためのセッション引継ぎ形式を用いて、コード変更を追跡します。
...すべて拡張しますTCトラッカー
構造化JSONレコード、強制された状態マシン、および前のセッションが期限切れになった場合に新しいAIセッションがクリーンに作業を再開できるようにするセッション引継ぎ形式により、すべてのコード変更を追跡します。
概要
技術的変更(TC)は、何が変更されたか、なぜ変更されたか、誰が変更したか、いつ変更されたか、どのようにテストされたか、そして次のセッションでの作業の進捗状況をキャプチャする構造化レコードです。レコードは、対象プロジェクト内の docs/TC/ 内にJSONとして保存され、厳格なスキーマと状態マシンに対して検証されます。
ユーザーが以下の場合にこのスキルを使用します:
- 「この変更を追跡する」を要求する場合、またはコード変更の監査証跡を希望する場合
- 進行中の作業を将来のAIセッションに引継ぎたい場合
- コミットメッセージを超えた構造化されたリリースノートが必要である場合
- 既存のプロジェクトにオンボーディングし、遡及的な変更ドキュメントを希望する場合
/tc init、/tc create、/tc update、/tc status、/tc resume、または/tc closeを要求する場合
以下の場合はこのスキルを使用しないでください:
- ユーザーがgit履歴からの変更ログのみを希望する場合(
engineering/changelog-generatorを使用) - ユーザーが技術的負債項目のみを追跡したい場合(
engineering/tech-debt-trackerを使用) - 変更が些細なもので(タイプミス、フォーマット)、動作に影響を与えない場合
ストレージレイアウト
各プロジェクトは {project_root}/docs/TC/ にTCを保存します:
docs/TC/
├── tc_config.json # プロジェクト設定
├── tc_registry.json # マスターインデックス + 統計情報
├── records/
│ └── TC-001-04-05-26-user-auth/
│ └── tc_record.json # 真実のソース
└── evidence/
└── TC-001/ # ログスニペット、コマンド出力、スクリーンショット
TC ID 規約
- 親TC:
TC-NNN-MM-DD-YY-functionality-slug(例:TC-001-04-05-26-user-authentication) - サブTC:
TC-NNN.AまたはTC-NNN.A.1(文字 = 改訂版、数字 = サブ改訂版) NNNは連番、MM-DD-YYは作成日、slugはkebab-caseです。
状態マシン
planned -> in_progress -> implemented -> tested -> deployed
| | | | |
+-> blocked -+ +- in_progress planned
完全な遷移テーブルと回復フローについては、references/lifecycle.md を参照してください。
ワークフローコマンド
このスキルには、TCレコードに対して決定論的でstdlibのみの操作を実行する5つのPythonスクリプトが含まれています。それぞれが --help と --json をサポートします。
1. プロジェクトでの追跡を初期化する
python3 scripts/tc_init.py --project "My Project" --root .
docs/TC/、docs/TC/records/、docs/TC/evidence/、tc_config.json、および tc_registry.json を作成します。冪等性があり、再実行すると現在の統計情報とともに「すでに初期化済み」が報告されます。
2. 新しいTCレコードを作成する
python3 scripts/tc_create.py \
--root . \
--name "user-authentication" \
--title "Add JWT-based user authentication" \
--scope feature \
--priority high \
--summary "Adds JWT login + middleware" \
--motivation "Required for protected endpoints"
次の連番TC IDを生成し、レコードディレクトリを作成し、完全に populated な tc_record.json(ステータス planned、R1 作成改訂版)を書き出し、レジストリを更新します。
3. TCレコードを更新する
# ステータス遷移(状態マシンに対して検証)
python3 scripts/tc_update.py --root . --tc-id TC-001-04-05-26-user-auth \
--set-status in_progress --reason "Starting implementation"
# ファイルを追加
python3 scripts/tc_update.py --root . --tc-id TC-001-04-05-26-user-auth \
--add-file src/auth.py:created
# 引継ぎデータを追加
python3 scripts/tc_update.py --root . --tc-id TC-001-04-05-26-user-auth \
--handoff-progress "JWT middleware wired up" \
--handoff-next "Write integration tests" \
--handoff-next "Update README"
すべての変更は、連番の R<n></n> 改訂エントリを追加し、updated を更新し、アトミックに書き出す前に(.tmp 後にリネーム)スキーマに対して再検証します。
4. ステータスを表示する
# 単一TC
python3 scripts/tc_status.py --root . --tc-id TC-001-04-05-26-user-auth
# すべてのTC(レジストリサマリー)
python3 scripts/tc_status.py --root . --all --json
5. レコードまたはレジストリを検証する
python3 scripts/tc_validator.py --record docs/TC/records/TC-001-.../tc_record.json
python3 scripts/tc_validator.py --registry docs/TC/tc_registry.json
バリデーターはスキーマを強制し、状態マシンの合法性をチェックし、連番の R<n></n> および T<n></n> IDを検証し、承認の一貫性(approved=true には approved_by と approved_date が必要)をアサートします。
完全なスキーマについては、references/tc-schema.md を参照してください。
スラッシュコマンドディスパッチャ
リポジトリには、サブコマンドに基づいてこれらのスクリプトにディスパッチする commands/tc.md 内の /tc スラッシュコマンドが含まれています:
| コマンド | アクション |
|---|---|
| `/tc init` | 現在のプロジェクトに対して `tc_init.py` を実行 |
| `/tc create | フィールドをプロンプトし、`tc_create.py` を実行 |
| `/tc update | ユーザーが記述した変更を `tc_update.py` 経由で適用 |
| `/tc status [tc-id]` | `tc_status.py` を実行 |
| `/tc resume | 引継ぎを表示し、以前のセッションをアーカイブし、新しいセッションを開始 |
| `/tc close | `deployed` に遷移し、承認を設定 |
| `/tc export` | すべての派生アーティファクトを再レンダリング |
| `/tc dashboard` | レジストリサマリーを再レンダリング |
スラッシュコマンドがユーザーインターフェースであり、Pythonスクリプトがエンジンです。
セッション引継ぎ形式
引継ぎブロックは各TC内の session_context.handoff に存在し、AIの継続性にとって最も重要なフィールドです。これには以下が含まれます:
progress_summary— 完了した内容next_steps— 残りのアクションの順序付きリストblockers— 進捗を妨げるものkey_context— 次のボットが知る必要がある重要な決定、落とし穴、パターンfiles_in_progress— 編集中のファイルとその状態(editing、needs_review、partially_done、ready)decisions_made— 根拠とタイムスタンプ付きのアーキテクチャ上の決定
完全な構造および記入ルールについては、references/handoff-format.md を参照してください。
検証ルール(常に適用)
- 状態マシン — 有効な遷移のみが許可されます。
- 連番ID —
revision_historyはR1, R2, R3...を使用します;test_casesはT1, T2, T3...を使用します。 - 追記型履歴 — 改訂エントリは決して変更または削除されません。
- 承認の一貫性 —
approved=trueにはapproved_byとapproved_dateが必要です。 - TC ID形式 —
TC-NNN-MM-DD-YY-slugに一致する必要があります。 - サブTC ID形式 —
TC-NNN.AまたはTC-NNN.A.Nに一致する必要があります。 - アトミック書き込み — JSONは
.tmpに書き込まれ、その後リネームされます。 - レジストリ統計 — 毎回のレジストリ書き込み時に再計算されます。
ブロッキングしない会計処理パターン
TC追跡はメインのワークフローを中断してはいけません。
- TCレコードをインラインで更新するために決して停止しないでください。 コーディングを続けます。
- 自然なマイルストーンで、レコードを更新するバックグラウンドサブエージェントを起動します。
- 真に必要とされる場合にのみ質問を表面化し(「この作業はアクティブなTCのいずれにも一致しません — 作成しますか?」)、ファイルごとではなくセッションごとに1回だけ質問します。
- セッション終了時、閉じる前に最終的な引継ぎブロックを書き出します。
遡及的バルク作成
ドキュメント化されていない履歴を持つ既存のプロジェクトにオンボーディングする場合、retro_changelog.json(論理的な変更ごとに1エントリ)を構築し、ループ内で tc_create.py にフィードするか、バッチモードのためにスクリプトを拡張します。コミットをファイルではなく機能ごとにグループ化します。
アンチパターン
| アンチパターン | なぜ悪いのか | 代わりにこれを行う |
|---|---|---|
| `revision_history` を編集してタイプミスを「修正」する | 履歴は追記型のみ — 改ざんは監査証跡を破壊する | フィールドを修正する新しい改訂版を追加する |
| 状態マシンをスキップする(「単にステータスをdeployedに設定する」) | 検証をバイパスし、スキップされたフェーズを隠す | `in_progress -> implemented -> tested -> deployed` を通過する |
| 変更されたファイルごとに1つのTCを作成する | 関連する作業を断片化し、レジストリを爆発させる | 論理的な単位(機能、修正、リファクタリング)ごとに1つのTC |
| すべてのコード編集の間にTCをインラインで更新する | メインエージェントを遅くし、コンテキストを浪費する | マイルストーンでバックグラウンドサブエージェントを起動する |
| `approved_by` なしで `approved=true` をマークする | バリデーターは拒否します — 誤解を招く監査証跡 | 常に `approved_by` と `approved_date` を一緒に設定する |
| テキストエディタで `tc_record.json` を直接上書きする | 書き込み中の破損のリスクがあり、検証をスキップする | `tc_update.py` を使用する(アトミック書き込み + スキーマチェック) |
| `notes` や証拠にシークレットを配置する | レコードはリポジトリにコミットされる | 環境変数または外部シークレットストアを参照する |
| 削除後にTC IDを再利用する | 連番の保証を破り、履歴を混乱させる | 前方にのみインクリメント — 決してリサイクルしない |
| `next_steps` を古くさせる | 引継ぎの目的を無効にする | すべてのマイルストーンで更新する(「何も変更なし」であっても) |
クロスリファレンス
engineering/changelog-generator— Conventional CommitsからKeep-a-Changelogリリースノートを生成します。TCトラッカーとペアにする:TCは細粒度な変更ごとの監査証跡用、changelogはユーザー向けリリースノート用。engineering/tech-debt-tracker— discreteなコード変更ではなく、長期にわたる負債項目を追跡する場合。engineering/focused-fix— バグ修正に体系的な機能全体の修復が必要な場合、まず/focused-fixを実行し、その結果をTCとしてキャプチャします。project-management/decision-log— TCのdecisions_madeブロック内で行われたアーキテクチャ上の決定は、プロジェクト全体の意思決定ログに昇格させることもできます。engineering-team/code-reviewer— マージ前のレビューはtested -> deployedの遷移に自然に適合します;レビュアーをapproval.approved_byにキャプチャします。
このスキル内の参照
- references/tc-schema.md — TCレコードおよびレジストリの完全なJSONスキーマ。
- references/lifecycle.md — 状態マシン、有効な遷移、および回復フロー。
- references/handoff-format.md — セッション引継ぎ構造およびベストプラクティス。
---
name: tc-tracker
description: Track code changes with structured JSON records, an enforced state machine, and a session handoff format for AI continuity.
---
# TC Tracker
Track every code change with structured JSON records, an enforced state machine, and a session handoff format that lets a new AI session resume work cleanly when a previous one expires.
## Overview
A Technical Change (TC) is a structured record that captures **what** changed, **why** it changed, **who** changed it, **when** it changed, **how it was tested**, and **where work stands** for the next session. Records live as JSON in `docs/TC/` inside the target project, validated against a strict schema and a state machine.
**Use this skill when the user:**
- Asks to "track this change" or wants an audit trail for code modifications
- Wants to hand off in-progress work to a future AI session
- Needs structured release notes that go beyond commit messages
- Onboards an existing project and wants retroactive change documentation
- Asks for `/tc init`, `/tc create`, `/tc update`, `/tc status`, `/tc resume`, or `/tc close`
**Do NOT use this skill when:**
- The user only wants a changelog from git history (use `engineering/changelog-generator`)
- The user only wants to track tech debt items (use `engineering/tech-debt-tracker`)
- The change is trivial (typo, formatting) and won't affect behavior
## Storage Layout
Each project stores TCs at `{project_root}/docs/TC/`:
```
docs/TC/
├── tc_config.json # Project settings
├── tc_registry.json # Master index + statistics
├── records/
│ └── TC-001-04-05-26-user-auth/
│ └── tc_record.json # Source of truth
└── evidence/
└── TC-001/ # Log snippets, command output, screenshots
```
## TC ID Convention
- **Parent TC:** `TC-NNN-MM-DD-YY-functionality-slug` (e.g., `TC-001-04-05-26-user-authentication`)
- **Sub-TC:** `TC-NNN.A` or `TC-NNN.A.1` (letter = revision, digit = sub-revision)
- `NNN` is sequential, `MM-DD-YY` is the creation date, slug is kebab-case.
## State Machine
```
planned -> in_progress -> implemented -> tested -> deployed
| | | | |
+-> blocked -+ +- in_progress <-------+
| (rework / hotfix)
+-> planned
```
> See [references/lifecycle.md](references/lifecycle.md) for the full transition table and recovery flows.
## Workflow Commands
The skill ships five Python scripts that perform deterministic, stdlib-only operations on TC records. Each one supports `--help` and `--json`.
### 1. Initialize tracking in a project
```bash
python3 scripts/tc_init.py --project "My Project" --root .
```
Creates `docs/TC/`, `docs/TC/records/`, `docs/TC/evidence/`, `tc_config.json`, and `tc_registry.json`. Idempotent — re-running reports "already initialized" with current stats.
### 2. Create a new TC record
```bash
python3 scripts/tc_create.py \
--root . \
--name "user-authentication" \
--title "Add JWT-based user authentication" \
--scope feature \
--priority high \
--summary "Adds JWT login + middleware" \
--motivation "Required for protected endpoints"
```
Generates the next sequential TC ID, creates the record directory, writes a fully populated `tc_record.json` (status `planned`, R1 creation revision), and updates the registry.
### 3. Update a TC record
```bash
# Status transition (validated against the state machine)
python3 scripts/tc_update.py --root . --tc-id TC-001-04-05-26-user-auth \
--set-status in_progress --reason "Starting implementation"
# Add a file
python3 scripts/tc_update.py --root . --tc-id TC-001-04-05-26-user-auth \
--add-file src/auth.py:created
# Append handoff data
python3 scripts/tc_update.py --root . --tc-id TC-001-04-05-26-user-auth \
--handoff-progress "JWT middleware wired up" \
--handoff-next "Write integration tests" \
--handoff-next "Update README"
```
Every change appends a sequential `R<n>` revision entry, refreshes `updated`, and re-validates against the schema before writing atomically (`.tmp` then rename).
### 4. View status
```bash
# Single TC
python3 scripts/tc_status.py --root . --tc-id TC-001-04-05-26-user-auth
# All TCs (registry summary)
python3 scripts/tc_status.py --root . --all --json
```
### 5. Validate a record or registry
```bash
python3 scripts/tc_validator.py --record docs/TC/records/TC-001-.../tc_record.json
python3 scripts/tc_validator.py --registry docs/TC/tc_registry.json
```
Validator enforces the schema, checks state-machine legality, verifies sequential `R<n>` and `T<n>` IDs, and asserts approval consistency (`approved=true` requires `approved_by` and `approved_date`).
> See [references/tc-schema.md](references/tc-schema.md) for the full schema.
## Slash-Command Dispatcher
The repo ships a `/tc` slash command at `commands/tc.md` that dispatches to these scripts based on subcommand:
| Command | Action |
|---------|--------|
| `/tc init` | Run `tc_init.py` for the current project |
| `/tc create <name>` | Prompt for fields, run `tc_create.py` |
| `/tc update <tc-id>` | Apply user-described changes via `tc_update.py` |
| `/tc status [tc-id]` | Run `tc_status.py` |
| `/tc resume <tc-id>` | Display handoff, archive prior session, start a new one |
| `/tc close <tc-id>` | Transition to `deployed`, set approval |
| `/tc export` | Re-render all derived artifacts |
| `/tc dashboard` | Re-render the registry summary |
The slash command is the user interface; the Python scripts are the engine.
## Session Handoff Format
The handoff block lives at `session_context.handoff` inside each TC and is the single most important field for AI continuity. It contains:
- `progress_summary` — what has been done
- `next_steps` — ordered list of remaining actions
- `blockers` — anything preventing progress
- `key_context` — critical decisions, gotchas, patterns the next bot must know
- `files_in_progress` — files being edited and their state (`editing`, `needs_review`, `partially_done`, `ready`)
- `decisions_made` — architectural decisions with rationale and timestamp
> See [references/handoff-format.md](references/handoff-format.md) for the full structure and fill-out rules.
## Validation Rules (Always Enforced)
1. **State machine** — only valid transitions are allowed.
2. **Sequential IDs** — `revision_history` uses `R1, R2, R3...`; `test_cases` uses `T1, T2, T3...`.
3. **Append-only history** — revision entries are never modified or deleted.
4. **Approval consistency** — `approved=true` requires `approved_by` and `approved_date`.
5. **TC ID format** — must match `TC-NNN-MM-DD-YY-slug`.
6. **Sub-TC ID format** — must match `TC-NNN.A` or `TC-NNN.A.N`.
7. **Atomic writes** — JSON is written to `.tmp` then renamed.
8. **Registry stats** — recomputed on every registry write.
## Non-Blocking Bookkeeping Pattern
TC tracking must NOT interrupt the main workflow.
- **Never stop to update TC records inline.** Keep coding.
- At natural milestones, spawn a background subagent to update the record.
- Surface questions only when genuinely needed ("This work doesn't match any active TC — create one?"), and ask once per session, not per file.
- At session end, write a final handoff block before closing.
## Retroactive Bulk Creation
For onboarding an existing project with undocumented history, build a `retro_changelog.json` (one entry per logical change) and feed it to `tc_create.py` in a loop, or extend the script for batch mode. Group commits by feature, not by file.
## Anti-Patterns
| Anti-pattern | Why it's bad | Do this instead |
|--------------|--------------|-----------------|
| Editing `revision_history` to "fix" a typo | History is append-only — tampering destroys the audit trail | Add a new revision that corrects the field |
| Skipping the state machine ("just set status to deployed") | Bypasses validation and hides skipped phases | Walk through `in_progress -> implemented -> tested -> deployed` |
| Creating one TC per file changed | Fragments related work and explodes the registry | One TC per logical unit (feature, fix, refactor) |
| Updating TC inline between every code edit | Slows the main agent, wastes context | Spawn a background subagent at milestones |
| Marking `approved=true` without `approved_by` | Validator will reject; misleading audit trail | Always set `approved_by` and `approved_date` together |
| Overwriting `tc_record.json` directly with a text editor | Risks corruption mid-write and skips validation | Use `tc_update.py` (atomic write + schema check) |
| Putting secrets in `notes` or evidence | Records are committed to the repo | Reference an env var or external secret store |
| Reusing TC IDs after deletion | Breaks the sequential guarantee and confuses history | Increment forward only — never recycle |
| Letting `next_steps` go stale | Defeats the purpose of handoff | Update on every milestone, even if it's "nothing changed" |
## Cross-References
- `engineering/changelog-generator` — Generates Keep-a-Changelog release notes from Conventional Commits. Pair it with TC tracker: TC for the granular per-change audit trail, changelog for user-facing release notes.
- `engineering/tech-debt-tracker` — For tracking long-lived debt items rather than discrete code changes.
- `engineering/focused-fix` — When a bug fix needs systematic feature-wide repair, run `/focused-fix` first then capture the result as a TC.
- `project-management/decision-log` — Architectural decisions made inside a TC's `decisions_made` block can also be promoted to a project-wide decision log.
- `engineering-team/code-reviewer` — Pre-merge review fits naturally into the `tested -> deployed` transition; capture the reviewer in `approval.approved_by`.
## References in This Skill
- [references/tc-schema.md](references/tc-schema.md) — Full JSON schema for TC records and the registry.
- [references/lifecycle.md](references/lifecycle.md) — State machine, valid transitions, and recovery flows.
- [references/handoff-format.md](references/handoff-format.md) — Session handoff structure and best practices.
すべてのファイル
0件のファイルtc-trackerをインストール
スキルファイルをダウンロードして .claude/skills/ ディレクトリに展開してください。
ZIPをダウンロードリポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。
git clone https://github.com/alirezarezvani/claude-skills/tree/main/engineering/skills/tc-tracker # Copy SKILL.md to your .claude/skills/ directory
コピー





家
