
Text Diff
- 36 installs
- 84 repo stars
- Updated January 28, 2026
- aidotnet/moyucode
text-diff is a Claude Code skill that compares files and text using difflib and outputs unified diffs, side-by-side views, HTML, or patches.
About
text-diff is a Claude Code skill that compares two files or text blocks using Python's difflib. It produces unified diffs, side-by-side or HTML views, and patch files. A developer uses it to see and export differences between file versions.
- Compares files and text with unified diff output
- Supports side-by-side view and HTML output
- Can generate a patch file
Text Diff by the numbers
- 36 all-time installs (skills.sh)
- Ranked #337 of 550 CLI & Terminal skills by installs in the Skillselion catalog
- Data as of Jul 28, 2026 (Skillselion catalog sync)
text-diff capabilities & compatibility
- Capabilities
- file diff · patch generation · text comparison
- Pricing
- Free
What text-diff says it does
Compare files and text content with unified diff output, side-by-side view, and patch generation.
python scripts/text_diff.py old.txt new.txt --patch > changes.patch
`diff`, `compare`, `patch`, `text`, `files`
npx skills add https://github.com/aidotnet/moyucode --skill text-diffAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 36 |
|---|---|
| repo stars | ★ 84 |
| Last updated | January 28, 2026 |
| Repository | aidotnet/moyucode ↗ |
What it does
Compare two files and produce a unified diff, side-by-side view, HTML report, or patch file.
Who is it for?
Diffing two files and generating a unified diff or patch.
When should I use this skill?
You need to compare two files or produce a patch of their differences.
What you get
Outputs a unified, side-by-side, or HTML diff, or a patch file.
- unified diff output
- patch file
- HTML diff
By the numbers
- Supports 4 output modes: unified, side-by-side, HTML, patch
Files
Text Diff Tool
Description
Compare files and text content with unified diff output, side-by-side view, and patch generation.
Trigger
/diffcommand- User needs to compare files
- User wants to see changes
Usage
# Compare two files
python scripts/text_diff.py file1.txt file2.txt
# Unified diff format
python scripts/text_diff.py old.py new.py --unified
# Side-by-side view
python scripts/text_diff.py file1.txt file2.txt --side-by-side
# Generate patch
python scripts/text_diff.py old.txt new.txt --patch > changes.patchTags
diff, compare, patch, text, files
Compatibility
- Codex: ✅
- Claude Code: ✅
#!/usr/bin/env python3
"""
Text Diff Tool
Based on Python's difflib: https://github.com/python/cpython
Usage:
python text_diff.py file1.txt file2.txt
python text_diff.py old.py new.py --unified
"""
import argparse
import difflib
import sys
from pathlib import Path
def read_file(filepath):
"""Read file and return lines."""
with open(filepath, 'r', encoding='utf-8') as f:
return f.readlines()
def unified_diff(file1, file2, lines1, lines2, context=3):
"""Generate unified diff."""
diff = difflib.unified_diff(
lines1, lines2,
fromfile=file1, tofile=file2,
lineterm=''
)
return '\n'.join(diff)
def context_diff(file1, file2, lines1, lines2, context=3):
"""Generate context diff."""
diff = difflib.context_diff(
lines1, lines2,
fromfile=file1, tofile=file2,
lineterm=''
)
return '\n'.join(diff)
def html_diff(file1, file2, lines1, lines2):
"""Generate HTML diff."""
differ = difflib.HtmlDiff()
return differ.make_file(lines1, lines2, file1, file2)
def main():
parser = argparse.ArgumentParser(description="Compare files")
parser.add_argument('file1', help='First file')
parser.add_argument('file2', help='Second file')
parser.add_argument('--unified', '-u', action='store_true', help='Unified format')
parser.add_argument('--context', '-c', type=int, default=3, help='Context lines')
parser.add_argument('--html', action='store_true', help='HTML output')
parser.add_argument('--output', '-o', help='Output file')
parser.add_argument('--patch', '-p', action='store_true', help='Patch format')
args = parser.parse_args()
lines1 = read_file(args.file1)
lines2 = read_file(args.file2)
if lines1 == lines2:
print("✓ Files are identical")
return
if args.html:
result = html_diff(args.file1, args.file2, lines1, lines2)
elif args.unified or args.patch:
result = unified_diff(args.file1, args.file2, lines1, lines2, args.context)
else:
# Simple diff
differ = difflib.Differ()
diff = differ.compare(lines1, lines2)
result = ''.join(diff)
if args.output:
with open(args.output, 'w', encoding='utf-8') as f:
f.write(result)
print(f"✓ Diff saved to {args.output}")
else:
print(result)
if __name__ == "__main__":
main()
Related skills
FAQ
What diff formats does text-diff produce?
Unified diff, side-by-side, HTML, and patch output.
What library does it use?
Python's difflib standard library module.