askill
diff-preview

diff-previewSafety 95Repository

Preview changes before applying them. Shows git diffs, prompts for confirmation, safer than direct edits.

0 stars
1.2k downloads
Updated 2/14/2026

Package Files

Loading files...
SKILL.md

/diff-preview - Preview Before Apply

See changes before they happen. Safer editing with confirmation prompts.


When To Use

User says:

  • "preview changes"
  • "show me what will change"
  • "diff before apply"
  • "safe mode editing"
  • Before any multi-file edit operation

How It Works

Before applying edits:

  1. Run git diff to show pending changes
  2. Present diff in readable format
  3. Ask user to confirm: Apply these changes? [y/n]
  4. Only apply if user confirms

For new files:

  1. Show what content will be created
  2. Show file path
  3. Ask for confirmation

Usage Patterns

Before Multi-File Edits

# User: "Rename function across all files"

You do:
1. Run: git diff to check current state
2. Calculate changes: grep -r "oldFunction" --include="*.py"
3. Show preview:

πŸ“‹ Proposed Changes:

src/auth.py:42

  • def oldFunction(user):
  • def newFunction(user):

src/api.py:15

  • return oldFunction(data)
  • return newFunction(data)

2 files will be modified


4. Ask: "Apply these changes? [y/n/diff]"
- y: Apply all changes
- n: Cancel
- diff: Show full git diff

Before Creating New Files

# User: "Create a new API endpoint"

You do:
1. Show what will be created:

πŸ“‹ Will Create: src/api/endpoints/user.py

Content:

from fastapi import APIRouter

router = APIRouter()

@router.get("/users/{user_id}")
async def get_user(user_id: str):
    ...

File size: ~250 bytes


2. Ask: "Create this file? [y/n/edit]"

Integration with Edit Tool

# Before using Edit tool:
1. Read file to get current content
2. Show proposed edit in diff format:

πŸ“‹ Edit Preview: src/main.py

@@ -15,7 +15,7 @@ - port = int(os.getenv("PORT", 8000)) + port = int(os.getenv("PORT", 3000))


3. Ask: "Apply this edit? [y/n]"
4. Only call Edit tool if user confirms

Diff Format

Compact Preview (default)

πŸ“‹ Proposed Changes (3 files):

βœ“ src/config.py:12     - Change default port 8000β†’3000
βœ“ src/auth.py:45      - Add rate limiting
βœ“ src/utils/helpers.py - Extract common function

Lines added: 15 | Lines removed: 5 | Files changed: 3

Full Diff

πŸ“‹ Full Diff:

src/config.py
@@ -12,7 +12,7 @@
     """Load configuration from environment."""
-    port = int(os.getenv("PORT", 8000))
+    port = int(os.getenv("PORT", 3000))
     debug = os.getenv("DEBUG", "false").lower() == "true"

src/auth.py
@@ -45,6 +45,10 @@
     def authenticate(self, token: str) -> User:
+        # Rate limiting
+        if self._is_rate_limited(token):
+            raise RateLimitError()
         return self._verify_token(token)

Apply these changes? [y/n/diff/all]

Confirmation Prompts

PromptOptionsWhen to Use
Apply? [y/n]y=yes, n=noSingle file change
Apply all? [y/n/diff]y=yes, n=no, diff=show moreMulti-file change
Create? [y/n/edit]y=yes, n=no, edit=modify contentNew file
Continue? [y/n/skip]y=yes, n=stop all, skip=this fileBatch operation

Safety Features

Automatic Diff Before Write

# In your workflow, before Write tool:
1. If file exists: Read it first
2. Compute diff between old and new
3. Show preview to user
4. Only Write if confirmed

Dry Run Mode

# User says "dry run" or "just show me"
/diff-preview --dry-run "rename oldFunction to newFunction"

# Shows changes without applying any

Rollback Prompt

# After applying changes:
"Changes applied! Undo with: git checkout -- <files>"
"Create checkpoint? [y/n]"  # Offer to create git commit

Integration with Other Skills

With refactorer

# refactorer uses diff-preview automatically
User: "refactor to extract common validation"

You do:
1. Analyze code and plan changes
2. Show diff-preview of proposed refactor
3. Wait for confirmation
4. Apply changes

With batch-processor

# batch-processor shows summary before applying
User: "add license header to all Python files"

You do:
1. Find all matching files: 15 files
2. Show summary: "Will add license to 15 Python files"
3. Show first file as example
4. Confirm: "Apply to all 15 files? [y/n/first]"

With implement-plan

# After implementing a plan step:
"Step 3/5 complete: Added authentication

Changes:
+ src/auth.py (new file, 120 lines)
+ src/middleware/auth.py (new file, 45 lines)
~ src/main.py (modified, 3 lines added)

Continue to step 4? [y/n/review]"

Quick Win from Research

Competitor: Cline has built-in diff preview Problem: Direct file edits feel risky Solution: Always show changes before applying Result: Users feel more in control, safer experimentation


Implementation Checklist

When using diff-preview:

  • Show WHAT will change (file list)
  • Show HOW it will change (diff)
  • Show IMPACT (lines added/removed)
  • Ask for CONFIRMATION
  • Only apply if confirmed
  • Offer rollback option

Keywords

diff, preview, changes, safe mode, confirm before apply, show diff, dry run, rollback

Install

Download ZIP
Requires askill CLI v1.0+β–Ά

AI Quality Score

82/100Analyzed 2/19/2026

Well-structured skill documenting a safe editing workflow. Provides comprehensive coverage of preview-before-apply pattern with multiple usage scenarios, diff formats, confirmation prompts, and safety features. Highly actionable with clear examples. Generic enough to be reusable across projects despite specific repo reference. Scoring bonus for clear 'when to use' section, structured steps, tags, and dedicated skills folder location.

95
92
85
88
90

Metadata

Licenseunknown
Version-
Updated2/14/2026
PublisherKhamel83

Tags

apigithub-actionspromptingsecurity