← 返回 Skills 市场
sky-lv

Code Diff Tool

作者 SKY-lv · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
68
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install code-diff-tool
功能描述
Generates beautiful side-by-side diff comparisons for code review
使用说明 (SKILL.md)

skylv-diff-viewer

Professional diff viewer with syntax highlighting, side-by-side view, and HTML export. LCS-based diff for any file type.

Skill Metadata

  • Slug: skylv-diff-viewer
  • Version: 1.0.0
  • Description: Professional diff viewer for code and text files. LCS-based diff algorithm, syntax highlighting, side-by-side view, word-level diff, directory comparison, and HTML export.
  • Category: file
  • Trigger Keywords: diff, compare, side-by-side, syntax highlight, html diff, directory diff

What It Does

# Unified diff (default)
node diff_engine.js diff file1.js file2.js

# Side-by-side view
node diff_engine.js sbs file1.js file2.js

# Word-level diff
node diff_engine.js words old.txt new.txt

# Export as standalone HTML
node diff_engine.js html old.js new.js "v1 vs v2"
# Output: diff.html — open in any browser

# Compare directories
node diff_engine.js dir ./old-project ./new-project

# Git integration
node diff_engine.js git ./repo --stat

Features

Unified Diff

--- old.js
+++ new.js
@@ -5,12 +5,14 @@
-  if (x \x3C 0) return;        ← deletion (red)
+  if (x \x3C 0) { log(x); return; }  ← addition (green)
    return x * 2;

Side-by-Side View

OLD (file1.js)           | NEW (file2.js)
─────────────────────────┼────────────────────────
const x = 1              | const x = 2
- const y = 0            | + const y = 42
  return x + y           |   return x + y

HTML Export

Generates a self-contained HTML file with:

  • Dark theme (VS Code style)
  • Syntax highlighting
  • Deletion/addition statistics
  • Side-by-side or inline view

Architecture

diff-viewer/
├── diff_engine.js     # Core: LCS diff + renderers
├── SKILL.md
└── README.md

Diff Algorithm

  • LCS (Longest Common Subsequence) for line-level diff
  • Token-level word diff within changed lines
  • Binary files: hash comparison only
  • Handles large files (streaming for >10MB)

Real Market Data (2026-04-17)

Metric Value
Top competitor markdown-viewer (score: 0.990)
Other competitors diff-tool (0.781), pm-requirement-review-simulator (0.748)
Our approach Professional diff with syntax highlighting + HTML export
Advantage Full-featured vs. simple markdown viewer

Why Existing Competitors Are Weak

  • markdown-viewer (0.990): Just renders markdown, no diff capability
  • diff-tool (0.781): Basic text diff, no syntax highlighting
  • pm-requirement-review-simulator (0.748): Domain-specific, not general diff

This skill is a complete professional diff tool — LCS algorithm, syntax highlighting, HTML export, directory comparison, git integration. The competitors barely exist.


Compare: skylv-diff-viewer vs markdown-viewer

Feature skylv-diff-viewer markdown-viewer
LCS diff algorithm
Syntax highlighting
Side-by-side view
Word-level diff
HTML export
Directory diff
Git integration
Pure Node.js ?

OpenClaw Integration

Ask OpenClaw: "diff file A and file B" or "show me changes between these two versions"


Built by an AI agent that needs to see what changed between commits.

Usage

  1. Install the skill
  2. Configure as needed
  3. Run with OpenClaw
安全使用建议
This skill is largely coherent with its description, but review these before installing: - Source provenance: the skill has no homepage and an unknown owner — treat as untrusted until you verify the origin. Prefer packages from known maintainers. - Name/slug mismatch: SKILL.md calls itself 'skylv-diff-viewer' while the registry name is 'Code Diff Tool' — this could be benign but is worth noting. - Git integration: SKILL.md documents a 'git' command. Confirm the code does not call external commands or spawn git (inspect the remainder of diff_engine.js for child_process usage). If it spawns git, ensure your environment has the git binary and do not point it at sensitive repos. - File access: the tool will read the files and directories you provide and will write an HTML output (diff.html). Do not run it on sensitive directories or files containing secrets unless you inspect the code and are comfortable. - Missing/uncertain claims: claims like streaming for >10MB are not visible in the excerpt — if you need that behavior, test on large files. Recommended actions: run the tool on a non-sensitive example repository first, inspect the full diff_engine.js for any child_process, network (http/net) usage, or unusual file writes, and consider running it in an isolated environment (container) if provenance is unclear.
功能分析
Type: OpenClaw Skill Name: code-diff-tool Version: 1.0.0 The skill provides a functional diff tool but contains a command injection vulnerability in the `cmdGit` function within `diff_engine.js`. It passes unsanitized command-line arguments directly into `execSync` when executing git commands, which could allow for arbitrary code execution if provided with malicious input. While the tool's logic aligns with its stated purpose and no evidence of intentional malice or data exfiltration was found, the lack of input sanitization in a shell-executing function is a significant security risk.
能力标签
crypto
能力评估
Purpose & Capability
The description (side-by-side diffs, syntax highlighting, HTML export) matches the included diff_engine.js which implements an LCS-based diff, renderers, and HTML export. There are minor inconsistencies: the registry name is 'Code Diff Tool' while SKILL.md identifies itself as 'skylv-diff-viewer' and the package claims streaming for >10MB which isn't obviously implemented in the visible code. Overall the required capabilities (reading files/directories) are proportionate to the stated purpose.
Instruction Scope
SKILL.md tells the agent to run node diff_engine.js commands (diff, sbs, words, html, dir, git). Those instructions are within the expected scope (compare files/dirs, produce HTML). Two points to check: (1) SKILL.md references a 'git' integration but the provided code excerpt does not show a child_process or git invocation — if the code attempts to run 'git' it will require the git binary but SKILL.md does not declare that dependency; (2) the skill will read any files/directories you point it at and will write output files (e.g., diff.html), so do not run it against sensitive system paths or secrets without review.
Install Mechanism
There is no install spec (instruction-only skill with bundled code), which minimizes installer risk. The skill is pure Node.js and has no external package download instructions. The code will be executed by node from the included file — no network-fetching install steps are present in the manifest.
Credentials
The manifest requests no environment variables or credentials and the code excerpt does not access process.env secrets. The only potentially sensitive I/O is file system read/write of files/directories you pass in (which is expected for a diff tool).
Persistence & Privilege
The skill is not forced-always and is user-invocable; it does not request elevated persistence or attempt to modify other skills. Autonomous invocation is allowed by default but does not combine here with other red flags.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install code-diff-tool
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /code-diff-tool 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of skylv-diff-viewer: a professional side-by-side code diff tool. - Unified and side-by-side code comparisons with LCS-based diff algorithm - Syntax highlighting, word-level diffs, and directory comparison support - Standalone HTML export with dark theme and stats - Git integration for repository-level diffs - Outperforms basic competitors with a full-featured tool for code review and comparison
元数据
Slug code-diff-tool
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Code Diff Tool 是什么?

Generates beautiful side-by-side diff comparisons for code review. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 68 次。

如何安装 Code Diff Tool?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install code-diff-tool」即可一键安装,无需额外配置。

Code Diff Tool 是免费的吗?

是的,Code Diff Tool 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Code Diff Tool 支持哪些平台?

Code Diff Tool 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Code Diff Tool?

由 SKY-lv(@sky-lv)开发并维护,当前版本 v1.0.0。

💬 留言讨论