wp-abilities-api_skill

This skill guides implementing the WordPress Abilities API, including registration, REST exposure, and client consumption for secure permissions.
  • JavaScript

159

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill automattic/agent-skills --skill wp-abilities-api

  • SKILL.md3.6 KB

Overview

This skill helps engineers implement and debug the WordPress Abilities API end-to-end. It covers registering abilities and categories in PHP, exposing them via the REST endpoints, and consuming or checking abilities in client-side JavaScript using @wordpress/abilities.

How this skill works

The skill inspects the codebase for PHP registration calls (wp_register_ability, wp_register_ability_category) and REST usage under wp-abilities/v1, plus JS imports of @wordpress/abilities. It guides where to register categories and abilities, which meta flags to set (notably show_in_rest and readonly), verifies REST exposure, and outlines common failure modes and fixes.

When to use it

  • Adding new abilities or categories to a plugin, theme, or core work.
  • Exposing server-side abilities to client apps via the REST API.
  • Troubleshooting abilities that do not appear in REST responses or JS checks.
  • Migrating projects to use @wordpress/abilities for client-side permission checks.
  • Ensuring compatibility on sites targeting WordPress versions before Abilities support in core.

Best practices

  • Use stable, namespaced IDs for abilities and a clear category to avoid collisions.
  • Set meta.show_in_rest = true for any ability clients must consume; use readonly for informational flags.
  • Register abilities on the documented init hooks so registration code always runs.
  • Prefer @wordpress/abilities on the client and ensure your build bundles that dependency.
  • Run REST checks in a local WP environment and clear caches when results differ from expectations.

Example use cases

  • Register a new ability in a plugin and expose it so a React admin app can hide/show UI.
  • Add an ability category for a custom feature set to group related permissions.
  • Fix a missing ability by enabling show_in_rest and correcting the registration hook.
  • Update client code to consume abilities via @wordpress/abilities instead of custom REST parsing.
  • Validate Abilities API availability when supporting sites running older WordPress versions.

FAQ

Confirm meta.show_in_rest is true, the registration runs on the correct init hook, and you are querying the correct wp-abilities/v1 endpoint; also clear caches.

Do I always need @wordpress/abilities on the client?

It is recommended for consistent checks and helpers, but you can consume the REST endpoint directly if you cannot add the package to your build.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
wp-abilities-api skill by automattic/agent-skills | VeilStrat