diff

A command that compares two SKILL.md files section by section, including their metadata and instruction text. It reports added, removed, and changed content.

In plain words
What is it for?
Use it to review edits, compare variants, or produce a short or machine-readable change report.
Why use it?
It makes differences between two versions or related skills easier to review than reading both files manually.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/rolecraft-sh/rolecraft/diff
Clone the repo
git clone --depth 1 https://github.com/rolecraft-sh/rolecraft
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 686 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00686
Opus 5 $0.00000 $0.00343
Sonnet 5 $0.00000 $0.00137
Haiku 4.5 $0.00000 $0.00069

Measured 2d ago against content hash 4012ae7bd4bd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

diff scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/commands/diff.md · 101 lines

What it actually says

rolecraft diff

Compare two SKILL.md files section-by-section. Parses frontmatter and body sections independently, showing exactly what changed.

Usage

rolecraft diff <skill-a> <skill-b>          # Full diff output
rolecraft diff <skill-a> <skill-b> --brief  # Summary only
rolecraft diff <skill-a> <skill-b> --json   # Machine-readable JSON

Options

Flag Description
--json Machine-readable JSON output
--brief Summary only (which fields/sections changed)
--context <N> Context lines around changes (default: full)
--no-color Disable ANSI colors

How it works

  1. Parse both SKILL.md files (frontmatter + body)
  2. Compare frontmatter fields key-by-key → show added/removed/changed
  3. Split body into sections by ## headings
  4. For each section heading present in both files:
    • Compare lines line-by-line (using set diff)
    • Tags: - (removed), + (added)
  5. Sections in only one file → marked as added/removed
  6. Output with color (red: removed, green: added)

Examples

$ rolecraft diff ./frontend.SKILL.md ./backend.SKILL.md

=== ./frontend.SKILL.md → ./backend.SKILL.md ===

--- Frontmatter Changes ---
  --- name:
  - Skill A
  + Skill B
  --- agents:
  - cursor
  + cursor, claude

--- Section Changes ---

## Code Style
-Lint with ESLint
+Lint with Biome

## Testing (added)
+Write unit tests
+Aim for 80% coverage

## Configuration (removed)
-Set key in config

Summary: 1 changed, 1 added, 1 removed, 2 unchanged, 2 frontmatter changes
$ rolecraft diff ./a.SKILL.md ./b.SKILL.md --brief

=== ./a.SKILL.md → ./b.SKILL.md ===

Frontmatter changes:
  name: A → B
  agents: cursor → cursor, claude

Sections:
  ~ Code Style (+2, -1)
  + Testing (+3)
  - Configuration (-2)

Summary: 1 changed, 1 added, 1 removed
$ rolecraft diff ./identical.SKILL.md ./copy.SKILL.md --json

Node.js API

import { diff } from 'rolecraft'

const result = await diff('./a.SKILL.md', './b.SKILL.md')
// {
//   a: './a.SKILL.md',
//   b: './b.SKILL.md',
//   frontmatter: { name: { from: 'A', to: 'B' }, ... },
//   sections: [
//     { heading: 'Code Style', status: 'changed', added: [...], removed: [...] },
//     { heading: 'Testing', status: 'added', added: [...], removed: [] },
//   ],
//   stats: { changedSections: 1, addedSections: 1, removedSections: 1, ... }
// }
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 101 lines · 0 tokens per session scan A 4012ae7bd4bd

Subscribe to this mod's changes

diff is a command published in the GitHub repository rolecraft-sh/rolecraft (75 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 686 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.