选项

代码修改后,通过 difit 请求用户进行代码审查。

...展开全部
11
更新时间 2026-08-26

关于 difit

difit 技能会在用户完成代码修改后,通过本地差异查看工具 difit 向用户请求代码审查。 它解决了将人工审查反馈纳入代理工作流的问题:代理针对选定的差异目标启动 difit,用户在 difit 界面中留下审查评论,当 difit 退出时,这些评论会被打印到标准输出(stdout),以便代理继续工作并处理这些评论。如果服务器在未留下评论的情况下关闭,代理将视同未提供审查评论。

该技能定义了一个简短的命令界面。它会优先选择difit二进制文件(如果可用),否则回退到npx difit;如果npx回退操作在沙箱环境中需要网络访问,它会先请求提升权限并获取用户批准,而不是静默执行。 审查目标包括未提交的更改、HEAD 提交、已暂存的更改、未暂存的更改、单个提交,或两个提交或分支之间的比较。 可通过 --comment 参数附加可选的启动注释,这些注释以 JSON 线程对象的形式固定在文件路径和行号范围内,有助于将审查结果直接显示在差异对比中;同时可通过 --include-untracked 参数将未跟踪的文件纳入审查范围。该工具仅可在 Git 管理的目录内使用。

目标用户是希望在代理编辑代码后,通过人工介入进行代码审查的开发者。 该技能注重安全性:它明确规定绝不将机密信息、令牌、密码、API 密钥、私钥或其他类似凭据的内容从差异中复制到评论正文或命令行参数中。其操作仅限于对 Git 差异运行本地审查工具,因此性质温和。

常见问题

审查反馈如何传达给代理?

当用户在 difit 中留下评论时,这些评论会在 `difit` 命令退出时输出到标准输出(stdout),随后代理会继续处理这些评论。如果 difit 在未留下评论的情况下被关闭,则视为未提供审核评论。

如果未安装 difit 该怎么办?

如果 `command -v difit` 执行成功,该技能将使用 difit;否则将回退到 `npx difit`。如果在未获授权的沙箱环境中,该 npx 回退操作需要网络访问权限,它会在运行前请求提升权限并获得用户批准。

我可以用它查看哪些内容?

未提交的更改、HEAD 提交、已暂存的更改、未暂存的更改、单个提交,或两个提交或分支之间的比较,可通过 --include-untracked 选项选择性地包含未跟踪的文件。

是否有任何使用限制?

是的,由于它基于 Git 差异进行操作,因此只能在 Git 管理的目录内使用。

它如何处理 diff 中的敏感数据?

它明确规定,绝不会将差分中的机密信息、令牌、密码、API 密钥、私钥或其他类似凭据的内容复制到 --comment 正文或任何命令行参数中。

所有文件

2 个文件agents/openai.yaml0.2 KB查看SKILL.md2.6 KB查看
在 GitHub 上查看

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 difit succeeds, use difit.
  • Otherwise, use npx difit.
  • If falling back to npx difit would 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 --comment bodies 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

复制 复制
快速设置: 将技能文件夹复制到 .claude/skills/ 目录下,Claude 会自动检测并使用该技能

相关技能

code-simplify
更新时间 2026-07-02
requesting-code-review
更新时间 2026-06-29
Git Commit Helper
更新时间 2026-06-29
commit-standards
更新时间 2026-06-29
OR