Community코딩 & 개발github.com

fswp-api-developer

WordPress REST API 및 Abilities API 작업을 위한 풀스택 WP 개발자 도메인 스킬입니다. 스키마가 있는 경로 등록, 인수 검증 및 살균, 권한 콜백, 컨트롤러 클래스, 포스트 타입 및 메타 노출, 인증(쿠키 논스, 애플리케이션 비밀번호), 페이지네이션 및 오류 처리, 입력/출력 스키마 및 안전 주석이 있는 능력 등록을 다룹니다. 플러그인이나 테마에서 사용자 정의 엔드포인트나 기계 판독 가능 기능에 사용하세요.

fswp-api-developer란 무엇인가요?

이 스킬은 WordPress REST API와 Abilities API를 사용하여 사용자 정의 엔드포인트 및 기계 판독 가능 기능을 구현하는 풀스택 WP 개발자를 위한 도메인 지침입니다. 경로 등록 시 네임스페이스 및 버전 규칙, 강제적인 `permission_callback`, 인수 검증 및 살균, `rest_ensure_response()`를 통한 데이터 반환, 오류 코드 사용법, 스키마 구현, 컬렉션 페이지네이션, 보안 규칙 등을 상세히 설명합니다. 또한 동일 사이트 JS, 외부 서버/앱, 공개 읽기 등 다양한 클라이언트에 대한 인증 방법(쿠키 논스, 애플리케이션 비밀번호)을 제공하며, `@wordpress/api-fetch`를 사용한 클라이언트 측 처리 방법도 포함합니다. Abilities API 부분에서는 AI 에이전트가 호출할 수 있는 이산적이고 기계 판독 가능한 능력(이름, 입력/출력 스키마, 권한 검사, 실행 콜백)을 등록하는 방법을 다루며, 읽기 전용 및 파괴적 작업에 대한 안전 주석의 중요성을 강조합니다. 이 스킬은 `fswp-developer`의 참조 문서와 `fswp-security-engineer`의 보안 규칙을 기반으로 합니다.

지원 대상~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 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

FSWP API 개발자

기본 (항상 적용): fswp-developer/references/lean-coding.md (적게 작성하고 재사용 우선), fswp-developer/references/coding-standards.md (코딩 표준, 문서, i18n, 접근성), fswp-security-engineer (입력, 출력, 인가).

공식 참조: REST API 핸드북 (fswp-developer/references/official-docs.md). fswp-security-engineer의 보안 규칙은 모든 경로에 적용됩니다.

경로 등록

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' );

규칙

  • 네임스페이스 및 버전: vendor-prefix/v1. 코어의 wp/v2 네임스페이스에 절대 등록하지 마세요.
  • permission_callback는 필수입니다. 로그인 상태 확인이 아닌 기능(capability) 검사를 반환하세요. 진정으로 공개적인 데이터에만 __return_true를 사용하고, 그 이유를 설명하는 주석을 추가하세요. 요청에 ID가 포함된 경우 객체 수준 접근(edit_post, 소유권)을 확인하세요.
  • args 선언 시 type, required, enum, minimum/maximum, validate_callback, sanitize_callback을 포함하세요. 요청은 검증 후에도 신뢰할 수 없으므로 $request->get_param() 값을 타입화된 대로 사용하세요.
  • 데이터 반환은 rest_ensure_response()로; 오류는 new WP_Error( 'vp_code', __( '메시지', 'text-domain' ), array( 'status' => 404 ) )로 처리하세요. 정확한 상태 코드를 사용하세요 (400 잘못된 요청, 401 인증되지 않음, 403 금지됨, 404 찾을 수 없음, 409 충돌, 413 너무 큼).
  • 스키마: 클라이언트와 인덱스가 리소스를 설명할 수 있도록 get_item_schema() (또는 schema 콜백)을 구현하고, prepare_item_for_response()로 응답을 구성하세요.
  • 컬렉션: 하드 상한이 있는 page/per_page를 지원하고, X-WP-Total 및 X-WP-TotalPages 헤더를 설정하며, 무제한 목록을 절대 반환하지 마세요.
  • 비밀 정보, 비밀번호 해시, 원시 옵션, 다른 사용자의 개인 데이터를 절대 반환하지 마세요.
  • 컨트롤러: 경로가 몇 개 이상이면 WP_REST_Controller를 확장하여 (register_routes, get_items, get_item, create_item, 메서드별 권한 검사) 클래스를 한 번 등록하세요.
  • 코어 객체 노출: 사용자 정의 포스트 타입과 분류는 'show_in_rest' => true (및 rest_base)로; 메타는 register_meta()/register_post_meta()와 'show_in_rest' => true, 스키마, auth_callback로 노출하세요.
  • 캐싱 및 성능: GET 핸들러는 가볍게 유지하고, 비용이 많이 드는 결과는 캐시하세요 (fswp-performance-engineer); 반복문 내에서 쿼리를 피하세요.

인증

클라이언트방법
동일 사이트 JS (관리자, 블록, 프런트 엔드)X-WP-Nonce 헤더를 사용한 쿠키 인증 (wp_create_nonce( 'wp_rest' ), 또는 wp_localize_script / @wordpress/api-fetch에서 자동 추가)
외부 서버 또는 앱HTTPS를 통한 애플리케이션 비밀번호, 또는 검증된 OAuth 플러그인
공개 읽기데이터가 공개적인 경우에만 인증 없음

논스는 기능(capability) 검사를 대체하지 않습니다. CORS: 인증된 경로에 Access-Control-Allow-Origin: *를 열지 마세요.

클라이언트 측

블록 및 관리자 화면에서 @wordpress/api-fetch를 사용하세요. 오류는 텍스트를 파싱하지 말고 code와 message로 처리하세요.

Abilities API

도구와 AI 에이전트가 발견하고 호출할 수 있는 이산적이고 기계 판독 가능한 능력(이름, 입력 스키마, 출력 스키마, 권한 검사, 실행 콜백)을 등록하기 위한 코어 API입니다. 최근에 도입되었으므로 사용 전에 최소 WordPress 버전과 정확한 함수 이름을 개발자 문서에서 확인하세요 ("Abilities API" 검색). PRD에 에이전트가 호출할 수 있는 함수가 필요한 경우에만 사용하세요; 일반적인 클라이언트-서버 호출에는 일반 REST가 적합합니다.

능력을 등록할 때:

  • 먼저 카테고리를 등록하고, 그 다음 능력을 문서화된 훅에 등록하세요.
  • 입력 및 출력에 JSON 스키마를 제공하고, 실제 기능(capability)을 확인하는 permission_callback을 제공하세요.
  • 안전 주석을 정직하게 설정하세요: 읽기 전용 능력은 쓰기를 해서는 안 되며, 파괴적 능력은 플래그를 지정해야 합니다. 읽기 전용으로 주석이 달린 콜백이 쓰기를 수행하는 것은 결함이며, fswp-reviewer는 이를 결함으로 처리합니다.
  • 원격으로 호출 가능해야 하는 것만 REST로 노출하세요.

감사 및 검증 절차: references/abilities.md.

기존 엔드포인트 중 어떤 것이 능력이 되어야 하는지 제안하려면 각 경로의 메서드, 현재 권한 검사, 부작용, 제안된 주석을 나열하세요; 승인될 때까지 아무것도 등록하지 마세요.

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.

관련 스킬