Agent skill

Add Renderer

by afnanenayet in afnanenayet/diffsitter

Step-by-step guide for adding a new diff output renderer to diffsitter.

MITAuto-check: notes

Install Add Renderer

skills CLI
$ npx skills add afnanenayet/diffsitter --skill add-renderer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install afnanenayet/diffsitter add-renderer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/afnanenayet/diffsitter.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/add-renderer .claude/skills/add-renderer && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
add-renderer
GitHub stars
2.4k
Token cost
~1.4k tokens
SKILL.md length
411 words
Files
1
Skills in repo
4
Repo updated
First seen
Licence
MIT

At a glance

Step-by-step guide for adding a new diff output renderer to diffsitter.

  • Works in 7 steps: Create the renderer module → Register the module in src/render/mod.rs → Add a variant to the Renderers enum → …
  • Adding a new output format
  • SKILL.md covers Prerequisites, Step-by-Step Checklist and Common Pitfalls
  • Calls cargo

What it does

Add Renderer is an agent skill from afnanenayet/diffsitter. Step-by-step guide for adding a new diff output renderer to diffsitter. Use when adding a new output format.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: A tree-sitter based AST difftool to get meaningful semantic diffs. The licence is MIT.

When your agent uses it

  • Adding a new output format

Example prompts

  • “/add-renderer”

Requirements

  • Pre-approved tools (allowed-tools): Read, Grep, Glob, Bash, Edit, Write

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Create the renderer module
  2. Register the module in src/render/mod.rs
  3. Add a variant to the Renderers enum
  4. Add a field to RenderConfig
  5. Update assets/sample_config.json5
  6. Add tests
  7. Build and test

What it can do on your machine

Read from SKILL.md and the folder at commit a5a6681. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Grep
    • Glob
    • Bash
    • Edit
    • Write

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • cargo

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Add Renderer loads about 1.4k tokens when it runs. Until then it costs about 30 tokens; SKILL.md has 411 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~30
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Grep, Glob, Bash, Edit, Write

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from afnanenayet/diffsitter at commit a5a6681, republished under its MIT licence (© afnanenayet). 411 words, ~1,438 tokens.

Download SKILL.mdSave it as .claude/skills/add-renderer/SKILL.md (or your agent's skills folder).
name
add-renderer
description
Step-by-step guide for adding a new diff output renderer to diffsitter. Use when adding a new output format.
allowed-tools
Read, Grep, Glob, Bash, Edit, Write
user-invocable
true
argument-hint
[name] Name of the new renderer (e.g., 'delta', 'html')

Adding a New Renderer to diffsitter

Follow this checklist to add a new diff output renderer named $ARGUMENTS. If the user did not provide a name, ask for one before proceeding.

Prerequisites

Read these files first to understand the existing patterns:

  • src/render/mod.rs -- trait definition, enum, config
  • src/render/json.rs -- minimal renderer example
  • src/render/unified.rs -- full-featured renderer example
  • src/config.rs -- top-level config struct
  • assets/sample_config.json5 -- sample config (CI parses this as a test)

Step-by-Step Checklist

Step 1: Create the renderer module

Create src/render/$ARGUMENTS.rs with a struct that derives the required traits:

rust
use super::DisplayData;
use crate::render::Renderer;
use console::Term;
use serde::{Deserialize, Serialize};
use std::io::Write;

/// A renderer that outputs diffs in $ARGUMENTS format.
#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Debug, Default)]
pub struct $ARGUMENTS_PASCAL_CASE {
    // Add configuration fields here.
    // Each field should be serializable for the config system.
}

impl Renderer for $ARGUMENTS_PASCAL_CASE {
    fn render(
        &self,
        writer: &mut dyn Write,
        data: &DisplayData,
        term_info: Option<&Term>,
    ) -> anyhow::Result<()> {
        // Implementation goes here.
        // `data.hunks` contains `RichHunks` (Vec<RichHunk> where RichHunk = DocumentType<Hunk>)
        // `data.old` and `data.new` contain DocumentDiffData { filename, text }
        // `term_info` provides terminal dimensions if the output is a TTY
        todo!()
    }
}

Key types available in DisplayData:

  • data.hunks.0 -- Vec<RichHunk<'a>> where RichHunk is DocumentType<Hunk>
  • Each Hunk contains Vec<Line>, each Line has line_index: usize and entries: Vec<&Entry>
  • Each Entry has text: Cow<str>, start_position: Point, end_position: Point, kind_id: u16
  • DocumentType::Old(hunk) / DocumentType::New(hunk) distinguishes old vs new document hunks

Use src/render/json.rs as a minimal reference (just serializes DisplayData to JSON). Use src/render/unified.rs for a full-featured example with terminal colors, hunk titles, and line-by-line rendering.

Step 2: Register the module in src/render/mod.rs

Add the module declaration and use statement near the top:

rust
mod $ARGUMENTS;
use self::$ARGUMENTS::$ARGUMENTS_PASCAL_CASE;

These go alongside the existing:

rust
mod json;
mod unified;
use self::json::Json;
use unified::Unified;
Step 3: Add a variant to the Renderers enum

Add your variant to the Renderers enum in src/render/mod.rs:

rust
#[enum_dispatch]
#[derive(Clone, Eq, PartialEq, Debug, Serialize, Deserialize, Display, EnumIter, EnumString)]
#[strum(serialize_all = "snake_case")]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum Renderers {
    Unified,
    Json,
    $ARGUMENTS_PASCAL_CASE,  // <-- add this
}

The enum_dispatch attribute automatically generates the Renderer trait dispatch for the new variant. The strum and serde derives handle string conversion and serialization using the snake_case name.

Step 4: Add a field to RenderConfig

In src/render/mod.rs, add a field to RenderConfig:

rust
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
#[serde(rename_all = "snake_case", default)]
pub struct RenderConfig {
    default: String,
    unified: unified::Unified,
    json: json::Json,
    $ARGUMENTS: $ARGUMENTS::$ARGUMENTS_PASCAL_CASE,  // <-- add this
}

Update the Default impl for RenderConfig:

rust
impl Default for RenderConfig {
    fn default() -> Self {
        let default_renderer = Renderers::default();
        RenderConfig {
            default: default_renderer.to_string(),
            unified: Unified::default(),
            json: Json::default(),
            $ARGUMENTS: $ARGUMENTS_PASCAL_CASE::default(),  // <-- add this
        }
    }
}
Show full SKILL.md (172 more words)Show less
Step 5: Update assets/sample_config.json5

Add a section for the new renderer's configuration under the "formatting" key. CI parses this file as a test (test_sample_config in src/config.rs), so it must be valid.

Step 6: Add tests

At minimum:

  1. Add a #[test_case("$ARGUMENTS")] line to the test_get_renderer_custom_tag test in src/render/mod.rs:
rust
#[test_case("unified")]
#[test_case("json")]
#[test_case("$ARGUMENTS")]  // <-- add this
fn test_get_renderer_custom_tag(tag: &str) {
  1. Add unit tests in your renderer module for any non-trivial logic.

  2. Consider adding snapshot tests with insta if the output format is complex.

Step 7: Build and test
sh
cargo build
cargo test --all

If you updated sample_config.json5, the test_sample_config test will verify it parses correctly.

Common Pitfalls

  • Forgetting Default derive/impl: The RenderConfig uses #[serde(default)], so your struct must implement Default.
  • Case sensitivity: The Renderers enum uses snake_case serialization via strum/serde. Your variant MyRenderer becomes "my_renderer" as a string tag.
  • The writer is generic: Don't assume stdout. The renderer receives &mut dyn Write which could be a buffered terminal, a pager, or a file.
  • term_info may be None: If the output is piped or redirected, there is no terminal. Handle gracefully (see how unified.rs handles missing terminal width).

© afnanenayet, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/add-renderer of afnanenayet/diffsitter.

Open the folder on GitHubat commit a5a6681

Compare with similar skills

Add Renderer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Add Renderer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Add Renderer this skillafnanenayet/diffsitter2.4k—~1.4kAutomated safety check: NotesMIT
Diffsopenclaw/openclaw392k4 repos~461Automated safety check: PassMIT
@pierre/diffs Code Renderingpierrecomputer/pierre6.3k2 repos~803Automated safety check: PassApache-2.0
Diff Reviewnexu-io/open-design100k—~508Automated safety check: PassApache-2.0
Render Blockingthedaviddias/Front-End-Checklist74k—~430Automated safety check: PassMIT
Accesslint Diffsickn33/agentic-awesome-skills47k1 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • Diffs

    openclaw/openclaw

    Use the diffs tool to produce real, shareable diffs (viewer URL, file artifact, or both) instead of manual edit summaries.

    392k GitHub starsUsed in 4 repos~461 tokens
    Auto-check passed
  • @pierre/diffs Code Rendering

    pierrecomputer/pierre

    Guides an agent through using @pierre/diffs to render syntax-highlighted files and diffs, and to build editing and review surfaces in React or plain JavaScript.

    6.3k GitHub starsUsed in 2 repos~803 tokens
    DevelopmentAuto-check passed
  • Diff Review

    nexu-io/open-design

    Render the patch-edit run's accumulated changes as a reviewable diff, surface it through a GenUI choice surface, and persist the user's accept / reject decision into the artifact manifest.

    100k GitHub stars~508 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Render Blocking

    thedaviddias/Front-End-Checklist

    A skill your agent uses when auditing slow page loads, heavy assets, or rendering delays related to Eliminate render-blocking resources.

    74k GitHub stars~430 tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • Accesslint Diff

    sickn33/agentic-awesome-skills

    Diff a live page's accessibility violations against a baseline — by default compares uncommitted changes (stash-based), or pass --branch [<name] to diff against a branch.

    47k GitHub starsUsed in 1 repo~1.2k tokens
    Frontend & DesignAuto-check passed
  • Render

    LeoYeAI/openclaw-master-skills

    Deploy and operate apps on Render (Blueprint + one-click Dashboard deeplink, same flow as Codex render-deploy).

    2.2k GitHub stars~4.8k tokensUpdated 2 mo ago
    Productivity & AutomationAuto-check passed

More from afnanenayet/diffsitter

  • Add Grammar

    afnanenayet/diffsitter

    Step-by-step guide for adding a new tree-sitter language grammar to diffsitter.

    2.4k GitHub stars~1.9k tokensUpdated yesterday
    Auto-check: notes
  • Debug Diff

    afnanenayet/diffsitter

    Diagnose unexpected diff output by tracing the pipeline from parsing through AST processing to hunk generation.

    2.4k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check: notes
  • Rust Expert

    afnanenayet/diffsitter

    Expert Rust guidance for diffsitter: tree-sitter FFI patterns, lifetime management, unsafe optimization, edition 2024 idioms.

    2.4k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check: notes

Questions about Add Renderer

What does Add Renderer do?

Step-by-step guide for adding a new diff output renderer to diffsitter. Add Renderer is an agent skill from afnanenayet/diffsitter. Step-by-step guide for adding a new diff output renderer to diffsitter.

When should I use Add Renderer?

Add Renderer fits situations like: adding a new output format.

How do I install Add Renderer in Claude Code?

Run `npx skills add afnanenayet/diffsitter --skill add-renderer -a claude-code`. Or copy the skill folder (.claude/skills/add-renderer in afnanenayet/diffsitter) into .claude/skills/add-renderer in your project. Claude Code loads it when a task matches its description.

How do I install Add Renderer in Codex?

Run `npx skills add afnanenayet/diffsitter --skill add-renderer -a codex`. Or copy the skill folder (.claude/skills/add-renderer in afnanenayet/diffsitter) into .agents/skills/add-renderer in your project. Codex loads it when a task matches its description.

Can I use Add Renderer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add afnanenayet/diffsitter --skill add-renderer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-renderer, .gemini/skills/add-renderer, .github/skills/add-renderer and .opencode/skills/add-renderer in your project.

What does Add Renderer need to run?

Going by SKILL.md and its folder, Add Renderer needs the command-line tools its instructions call (cargo). Its frontmatter pre-approves these tools: Read, Grep, Glob, Bash, Edit, Write.

Does Add Renderer access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Add Renderer safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Add Renderer use?

Add Renderer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Add Renderer use?

About 1.4k tokens (SKILL.md is roughly 5.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Add Renderer?

Skills that share tags, products or a category with Add Renderer: Diffs (openclaw/openclaw, 392k stars), @pierre/diffs Code Rendering (pierrecomputer/pierre, 6.3k stars), Diff Review (nexu-io/open-design, 100k stars) and Render Blocking (thedaviddias/Front-End-Checklist, 74k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Add Renderer?

afnanenayet (a GitHub user) maintains it in afnanenayet/diffsitter, which has 2,405 GitHub stars. The repository holds 4 skills in this directory. The repository was last updated on October 9, 2026.

Source: afnanenayet/diffsitter on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.