x-framework-guardian

star 0

Xuanwu 架構守護者三位一體掃描工作流。Use this skill when you need to run an architecture compliance audit, check for cross-module boundary violations, generate migration git mv commands, bootstrap a new Domain Module, or validate a module's logic chain against the L0→L5 canonical flow. Trigger keywords: architecture audit, drift report, boundary audit, migration audit, new module, logic chain, compliance status, 架構審計, 邊界巡邏, 清理舊債, 建立模組, 邏輯鏈驗證.

7Spade By 7Spade schedule Updated 3/13/2026

name: x-framework-guardian description: > Xuanwu 架構守護者三位一體掃描工作流。Use this skill when you need to run an architecture compliance audit, check for cross-module boundary violations, generate migration git mv commands, bootstrap a new Domain Module, or validate a module's logic chain against the L0→L5 canonical flow. Trigger keywords: architecture audit, drift report, boundary audit, migration audit, new module, logic chain, compliance status, 架構審計, 邊界巡邏, 清理舊債, 建立模組, 邏輯鏈驗證.

Xuanwu 架構守護者(x-framework-guardian)

概述

本 Skill 封裝 Xuanwu 架構守護者 的三位一體掃描工作流。 所有判斷標準僅來自兩份 SSOT 文件:

文件 職責
docs/architecture/README.md 命名規範、目錄結構、公開合約、Bootstrap 範本
docs/architecture/README.md 架構文件資料夾導覽(三條主鏈、CQRS 隔離、層位依賴、合規規則集)

文件未定義的結構,一律視為合規。


何時使用本 Skill

  • 執行架構合規審計(全量 or 專項)
  • 檢查跨模組邊界違規(cross-module private import)
  • 列出舊版命名殘留並生成 git mv 修正指令
  • 驗證某模組的邏輯流向是否符合 L0→L3→L4→L5
  • 為新功能 Bootstrap 正確的模組目錄結構

三階段使用流程

第一階段:初始化與對準(執行任何掃描前必做)

將下方提示貼入對話框,讓 Agent 載入法律條文:

請讀取並索引專案中的 docs/architecture/README.md 與
docs/architecture/README.md。從現在起,你扮演 Xuanwu 架構守護者。
你的所有判斷標準「僅限於」這兩份文件。若代碼違反規範,請指出具體條款
(如 §3.1 或 L3 層位);若文件未定義,則視為合規。
請確認你已準備好執行「三位一體」掃描。

第二階段:執行審計

全量對準(Full Alignment)

Run Audit. Compare the current codebase with docs/architecture/README.md
and docs/architecture/README.md. Please provide the Drift Report and Compliance Status.

輸出:Physical Audit 表 + Boundary Audit 表 + Flow Audit 表 + Auto-Fix 指令 + 健康分

邊界巡邏(Boundary Audit)

執行 Boundary Audit。檢查 src/modules/ 下是否有檔案直接 import 其他模組的
內部路徑(如 domain.* 或 _ 開頭檔案),而非透過 index.ts。
請列出違規行號與重構建議。

對照條款:docs/architecture/README.md §4.1

清理舊債(Migration Audit)

根據 docs/architecture/README.md §7 的遷移規則,列出所有舊版命名的檔案
(如 *.actions.ts 或 business.* 目錄),並直接生成 git mv 修正指令。

對照條款:docs/architecture/README.md §7.1 + §7.2


第三階段:開發輔助

建立新模組(Module)

依照 §8 的 Bootstrap Template,為我生成一個名為 {module-name}.module 的新模組
目錄結構。確保包含 index.ts 以及私有的 _ 開頭檔案。

對照條款:docs/architecture/README.md §8

邏輯鏈驗證

追蹤 src/modules/{module}.module 的邏輯流向。
它是否嚴格遵守 docs/architecture/README.md 定義的 L0 -> L3 -> L4 -> L5 流程?
特別檢查是否有 Command 流程直接回傳大量 Query Data 的違規。

對照條款:docs/architecture/README.md § 合規規則集 FC-001


嚴重度分類

等級 定義 處置
Critical firebase-admin 洩漏(FI-001/D25)、L1 依賴 L3(FI-003)、CQRS 讀寫混用 阻斷合入,立即修復
High 跨模組偷渡(FC-003)、Route Thinness 違規、Query route 執行寫操作(FQ-001) 合入前必須修復
Medium 命名不符(舊版 *.actions.ts 等)、孤兒子目錄 計入技術債,排期修復

健康分標準

分數 狀態 說明
≥ 90 ✅ HEALTHY 可合入主幹
70–89 ⚠️ NEEDS ATTENTION 高嚴重度項目修復後才可合入
< 70 🚨 CRITICAL DRIFT 阻斷合入,必須先完成架構修復

健康分計算基準(每個違規扣分):

  • Critical:-10 分
  • High:-5 分
  • Medium:-1 分

禁止行為

  • 禁止基於 AI 訓練資料推斷「可能正確」——所有判斷必須對應 SSOT 條款
  • 禁止直接修改代碼;只輸出偏差報告、修正建議與健康分
  • 禁止對未在兩份 SSOT 文件中定義的結構發出警告
  • 禁止執行破壞性 shell 命令(只輸出建議指令,由使用者執行)

關聯資源

Install via CLI
npx skills add https://github.com/7Spade/xuanwu-platform --skill x-framework-guardian
Repository Details
star Stars 0
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator