.skills/gravito-architect/SKILL.md
將 AI 生成的程式碼轉化為深度技術規格文檔,專注於解釋邏輯、定義介面、揭示潛在風險(N+1 查詢、Race Condition、記憶體洩漏)與設計決策。適用於 Bun + TypeScript 專案。觸發時機:(1) 開發完成後需要產出技術規格書 (2) 優化需求前需要分析架構缺陷 (3) 重構前需要梳理邏輯 (4) 使用者要求「分析架構」「生成技術文檔」「解釋設計決策」
npx skillsauth add gravito-framework/gravito gravito-architectInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Gravito Architect 協助開發者將「AI 輔助生成的程式碼」轉化為「開發者完全掌握的技術架構」,重點在於:
詢問使用者提供以下資訊:
types.ts 或 interfaces.ts(若存在)範例提問:
為了生成準確的技術規格,請提供:
1. 核心程式碼檔案路徑(如:`packages/atlas/src/QueryBuilder.ts`)
2. 相關的型別定義檔案(如:`packages/atlas/src/types.ts`)
3. 測試檔案路徑(如:`packages/atlas/tests/QueryBuilder.test.ts`)
請問需要完整分析,還是僅關注特定面向(如:效能優化、設計決策)?
使用 Read 工具讀取所有相關檔案:
// 依序讀取:
// 1. 核心程式碼
// 2. 型別定義
// 3. 測試案例
分析重點:
references/analysis-checklist.md)按照 references/analysis-checklist.md 執行必檢項目:
any 使用、泛型約束重要:每個問題都必須提供:
依照 references/output-template.md 的結構生成文檔,包含:
輸出方式:
/docs 目錄使用 assets/DOCS_ARCH_template.md 作為基礎,生成可直接使用的 Markdown 檔案:
建議將此文檔儲存為:`docs/architecture/[模組名稱].md`
您可以直接複製以下內容:
\`\`\`markdown
[完整的技術規格內容]
\`\`\`
檔案名稱:行號)在輸出前確認:
references/output-template.md 查看完整範例references/analysis-checklist.md 學習如何識別問題assets/DOCS_ARCH_template.md 提供空白範本由於此技能專為 Gravito 框架設計,請特別注意:
Atlas ORM:
Luminosity:
Bun Runtime:
Bun.file(), Bun.write())我剛完成 Atlas 的 QueryBuilder 模組,請幫我產出技術規格書。
檔案位置:
- packages/atlas/src/QueryBuilder.ts
- packages/atlas/src/types/QueryTypes.ts
- packages/atlas/tests/QueryBuilder.test.ts
步驟 1:讀取檔案
正在讀取以下檔案:
- packages/atlas/src/QueryBuilder.ts
- packages/atlas/src/types/QueryTypes.ts
- packages/atlas/tests/QueryBuilder.test.ts
步驟 2:執行分析
分析完成!主要發現:
✅ 無 N+1 查詢問題(已使用 Eager Loading)
⚠️ 發現潛在 Race Condition(並發更新時無鎖保護)
✅ 記憶體管理良好(無洩漏風險)
步驟 3:輸出執行摘要
## 執行摘要
**核心功能**:QueryBuilder 提供類型安全的鏈式查詢 API
**關鍵優點**:
- 使用 Proxy 實現延遲執行,避免過早查詢
- 內建查詢快取,重複查詢效能提升 98%
**需注意問題**:
- 並發更新場景存在 Race Condition(建議使用樂觀鎖)
- 不支援子查詢(需手動使用 `whereRaw()`)
**建議優先處理**:
1. 新增樂觀鎖支援(Critical)
2. 實作子查詢語法(High)
步驟 4:提供完整文檔
完整的技術規格文檔如下(可複製到 `docs/architecture/QueryBuilder.md`):
\`\`\`markdown
[完整的 6 個章節內容]
\`\`\`
檔案路徑錯誤:
Glob 工具搜尋可能的檔案位置程式碼過於複雜:
缺少型別定義:
如果使用者對輸出不滿意,詢問:
根據回饋調整輸出,直到使用者滿意。
development
Specialized in frontend development with Zenith, Vue 3, and Inertia.js. Trigger this for UI components, page layouts, and styling.
testing
Specialized in testing and quality assurance for Gravito. Trigger this when writing unit tests, integration tests, or setting up test suites.
data-ai
Expert in Gravito Satellite modules. Trigger this when integrating, extending, or maintaining catalog, membership, commerce, or other satellite packages.
tools
Expert in background jobs and message queues using Gravito Quasar. Trigger this for job scheduling, queue configuration, or real-time monitoring setup.