[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M70DDD8SMSRYCT6CMZAZ79V8":3,"skill-same:01M70DDD8SMSRYCT6CMZAZ79V8":102},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":14,"repositoryHtmlUrl":57,"repositoryHomepageUrl":58,"ownerHtmlUrl":59,"ownerBlogUrl":6,"ownerDescription":60,"updatedAt":61,"install":62,"resources":75},"01M70DDD8SMSRYCT6CMZAZ79V8","wp-rest-api",null,"Use when building, extending, or debugging WordPress REST API endpoints\u002Froutes: register_rest_route, WP_REST_Controller\u002Fcontroller classes, schema\u002Fargument validation, permission_callback\u002Fauthentication, response shaping, register_rest_field\u002Fregister_meta, or exposing CPTs\u002Ftaxonomies via show_in_rest.","Spaghetti-Dojo\u002Ftosuto","Spaghetti-Dojo","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F171473277?v=4","01M70D7HTSB1T6F7P71CN4CA4K","Spaghetti Dojo","01M70D7HVFH1GMH0R0ZFAZRXM6",0,"GPL-2.0","https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-rest-api\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"api","REST","rest api","wp rest api","argument","callback","endpoints","controller","shaping","route","when","debugging","taxonomies","use","schema","Meta","authentication","wordpress","register","show","2026-11-10 10:12:30",false,"---\nname: wp-rest-api\ndescription: \"Use when building, extending, or debugging WordPress REST API endpoints\u002Froutes: register_rest_route, WP_REST_Controller\u002Fcontroller classes, schema\u002Fargument validation, permission_callback\u002Fauthentication, response shaping, register_rest_field\u002Fregister_meta, or exposing CPTs\u002Ftaxonomies via show_in_rest.\"\n---\n\n# WP REST API\n\n## When to use\n\nUse this skill when you need to:\n\n- create or update REST routes\u002Fendpoints\n- debug 401\u002F403\u002F404 errors or permission\u002Fnonce issues\n- add custom fields\u002Fmeta to REST responses\n- expose custom post types or taxonomies via REST\n- implement schema + argument validation\n- adjust response links\u002Fembedding\u002Fpagination\n\n## Inputs required\n\n- Repo root + target plugin\u002Ftheme\u002Fmu-plugin (path to entrypoint).\n- Desired namespace + version (e.g. `my-plugin\u002Fv1`) and routes.\n- Authentication mode (cookie + nonce vs application passwords vs auth plugin).\n- Target WordPress version constraints (if below 6.9, call out).\n\n## Procedure\n\n### 0) Triage and locate REST usage\n\n1. Run triage:\n   - `node skills\u002Fwp-project-triage\u002Fscripts\u002Fdetect_wp_project.mjs`\n2. Search for existing REST usage:\n   - `register_rest_route`\n   - `WP_REST_Controller`\n   - `rest_api_init`\n   - `show_in_rest`, `rest_base`, `rest_controller_class`\n\nIf this is a full site repo, pick the specific plugin\u002Ftheme before changing code.\n\n### 1) Choose the right approach\n\n- **Expose CPT\u002Ftaxonomy in `wp\u002Fv2`:**\n  - Use `show_in_rest => true` + `rest_base` if needed.\n  - Optionally provide `rest_controller_class`.\n  - Read `references\u002Fcustom-content-types.md`.\n- **Custom endpoints:**\n  - Use `register_rest_route()` on `rest_api_init`.\n  - Prefer a controller class (`WP_REST_Controller` subclass) for anything non-trivial.\n  - Read `references\u002Froutes-and-endpoints.md` and `references\u002Fschema.md`.\n\n### 2) Register routes safely (namespaces, methods, permissions)\n\n- Use a unique namespace `vendor\u002Fv1`; avoid `wp\u002F*` unless core.\n- Always provide `permission_callback` (use `__return_true` for public endpoints).\n- Use `WP_REST_Server::READABLE\u002FCREATABLE\u002FEDITABLE\u002FDELETABLE` constants.\n- Return data via `rest_ensure_response()` or `WP_REST_Response`.\n- Return errors via `WP_Error` with an explicit `status`.\n\nRead `references\u002Froutes-and-endpoints.md`.\n\n### 3) Validate\u002Fsanitize request args\n\n- Define `args` with `type`, `default`, `required`, `validate_callback`, `sanitize_callback`.\n- Prefer JSON Schema validation with `rest_validate_value_from_schema` then `rest_sanitize_value_from_schema`.\n- Never read `$_GET`\u002F`$_POST` directly inside endpoints; use `WP_REST_Request`.\n\nRead `references\u002Fschema.md`.\n\n### 4) Responses, fields, and links\n\n- Do **not** remove core fields from default endpoints; add fields instead.\n- Use `register_rest_field` for computed fields; `register_meta` with `show_in_rest` for meta.\n- For `object`\u002F`array` meta, define schema in `show_in_rest.schema`.\n- If you need unfiltered post content (e.g., ToC plugins injecting HTML), request `?context=edit` to access `content.raw` (auth required). Pair with `_fields=content.raw` to keep responses small.\n- Add related resource links via `WP_REST_Response::add_link()`.\n\nRead `references\u002Fresponses-and-fields.md`.\n\n### 5) Authentication and authorization\n\n- For wp-admin\u002FJS: cookie auth + `X-WP-Nonce` (action `wp_rest`).\n- For external clients: application passwords (basic auth) or an auth plugin.\n- Use capability checks in `permission_callback` (authorization), not just “logged in”.\n\nRead `references\u002Fauthentication.md`.\n\n### 6) Client-facing behavior (discovery, pagination, embeds)\n\n- Ensure discovery works (`Link` header or `\u003Clink rel=\"https:\u002F\u002Fapi.w.org\u002F\">`).\n- Support `_fields`, `_embed`, `_method`, `_envelope`, pagination headers.\n- Remember `per_page` is capped at 100.\n\nRead `references\u002Fdiscovery-and-params.md`.\n\n## Verification\n\n- `\u002Fwp-json\u002F` index includes your namespace.\n- `OPTIONS` on your route returns schema (when provided).\n- Endpoint returns expected data; permission failures return 401\u002F403 as appropriate.\n- CPT\u002Ftaxonomy routes appear under `wp\u002Fv2` when `show_in_rest` is true.\n- Run repo lint\u002Ftests and any PHP\u002FJS build steps.\n\n## Failure modes \u002F debugging\n\n- 404: `rest_api_init` not firing, route typo, or permalinks off (use `?rest_route=`).\n- 401\u002F403: missing nonce\u002Fauth, or `permission_callback` too strict.\n- `_doing_it_wrong` for missing `permission_callback`: add it (use `__return_true` if public).\n- Invalid params: missing\u002Fincorrect `args` schema or validation callbacks.\n- Fields missing: `show_in_rest` false, meta not registered, or CPT lacks `custom-fields` support.\n\n## Escalation\n\nIf version support or behavior is unclear, consult the REST API Handbook and core docs before inventing patterns.\n","# WP REST API\n\n## When to use\n\nUse this skill when you need to:\n\n- create or update REST routes\u002Fendpoints\n- debug 401\u002F403\u002F404 errors or permission\u002Fnonce issues\n- add custom fields\u002Fmeta to REST responses\n- expose custom post types or taxonomies via REST\n- implement schema + argument validation\n- adjust response links\u002Fembedding\u002Fpagination\n\n## Inputs required\n\n- Repo root + target plugin\u002Ftheme\u002Fmu-plugin (path to entrypoint).\n- Desired namespace + version (e.g. `my-plugin\u002Fv1`) and routes.\n- Authentication mode (cookie + nonce vs application passwords vs auth plugin).\n- Target WordPress version constraints (if below 6.9, call out).\n\n## Procedure\n\n### 0) Triage and locate REST usage\n\n1. Run triage:\n   - `node skills\u002Fwp-project-triage\u002Fscripts\u002Fdetect_wp_project.mjs`\n2. Search for existing REST usage:\n   - `register_rest_route`\n   - `WP_REST_Controller`\n   - `rest_api_init`\n   - `show_in_rest`, `rest_base`, `rest_controller_class`\n\nIf this is a full site repo, pick the specific plugin\u002Ftheme before changing code.\n\n### 1) Choose the right approach\n\n- **Expose CPT\u002Ftaxonomy in `wp\u002Fv2`:**\n  - Use `show_in_rest => true` + `rest_base` if needed.\n  - Optionally provide `rest_controller_class`.\n  - Read `references\u002Fcustom-content-types.md`.\n- **Custom endpoints:**\n  - Use `register_rest_route()` on `rest_api_init`.\n  - Prefer a controller class (`WP_REST_Controller` subclass) for anything non-trivial.\n  - Read `references\u002Froutes-and-endpoints.md` and `references\u002Fschema.md`.\n\n### 2) Register routes safely (namespaces, methods, permissions)\n\n- Use a unique namespace `vendor\u002Fv1`; avoid `wp\u002F*` unless core.\n- Always provide `permission_callback` (use `__return_true` for public endpoints).\n- Use `WP_REST_Server::READABLE\u002FCREATABLE\u002FEDITABLE\u002FDELETABLE` constants.\n- Return data via `rest_ensure_response()` or `WP_REST_Response`.\n- Return errors via `WP_Error` with an explicit `status`.\n\nRead `references\u002Froutes-and-endpoints.md`.\n\n### 3) Validate\u002Fsanitize request args\n\n- Define `args` with `type`, `default`, `required`, `validate_callback`, `sanitize_callback`.\n- Prefer JSON Schema validation with `rest_validate_value_from_schema` then `rest_sanitize_value_from_schema`.\n- Never read `$_GET`\u002F`$_POST` directly inside endpoints; use `WP_REST_Request`.\n\nRead `references\u002Fschema.md`.\n\n### 4) Responses, fields, and links\n\n- Do **not** remove core fields from default endpoints; add fields instead.\n- Use `register_rest_field` for computed fields; `register_meta` with `show_in_rest` for meta.\n- For `object`\u002F`array` meta, define schema in `show_in_rest.schema`.\n- If you need unfiltered post content (e.g., ToC plugins injecting HTML), request `?context=edit` to access `content.raw` (auth required). Pair with `_fields=content.raw` to keep responses small.\n- Add related resource links via `WP_REST_Response::add_link()`.\n\nRead `references\u002Fresponses-and-fields.md`.\n\n### 5) Authentication and authorization\n\n- For wp-admin\u002FJS: cookie auth + `X-WP-Nonce` (action `wp_rest`).\n- For external clients: application passwords (basic auth) or an auth plugin.\n- Use capability checks in `permission_callback` (authorization), not just “logged in”.\n\nRead `references\u002Fauthentication.md`.\n\n### 6) Client-facing behavior (discovery, pagination, embeds)\n\n- Ensure discovery works (`Link` header or `\u003Clink rel=\"https:\u002F\u002Fapi.w.org\u002F\">`).\n- Support `_fields`, `_embed`, `_method`, `_envelope`, pagination headers.\n- Remember `per_page` is capped at 100.\n\nRead `references\u002Fdiscovery-and-params.md`.\n\n## Verification\n\n- `\u002Fwp-json\u002F` index includes your namespace.\n- `OPTIONS` on your route returns schema (when provided).\n- Endpoint returns expected data; permission failures return 401\u002F403 as appropriate.\n- CPT\u002Ftaxonomy routes appear under `wp\u002Fv2` when `show_in_rest` is true.\n- Run repo lint\u002Ftests and any PHP\u002FJS build steps.\n\n## Failure modes \u002F debugging\n\n- 404: `rest_api_init` not firing, route typo, or permalinks off (use `?rest_route=`).\n- 401\u002F403: missing nonce\u002Fauth, or `permission_callback` too strict.\n- `_doing_it_wrong` for missing `permission_callback`: add it (use `__return_true` if public).\n- Invalid params: missing\u002Fincorrect `args` schema or validation callbacks.\n- Fields missing: `show_in_rest` false, meta not registered, or CPT lacks `custom-fields` support.\n\n## Escalation\n\nIf version support or behavior is unclear, consult the REST API Handbook and core docs before inventing patterns.\n",{"name":5,"description":7},"main","c5c9f6be96a3086970a7b9e89f09a99a9bf5d585",".claude\u002Fskills\u002Fwp-rest-api","https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto","https:\u002F\u002Fspaghetti-dojo.github.io\u002Ftosuto\u002F","https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo","A place where to experiment","2026-05-27 16:04:29",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add Spaghetti-Dojo\u002Ftosuto --skill wp-rest-api",{"tool":68,"command":69},"bunx","bunx skills add Spaghetti-Dojo\u002Ftosuto --skill wp-rest-api",{"tool":71,"command":72},"pnpm","pnpm dlx skills add Spaghetti-Dojo\u002Ftosuto --skill wp-rest-api","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-rest-api\u002FSKILL.md",true,[76,82,86,90,94,98],{"path":77,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Fauthentication.md","REFERENCE","参考文档",627,"https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-rest-api\u002Freferences\u002Fauthentication.md",{"path":83,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fcustom-content-types.md",760,"https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-rest-api\u002Freferences\u002Fcustom-content-types.md",{"path":87,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":88,"sourceHtmlUrl":89},"references\u002Fdiscovery-and-params.md",730,"https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-rest-api\u002Freferences\u002Fdiscovery-and-params.md",{"path":91,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":92,"sourceHtmlUrl":93},"references\u002Fresponses-and-fields.md",1091,"https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-rest-api\u002Freferences\u002Fresponses-and-fields.md",{"path":95,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":96,"sourceHtmlUrl":97},"references\u002Froutes-and-endpoints.md",1370,"https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-rest-api\u002Freferences\u002Froutes-and-endpoints.md",{"path":99,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":100,"sourceHtmlUrl":101},"references\u002Fschema.md",964,"https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-rest-api\u002Freferences\u002Fschema.md",[103,119,146,168,191,211],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":112,"publishedAt":49},"01M70DDJXEN0BM5TZPB5GF9TA6","wpds","Use when building UIs leveraging the WordPress Design System (WPDS) and its components, tokens, patterns, etc.","https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwpds\u002FSKILL.md",[109],{"categoryNo":110,"categoryName":111,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000015","视觉设计",[105,46,113,114,115,42,116,39,117,118],"system","tokens","design","design system","patterns","components",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":128,"publishedAt":49},"01M70DDG4PMCJVM2MAH4BQ4F6C","wp-wpcli-and-ops","Use when working with WP-CLI (wp) for WordPress operations: safe search-replace, db export\u002Fimport, plugin\u002Ftheme\u002Fuser\u002Fcontent management, cron, cache flushing, multisite, and scripting\u002Fautomation with wp-cli.yml.","https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-wpcli-and-ops\u002FSKILL.md",[125],{"categoryNo":126,"categoryName":127,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[129,130,131,132,133,134,46,135,136,42,39,137,138,139,140,141,142,143,144,145],"ops","wp wpcli and ops","import","theme","for","db","search","wp-cli","automation","cache","with","plugin","cli","scripting","operations","safe","export",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":49},"01M70DDB298BG7A74YZ3XEWHQY","wp-project-triage","Use when you need a deterministic inspection of a WordPress repository (plugin\u002Ftheme\u002Fblock theme\u002FWP core\u002FGutenberg\u002Ffull site) including tooling\u002Ftests\u002Fversion hints, and a structured JSON report to guide workflows and guardrails.","https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-project-triage\u002FSKILL.md",[],[153,154,155,156,132,157,46,158,159,160,42,161,39,162,163,140,164,165,166,167],"project","wp project triage","triage","deterministic","core","Guardrails","tests","inspection","workflows","you","version","tooling","json","repository","report",{"skillNo":169,"name":170,"nameZh":6,"description":171,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":172,"categories":173,"keywords":175,"publishedAt":49},"01M70DD924A87SK645B5HKE39A","wp-plugin-development","Use when developing WordPress plugins: architecture and hooks, activation\u002Fdeactivation\u002Funinstall, admin UI and Settings API, data storage, cron\u002Ftasks, security (nonces\u002Fcapabilities\u002Fsanitization\u002Fescaping), and release packaging.","https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-plugin-development\u002FSKILL.md",[174],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[176,177,178,140,179,46,180,181,42,39,182,183,29,184,185,186,187,188,189,190],"development","plugin development","wp plugin development","uninstall","packaging","hooks","tasks","architecture","capabilities","admin","storage","release","settings","plugins","data storage",{"skillNo":192,"name":193,"nameZh":6,"description":194,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":195,"categories":196,"keywords":197,"publishedAt":49},"01M70DD5JTD6MBJV9KAQBZ5191","wp-playground","Use for WordPress Playground workflows: fast disposable WP instances in the browser or locally via @wp-playground\u002Fcli (server, run-blueprint, build-snapshot), auto-mounting plugins\u002Fthemes, switching WP\u002FPHP versions, blueprints, and debugging (Xdebug).","https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-playground\u002FSKILL.md",[],[198,199,200,133,46,201,202,42,203,204,40,161,205,206,141,207,208,209,210,189],"playground","wp playground","instances","themes","auto","switching","Blueprint","browser","server","via","build","run","snapshot",{"skillNo":212,"name":213,"nameZh":6,"description":214,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":215,"categories":216,"keywords":217,"publishedAt":49},"01M70DD2XKSJFZ17MCGEQMT2SQ","wp-phpstan","Use when configuring, running, or fixing PHPStan static analysis in WordPress projects (plugins\u002Fthemes\u002Fsites): phpstan.neon setup, baselines, WordPress-specific typing, and handling third-party plugin classes.","https:\u002F\u002Fgithub.com\u002FSpaghetti-Dojo\u002Ftosuto\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwp-phpstan\u002FSKILL.md",[],[218,219,220,221,222,46,223,224,201,42,39,225,140,189,226,227,228,229],"wp phpstan","running","typing","projects","static","neon","sites","analysis","party","third-party","static analysis","setup"]