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.
npx agentmods add skills/rolandbrecht/agent-skills/structural-refactornpx skills add rolandbrecht/agent-skills --skill structural-refactorgit clone --depth 1 https://github.com/rolandbrecht/agent-skillsWrote 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.
[](https://agentmods.dev/skills/rolandbrecht/agent-skills/structural-refactor)<a href="https://agentmods.dev/skills/rolandbrecht/agent-skills/structural-refactor"><img src="https://agentmods.dev/badge/skills/rolandbrecht/agent-skills/structural-refactor.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00375 | $0.03707 |
| Opus 5 | $0.00187 | $0.01853 |
| Sonnet 5 | $0.00075 | $0.00741 |
| Haiku 4.5 | $0.00038 | $0.00371 |
Grade B, and why
structural-refactor scanned grade B with 2 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 5d 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.
Asks for rootmediumPrivilege escalation
A mod that escalates privileges can change anything on the machine, not only the project.
> `sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3` Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
**Structural find-and-replace across a codebase:** "replace all fetch(url, options) calls How it starts
The opening of the file, as written. The whole thing — 371 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Structural Code Refactoring
This skill covers three complementary tools for structural code transformation. Use the right one for the job — they're not competitors, they're specialists.
Pick the Right Tool
| Situation | Best tool |
|---|---|
| Cross-language pattern replace (JS, Go, SQL, HTML…) | comby |
| Rearrange/capture subexpressions across many files | comby |
| Python 2 → 3 migration (print, unicode, exec, dict…) | 2to3 |
| Modernizing Python 3 idioms (f-strings, type hints…) | pyupgrade |
| True AST analysis (dead code, call graphs, imports) | ast-code-graph skill |
| Simple string search | grep / ripgrep |
comby — Structural Search and Replace
comby understands code shape: balanced delimiters, string boundaries, comment regions.
Unlike sed, you write patterns that look like the code you're targeting.
Match: request.get(':[url]')
Rewrite: request({ url: ':[url]', method: 'get' })
Wins over grep/sed when:
- The pattern spans multiple lines or contains nested brackets
- The same text appears in comments/strings and you want to skip it
- You need to capture and rearrange subexpressions
- You're working across multiple languages in one pass
Installation
which comby # check first
brew install comby # macOS
bash <(curl -sL get-comby.netlify.app) # Ubuntu/Debian
cargo install comby # any platform
# Docker — no install, prefix every command with:
# docker run --rm -it -v "$PWD":/src -w /src comby/comby
Linux PCRE note: if comby complains about libpcre, run:
sudo ln -s /usr/lib/libpcre.so /usr/lib/libpcre.so.3
Hole Syntax
Holes are the wildcards in comby templates. Choose carefully to avoid over-matching.
| Hole | Matches | Use when |
|---|---|---|
:[x] |
Zero or more chars (lazy, respects delimiters) | General expressions, argument lists, bodies |
:[[x]] |
One or more word chars ([a-zA-Z0-9_]) |
Identifiers, variable names |
:[x~regex] |
PCRE regex | Constrained patterns (e.g., :[n~[0-9]+]) |
:[?x] |
Optional — can be absent | Optional arguments, trailing commas |
... or :[_] |
Unnamed match (discard) | Skipping parts you don't need |
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.
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.
- 5d ago First seen · 371 lines · 375 tokens per session scan B 90ba54ca90f3
structural-refactor is a skill published in the GitHub repository rolandbrecht/agent-skills (4 stars, last pushed 23d ago), licensed MIT. It adds 375 tokens to every session and 3,707 once invoked, about $0.0019 per session on Opus 5. A static security scan graded it B with 2 findings (asks for root, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
cocotrace
Build and query the SHA-256 requirements-to-implementation traceability graph across lifecycle artifacts.
context-add
Guided wizard to capture or update organizational Snowflake/Cortex standards into .cocoplus/context/ .md. Presents a menu of 6 standard types, collects answers via multi-turn dialogue, and commits the file.
lean-review
CocoLean diff-scoped over-engineering audit — scans uncommitted git diff and applies five classification tags (delete/stdlib/native/yagni/shrink) to identify unnecessary surface area before commit.
ops-demo
CocoOps demo mode activator — populates .cocoplus/ops/demo/ with realistic mock data and sets cocoplus.toml [demo] enabled = true. Invoked via $ops demo.
cocoplus-config
CocoPlus configuration SSOT — $cocoplus sync propagates cocoplus.toml into downstream artifacts; $cocoplus migrate-config converts legacy safety-config.json. Invoked via $cocoplus sync and $cocoplus migrate-config.
bloom-crystallize
CocoBloom crystallization — converts a successful ship execution trace into a reusable skill file. Requires recent successful $ship. Invoked via $bloom crystallize.