/php-structured-edit:php-structured-editfrom php-structured-edit
Use when changing PHP source: method or variable renames, declarations, statements, expressions, imports, literals and file creation/deletion. Provides guarded AST writes and project method discovery. Use ordinary search for reads; not for read-only questions or non-PHP edits.
Ships in php-structured-edit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Use php-ast-edit for PHP writes. Use the supplied executable directly, or resolve
repository bin/php-ast-edit, vendor/bin/php-ast-edit, PATH or this skill's wrapper
once. Correct rejected requests rather than falling back to text writes.
php-ast-edit rename --method 'Checkout::submit' --to placeOrder
Name the declaring class and method. The command discovers the file, captures its
hash, resolves the hierarchy and callers, and submits one transaction with configured
checks. Do not enumerate callers or submit one rename per declaration. Qualify the
class when ambiguous. For another project, pass one positional project path or
--path; use --file to narrow declaration discovery. Non-private methods require
Phpactor, including final classes;
missing or uncertain resolution is refused. --dry-run previews without writing.
In the default compact report, review diff, renames, open, verify and
checksPassed. The changed lines are included for review. PHP literals and
non-PHP mentions remain visible for task-specific decisions. --mocks also changes
listed PHPUnit method names regardless of mocked class; use it only when all listed
names mean this method. Use --report agent when no inline diff is needed.
Search normally; prefer a named selector. Use inspect only for unnamed nodes and
retain its ref and sha256. One variable rename needs no payload file:
php-ast-edit apply --file Checkout.php --select method:Checkout::submit --op rename_variable --from total --to amount
Use replace_expression or replace_statement with match/php within a named
method; add_member for members; add_use for imports. For unfamiliar operations,
read contexts --operation NAME. Qualify or import external types in PHP snippets.
Batch related edits in one apply:
php-ast-edit apply <<'JSON'
{"files":[{"path":"src/Registry.php","edits":[{"target":{"select":"class:Registry"},"operation":"add_member","php":"public function register(string $name): void {}"}]}]}
JSON
Include sha256 when relying on a read snapshot. After STALE_SOURCE, reread and
reassess; never drop the guard. Auto printing preserves formatting unless the project
declares canonical mode; normalization is optional.
Use "report":"agent" when a declared check's verdict is sufficient; apply otherwise
defaults to full. rename defaults to compact. full and compact include small edit
diffs; choose the report before writing, since Git diff cannot recover transaction history.
Read effects, warnings and verification. checks: "none_declared" or
checksPassed: null means no configured check ran. Parser success alone is not
application correctness. Repair failed checks; run additional checks the task needs.
alreadyRun names checks already satisfied on unchanged inputs: do not repeat them
or reread solely to reconfirm supplied byte evidence. Tests and hashes do not establish
reference completeness. Review unresolved facts and report the observed outcome.
parseAs, reports.agents/openai.yaml (opens in a new tab)evals/eval_queries.json (opens in a new tab)evals/evals.json (opens in a new tab)references/enforcement.md (opens in a new tab)references/formatting-contract.md (opens in a new tab)references/operations.md (opens in a new tab)scripts/php-ast-edit (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
php-structured-edit@netresearch-claude-code-marketplace is listed by netresearch/claude-code-marketplace — review the source before installing
npx claudepluginhub netresearch/claude-code-marketplace --plugin php-structured-edit