PHP Structured Edit
PHP-Änderungen über den AST statt über Regex oder sed: typisierte Operationen auf nikic/php-parser, Hash-Guards, erneutes Parsen vor dem Schreiben.
Installation
Nimm den Weg, der zu deinem Projekt passt — alle führen zum selben Skill.
-
Claude Code über diesen Marketplace /plugin install php-structured-edit@netresearch-claude-code-marketplace -
npx beliebige Agent-Skills-CLI npx skills add https://github.com/netresearch/php-ast-edit-skill --skill php-structured-editUniverselle Agent-Skills-CLI von
skills.sh— funktioniert in Claude Code, Cursor, GitHub Copilot, Codex, Gemini CLI und 30+ weiteren Agents. -
composer require PHP-Projekt, als Paket composer require netresearch/php-ast-edit-skillSetzt
netresearch/composer-agent-skill-pluginvoraus — bindet Agent Skills als Composer-Dependencies in PHP-Projekte ein, erkennt Skills automatisch, generiert AGENTS.md. -
composer skills:add PHP-Projekt, direkte Quelle composer skills:add github:netresearch/php-ast-edit-skillKommt aus
netresearch/composer-agent-skill-plugin— pinnt Skill-Repos direkt ohne Packagist-Veröffentlichung, persistiert incomposer.skills.lock.
Wofür du den Skill einsetzt
- Edits PHP through its AST rather than regex, sed or patch, so a rename hits the identifier and not the same-named string literal beside it
- Ten typed operations on nikic/php-parser, guarded by SHA-256 and expected node type, reparsed before write
- Ships the php-ast-edit CLI
Was du zurückbekommst
- An inspect JSON document: file SHA-256 plus the AST ancestry at the requested position, smallest node first.
- A mutated PHP file, canonically printed and reparsed before the write.
- A structured failure (STALE_SOURCE, expectation mismatch, detached target) when a guard rejects the transaction — the file is left untouched.
Was der Skill im Projekt erwartet
- PHP 8.2+ with ext-json and ext-tokenizer.
- nikic/php-parser 5.8+ — via composer install, or bundled in the release PHAR.
- Write access to the target working tree. No external network access.