topiary

topiary is a skill for Claude Code, Codex from vinnie357/claude-skills. It costs 40 tokens per session (2,240 once invoked), scanned A, original, MIT.

A code formatter that uses syntax-tree queries to define formatting rules. A syntax tree is a structured representation of code that shows how its parts fit together.

In plain words
What is it for?
Use it to format supported code, create custom Tree-sitter query files, and configure formatting through languages.ncl.
Why use it?
It can format languages that do not have their own dedicated formatter. Formatting rules can be described in reusable query files instead of writing a separate formatter for each language.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Part of the tweag plugin — 2 skills shipped together

Good fit Use it to format supported code, create custom Tree-sitter query files, and configure formatting through languages.ncl.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vinnie357/claude-skills/topiary
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.

Any agent
npx skills add vinnie357/claude-skills --skill topiary
Clone the repo
git clone --depth 1 https://github.com/vinnie357/claude-skills

Made for: Claude Code, Codex.

Or install tweag, the plugin that ships this one along with the rest of its 2 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for topiary

README.md
[![agentmods](https://agentmods.dev/badge/skills/vinnie357/claude-skills/topiary/github.svg)](https://agentmods.dev/skills/vinnie357/claude-skills/topiary)
Your own site
<a href="https://agentmods.dev/skills/vinnie357/claude-skills/topiary"><img src="https://agentmods.dev/badge/skills/vinnie357/claude-skills/topiary/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for topiary

Your own site · 80×15
<a href="https://agentmods.dev/skills/vinnie357/claude-skills/topiary"><img src="https://agentmods.dev/badge/skills/vinnie357/claude-skills/topiary.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,240 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Rogue Agent · line 125
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
How audits are shown
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.1 $0.00040 $0.02240
Opus 5 $0.00020 $0.01120
Sonnet 5 $0.00008 $0.00448
Haiku 4.5 $0.00004 $0.00224

Measured 6d ago against content hash 0cf50cf2fe00, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

topiary 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 6d 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.

plugins/tools/tweag/skills/topiary/SKILL.md · 367 lines

How it starts

The opening of the file, as written. The whole thing — 367 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Topiary

Topiary is a universal code formatter that uses Tree-sitter grammars and queries to define formatting rules. Rather than implementing language-specific formatting logic, Topiary uses declarative Tree-sitter query files (.scm) to specify how code should be formatted.

Key Concepts

Tree-Sitter Queries

Tree-sitter is a parser generator that creates language parsers from grammar definitions. Topiary uses Tree-sitter queries to analyze code structures and apply formatting rules. Queries match patterns in the syntax tree using S-expression syntax and decorate matched nodes with capture names (prefixed with @) that describe formatting actions.

Query Files and Capture Names

Language formatting is defined in .scm (Scheme) query files. Each capture name instructs Topiary how to format the matched node:

  • Line breaks: @prepend_hardline, @append_hardline (always insert newline), @prepend_empty_softline, @append_empty_softline (newline or nothing), @prepend_spaced_softline, @append_spaced_softline (newline or space)
  • Indentation: @prepend_indent_start, @append_indent_start, @prepend_indent_end, @append_indent_end (mark indentation scopes)
  • Spacing: @prepend_space, @append_space (add single space)
  • Control: @delete (remove matched node), @do_nothing (suppress default behavior), @leaf (prevent formatting within node)
  • Input-aware: @prepend_input_softline, @append_input_softline (preserve original line break presence)

Idempotency

Topiary formatting is idempotent—running the formatter repeatedly on already-formatted code produces identical output. This guarantee allows safe integration into version control hooks and CI pipelines.

Author Intent Preservation

Topiary respects the structural intent of code by preserving language-specific semantics. It focuses on whitespace, indentation, and line breaks rather than restructuring code. This approach works especially well with languages whose semantics are simple and whitespace-independent.

Read the full file on GitHub · 367 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 6d ago First seen · 367 lines · 40 tokens per session scan A 0cf50cf2fe00

Subscribe to this mod's changes

topiary is a skill published in the GitHub repository vinnie357/claude-skills (25 stars, last pushed today), licensed MIT. It adds 40 tokens to every session and 2,240 once invoked, about $0.0002 per session on Opus 5. 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-09-04.