jpskill.com
🛠️ 開発・MCP コミュニティ

wp-abilities-api

Use when working with the WordPress Abilities API (wp_register_ability, wp_register_ability_category, /wp-json/wp-abilities/v1/*, @wordpress/abilities) including defining abilities, categories, meta, REST exposure, and permissions checks for clients.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o wp-abilities-api.zip https://jpskill.com/download/17344.zip && unzip -o wp-abilities-api.zip && rm wp-abilities-api.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17344.zip -OutFile "$d\wp-abilities-api.zip"; Expand-Archive "$d\wp-abilities-api.zip" -DestinationPath $d -Force; ri "$d\wp-abilities-api.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して wp-abilities-api.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → wp-abilities-api フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
3

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

WP Abilities API

どのような時に使うか

このスキルは、以下のようなタスクに関わる場合に使用します。

  • PHP で ability または ability カテゴリを登録する。
  • REST (wp-abilities/v1) 経由で ability をクライアントに公開する。
  • JS (特に @wordpress/abilities) で ability を利用する。
  • 「ability が表示されない」「クライアントが ability を見ることができない」「REST が空を返す」といった問題を診断する。

必要な入力

  • リポジトリのルート (まだの場合は、最初に wp-project-triage を実行してください)。
  • 対象の WordPress バージョンと、これが WP core なのか、プラグイン/テーマなのか。
  • 変更をどこに配置するか (プラグイン vs テーマ vs mu-plugin)。

手順

1) 可用性とバージョンの制約を確認する

  • これが WP core の作業である場合は、signals.isWpCoreCheckoutversions.wordpress.core を確認してください。
  • プロジェクトが WP < 6.9 を対象とする場合、core に依存するのではなく、Abilities API プラグイン/パッケージが必要になる場合があります。

2) 既存の Abilities の使用箇所を探す

リポジトリ内で以下を検索します。

  • wp_register_ability(
  • wp_register_ability_category(
  • wp_abilities_api_init
  • wp_abilities_api_categories_init
  • wp-abilities/v1
  • @wordpress/abilities

何も存在しない場合は、Abilities API を新たに導入するのか (新しい登録 + クライアントでの利用)、それとも利用のみなのかを決定します。

3) カテゴリを登録する (オプション)

論理的なグループ分けが必要な場合は、早い段階で ability カテゴリを登録します ( references/php-registration.md を参照)。

4) ability を登録する (PHP)

PHP での ability の登録を以下のように実装します。

  • 安定した id (名前空間付き)。
  • label/description
  • category
  • meta:
    • ability が情報提供のみの場合は、readonly: true を追加します。
    • クライアントに表示したい ability については、show_in_rest: true を設定します。

適切なタイミングでロードされるように、Abilities API 登録のためにドキュメント化された init フックを使用します ( references/php-registration.md を参照)。

5) REST 公開を確認する

  • REST エンドポイントが存在し、期待される結果を返すことを確認します ( references/rest-api.md を参照)。
  • クライアントが ability をまだ見ることができない場合は、meta.show_in_rest が有効になっていることと、正しいエンドポイントをクエリしていることを確認します。

6) JS から利用する (必要な場合)

  • クライアントサイドでのアクセスとチェックには、@wordpress/abilities API を優先します。
  • ビルドツールに依存関係が含まれており、プロジェクトのビルドパイプラインがそれをバンドルしていることを確認します。

検証

  • wp-project-triage は、変更後、signals.usesAbilitiesApi: true を示す (該当する場合)。
  • REST チェック (WP 環境で): wp-abilities/v1 の下のエンドポイントは、期待される場合に ability とカテゴリを返します。
  • リポジトリにテストがある場合は、以下の近くにカバレッジを追加/更新します。
    • PHP: ability の登録とメタデータの公開
    • JS: ability の利用と UI ゲーティング

失敗モード / デバッグ

  • ability が表示されない:
    • 登録コードが実行されていない (間違ったフック / ファイルがロードされていない)。
    • meta.show_in_rest がない。
    • 間違ったカテゴリ/ID の不一致。
  • REST は ability を表示するが、JS は表示しない:
    • 間違った REST ベース/名前空間。
    • JS の依存関係がバンドルされていない。
    • キャッシュ (オブジェクト/ページキャッシュ) が変更を隠蔽している。

エスカレーション

  • バージョンのサポートについて不明な点がある場合は、対象の WP core バージョンと、Abilities API が core から提供されることが期待されるのか、プラグインとして提供されることが期待されるのかを確認してください。
  • 正確な詳細については、以下を参照してください。
    • references/rest-api.md
    • references/php-registration.md
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

WP Abilities API

When to use

Use this skill when the task involves:

  • registering abilities or ability categories in PHP,
  • exposing abilities to clients via REST (wp-abilities/v1),
  • consuming abilities in JS (notably @wordpress/abilities),
  • diagnosing “ability doesn’t show up” / “client can’t see ability” / “REST returns empty”.

Inputs required

  • Repo root (run wp-project-triage first if you haven’t).
  • Target WordPress version(s) and whether this is WP core or a plugin/theme.
  • Where the change should live (plugin vs theme vs mu-plugin).

Procedure

1) Confirm availability and version constraints

  • If this is WP core work, check signals.isWpCoreCheckout and versions.wordpress.core.
  • If the project targets WP < 6.9, you may need the Abilities API plugin/package rather than relying on core.

2) Find existing Abilities usage

Search for these in the repo:

  • wp_register_ability(
  • wp_register_ability_category(
  • wp_abilities_api_init
  • wp_abilities_api_categories_init
  • wp-abilities/v1
  • @wordpress/abilities

If none exist, decide whether you’re introducing Abilities API fresh (new registrations + client consumption) or only consuming.

3) Register categories (optional)

If you need a logical grouping, register an ability category early (see references/php-registration.md).

4) Register abilities (PHP)

Implement the ability in PHP registration with:

  • stable id (namespaced),
  • label/description,
  • category,
  • meta:
    • add readonly: true when the ability is informational,
    • set show_in_rest: true for abilities you want visible to clients.

Use the documented init hooks for Abilities API registration so they load at the right time (see references/php-registration.md).

5) Confirm REST exposure

  • Verify the REST endpoints exist and return expected results (see references/rest-api.md).
  • If the client still can’t see the ability, confirm meta.show_in_rest is enabled and you’re querying the right endpoint.

6) Consume from JS (if needed)

  • Prefer @wordpress/abilities APIs for client-side access and checks.
  • Ensure build tooling includes the dependency and the project’s build pipeline bundles it.

Verification

  • wp-project-triage indicates signals.usesAbilitiesApi: true after your change (if applicable).
  • REST check (in a WP environment): endpoints under wp-abilities/v1 return your ability and category when expected.
  • If the repo has tests, add/update coverage near:
    • PHP: ability registration and meta exposure
    • JS: ability consumption and UI gating

Failure modes / debugging

  • Ability never appears:
    • registration code not running (wrong hook / file not loaded),
    • missing meta.show_in_rest,
    • incorrect category/ID mismatch.
  • REST shows ability but JS doesn’t:
    • wrong REST base/namespace,
    • JS dependency not bundled,
    • caching (object/page caches) masking changes.

Escalation

  • If you’re uncertain about version support, confirm target WP core versions and whether Abilities API is expected from core or as a plugin.
  • For canonical details, consult:
    • references/rest-api.md
    • references/php-registration.md

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。