一键导入
add-wp-function
Add a WordPress function replacement. Full workflow from WP source to Rust implementation, testing, and registration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add a WordPress function replacement. Full workflow from WP source to Rust implementation, testing, and registration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Benchmark a change to prove it is faster. Runs Criterion and PHP benchmarks before and after, compares results, and rejects regressions.
Debug when a Rust implementation produces different output than the WordPress fixture. Identifies the exact behavioral difference and fixes it.
Profile WordPress to identify functions suitable for Rust replacement.
Build the extension for PHP 8.3, install in the WordPress profiling stack, and verify it works end-to-end.
| name | add-wp-function |
| description | Add a WordPress function replacement. Full workflow from WP source to Rust implementation, testing, and registration. |
| disable-model-invocation | true |
| argument-hint | [function_name] |
Start the profiling stack, find and read the source:
cd profiling && docker compose up -d
docker compose exec php-fpm php -d memory_limit=512M -r "
require '/var/www/html/wp-load.php';
\$ref = new ReflectionFunction('$ARGUMENTS');
echo \$ref->getFileName() . ':' . \$ref->getStartLine() . '-' . \$ref->getEndLine();
"
Document: operations in order, whether it calls apply_filters (and filter name), whether pluggable, dependencies, edge cases.
Create php/fixture-generator/functions/$ARGUMENTS.php following the pattern of existing definitions.
Generate: docker compose -f profiling/docker-compose.yml exec php-fpm php -d memory_limit=512M /app/php/fixture-generator/generate.php --function=$ARGUMENTS --output=/app/fixtures/
Add to the appropriate module (escaping/, kses/, formatting/, sanitize/, pluggable/). Follow the patterns in existing implementations. Include a matches_wordpress_fixtures test.
Add #[php_function] + wrap_function!() in lib.rs. Follow existing function patterns:
patina_* version (always)_filtered version with apply_filters callback (if WP function uses filters)OVERRIDES if non-pluggablephp/tests/ extending FixtureTestCasefuzz/fuzz_targets/ + [[bin]] in fuzz/Cargo.tomlmake check
cargo +nightly fuzz run fuzz_$ARGUMENTS -- -max_total_time=30