lw-site-manager-extend-abilities
Installation
SKILL.md
LW Site Manager: extending with custom abilities
For developers shipping a companion plugin that adds abilities to the LW Site Manager hub — without forking, without registering a parallel namespace. The plugin exposes a small but precise extension contract: two action hooks plus a reusable abstract registrar. Done right, your custom abilities appear seamlessly in the hub's catalog with consistent meta annotations and capability checks; done wrong, they look like an unrelated plugin that happens to share a prefix.
Misconception this skill corrects
"I'll just call
wp_register_ability('site-manager/my-thing', [...])directly onwp_abilities_api_init— same outcome."
It registers the ability, yes. But it bypasses the plugin's central infrastructure:
- No shared
PermissionManager— yourpermission_callbackis some inlinecurrent_user_can('edit_posts')rather than the typed$permissions->callback('can_edit_posts'). When WP shifts a capability mapping (rare but happens — comment editing migrated cap), every ability that calledcurrent_user_candirectly needs its own update; abilities routed throughPermissionManagerget the fix in one place. - No
AbstractAbilitiesRegistrarhelpers — meta annotations (readonly/destructive/idempotent) and output envelope shapes (success / list / entity / bulk-result / update-result) become whatever you remembered to build by hand. Surface looks heterogeneous to AI agents; some abilities tagreadonly: truefor read endpoints, yours doesn't, agent doesn't realize a "list" is safe to retry. - Wrong category — if you forget
categoryor set one the plugin's category map doesn't recognize, the ability registers but doesn't appear in the plugin's grouped admin UI / catalog views.
The contract is two action hooks + one abstract class to extend. Verified at:
lw_site_manager_register_categoriesaction — lw-site-manager.php:232. Fires inside the plugin's category-init hook AFTER its own categories register, so external categories don't collide with built-in ones.lw_site_manager_register_abilitiesaction — src/Abilities/Registrar.php:48. Fires AFTER the plugin's own four registrars run, with thePermissionManagerinstance as the only argument:do_action( 'lw_site_manager_register_abilities', $this->permissions );.