php-structured-edit
Installation
SKILL.md
PHP Structured Edit
Use normal repository discovery to find the intended code. This skill controls mutation only.
Workflow
- Locate the relevant PHP code using the normal search tools.
- Run
scripts/php-ast-edit inspectat a byte offset or line/column inside the target syntax. - Choose the narrowest useful AST node from the returned ancestry.
- Send all edits for one file in a single
applytransaction when practical. Include the SHA-256 returned byinspect; later edits fail if an earlier edit detached their target node. - Use compact syntactically valid PHP snippets. Do not spend tokens formatting snippets; the printer canonicalizes output.
- Run the project's formatter and normal validation after the AST transaction.
Do not use raw text replacement for syntactic PHP. For foreign code stored inside a PHP string, target the Scalar_String node and use set_string unless a dedicated nested-language editor is available.