Help us improve
Share bugs, ideas, or general feedback.
From patchwork
AST-native code transformation CLI for structural find, replace, delete, and insert across multiple languages. Use instead of sed/regex for renaming functions, changing API signatures, or deleting logging statements.
npx claudepluginhub thatxliner/claude-plugins --plugin patchworkHow this skill is triggered — by the user, by Claude, or both
Slash command
/patchwork:patchworkThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
AST-native sed. Find, replace, delete, and insert code by structure, not regex.
Creates p5.js generative art with seeded randomness, noise fields, and interactive parameter exploration. Use for algorithmic art, flow fields, or particle systems.
Share bugs, ideas, or general feedback.
AST-native sed. Find, replace, delete, and insert code by structure, not regex.
Use patchwork instead of sed/grep/regex when:
Do NOT use for: simple string replacements, non-code files, languages not supported.
Java, Python, JavaScript, TypeScript, TSX, Rust, Go, Ruby, C, C++, C#, PHP, Bash
| Command | Effect |
|---|---|
find | Print file:line:col for each match |
replace | Replace matched code with new code |
delete | Remove matched code |
insert-before | Insert code before each match |
insert-after | Insert code after each match |
nodes | List available tree-sitter node kinds for a language |
$name — matches any single AST node (identifier, literal, expression)$name:Kind — matches only nodes of specific tree-sitter kind (e.g., $x:identifier, $n:string_literal)| Token | Matches |
|---|---|
$BODY | Zero or more statements inside a block |
$STMT | A single statement of any kind |
$EXPR | A single expression |
$($name)sep* — Rust-style repetition with separator awareness (zero or more)$($name)sep+ — one or more$($a, $b)sep* — multi-item repetition groups$$$name — position-independent catch-all (no separator tracking)# Rename method across files
patchwork replace -i -p 'getOldData($a)' -r 'getData($a)' src/**/*.java
# Delete all debug calls
patchwork delete -i -p 'debug($msg)' src/*.py
# Find return statements
patchwork find -p 'return $val;' src/
# Match function calls with any number of args (separator-aware)
patchwork find -p '$f($($arg,)*);' src/
# Find all if statements
patchwork find -p 'if ($EXPR) { $BODY }' src/
# Replace with arg reordering
patchwork replace -i -p '$f($a, $b)' -r '$f($b, $a)' src/*.py
# Match only identifiers (not property access) on LHS
patchwork find -p '$x:identifier = $val;' src/
# List node kinds for type constraints
patchwork nodes java
patchwork nodes python --all # include punctuation/operators
-i, --in-place — modify files directly (like sed -i)-l, --language — force language detection-p, --pattern — code snippet pattern-q, --query — tree-sitter query (advanced)-r, --replacement — replacement code (for replace)--code — code to insert (for insert-before/insert-after)cat Main.java | patchwork find -l java -p 'return null;'
$$$name doesn't match statements inside blocks (use $BODY)