mahmoud20138/tradecraft/git-phase-restore
Claude Code and agent skill by mahmoud20138/tradecraft
- community
Checking that the SKILL.md file is still in the repository.
Autonomous Git-based project phase restoration. Uses Git history (commits, tags, branches, diffs, semantic messages) to identify and restore any development phase automatically. Trigger for: "restore to when X worked", "go back to before Y broke", "show project phases", "undo the last feature", "roll back to [phase]", "find when this bug was introduced", "restore to [tag/commit/date]", "time travel", "git timeline", "diff between phases", "what changed since X", or any variation of wanting to r…
Install
npx vskill@latest install mahmoud20138/tradecraft/git-phase-restoreSKILL.md
The same SKILL.md was published earlier as mahmoud20138/tradecraft/git-phase-restore.
Git Phase Restore — Autonomous Development Phase Recovery
Leverage Git's full history to identify development phases and restore any project state automatically. No manual snapshots needed — Git already has everything.
Core Philosophy
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:
- Commits with conventional messages → semantic phase boundaries
- Tags → explicit version milestones
- Branches → parallel development tracks
- Timestamps → temporal navigation
- Diffs → understanding what each phase changed
Instead of maintaining separate snapshot systems, this skill mines Git itself as the single source of truth.
When to Trigger
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) |
Phase Detection Strategy
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.
1. Tag-Based Phases (highest confidence)
Tags are explicit developer-placed milestones. Always check these first.
2. Semantic Commit Phases (high confidence)
Parse conventional commit messages to detect phase boundaries. A new phase starts when:
- A
feat:commit introduces a major new capability - Multiple related commits cluster around a single feature/module
- A
refactor:orchore:commit restructures the project - A merge commit lands a feature branch
Group consecutive commits by their semantic prefix and the files they touch. A phase = a cluster of commits that share a purpose.
3. Branch-Based Phases
Each feature/bugfix branch represents a development phase.
4. Time-Based Phases
When the user references a date or relative time period.
5. File-Change-Based Phases
When the user references a specific feature or module, find phases by file paths.
Core Workflows
Workflow 1: List Project Phases
Trigger: "show phases", "project timeline", "what phases exist"
Steps:
- Verify the project is a Git repository (
git rev-parse --is-inside-work-tree) - Run phase detection across all lenses (tags → semantic → branches → time)
- Present a structured timeline to the user:
- Ask the user which phase they want to explore or restore.
Workflow 2: Restore to a Specific Phase
Trigger: "restore to phase X", "go back to [tag/commit/date/description]"
Steps:
- Identify the target commit:
- If tag:
git rev-parse <tag> - If commit hash: use directly
- If date:
git rev-list -1 --before="<date>" HEAD - If description: search commit messages:
git log --all --grep="<keyword>" --oneline - If phase name: use phase detection to find the boundary commit
- Safety check — protect current work:
```bash # 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") ``bash git checkout <target-commit> # User can look around, then return with: git checkout - ``
Option B: New branch from phase (recommended for "restore and continue") ``bash git checkout -b restore/<phase-label> <target-commit> ``
Option C: Hard reset (destructive — ONLY with explicit user confirmation) ``bash git reset --hard <target-commit> # Original HEAD saved in reflog for 90 days ``
Option D: Revert range (safe undo of specific phases) ``bash git revert --no-commit <start-commit>..<end-commit> git commit -m "revert: undo phase [label] (commits <start>..<end>)" ``
- Post-restore verification:
```bash # 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:
- Which commit was restored
- Which strategy was used
- How to get back (reflog, stash, branch name)
- What files changed
Workflow 3: Find When Something Broke (Git Bisect)
Trigger: "when did X break", "find the regression", "bisect"
Steps:
- Identify the "good" state (when it last worked) and "bad" state (current or reported)
- Run automated bisect:
- Report the exact commit that introduced the issue
- Offer to revert just that commit:
git revert <bad-commit>
Workflow 4: Compare Phases
Trigger: "diff between phases", "what changed since X", "compare auth phase to current"
Steps:
Present as a structured summary:
- Files added / modified / deleted
- Lines added / removed per file
- Key changes in plain English
Workflow 5: Inspect a File at a Past Phase
Trigger: "show me file X at phase Y", "what did config look like before"
Safety Rules
These are non-negotiable safeguards:
- Never force-push to shared branches (main, master, develop) without explicit user confirmation
- Always stash or commit uncommitted work before any checkout or reset
- Prefer non-destructive operations — detached HEAD and new branches over hard resets
- Always tell the user the reflog entry so they can recover:
git reflogshows the safety net - Verify the repo is clean before any restoration —
git status --porcelainmust be empty or stashed - Log the restore action — if project-history or restore-points skills are active, update their logs too
- Never rewrite history on branches that others may have pulled from
Automatic Phase Labeling
When 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 |
Integration with Other Skills
- git-workflow: This skill handles backward navigation; git-workflow handles forward progress. They complement each other.
- project-history: After a restore, update PROJECT_HISTORY.md's Active Context to reflect the restored state.
- project-restore-points: If the user also has filesystem snapshots, cross-reference them with Git phases for richer context.
- codebase-understanding: Before restoring, understand the current codebase structure so the restore doesn't break active work.
Quick Reference Commands
Error Handling
| 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 |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/tradecraft/skills/git-phase-restore/SKILL.md
Popularity
- Repository stars
- 18
- Repository forks
- 6
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mahmoud20138/tradecraft/git-phase-restore)