Communitygithub.com

헤드리스 WooCommerce API (headless-woocommerce-api)

WPGraphQL, WooGraphQL 및 JWT 인증을 포함한 WooCommerce API를 구성하고 쿼리하여 헤드리스 프론트엔드(Next.js, Remix 등)에서 사용할 수 있도록 합니다.

헤드리스 WooCommerce API (headless-woocommerce-api)란 무엇인가요?

이 스킬은 WordPress/WooCommerce 백엔드를 헤드리스 구조의 프론트엔드 애플리케이션(Next.js, Remix, 모바일 앱 등)에 연결할 때 필요한 완전한 백엔드 API 설정 및 쿼리 가이드를 제공합니다. 주요 기능으로는 WPGraphQL 및 WooGraphQL 플러그인 설치, JWT 또는 OAuth 기반 인증 구성, 제품/카테고리/장바구니 등 상점 데이터에 대한 GraphQL 쿼리 작성, 그리고 Next.js 환경에서의 SSG/ISR 통합 방법이 포함됩니다. 또한 다형성 제품 타입(SimpleProduct, VariableProduct) 쿼리 시 필수 타입 조건 사용, 세션 헤더 유지 관리 등 자주 발생하는 문제와 해결책을 제시하여 개발자가 실제 프로젝트에서 겪을 수 있는 함정을 피할 수 있도록 돕습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/BIGboss248/nextjs-wordpress/tree/HEAD/.agents/skills/headless-woocommerce-api

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

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

문서

헤드리스 WooCommerce API (headless-woocommerce-api)은(는) 무엇을 하나요?

WooCommerce 백엔드 API(WPGraphQL 및 REST)를 구성, 쿼리 및 보호하여 디커플드 프론트엔드 애플리케이션(Next.js, Remix, 모바일)을 구동하기 위한 오케스트레이션 가이드입니다.


사전 요구 사항

  • WordPress가 설치되어 있고 WooCommerce 플러그인이 활성화되어 있어야 합니다.
  • GraphQL 엔드포인트에 접근 가능해야 합니다 (기본값: https://your-store.com/graphql).
  • 심층 쿼리 및 기술 예제는 headless-api-reference.md를 검토하세요.
  • 프론트엔드 클라이언트 설정은 storefront-client.ts를 확인하세요.

단계별 실행 체크리스트

flowchart TD
    S1["1. WPGraphQL & WooGraphQL 설치"] --> S2["2. Mock / 라이브 카탈로그 데이터 시드"]
    S2 --> S3["3. 인증 구성 (JWT / OAuth)"]
    S3 --> S4["4. GraphiQL로 스키마 검증"]
    S4 --> S5["5. Next.js에서 클라이언트 쿼리 연결"]

1단계: 백엔드 플러그인 배포

  • WPGraphQL 코어 설치:
    • WordPress 플러그인 디렉토리에서 wp-graphql을 설치하고 활성화합니다.
    • 엔드포인트가 활성화되었는지 확인합니다: GET/POST /graphql.
  • WooGraphQL 확장 설치:
    • wp-graphql-woocommerce를 다운로드하여 설치합니다.
    • Product, ProductCategory, Cart, Customer 타입이 GraphQL 스키마에 나타나는지 확인합니다.
  • 테스트 데이터 시드:
    • 도구 → 가져오기 → WooCommerce 상품 (CSV)를 통해 CSV 임포터를 실행하여 sample-data/sample_products.csv 파일을 가져옵니다.

2단계: 헤드리스 인증 구성

  • 옵션 A: JWT 인증 (wp-graphql-jwt-authentication):
    • wp-graphql-jwt-authentication을 업로드하고 활성화합니다.
    • 64자 시크릿 키를 생성합니다 (openssl rand -base64 48 | tr -dc 'A-Za-z0-9_#%+=@!' | head -c 64 또는 PowerShell 동등 명령어).
    • 컨테이너에 주입하거나 (docker exec -it <container> sed -i ... /var/www/html/wp-config.php), .env 파일에 추가하거나 (GRAPHQL_JWT_AUTH_SECRET_KEY), wp-config.php에 직접 추가합니다:
      define( 'GRAPHQL_JWT_AUTH_SECRET_KEY', 'your-strong-random-secret' );
      
  • 옵션 B: 헤드리스 로그인 (wp-graphql-headless-login):
    • 외부 OAuth 2.0 / 소셜 로그인(Google, GitHub)이 필요한 경우 사용합니다.
    • 필터 또는 관리자 설정을 통해 제공자를 구성합니다.

3단계: 상점 데이터 쿼리

  • 공개 카탈로그: 유니온 프래그먼트(... on SimpleProduct, ... on VariableProduct)를 사용하여 카테고리와 제품을 쿼리합니다.
  • 고객 세션: 장바구니 변이 요청 시 woocommerce-session 헤더를 캡처하고 이후 요청에서 전달합니다.
  • 보호된 프로필: 고객 주문 및 주소 업데이트를 위해 Authorization: Bearer <authToken>을 전달합니다.

4단계: 프론트엔드 통합 (Next.js)

  • 공개 GraphQL 쿼리를 사용하여 정적 제품 페이지에 대해 SSG/ISR을 구현합니다.
  • 장바구니 토큰을 클라이언트 측 상태(Zustand / LocalStorage)로 유지하여 Next.js 페이지의 캐시 가능성을 유지합니다.
  • 네이티브 체크아웃 브리지 구현: 로컬 결제 게이트웨이 및 전자상거래 규정 준수를 위해 WordPress /checkout으로 리디렉션합니다.

엣지 케이스 및 알려진 AI 함정

  1. 제품 쿼리의 유니온: WooCommerce 제품은 다형성입니다. products { nodes { price } } 와 같이 직접 price를 쿼리하지 마십시오. 반드시 타입 조건(... on SimpleProduct { price }, ... on VariableProduct { price })을 사용해야 합니다.
  2. 세션 헤더 누락: 서버가 반환한 woocommerce-session 토큰이 프론트엔드 클라이언트에 의해 저장되고 재전송되지 않으면 장바구니 항목이 다음 요청에서 사라집니다.
  3. 관리자 React 비호환성: 사용자 지정 빌드 단계가 없는 엄격한 코어 WordPress를 사용하는 경우 레거시 Gutenberg 관리 번들이 있는 플러그인(예: wp-graphql-headless-login 설정 패널)을 피하고 상수 기반 플러그인(예: wp-graphql-jwt-authentication)을 고수하십시오.
  4. CORS 헤더: 헤더 또는 리버스 프록시를 구성하여 WordPress가 프론트엔드 출처의 요청을 허용하는지 확인하십시오.

검증 및 자체 점검

  • /graphql에 대한 테스트 쿼리를 실행하여 productCategories와 products가 노드를 반환하는지 확인합니다.
  • login 변이를 실행하여 유효한 authToken이 생성되는지 확인합니다.
  • 장바구니에 아이템을 추가할 때 woocommerce-session 헤더가 반환되는지 확인합니다.

Individual skills in this repo

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

BIGboss248/nextjs-wordpress

Create, configure, manage, and validate Google Antigravity customizations including skills, rules, MCP servers, lifecycle hooks, plugins, and custom JSON configs. Use when adding new capabilities to Antigravity, configuring MCP servers, writing rules, creating skills, setting up hooks, or modernizing legacy workflows.

BIGboss248/nextjs-wordpress

Spawn multiple agents into a shared conversation where they debate, disagree, and converge on a solution via a shared chat.json file. Use for architecture decisions, code review debates, design trade-offs, or any problem that benefits from adversarial reasoning. Triggers on "chatroom", "agent debate", "have agents discuss", "agent chatroom", "debate this", or /agent-chatrooms. Also triggers on phrases like "have 3 agents argue about", "multi-agent discussion", or "let them debate".

BIGboss248/nextjs-wordpress

Always-active code intelligence, search, and navigation skill utilizing the codebase-memory MCP server. Enforces an index-first protocol (verifying and refreshing the knowledge graph via index_repository or index_status before searching, required because background auto_watch is disabled to eliminate editor stutter and system lag), followed by graph-first exploration (search_graph, trace_path, get_code_snippet, query_graph, get_architecture, detect_changes) instead of naive text grep or full-file reads. Always activate before searching the codebase, inspecting unknown architecture, finding symbols, or tracing callers/callees.

BIGboss248/nextjs-wordpress

>- Discover, interview, and craft comprehensive UX/UI design specifications (design-spec.md) and design tokens for web components. Triggers on "/component-design", "design component", "design section", "design UI", "wireframe component", or "create design spec".

BIGboss248/nextjs-wordpress

Orchestrate parallel browser automation using multiple Chrome DevTools MCP instances. Use when a task requires doing the same browser action across many targets simultaneously (e.g., submitting contact forms, filling applications, scraping pages that need JS rendering). Spin up 1-5 parallel Chrome agents.

BIGboss248/nextjs-wordpress

Workflow for spawning an independent subagent to conduct unbiased code reviews and inject adversarial edge-case tests ([ComponentName].edge.test.tsx).

BIGboss248/nextjs-wordpress

>- Build Next.js App Router React components with Suspense skeletons, semantic OKLCH tokens, Jest + RTL unit tests, Playwright visual/hydration checks, and Tailwind logical styling. Triggers on "/nextjs-component-dev", "create component", "new component", "build component", or "develop component".

BIGboss248/nextjs-wordpress

>- Bootstrap, configure, and verify the complete Next.js App Router development environment, developer tooling, testing suites, MCP servers, Docker containerization, and CI/CD. Triggers on "/nextjs-dev-setup", "setup nextjs dev environment", "start a nextjs project", or "containerize nextjs app".

BIGboss248/nextjs-wordpress

>- Configure production health monitoring endpoints (/api/health), Docker Compose probes, and runtime metrics in Next.js App Router applications. Use when asked to "setup health check", "add health endpoint", "docker compose healthcheck nextjs", "configure health monitor", or "/nextjs-healthcheck".

BIGboss248/nextjs-wordpress

Bootstrap, configure, and verify next-intl App Router internationalization (proxy.ts/middleware.ts, next/root-params, [locale] layout, routing). Triggers on "/nextjs-i18n-setup", "setup i18n", "install next-intl", "configure next-intl", "add internationalization", "setup locale routing", "migrate to [locale]".

BIGboss248/nextjs-wordpress

Read/write translation dictionaries (messages/[locale].json), next-intl hooks (getTranslations/useTranslations), providers (Storybook/tests/subtrees), and BiDi styling. Triggers on "/nextjs-i18n-usage", "i18n dictionary", "use translations", "read dictionary", "i18n provider", "next-intl hooks", "storybook i18n", "test i18n", "add translation keys", "localize component", "create a component", "update a component".

BIGboss248/nextjs-wordpress

>- Configure, test, and verify OpenTelemetry (OTel) observability in Next.js App Router applications. Triggers on "/nextjs-otel", "setup otel", "configure opentelemetry", "test otel", or "verify opentelemetry".

BIGboss248/nextjs-wordpress

Step-by-step workflow for designing and building Next.js App Router pages (RSC page.tsx, loading skeleton, metadata, JSON-LD schema, and dynamic static params). Triggers on "/nextjs-page-dev", "create page", "new page", "develop page", "build route", or "implement page".

BIGboss248/nextjs-wordpress

>- Orchestrate end-to-end planning for Next.js App Router projects, generating canonical specifications, design systems, and a 7-phase modular implementation roadmap in docs/plan/. Triggers on "/nextjs-plan", "plan a nextjs project", "plan nextjs app", "create nextjs project plan", "outline nextjs architecture", or "generate plan".

BIGboss248/nextjs-wordpress

Workflow and engineering standards for crafting co-located Storybook CSF3 stories ([ComponentName].stories.tsx) with interactive controls, action spies, and 4 canonical theme variants.

BIGboss248/nextjs-wordpress

>- Build Next.js e-commerce frontends backed by WooCommerce APIs, handling ISR catalogs, cart sessions, and JWT authentication. Use when building or querying Next.js stores with WooCommerce.

BIGboss248/nextjs-wordpress

Self-correcting rules engine and feedback loop that learns from user corrections, mistakes, and project-specific constraints by maintaining a persistent autofix ruleset. Scans learned rules before starting any task, resolves conflicts, and automatically appends new rules upon corrections. Triggers on user corrections ("no, do it this way", "never do X", "always use Y"), /learn, "self repair", "add rule", "update rules", or when diagnosing assumptions and bugs. CRITICAL ALWAYS-ACTIVE LIFECYCLE SKILL. Must always be kept in context, loaded at session start, and consulted before starting ANY task to read and apply active constraints from autofix.json. MUST ALWAYS be triggered immediately whenever the user provides ANY correction, preference, criticism, rejection of an approach, or adjustment ("no", "don't do X", "use Y", "remember", "prefer"), or when any mistake/bug is identified. Automatically and immediately formulates and appends the new imperative rule to the project's autofix.json ruleset file.

BIGboss248/nextjs-wordpress

Setup, automate, and execute SEO audits, CI/CD pre-push/pre-deploy checks, and ranking optimizations using the seo CLI and MCP server.

BIGboss248/nextjs-wordpress

End-to-end repository onboarding and development environment setup skill. Scans repository structure, configures project metadata (docs/project.json), sets up the codebase-memory-mcp code intelligence knowledge graph server (in workspace mcp.json and globally for AGY only), configures git hooks with Husky and Commitlint, establishes multi-stage production Docker containerization, and automates credit-optimized Release Please CI/CD with multi-arch (AMD64 & ARM64) GHCR package deployment. Triggers on "/setup-repository", "setup repository", "setup repo", "initialize repository", "new repo setup", or when preparing any repository for development and AI agent workflows.

BIGboss248/nextjs-wordpress

AI screen scaffolding, layout generation, and variant exploration workflow powered by Google Stitch (StitchMCP). Consumes a component design specification (docs/design/components/[page name]/[component name]/design-spec.md), verifies and reuses the central Stitch project in docs/project.json (or creates/persists one if absent), seeds the project's design system into Stitch, synthesizes layout prompts to generate a screen and create one variant of the given design spec file, downloads and saves Stitch JPG screenshots and HTML code files directly into docs/design/components/[page name]/[component name]/stitch/ using binary-safe PowerShell Invoke-WebRequest, outputs image prompts to the user if visual assets are needed (without calling generate_image to conserve tokens), updates design-spec.md with Stitch layout benchmarks, and audits asset download integrity with an independent subagent. Triggers on "/stitch-design", "generate stitch screen", "create stitch variant", "scaffold screen with stitch", or "stitch...

관련 스킬