Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Revert

ASecurity

Git-aware revert that understands Draft tracks, phases, and tasks. Safely undo work at task, phase, or track level. Use when the user asks to 'revert this track', 'undo a phase', 'revert task X', or says 'roll back the last task', 'undo this work'.

40 stars
0 votes
0 copies
0 views
Added 9/22/2026
ai-agentsbashgit

Works with

cli

Security Analysis

A100/100

Scanned 9/22/2026

Install to Claude Code

$npx -y skills add drafthq/draft --skill revert --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Revert?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Revert
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/drafthq-revert/badge)](https://www.skillsdirectory.com/skills/drafthq-revert)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: revert
description: "Git-aware revert that understands Draft tracks, phases, and tasks. Safely undo work at task, phase, or track level. Use when the user asks to 'revert this track', 'undo a phase', 'revert task X', or says 'roll back the last task', 'undo this work'."
---

# Draft Revert

Perform intelligent git revert that understands Draft's logical units of work.

## Red Flags - STOP if you're

- Reverting without showing preview first
- Skipping user confirmation
- Not checking for uncommitted changes first
- Reverting more than requested
- Not updating Draft state after git revert
- Assuming you know which commits to revert without checking

**Preview and confirm before any destructive action.**

---

## Step 0: Pre-flight Check

1. **Verify Draft context exists:**

   ```bash
   ls draft/tracks.md 2>/dev/null
   ```

   If `draft/` does not exist: **STOP** — "No Draft context found. Run `/draft:init` first."

2. **Check working tree:**
   Run `git status --porcelain`. If output is non-empty, warn the user about uncommitted changes and suggest stashing or committing first. Do NOT proceed until working tree is clean.

---

## Step 1: Analyze What to Revert

Ask user what level to revert:

1. **Task** - Revert a single task's commits
2. **Phase** - Revert all commits in a phase
3. **Track** - Revert entire track's commits

If user specifies by name/description, find the matching commits.

## Step 2: Find Related Commits

**Primary method:** Read `plan.md` — every completed task has its commit SHA recorded inline. Use these SHAs directly.

**If no commits found** (all tasks are `[ ]` Pending with no SHAs): announce "No commits found for this scope — nothing to revert." and **STOP**.

**Fallback method (if SHAs missing but completed tasks exist):** Search git log by track ID pattern:

For Draft-managed work, commits follow pattern:

- `feat(<track_id>): <description>`
- `fix(<track_id>): <description>`
- `test(<track_id>): <description>`
- `refactor(<track_id>): <description>`

```bash
# Find commits for a track
git log --oneline --grep="<track_id>"

# Find commits in date range (for phase)
git log --oneline --since="<phase_start>" --until="<phase_end>" --grep="<track_id>"
```

**Cross-reference:** Verify SHAs from `plan.md` match the git log results. Git log is always authoritative for commit identification. plan.md is authoritative for task-to-commit mapping. On SHA mismatch, prefer git log and warn the user.

## Step 3: Preview Revert

Show user what will be reverted:

```text
═══════════════════════════════════════════════════════════
                    REVERT PREVIEW
═══════════════════════════════════════════════════════════

Reverting: [Task/Phase/Track] "[name]"

Commits to revert (newest first):
  abc1234 feat(add-auth): Add JWT validation
  def5678 feat(add-auth): Create auth middleware
  ghi9012 test(add-auth): Add auth middleware tests

Files affected:
  src/auth/middleware.ts
  src/auth/jwt.ts
  tests/auth/middleware.test.ts

Plan.md changes:
  Task 2.1: [x] (abc1234) → [ ]
  Task 2.2: [x] (def5678) → [ ]

═══════════════════════════════════════════════════════════
Proceed with revert? (yes/no)
```

## Step 4: Execute Revert

If confirmed:

Maintain a list of successfully reverted commits during execution.

Read `draft/workflow.md` → `## Toolchain` section for VCS CLI. See `core/shared/vcs-commands.md` for the full command mapping.

**git mode:**

```bash
# Revert each commit in reverse order (newest first)
git revert --no-commit <commit1>
git revert --no-commit <commit2>
# ... continue for all commits

# Create single revert commit
git commit -m "revert(<track_id>): Revert [task/phase description]"
```

On conflict, report: "Successfully reverted: [list]. Conflict on: [sha]. Run `git revert --abort` to undo partial state."

## Step 5: Update Draft State

1. Update `plan.md`:
   - Change reverted tasks from `[x]` to `[ ]`
   - Remove the commit SHA from the reverted task line
   - Add revert note

2. Update `metadata.json`:
   - Decrement tasks.completed
   - Decrement phases.completed if applicable
   - Update timestamp
   - **Note:** `metadata.json` only stores `phases.total` (int) and `phases.completed` (int). Decrement `phases.completed` if all tasks in a previously completed phase are reverted. Phase status markers (`[~]`, `[x]`, `[ ]`) are tracked in `plan.md` text, not in `metadata.json`. Update `plan.md` phase headings accordingly: if any task in a completed phase is reverted, mark that phase `[~]` In Progress in `plan.md`; if ALL tasks are reverted, mark it `[ ]` Pending in `plan.md`.

3. Update `draft/tracks.md` if track status changed

4. **Stale reports:** After revert, existing `review-report-latest.md` and `bughunt-report-latest.md` for the track are stale. Resolve symlink targets first: `readlink -f review-report-latest.md` and `readlink -f bughunt-report-latest.md`. Add a warning header to the symlink targets (the actual timestamped files): `> **WARNING: This report predates a revert operation and may be stale. Re-run the review/bughunt.**` Or delete them if the revert is substantial.

## Step 6: Confirm

```text
Revert complete

Reverted:
  - [list of tasks/commits]

Updated:
  - draft/tracks/<track_id>/plan.md
  - draft/tracks/<track_id>/metadata.json

Git status:
  - Created revert commit: [sha]

The reverted tasks are now available to re-implement.
Run /draft:implement to continue.
```

## Recovery

If the process is interrupted between git revert and Draft state update, the recovery procedure is: check `git log` for the revert commit, then manually update plan.md task statuses to match the reverted state.

---

## Abort Handling

If user says no to preview:

```text
Revert cancelled. No changes made.
```

If git revert has conflicts:

```text
Revert conflict detected in: [files]

Options:
1. Resolve conflicts manually, then run: git revert --continue
2. Abort revert: git revert --abort

Draft state NOT updated (pending revert completion).
```

Attribution

drafthqdrafthq
View sourceMore from drafthq →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Ultra-compressed communication mode that cuts output tokens while keeping technical accuracy. Levels: lite, full, ultra and the wenyan variants. Use for /caveman, "caveman mode", "talk like caveman", "be brief" or "less tokens".

1066601 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

686011 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3351 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

651 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →