CommunityCoding & Developmentgithub.com

fswp-api-developer

Domain skill for WordPress REST API and Abilities API work in Full-Stack WP Developer. Covers registering routes with schemas, argument validation and sanitization, permission callbacks, controller classes, exposing post types and meta, authentication (cookie nonce, application passwords), pagination and errors, and registering abilities with input and output schemas and safety annotations. Use for any custom endpoint or machine-readable capability in a plugin or theme.

What is fswp-api-developer?

fswp-api-developer is a Claude Code agent skill that domain skill for WordPress REST API and Abilities API work in Full-Stack WP Developer. Covers registering routes with schemas, argument validation and sanitization, permission callbacks, controller classes, exposing post types and meta, authentication (cookie nonce, application passwords), pagination and errors, and registering abilities with input and output schemas and safety annotations. Use for any custom endpoint or machine-readable capability in a plugin or theme.

Works with~Claude Code~Codex CLI~Cursor
Part ofMobile
npx skills add https://github.com/syncwin/fswp-developer/tree/main/skills/fswp-api-developer

Installed? Explore more Coding & Development skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

FSWP API Developer

Foundational (always applied): fswp-developer/references/lean-coding.md (write less, reuse first), fswp-developer/references/coding-standards.md (coding standards, docs, i18n, accessibility), and fswp-security-engineer (input, output, authorization).

Official reference: REST API Handbook (fswp-developer/references/official-docs.md). Security rules in fswp-security-engineer apply to every route.

Register a route

function vp_register_routes() {
	register_rest_route( 'vendor-prefix/v1', '/items/(?P<id>\d+)', array(
		'methods'             => WP_REST_Server::READABLE,
		'callback'            => 'vp_get_item',
		'permission_callback' => function ( WP_REST_Request $r ) {
			return current_user_can( 'edit_post', (int) $r['id'] );
		},
		'args'                => array(
			'id' => array( 'type' => 'integer', 'required' => true, 'sanitize_callback' => 'absint' ),
		),
	) );
}
add_action( 'rest_api_init', 'vp_register_routes' );

Rules

  • Namespace and version: vendor-prefix/v1. Never register in core's wp/v2 namespace.
  • permission_callback is mandatory. Return a capability check, not just login status. Use __return_true only for genuinely public data, with a comment explaining why. Check object-level access (edit_post, ownership) whenever an ID is in the request.
  • Declare args with type, required, enum, minimum/maximum, validate_callback, and sanitize_callback. The request is untrusted even after validation; use $request->get_param() values as typed.
  • Return data with rest_ensure_response(); errors as new WP_Error( 'vp_code', __( 'Message', 'text-domain' ), array( 'status' => 404 ) ). Use accurate status codes (400 invalid, 401 unauthenticated, 403 forbidden, 404 missing, 409 conflict, 413 too large).
  • Schema: implement get_item_schema() (or schema callback) so clients and the index can describe the resource; shape responses with prepare_item_for_response().
  • Collections: support page/per_page with a hard cap, set X-WP-Total and X-WP-TotalPages, and never return unbounded lists.
  • Never return secrets, password hashes, raw options, or other users' private data.
  • Controllers: for more than a couple of routes, extend WP_REST_Controller (register_routes, get_items, get_item, create_item, permission checks per method) and register the class once.
  • Expose core objects: custom post types and taxonomies with 'show_in_rest' => true (and rest_base); meta with register_meta()/register_post_meta() and 'show_in_rest' => true plus a schema and an auth_callback.
  • Caching and performance: cheap GET handlers; cache expensive results (fswp-performance-engineer); avoid queries in loops.

Authentication

ClientMethod
Same-site JS (admin, blocks, front end)Cookie auth with the X-WP-Nonce header (wp_create_nonce( 'wp_rest' ), or wp_localize_script / @wordpress/api-fetch which adds it)
External server or appApplication Passwords over HTTPS, or a vetted OAuth plugin
Public readNo auth, only when the data is public

Nonces do not replace capability checks. CORS: do not open Access-Control-Allow-Origin: * on authenticated routes.

Client side

Use @wordpress/api-fetch in blocks and admin screens. Handle errors by code and message, not by parsing text.

Abilities API

A Core API for registering discrete, machine-readable capabilities (name, input schema, output schema, permission check, execute callback) that tools and AI agents can discover and call. It is recent: confirm the minimum WordPress version and the exact function names in the developer documentation before using it (search "Abilities API"). Use it only when the PRD needs agent-callable functions; plain REST is right for ordinary client-server calls.

When registering an ability:

  • Register the category first, then the ability, on the documented hooks.
  • Give it JSON Schemas for input and output, and a permission_callback that checks a real capability.
  • Set the safety annotations honestly: read-only abilities must not write, destructive ones must be flagged. A callback that writes while annotated read-only is a defect, and fswp-reviewer treats it as one.
  • Expose over REST only what should be callable remotely.

Audit and verification procedures: references/abilities.md.

To propose which existing endpoints should become abilities, list each route with its method, current permission check, side effects, and a suggested annotation; do not register anything until approved.

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

fswp-architect

Planning stage of Full-Stack WP Developer. Classifies the work (new plugin, new theme, update to an existing plugin or theme, add-on for another product, or WordPress Core patch), triages existing code with a bundled detection script, asks one round of essential questions, does competitive research, and produces one reviewable PRD or change brief with a single approval gate. Also covers Migration mode and multi-session handoff docs. Invoked by fswp-developer before any code is written; consult directly for PRD, change-brief, or handoff-doc questions.

fswp-block-developer

Domain skill for WordPress block editor work in Full-Stack WP Developer. Covers building custom Gutenberg blocks (block.json, static and dynamic rendering, attributes, supports, InnerBlocks, variations, deprecations, block bindings), block patterns, and the Interactivity API (data-wp directives, stores, server-side state), with the @wordpress/scripts build workflow. Use for any custom block, pattern, or front-end interactivity in a plugin or theme.

fswp-core-contributor

WordPress Core contribution stage of Full-Stack WP Developer. Guides a contributor through finding or filing a Trac ticket, setting up the wordpress-develop checkout and test environment, writing a patch or GitHub pull request that follows Core coding standards, inline documentation, backward compatibility and tests, and preparing the ticket comment; also routes block-editor changes to the Gutenberg repository and security reports to the private process. Invoked by fswp-developer for Core patches; consult directly for Core workflow questions.

fswp-devops-engineer

Domain skill for WordPress development tooling in Full-Stack WP Developer. Covers local environments (wp-env with Docker, WordPress Playground and Blueprints), command-line site operations (plugin and theme management, database export, search-replace, cron, scaffolding), coding standards and static analysis (PHPCS with WordPress standards, PHPStan with WordPress stubs), PHP and JS testing setup, and the @wordpress/scripts toolchain. Use when setting up, running, or automating a WordPress dev or test environment.

fswp-maintainer

Change stage for existing WordPress code in Full-Stack WP Developer. Updates, fixes, refactors, and upgrades existing plugins and themes without breaking them, and builds add-ons for products you do not own (WooCommerce extensions, page-builder elements, extensions of other plugins) using hooks instead of edits to third-party files. Covers reading before changing, parity lists, deprecation, host compatibility, upgrade paths, and patch delivery. Invoked by fswp-developer after an approved change brief; consult directly for safe-change or add-on questions.

fswp-qa-engineer

Verification stage of Full-Stack WP Developer. Runs the mechanical gate for plugins and themes (house-rule scripts, PHP lint, PHPCS with WordPress standards, PHP compatibility, PHPStan with WordPress stubs), the manual checklist, PRD or change-brief scenario tests, and the pre-release check. Reports PASS, FAIL, or NOT RUN and never implies a skipped check passed. Invoked by fswp-developer after a build and again before delivery; consult directly to audit any plugin or theme folder.

fswp-reviewer

Independent review stage of Full-Stack WP Developer. Reviews a finished WordPress plugin, theme, add-on, or Core patch through a security lens (WordPress-specific vulnerabilities, REST and AJAX authorization with an API risk map, AI-generated-code risks), a quality lens (error handling, data and upgrade safety, performance, i18n, accessibility, comment accuracy, test gaps, class and type design, scope), and an optional lean lens for trimming over-engineering, reporting only high-confidence findings in a fixed format. Invoked by fswp-developer after the verify gate, normally through the fswp-code-reviewer agent; consult directly to review or optimize any WordPress code.

fswp-theme-developer

Theme build stage of Full-Stack WP Developer. Builds custom WordPress themes - block themes (theme.json, templates, template parts, patterns, style variations), classic themes (template hierarchy, functions.php, theme supports), hybrids, and child themes - with accessibility, escaping, and directory readiness built in, plus a scaffold script. Invoked by fswp-developer after an approved PRD for a new theme; consult directly for a specific theme pattern. For changes to an existing theme use fswp-maintainer.

syncwin/fswp-plugin-developer

Plugin build stage of Full-Stack WP Developer. House standards and code templates for real WordPress plugins (not shortcode snippets) - folder anatomy, activation/uninstall lifecycle, custom post types and tables, admin UI tiers, front-end output on the Atomic Framework, REST and cron, i18n, distribution, and the Tier 3 React admin stack - plus a scaffold script. Also the base structure for add-ons. Invoked by fswp-developer after an approved PRD; consult directly for a specific plugin build pattern.

Related Skills