AI Agent Hub
Back to skills
Text Difference Viewer icon

Text Difference Viewer

Development Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please install @user_15292d5a/yjkj-text-diff according to https://skillhub.cn/install/skillhub.md.

About this skill

Problem It Solves

When comparing two text files, raw diff output can mix changed lines, context, and blank lines, making it hard to spot exactly which lines changed. text-diff wraps Python difflib into a readable terminal result for quickly inspecting differences between scripts, configs, generated text, or translation drafts.

How It Works

It accepts two text file paths and uses difflib to produce line-level differences. Modes include:
- unified: unified diff (default), showing context around changes
- context: context diff, grouped by hunk
- side-by-side: left-right comparison, line by line
Common options include -c/--context for context lines, -o/--output to save to a file, and --no-color to disable colors. Exit codes are explicit: 0 means identical files and 1 means differences exist, which helps scripting or CI.

Scope And Limitations

The skill is for plain-text files and line-level comparison. It does not parse code semantics, formatting rules, or binary content. For large directories or noisy generated files, narrow the comparison first; for character-level, word-level, or merge-conflict workflows, text-diff is a quick review layer, not a full diff toolchain.

Use Cases

  • Before release, compare local scripts with backup copies to confirm added, removed, and changed lines.
  • When reviewing translation drafts against source text, inspect every wording change line by line.
  • In CI, run text-diff and block on exit code 1 while saving unified diff to a file.
  • Debug template rendering by comparing expected text against actual output to locate missing context lines.

Best For

  • Engineers maintaining Bash or Python scripts who need to see exact line changes between two versions.
  • SREs releasing docs or configs who need to save change evidence as unified diff.
  • Localization engineers reviewing multilingual copy who need line-by-line comparison of source and draft.
  • CI engineers integrating automated checks who need exit codes to determine whether text files match.