difit
yoshiko-pg/difit
在程式碼變更後,透過 difit 請求使用者進行程式碼審查。
...展開全部關於 difit
difit 技能會在程式碼修改完成後,透過本地差異檢視工具 difit 向使用者請求進行程式碼審查。 此功能解決了將人工審查回饋整合至代理程式工作流程的問題:代理程式會針對選定的 diff 目標執行 difit,使用者可在 difit 介面中留下審查評論,當 difit 結束時,這些評論會輸出至標準輸出(stdout),以便代理程式能繼續執行工作並處理這些回饋。若伺服器在未留下評論的情況下關閉,代理程式會將此視為未提供審查評論。
此技能定義了一個簡潔的命令介面。若可用,它會選用 difit 二進位檔;否則會回退至 npx difit。若 npx 回退機制在沙箱環境中需要網路存取權限,系統會先請求提升權限並取得使用者批准,而非在未經通知的情況下繼續執行。 審查目標包括未提交的變更、HEAD 提交、已暫存的變更、未暫存的變更、單一提交,或是兩個提交或分支之間的比較。 可透過 --comment 參數附加可選的啟動註解,格式為固定於檔案路徑和行範圍的 JSON 串列物件,此功能有助於直接在差異對比中顯示審查結果;此外,可透過 --include-untracked 參數將未追蹤的檔案納入審查範圍。此工具僅限於 Git 管理的目錄內使用。
目標使用者是希望在代理程式編輯程式碼後,能進行「人為介入」審查檢查點的開發人員。 此技能具備安全意識:它明確指示絕不將機密資訊、憑證、密碼、API 金鑰、私鑰或其他類似憑證的內容從 diff 複製到註解正文或命令列參數中。其操作僅限於對 Git diff 執行本地審查工具,因此安全性無虞。
常見問題
審查回饋如何傳達給代理?
當使用者在 difit 中留下評論時,這些評論會在 difit 指令結束執行時輸出至標準輸出(stdout),隨後代理程式會繼續處理這些評論。若 difit 在未留下評論的情況下被關閉,則視同未提供任何審查評論。
如果未安裝 difit 該怎麼辦?
若 `command -v difit` 執行成功,此技能將使用 difit;否則會回退至 npx difit。若該 npx 回退機制在未獲授權的沙盒環境中需要網路存取權限,系統會在執行前請求提升權限並取得使用者批准。
我可以透過它檢視哪些內容?
未提交的變更、HEAD 提交、已標記的變更、未標記的變更、單一提交,或是兩個提交或分支之間的比較,並可透過 --include-untracked 選項選擇性地包含未追蹤的檔案。
是否有任何使用限制?
是的,由於它基於 Git 差異進行操作,因此只能在 Git 管理的目錄內使用。
它如何處理 diff 中的敏感資料?
它會明確指示絕不將機密資訊、憑證、密碼、API 金鑰、私鑰或其他類似憑證的內容從 diff 複製到 --comment 內容或任何命令列參數中。
所有檔案
2 個檔案agents/openai.yaml0.2 KB檢視SKILL.md2.6 KB檢視Overview
This skill requests a code review from the user using difit.Before running commands, choose <difit-command> using the following rule:
- If
command -v difitsucceeds, usedifit. - Otherwise, use
npx difit. - If falling back to
npx difitwould require network access in a sandboxed environment without network permission, request escalated permissions and user approval before running it.
If the user leaves review comments, they are printed to stdout when the chosen difit command exits.When review comments are returned, continue work and address them.If the server is shut down without comments, treat it as "no review comments were provided." Restarting it is unnecessary.Manual verification of whether the page launched correctly is also unnecessary.
Commands
- Review uncommitted changes before commit:
<difit-command> . - Review the HEAD commit:
<difit-command> - Review staging area changes:
<difit-command> staged - Review unstaged changes only:
<difit-command> working
Basic Usage:
<difit-command> <target> # View single commit diff. ex: difit 6f4a9b7<difit-command> <target> [compare-with] # Compare two commits/branches. ex: difit feature main
Optional Startup Comments
If there is something you want to tell the user when difit opens, attach it as startup comments with --comment.This is useful for review findings, explanations, and any context the user should see directly on the diff.
<difit-command> <target> [compare-with] \ --comment '{"type":"thread","filePath":"src/foobar.ts","position":{"side":"old","line":102},"body":"line 1line 2"}' \ --comment '{"type":"thread","filePath":"src/example.ts","position":{"side":"new","line":{"start":36,"end":39}},"body":"Range comment for L36-L39"}'
- Use
type: "thread"for each comment. - Write comment bodies in the language the user is using.
- Use
position.side: "new"for lines that exist on the target side of the diff. - Use
position.side: "old"for lines that exist only on the deleted side. - Use range comments for issues that span multiple lines.
- Never copy secrets, tokens, passwords, API keys, private keys, or other credential-like material from the diff into
--commentbodies or any command-line arguments.
Including Untracked Files
For uncommitted changes, if files not yet added to git should also appear in the diff, add --include-untracked.
<difit-command> . --include-untracked
Constraints
Can only be used inside a Git-managed directory.
所有檔案
0 個檔案安裝 difit
請下載並將技能檔案解壓縮至您的 .claude/skills/ 目錄中。
下載 ZIP複製儲存庫並將技能檔案複製到您的專案中。
git clone https://github.com/yoshiko-pg/difit/blob/main/skills/difit/SKILL.md # Copy SKILL.md to your .claude/skills/ directory
複製





首頁
