/useful-skills:debug-patches [留空=套用全部;或 patch ID;或 remove;或「新增:<描述>」]from useful-skills
把「只在本機/測試環境才要有」的 debug 改動(例如印出 req/res body)套進當前 repo,並單獨包成一個 temp commit,測完可以整包丟掉。也負責維護這份 debug 改動清單:使用者說「再加一個測試用改動」「記下這個 debug patch」時,把新的一筆寫進 catalog。觸發:套 debug 改動、加測試用的 log、temp commit、debug patch、把 debug commit 拿掉。
Ships in useful-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
一組「平常不該進 codebase、但 debug 時很想要」的改動。呼叫本 skill 會把它們套進當前 repo 並單獨包成一個 temp commit——跟正在做的功能改動分開,測完 drop 掉即可,不會混進 MR。
這些改動一律不得 merge 進 stage / main。 多數會把 request body、response body 這類含 密碼 / token / PII 的東西寫進 log,只能活在本機或自己的 debug 分支。
| 使用者輸入 | 模式 |
|---|---|
| 無參數、或指定 patch ID | A. 套用(預設) |
remove / 「拿掉」/「還原」/「要 push 了」 | B. 移除 |
| 「新增:…」/「再加一個…」/ 描述一個新的 debug 改動 | C. 加進 catalog |
選 patch:讀下方 Catalog。無參數 → 取所有「適用專案」符合當前 repo 的 patch;有指定 ID → 只取該筆。 不符合當前 repo 的直接略過,並在最後回報時說明略過了哪些、為什麼。
檢查衝突(不可略過):
git log --oneline -20 找有沒有既存的 temp: commit。有 → 先問使用者要疊上去還是先移除舊的。git status --short 看 patch 會動到的檔案有沒有未 commit 的既有改動。有 → 停下來問,不要硬套:
混在一起之後 temp commit 就無法乾淨 drop。套用:照 patch 檔的「套用方式」改。以現行檔案為準做局部改動,不要整檔覆蓋——patch 檔裡的
參考實作是寫下當時的樣子,目標檔案可能已經演進。所有新增的行都要帶 [temp-debug] 標記註解,
移除時才 grep 得到。
驗證:跑專案自己的型別檢查 / lint(例如 bunx tsc --noEmit)確認沒把 build 弄壞。跑不動就說明原因,別默默跳過。
commit:git add 逐一列出改到的檔案(不用 git add -A / git add .),然後:
temp: debug patches — <patch ID 清單>(勿 merge)
commit 訊息不得含任何 AI attribution(不加 Co-Authored-By、不加 🤖 Generated with)。
回報:commit SHA、套了哪幾筆、略過哪幾筆與原因,並提醒 push 前用 remove 模式清掉。
先 git log --oneline -20 找到那個 temp: commit,再依它的位置選做法:
git reset --mixed HEAD~1,接著只對 patch 動到的那幾個檔案 git checkout -- <檔案>。
不要用 git reset --hard——會一併吃掉其他未 commit 的工作。git rebase --onto <temp-sha>^ <temp-sha> HEAD 把它抽掉。
後續 commit 有動到同一個檔案時會衝突,解法一律是留「沒有 [temp-debug] 標記」的那一版。收尾:git grep -n "\[temp-debug\]" 確認沒有殘留。
patches/ 新增一個檔,格式照 patches/http-req-res-body.md。| ID | 內容 | 適用專案 |
|---|---|---|
| http-req-res-body | 每筆 HTTP request 完成時,把 request body 與 response body 一起印進 access log | ai_family_backend / backend(Express + pino-http) |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub lystyp/useful-skill --plugin useful-skills19 skills in this plugin
/ai-family-backend-styleai_family_backend / backend-v2 專案的 coding style 與實作 tips — 分層架構(Controller → Service → Repository)、Zod validator 慣例、Import 分群、Prisma + Exception 處理、Pagination、Swagger/Router/Service/Repository 的新增流程、SRP 檢查四問、Commit 規範。當在 /Users/daniel.shi/hephai/ai_family_backend 這個 repo 內寫或改 code(特別是 controllers/services/repository/validators/routes/swagger)時觸發。/backend-repo-onboarding讓後端工程師在最短時間內從「看得懂字」變成「敢改」一個陌生的後端 repo。做法是先實地求證產出一份上手文件(目錄職責與依賴方向、對應到他原本熟的分層、可執行的架構驗證指令、一條讀路徑與一條寫路徑、交易邊界與錯誤轉換、改動迴路、語法與慣例路障),再照那份文件一步步導覽,隨時接「貼一行 code 問這是什麼」。當使用者說「我要怎麼讀這個專案」「幫我熟悉這個 repo」「我接手了一個專案」「這個後端是怎麼設計的」「每個資料夾是做什麼用的」「新人怎麼上手」「帶我看一下這個後端」「這專案怎麼分層」「我第一次碰這個語言的後端」時務必觸發。即使他只丟一個局部問題(例如「api path 寫在哪」「這個資料夾幹嘛的」),也先照常回答,然後用一句話提議把剩下的補齊成一份上手文件——因為他要的通常不只是那一題。不要觸發:已經熟這個 repo 的人問某支功能在哪、純 bug 排查、跟任何 repo 無關的語言教學、或只是要做 code review。/Other plugins' skills for the same job