Communitygithub.com

BIGboss248/nextjs-wordpress

自我修正規則引擎與回饋迴圈,能從使用者修正、錯誤與專案特定限制中學習,並維持持久的自動修正規則集。

nextjs-wordpress 是什麼?

此技能為 AI 代理程式提供一個持久的自我修正與學習機制。它透過一個名為 `autofix.json` 的 JSON 規則集檔案,記錄使用者提供的修正指令、專案慣例以及已知錯誤的修復方式。在每次工作階段開始或處理任何任務之前,代理程式會掃描此規則集,將其內容視為強制性限制條件。當使用者提出任何修正、偏好指示(例如“不要使用 X,改用 Y”)或發現錯誤時,此技能會自動將一條新的、明確的指令規則附加至規則集中。規則之間若發生衝突,則以編號較大的新規則為準。此機制能有效防止代理程式在不同工作階段中重複犯下相同的預設假設或風格錯誤。它支援多種儲存路徑,並可應用於程式碼風格、架構設計、工具使用、流程規範等多個類別。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/BIGboss248/nextjs-wordpress/tree/HEAD/.agents/skills/self-repair

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

自我修復(自我修正規則引擎)

一個自我修正的記憶與學習引擎,將修正內容、專案慣例和錯誤修復記錄到持久的規則集檔案(autofix.json)中。它確保代理程式持續適應、消除跨工作階段的重複錯誤,並嚴格遵守使用者偏好。

為何有效: AI 代理程式傾向於在新的工作階段中重複相同的預設假設或風格錯誤。透過將學到的知識外部化為一個指令性、帶有版本號的 JSON 規則集(新規則優先),代理程式會保留針對特定使用者與儲存庫的嚴格界限。


儲存與配置

此技能會按以下優先順序尋找規則集檔案:

  1. .agents/autofix.json
  2. autofix.json(位於工作區根目錄)
  3. .rules/autofix.json

如果上述位置皆不存在,且需要新增規則時,它會建立 .agents/autofix.json(或根據專案慣例建立根目錄下的 autofix.json)。

規則結構

每條規則以 JSON 陣列儲存,結構如下:

[
  {
    "Rule_number": 1,
    "Category": "CODE",
    "Instruction": "永遠不要對 React 元件使用預設匯出 - 一律使用具名匯出。",
    "Why": "確保與程式碼庫保持一致並簡化重構。"
  }
]

允許的類別

類別說明範例
[STYLE]程式碼格式、命名慣例、匯入順序、註解"一律對輔助函式使用駝峰式命名"
[CODE]語言模式、函式庫選擇、型別定義、錯誤處理"永遠不要在 TypeScript 中使用 any;請使用 unknown 搭配型別守衛"
[ARCH]目錄結構、模組邊界、架構層次"API 路由位於 src/server/routes/,而非 src/api/"
[TOOL]CLI 指令、建置工具、套件管理器、測試框架"一律使用 pnpm 而非 npm 或 `yarn""
[PROCESS]Git 工作流程、提交訊息、PR 要求、測試閘道"永遠不要在提交訊息中加入 emoji"
[DATA]資料庫結構、遷移、快取策略、狀態形狀"請記得在表格中加入 created_at 和 updated_at 時間戳"
[UX]UI 行為、文案慣例、無障礙標準"一律為僅含圖示的按鈕提供明確的 aria-label"
[OTHER]一般性或專案領域特定的偏好"一律以 markdown 表格格式記錄公開 API 端點"

操作流程

[工作階段開始 / 收到任務]
            │
            ▼
┌───────────────────────────────┐
│ 1. 任務前掃描                  │ ◄── 讀取 autofix.json
│    - 載入所有規則              │
│    - 解決衝突(新規則優先)     │
│    - 建立活躍限制條件          │
└───────────┬───────────────────┘
            │
            ▼
┌───────────────────────────────┐
│ 2. 任務執行                    │
│    - 套用限制條件              │
│    - 執行程式碼 / 編輯        │
└───────────┬───────────────────┘
            │
            ├─────────────────────────────────────────┐
            │                                         │
     [無修正]                                 [偵測到觸發條件]
            │                                         │
            ▼                                         ▼
┌───────────────────────────────┐       ┌───────────────────────────────┐
│ 任務完成                       │       │ 3. 自我修復與捕捉             │
│ 將結果交付給使用者            │       │    - 制定指令式規則           │
└───────────────────────────────┘       │    - 附加至 autofix.json      │
                                        │    - 確認已學習               │
                                        └─────────────┬─────────────────┘
                                                      │
                                                      ▼
                                        ┌───────────────────────────────┐
                                        │ 4. 重新執行與修正             │
                                        │ 修正目前任務輸出             │
                                        └───────────────────────────────┘

詳細逐步執行說明

1. 任務前掃描(執行任何動作之前)

在規劃或修改任何任務中的檔案之前:

  1. 找到並載入 autofix.json。
  2. 掃描規則:
    • 檢查是否有任何規則直接適用於當前提示所涉及的檔案、工具或模式。
  3. 解決衝突:
    • 如果兩條規則給出衝突的指導,編號較大(較新)的規則優先。
  4. 保持限制條件活躍:
    • 將所有活躍規則視為硬性限制條件(相當於提示合約中的 CONSTRAINTS)。

2. 何時新增規則(觸發條件)

發生以下任何情況時,立即觸發規則捕捉:

  • 使用者明確修正輸出:例如,「不,不要用 X,用 Y 來做」、「我們這裡不使用類別元件」。
  • 使用者拒絕某個檔案、方法或模式:例如,「不要把測試檔案放在原始碼旁邊」。
  • 使用者陳述個人/團隊偏好:例如,「一律將提交訊息格式化為 Conventional Commits」、「永遠不要在文件中使用 emoji」。
  • 因錯誤假設而導致的錯誤:代理程式假設某個函式庫或檔案位置導致了失敗。
  • 使用者執行 /learn 或要求記住某條規則。

3. 附加新規則

當觸發條件發生時,執行以下原子更新:

  1. 讀取現有的 autofix.json 陣列。
  2. 決定下一個連續的 Rule_number:
    • 如果現有最高規則編號為 $N$,則新規則編號為 $N + 1$。
    • 如果檔案為空或不存在,則從 1 開始。
  3. 格式化新規則物件:
    • Rule_number:連續整數。
    • Category:標準類別之一(STYLE、CODE、ARCH、TOOL、PROCESS、DATA、UX、OTHER)。
    • Instruction:以嚴格的指令式格式撰寫:「永遠不要/一律執行 X - 因為 Y。」
    • Why:簡短原因(例如「使用者偏好」、「程式碼庫模式」、「框架限制」)。
  4. 將規則附加至 JSON 陣列,並以 2 個空格縮排格式化儲存檔案。
  5. 永遠不要刪除現有規則。如果舊規則已過時,請撰寫新規則,使其以較高編號取得優先權。
  6. 簡短通知使用者:

    「已學習規則 #<N>([CATEGORY]):<指令> — 已記錄於 autofix.json。」


4. 範例規則檔案 (autofix.json)

[
  {
    "Rule_number": 1,
    "Category": "PROCESS",
    "Instruction": "永遠不要在提交訊息中加入 emoji - 保持提交標題為純 Conventional Commits 格式。",
    "Why": "使用者偏好"
  },
  {
    "Rule_number": 2,
    "Category": "ARCH",
    "Instruction": "一律將 API 路由處理程式放在「src/server/routes/」,不要放在「src/api/」- 維持一致的後端架構。",
    "Why": "現有程式碼庫模式"
  },
  {
    "Rule_number": 3,
    "Category": "CODE",
    "Instruction": "在所有外部進入點一律使用 Zod 架構進行輸入驗證 - 防止未經型別檢查的執行時期輸入。",
    "Why": "防止執行時期錯誤並強制型別檢查"
  }
]

最佳實踐與邊界案例

  • 原子性 JSON 寫入:務必解析現有的 JSON 陣列,附加新物件,然後寫回有效的 JSON。絕不要因未跳脫的文字而損壞檔案。
  • 具體且指令性強:撰寫能讓另一個 AI 明確遵循的規則。避免模糊的建議(如「撰寫乾淨的程式碼」),應優先採用「一律在 .types.ts 檔案中,將型別與元件實作一起匯出」這類寫法。
  • 避免無限迴圈:記錄規則時,不要為規則檔案本身觸發另一個自我修復迴圈。
  • 取代規則:如果規則 1 說「使用 Axios」,而使用者隨後指示「全部遷移至 Fetch」,則新增規則 4:「一律使用原生 Fetch 替代 Axios」,並將 Why 設為「使用者要求遷移至原生 fetch(取代規則 1)」。

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

>- Configure and query WooCommerce APIs including WPGraphQL, WooGraphQL, and JWT auth for headless frontends. Use when connecting Next.js to WooCommerce or fetching store catalog data.

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

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...

相關技能