/tradecraft:git-phase-restorefrom tradecraft
Autonomously restores any development phase using Git history (commits, tags, branches, diffs). Detects phases, finds regressions, compares states, and rolls back — all from Git's built-in record.
Ships in tradecraft. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Leverage Git's full history to identify development phases and restore any project state automatically. No manual snapshots needed — Git already has everything.
Every Git repository already contains a complete record of every development phase. This skill teaches Claude to read that record intelligently and act on it:
Instead of maintaining separate snapshot systems, this skill mines Git itself as the single source of truth.
Always trigger this skill when the user wants to:
| Intent | Example phrases |
|---|---|
| Restore a phase | "go back to when auth worked", "restore to v1.2", "undo last feature" |
| Explore history | "show project phases", "what was the state on March 1st", "git timeline" |
| Find a regression | "when did this bug appear", "find when X broke", "bisect this issue" |
| Compare phases | "diff between auth and current", "what changed since last week" |
| Inspect a past state | "show me the code before the refactor", "what did file X look like in phase Y" |
| Undo / rollback | "roll back", "undo", "revert", "go back" (in any Git project context) |
Development phases are identified by analyzing Git history through multiple lenses.
Run scripts/detect_phases.sh in the project root to get a structured phase map,
or follow the manual steps below.
Tags are explicit developer-placed milestones. Always check these first.
# List all tags with dates and messages
git tag -l --sort=-creatordate --format='%(creatordate:short) %(refname:short) %(subject)'
Parse conventional commit messages to detect phase boundaries. A new phase starts when:
feat: commit introduces a major new capabilityrefactor: or chore: commit restructures the project# Show commit history with type prefixes for phase detection
git log --oneline --decorate --all --date=short --format='%h %ad %s'
Group consecutive commits by their semantic prefix and the files they touch. A phase = a cluster of commits that share a purpose.
Each feature/bugfix branch represents a development phase.
# All branches (local + remote) with last commit date
git branch -a --sort=-committerdate --format='%(committerdate:short) %(refname:short)'
# Merged branches = completed phases
git branch --merged main
When the user references a date or relative time period.
# Commits in a date range
git log --after="2025-01-01" --before="2025-02-01" --oneline
# Find the exact commit at a point in time
git rev-list -1 --before="2025-01-15" HEAD
When the user references a specific feature or module, find phases by file paths.
# All commits that touched a specific path
git log --oneline -- src/auth/
# First and last commit touching a path = phase boundaries
git log --diff-filter=A --oneline -- src/auth/ # First appearance
git log -1 --oneline -- src/auth/ # Last change
Trigger: "show phases", "project timeline", "what phases exist"
Steps:
git rev-parse --is-inside-work-tree)PROJECT PHASE TIMELINE
━━━━━━━━━━━━━━━━━━━━━
Phase 1: Project Init [abc1234] 2025-01-10
└─ Initial scaffold, deps, config
Phase 2: Database Layer [def5678] 2025-01-12 → [ghi9012] 2025-01-15
└─ Room setup, DAOs, migrations (12 commits)
Phase 3: Auth System [jkl3456] 2025-01-16 → [mno7890] 2025-01-22
└─ JWT auth, login/register, token refresh (18 commits)
└─ TAG: v0.1.0-alpha
Phase 4: Profile Feature [pqr1234] 2025-01-23 → [stu5678] 2025-01-28
└─ User profile CRUD, avatar upload (9 commits)
Phase 5: Current (HEAD) [vwx9012] 2025-01-29 → now
└─ Settings screen, bug fixes (6 commits)
Trigger: "restore to phase X", "go back to [tag/commit/date/description]"
Steps:
Identify the target commit:
git rev-parse <tag>git rev-list -1 --before="<date>" HEADgit log --all --grep="<keyword>" --onelineSafety check — protect current work:
# Check for uncommitted changes
git status --porcelain
# If dirty, auto-stash
git stash push -m "auto-stash before phase restore $(date +%Y%m%d_%H%M%S)"
Choose restoration strategy (present options to user if ambiguous):
Option A: Detached HEAD inspection (non-destructive, default for "show me")
git checkout <target-commit>
# User can look around, then return with:
git checkout -
Option B: New branch from phase (recommended for "restore and continue")
git checkout -b restore/<phase-label> <target-commit>
Option C: Hard reset (destructive — ONLY with explicit user confirmation)
git reset --hard <target-commit>
# Original HEAD saved in reflog for 90 days
Option D: Revert range (safe undo of specific phases)
git revert --no-commit <start-commit>..<end-commit>
git commit -m "revert: undo phase [label] (commits <start>..<end>)"
Post-restore verification:
# Confirm HEAD is where expected
git log -1 --oneline
# Show what's different from where we were
git diff --stat <original-head> HEAD
Report to user:
Trigger: "when did X break", "find the regression", "bisect"
Steps:
git bisect start
git bisect bad HEAD
git bisect good <known-good-commit>
# If there's a test command:
git bisect run <test-command>
# Otherwise, manual bisect — Claude checks each midpoint
git revert <bad-commit>Trigger: "diff between phases", "what changed since X", "compare auth phase to current"
Steps:
# Stat summary between two phase boundary commits
git diff --stat <phase-start>..<phase-end>
# Detailed diff for specific files
git diff <commit-a> <commit-b> -- <path>
# Show which files were added/modified/deleted
git diff --name-status <commit-a> <commit-b>
Present as a structured summary:
Trigger: "show me file X at phase Y", "what did config look like before"
# Show file content at a specific commit
git show <commit>:<file-path>
# Compare a file between two commits
git diff <commit-a> <commit-b> -- <file-path>
These are non-negotiable safeguards:
git reflog shows the safety netgit status --porcelain must be empty or stashedWhen commits follow conventional commit format (feat:, fix:, refactor:, etc.),
Claude should auto-generate human-readable phase labels:
| Commit pattern | Auto-label |
|---|---|
feat: add user authentication | "Auth System" |
feat: implement payment gateway | "Payment Integration" |
refactor: extract service layer | "Service Layer Refactor" |
chore: initial project setup | "Project Init" |
Cluster of fix: commits | "Bug Fix Sprint" |
Merge of feature/X branch | Phase named after branch |
# Phase detection
git log --oneline --graph --decorate --all # Visual history
git tag -l --sort=-creatordate # Tags = milestones
git branch -a --sort=-committerdate # Branches = phases
# Time travel
git checkout <commit> # Inspect (detached HEAD)
git checkout -b restore/<label> <commit> # Restore as branch
git stash push -m "before restore" # Save current work
# Investigation
git bisect start && git bisect bad && git bisect good <commit>
git log --all --grep="<keyword>" --oneline # Search commits
git log --after="<date>" --before="<date>" --oneline # Time range
# Recovery (always available)
git reflog # Full undo history
git stash list # Stashed work
git checkout - # Go back to previous branch
| Situation | Action |
|---|---|
| Not a git repo | Tell user, offer to git init + initial commit |
| Dirty working tree | Auto-stash with descriptive message |
| Commit not found | Broaden search: try --all, check reflog, search by message |
| Merge conflicts on revert | Show conflicts, help resolve, or abort and try different strategy |
| Detached HEAD confusion | Explain clearly, offer to create a branch or return |
| User wants to undo the restore | Use reflog: git reset --hard HEAD@{1} or pop stash |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
169 skills in this plugin
/agent-developmentThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins./agentic-storageAgentic storage architecture — persistent memory for AI agents using MCP, immutable versioning, sandboxing, and intent validation. Covers the stateless problem in LLM agents, RAG limitations (read-only), MCP protocol (JSON-RPC, resources, tools), storage safety layers, and agent file system design. Source: IBM Technology (Martin Keen), March 2026. Use this skill for "agentic storage", "agent memory", "persistent agent state", "MCP storage", "agent file system", "agent hard drive", "stateless agent problem", "agent work product", "immutable versioning", "agent sandboxing", "intent validation", "agent safety layers", "agent context window limits", "storage for AI agents", "agent persistence", "autonomous agent storage", "agent audit trail". Works with mcp-integration, trading-brain, agents, trade-psychology-coach.
npx claudepluginhub mahmoud20138/tradecraft --plugin tradecraftOther plugins' skills for the same job