/backend:data-accessfrom backend
資料存取層:Repository 介面與實作、查詢物件、ORM 與 micro-ORM(如 Dapper)的取捨、參數化查詢、排序白名單、分頁。附 .NET(EF Core+Dapper)附錄。Use when 建立新 Repository、實作資料存取層、新增自訂查詢方法、複雜 SQL 查詢、分頁、repository pattern、data access layer、dapper query、raw sql。
Ships in backend. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
先看專案的 *.csproj(EF Core/Dapper)、go.mod、pyproject.toml(SQLAlchemy 等)、package.json(Prisma/TypeORM)、pom.xml、DB 連線字串、migration 目錄,對照下表載入附錄,並在回報第一行寫「附錄:<檔名>」。
| 偵測到 | 附錄 |
|---|---|
*.csproj/*.sln(.NET) | ${CLAUDE_PLUGIN_ROOT}/references/stacks/dotnet.md(共用)+ references/dotnet.md(BaseRepository、SqlGenerator、CTE 分頁、排序白名單) |
go.mod、pyproject.toml、node 後端的 package.json、pom.xml 等 | 目前沒有附錄,走下方退路 |
沒有對應附錄:照本 skill 的通用方法,加上專案既有程式的寫法(先找 2–3 個同類檔當樣板;有裝 workspace 就照 workspace:convention-first(可選))。做完問使用者要不要把這次的寫法整理成新附錄 references/stacks/<stack>.md,回報寫「附錄:無(照既有程式)」。
| 情境 | 選用 | 理由 |
|---|---|---|
| 單表 CRUD、簡單 JOIN、需要變更追蹤 | ORM | 開發快、型別安全 |
| 多表複雜 JOIN(>3 表)、報表、效能敏感、DB 引擎特定語法 | micro-ORM/手寫 SQL | SQL 形狀可控 |
| 批次大量寫入 | micro-ORM 或批次 API | 避開逐筆追蹤成本 |
| 兩者並存 | 同一連線與交易 | 避免交易不一致 |
灰色地帶(JOIN >3、報表、需 View)→ 派 lifecycle:architect 抉擇(可選;沒裝 lifecycle 用 general-purpose agent,prompt 帶「架構顧問,給 2–3 方案與 trade-off」)。派工 prompt 要帶上 §0 載入的附錄絕對路徑(${CLAUDE_PLUGIN_ROOT} 展開後),agent 才讀得到;general-purpose 退路也一樣。
ORDER BY。分頁語法依目標 DB 版本選擇:
ROW_NUMBER):相容性最廣,舊版唯一選項。OFFSET/FETCH(或 LIMIT/OFFSET):語法簡潔,需確認版本支援。Repository 回傳「總筆數+當頁項目」,頁碼與每頁筆數由共用分頁基底提供;排序預設值由 Handler 或 Repository 設定。
唯讀報表類查詢可接受髒讀時才使用鎖提示(如 NOLOCK),一致性要求高的查詢不用。
unit-testing 決策矩陣)。What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub kerryhuang/plugharbor --plugin backend7 skills in this plugin
/api-endpoint對外 API 端點開發:標準 CRUD 端點、版本控制、回應模型與狀態碼、分頁契約、Request 驗證。附 .NET(ASP.NET Core Controller)附錄。Use when 建立新 API Controller、新增 REST 端點、實作 API versioning、api endpoint、webapi controller、crud controller、REST API。/background-job背景作業與排程開發:Job 類別設計、DI 註冊、排程類型(固定 Cron、延遲、自動重排)、冪等與失敗處理。附 .NET(Hangfire)附錄。Use when 建立新背景作業、設定排程、需要 Job 開發範本、background job、recurring job、hangfire job、cron、排程作業。/cqrsCQRS 用例拆分:Command/Query Handler、Notification 事件、交易管線、分頁查詢與回傳規則。附 .NET(MediatR)附錄。Use when 新增 Handler、實作 CRUD 操作、cqrs、command handler、query handler、mediator、notification、交易管線、transaction behavior。Other plugins' skills for the same job