new-ability
Scaffold a new ability with PHP backend, JS chat interface, and test case
SKILL.md.claude/skills/new-ability/SKILL.md
GitHubScaffold New Ability: $ARGUMENTS
Before starting
Read these for the full patterns:
- An existing ability PHP file (e.g.,
includes/abilities/cache-flush.php) - An existing ability JS file (e.g.,
src/extensions/abilities/cache-flush.js) docs/ABILITIES-GUIDE.mdfor parseIntent, confirmation, and annotation details
Steps
PHP backend — create
includes/abilities/$ARGUMENTS.php:- Use
register_agentic_ability( 'agentic-admin/$ARGUMENTS', $php_config, $js_config ) - Include
permission_callbackwith appropriatecurrent_user_can()check - Include
input_schemawith top-leveldefaultfield - Include
output_schema - Set
annotations:readonly,destructive,idempotent - Implement
execute_callbackreturning{ success: bool, message: string, ... }
- Use
JS chat interface — create
src/extensions/abilities/$ARGUMENTS.js:- Use
registerAbility( 'agentic-admin/$ARGUMENTS', { ... } ) - Include:
label(string literal),description(string literal),keywords(array),initialMessage,summarize(),interpretResult(),execute() - Set
requiresConfirmationbased on whether the ability is destructive
- Use
Register — add import and call in
src/extensions/abilities/index.jsTest case — add at least one test case in
tests/abilities/core-abilities.test.jsLint — run
npx wp-scripts lint-json the new JS file andcomposer linton the new PHP fileVerify — run
npm run test:abilities -- --file tests/abilities/core-abilities.test.jsto confirm the model selects the new ability correctly