mcpField
A
agent-review

agent-review

github.com/civitai测试与质量7.3k61 次安装今天更新
代码仓库

关于 agent-review

agent-review 是一款命令行技能,可借助外部 AI Agent 审视代码、设计、错误或文档。它支持通过管道或文件传入内容,并可选择模型、补充上下文。

主要功能

  1. 01从标准输入或文件提交审查内容
  2. 02选择模型及其别名
  3. 03指定行范围并附加上下文文件
  4. 04设置系统提示词和温度
  5. 05输出文本或原始 JSON

适用场景

  1. 01检查代码中的安全与性能问题
  2. 02为架构决策征求第二意见
  3. 03结合错误上下文分析故障
  4. 04审查文档或测试覆盖情况

安装

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

$npx skills add https://github.com/civitai/civitai --skill agent-review

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

附带文件.env.examplequery.mjs

详细介绍

Agent Review

从外部 AI Agent 获取反馈。适用于代码审查、架构决策或征求第二意见。

运行命令

echo "code or prompt" | node .claude/skills/agent-review/query.mjs [options] "Your question"
# or
node .claude/skills/agent-review/query.mjs --file <path> [options] "Your question"
选项
标志简写说明
--model <model>-m模型或别名(默认:gemini)
--file <path>-f从文件读取输入,而非从 stdin 读取
--lines <start-end>-l从文件中提取指定行(例如,50-100)
--context <path>-c附加上下文文件(可重复使用)
--system <prompt>-s自定义系统提示词
--temperature <n>-t温度,范围为 0-1(默认:0.7)
--quiet-q禁止显示状态消息和用量统计
--list列出可用模型
--json输出原始 JSON 响应
可用模型
模型 ID别名提供商备注
google/gemini-3-pro-previewgemini、g3OpenRouter默认模型——适合提供外部视角
openai/gpt-5.1-codexgpt、codex、gpt5OpenRouter擅长代码分析
anthropic/claude-opus-4.5opus、claude-opusAgent SDK使用本地订阅
anthropic/claude-sonnet-4.5sonnet、claudeAgent SDK使用本地订阅

Anthropic 模型通过 Claude Agent SDK 路由(使用你的 Claude 订阅)。 其他模型通过 OpenRouter API 路由(需要 OPENROUTER_API_KEY)。

环境变量

变量必需说明
OPENROUTER_API_KEY非 Anthropic 模型必需OpenRouter API 密钥
AGENT_REVIEW_DEFAULT_MODEL否覆盖默认模型

示例

代码审查
# Review a file for security issues
cat src/server/auth.ts | node .claude/skills/agent-review/query.mjs \
  "Review this authentication code for security vulnerabilities"

# Review with a specific model (using alias)
node .claude/skills/agent-review/query.mjs -m gpt -f src/utils/parser.ts \
  "Review this parser for edge cases and error handling"
审查指定行
# Review a specific function (lines 50-100)
node .claude/skills/agent-review/query.mjs \
  -f src/server/auth.ts -l 50-100 \
  "Review this authentication function for security issues"

# Review a single line
node .claude/skills/agent-review/query.mjs \
  -f src/utils/parser.ts -l 42 \
  "Is this regex safe from ReDoS attacks?"
使用上下文文件
# Review code with type definitions as context
node .claude/skills/agent-review/query.mjs \
  -f src/api/routes.ts \
  -c src/types/api.ts \
  -c src/types/models.ts \
  "Review this API implementation"

# Review component with its hooks as context
node .claude/skills/agent-review/query.mjs \
  -f src/components/UserProfile.tsx \
  -c src/hooks/useUser.ts \
  "Review this React component for performance issues"
架构反馈
# Get feedback on a proposed design
cat docs/design-proposal.md | node .claude/skills/agent-review/query.mjs \
  "What are the potential issues with this architecture?"
自定义系统提示词
node .claude/skills/agent-review/query.mjs \
  -f src/api/routes.ts \
  -s "You are a security expert specializing in API design" \
  "Audit this API for OWASP top 10 vulnerabilities"
温度控制
# Lower temperature for more deterministic analysis
node .claude/skills/agent-review/query.mjs -t 0.2 -f src/algo.ts \
  "Analyze the time complexity"

# Higher temperature for creative suggestions
node .claude/skills/agent-review/query.mjs -t 0.9 -f src/ui.tsx \
  "Suggest ways to improve the user experience"
使用 Anthropic 模型(本地订阅)
# Uses Claude Agent SDK - no API credits consumed
node .claude/skills/agent-review/query.mjs -m opus -f complex-algorithm.ts \
  "Analyze the time complexity and suggest optimizations"
安静模式(用于脚本)
# Suppress all status messages, only output the response
REVIEW=$(node .claude/skills/agent-review/query.mjs -q -f src/auth.ts \
  "List security issues as JSON array")
echo "$REVIEW" | jq .

输出

响应文本会写入 stdout。响应之后,用量统计会显示在 stderr 中:

Tokens: 189 in / 871 out (1060 total)
Cost: $0.0108

这有助于跟踪 OpenRouter 请求的令牌消耗和费用。使用 --quiet 可禁止显示。

适用场景

  • 代码审查:征求对代码质量、安全性或性能的第二意见
  • 架构决策:从另一种视角验证设计选择
  • Bug 分析:提供错误上下文并获取调试建议
  • 文档审查:检查文档是否清晰、完整
  • 测试覆盖率:找出缺失的测试用例

提示

  • 对于大多数外部审查,建议使用默认模型(Gemini 3 Pro)
  • 需要与 Claude 的风格保持一致时,请使用 Anthropic 模型
  • 使用 -l 审查特定函数,而无需发送整个文件(节省令牌)
  • 使用 -c 添加类型定义或相关文件,以提供更充分的上下文
  • 使用 -t 0.2 获取更聚焦、更确定的响应,使用 -t 0.8 获取更有创意的建议
  • 如需快速审查,可直接通过管道传入代码:cat file.ts | node ... "review this"

评论

支持 Markdown