mcpField
C
check

check

github.com/continuedev测试与质量645 次安装
代码仓库

关于 check

check 是本地检查运行器,可针对当前改动执行 `.continue/checks/` 中的 Markdown 检查。它准备差异和提交上下文,由后台 Agent 并行运行检查,并汇总结果供后续处理。

主要功能

  1. 01运行 `.continue/checks/` 中的检查
  2. 02准备差异与提交上下文文件
  3. 03通过子 Agent 并行执行检查
  4. 04汇总通过与失败结果
  5. 05支持用户处理检查发现

适用场景

  1. 01对本地改动运行仓库检查
  2. 02在提交拉取请求前审查分支
  3. 03分类处理自动审查发现

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/continuedev/skills --skill check

安装后在 Claude Code 中输入/check确认已加载。

详细介绍

本地检查运行器

像 CI 中的 GitHub PR 检查一样,针对当前更改运行每个 .continue/checks/*.md 检查。

工作流

1. 收集上下文(写入磁盘,而不是写入你的上下文)
  • 运行 git diff main...HEAD 并将其写入 /tmp/check-diff.patch。如果差异为空,也尝试运行 git diff --cached 和 git diff。
    • 限制差异大小:如果差异超过 3000 行,写入时截断至 3000 行。添加最后一行:\n... (diff truncated at 3000 lines)。
    • 使用单条 bash 命令,例如:git diff main...HEAD | head -3000 > /tmp/check-diff.patch
  • 运行 git log main..HEAD --oneline 并将其写入 /tmp/check-log.txt。
  • 如果完全没有更改,告知用户并停止。
  • 不要将这些文件读回你自己的上下文中。 子 Agent 会直接读取它们。
2. 查找检查项
  • 使用 glob 查找 .continue/checks/*.md 中的所有检查文件。
  • 不要读取检查文件。 只提取文件名,并据此生成检查名称(例如,code-conventions.md ->「代码规范」)。
  • 向用户列出将运行的检查,然后立即继续,无需等待。
3. 并行运行检查(后台 Agent)

针对每个检查文件,使用以下设置启动一个子 Agent:

  • subagent_type: "general-purpose"
  • run_in_background: true

使用以下提示词结构:

You are a code reviewer running an automated check on a pull request.

## Setup
1. Read your check instructions from: {absolute path to .continue/checks/xxx.md}
2. Read the diff from: /tmp/check-diff.patch
3. Read the commit log from: /tmp/check-log.txt

## Your Task
Review the diff according to your check instructions. For each finding:
1. State the severity (Error / Warning / Info)
2. Reference the specific file and line from the diff
3. Explain what's wrong and how to fix it

If everything looks good and you have no findings, say "PASS" and briefly explain why the changes are clean for your check.

If you have findings, say "FAIL" and list them.

Keep your response concise. Do not repeat the diff back. Focus only on actionable findings.
Your final message must start with either "PASS" or "FAIL" on its own line.

在一条消息中启动所有子 Agent(同时发出所有 Agent 工具调用)。

4. 收集结果

所有 Agent 完成后,只读取每个输出文件的最后 30 行:tail -30 {output_file}。判断其中是 PASS 还是 FAIL,并提取关键发现。

5. 汇总结果

呈现汇总表:

| Check | Result |
|-------|--------|
| Code Conventions | Passed |
| Security | 2 errors, 1 warning |
| Test Quality | Passed |
6. 梳理发现

不要将所有失败详情一次性全部列出。应使用 AskUserQuestion 呈现每项失败检查的发现,并让用户决定如何处理。

对于每项有发现的检查,使用一个 AskUserQuestion,其中包含:

  • 将检查名称作为标题
  • 在问题文本中简要说明发现
  • 选项示例:
    • 「修复」— 你将修复该问题
    • 「跳过」— 忽略此发现

你可以在一次 AskUserQuestion 调用中批量处理多个失败检查(每项失败检查对应一个问题,每次最多 4 个)。如果失败检查超过 4 项,则使用多次 AskUserQuestion 调用。

然后执行用户选择的操作——修复他们要求修复的问题,跳过他们选择跳过的问题。

评论

支持 Markdown