Agent审查
- 作者仓库星标 3,406
- 作者更新于 实时读取
- 作者仓库 claude-octopus
- 领域
- 安全
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @nyldn · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: skill-code-review
description: Expert multi-AI code review with inline PR comments — use for thorough quality and security anal…
category: 安全
runtime: 无特殊运行时
---
# skill-code-review 输出预览
## PART A: 任务判断
- 适用问题:安全审计、密钥扫描、权限检查或风险分析。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“MANDATORY COMPLIANCE — DO NOT SKIP / Quick Mode / Usage”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于安全审计、密钥扫描、权限检查或风险分析,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“MANDATORY COMPLIANCE — DO NOT SKIP / Quick Mode / Usage”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/octo` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令。
先用一个小任务确认它会围绕“MANDATORY COMPLIANCE — DO NOT SKIP / Quick Mode / Usage”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: skill-code-review
description: Expert multi-AI code review with inline PR comments — use for thorough quality and security anal…
category: 安全
source: nyldn/claude-octopus
---
# skill-code-review
## 什么时候使用
- 用于审阅代码、文档或方案并给出可执行反馈 适合处理安全审计、密钥扫描、权限检查和风险分析,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;通常不需要额外 A…
- 面向安全审计、密钥扫描、权限检查或风险分析,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「MANDATORY COMPLIANCE — DO NOT SKIP / Quick Mode / Usage」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "skill-code-review" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> MANDATORY COMPLIANCE — DO NOT SKIP / Quick Mode / Usage
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Host: Codex CLI — This skill was designed for Claude Code and adapted for Codex. Cross-reference commands use installed skill names in Codex rather than
/octo:*slash commands. Use the active Codex shell and subagent tools. Do not claim a provider, model, or host subagent is available until the current session exposes it. For host tool equivalents, seeskills/blocks/codex-host-adapter.md.
Code Review Skill
MANDATORY COMPLIANCE — DO NOT SKIP
When this skill is invoked, you MUST execute the multi-LLM review pipeline. You are PROHIBITED from:
- Doing a direct single-model code review without multi-provider synthesis
- Deciding the scope is "too broad" and narrowing it without asking the user
- Skipping the provider check or structured review phases
- Substituting two background Sonnet agents for the full multi-provider pipeline
- Rationalizing "a focused audit would be more effective" — the user wants multi-LLM perspectives
Your first output line MUST be: 🐙 **CLAUDE OCTOPUS ACTIVATED** - Multi-LLM Code Review
Invokes the code-reviewer persona for thorough code analysis during the ink (deliver) phase.
Quick Mode
For fast sanity checks (staged changes, small PRs), skip the full review pipeline and run just two phases:
# Quick: grasp (consensus on scope) → tangle (parallel review)
${HOME}/.claude-octopus/plugin/scripts/orchestrate.sh grasp "[review request]"
${HOME}/.claude-octopus/plugin/scripts/orchestrate.sh tangle "[synthesized scope]"
Use quick mode when user says "check this PR", "quick review", "sanity check my changes", or for pre-commit checks. Use the full review for PRs with security/architecture impact.
Usage
# Via orchestrate.sh
${HOME}/.claude-octopus/plugin/scripts/orchestrate.sh spawn code-reviewer "Review this pull request for security issues"
# Via auto-routing (detects review intent)
${HOME}/.claude-octopus/plugin/scripts/orchestrate.sh auto "review the authentication implementation"
Capabilities
- AI-powered code quality analysis
- Security vulnerability detection
- Performance optimization suggestions
- Architecture and design pattern review
- TDD compliance and test-first evidence review
- Autonomous code generation risk detection
- Best practices enforcement
Persona Reference
This skill wraps the code-reviewer persona defined in:
agents/personas/code-reviewer.md- CLI:
codex-review - Model:
gpt-5.2-codex - Phases:
ink
Example Prompts
"Review this PR for OWASP Top 10 vulnerabilities"
"Analyze the error handling in src/api/"
"Check for memory leaks in the connection pool"
"Review the test coverage for the auth module"
Autonomous Implementation Review
When the review context indicates AI-assisted, Autonomous / Dark Factory, or unclear provenance, raise the rigor bar. Do not treat generated code as trustworthy just because it is polished.
TDD Evidence
Check for concrete signs that the change followed red-green-refactor rather than test-after implementation:
- Compare the diff and recent history when available to see whether tests were added before or alongside production changes.
- Prefer behavior-defining tests over snapshot-only or mock-heavy tests that merely restate the implementation.
- Verify the production code looks like the minimum needed to satisfy the tests, rather than a speculative abstraction with unused options.
- If evidence is missing, mark TDD compliance as unknown and do not assume TDD happened.
Autonomous Codegen Risk Patterns
Elevate or add findings when you see patterns common in high-autonomy output:
- Option-heavy APIs or abstractions not justified by tests or current requirements
- Placeholder logic, TODO/FIXME-driven control flow, or dead branches that appear "future ready"
- Mock, fake, or dummy behavior leaking into production paths
- Unwired components, unused helpers, or code that exists without an execution path
- Silent failure handling, broad catch blocks, missing logs, or weak operational visibility
- Missing rollback notes, migration guards, or release-safety checks for risky changes
Review Output Addendum
Add a short section to the review synthesis when autonomy or TDD is in scope:
## TDD / Autonomy Assessment
- Provenance: Human-authored | AI-assisted | Autonomous / Dark Factory | Unknown
- TDD evidence: Confirmed | Partial | Unknown
- Autonomous risk signals: None | Minor | Significant
- Recommendation: Ship | Fix before merge | Re-run with /octo:tdd or tighter supervision
Implementation Completeness Verification
After the code-reviewer persona completes, run stub detection to verify implementation completeness.
Stub Detection Process
Step 1: Get changed files
# Get files changed in the commit/PR
if [ -n "$COMMIT_RANGE" ]; then
changed_files=$(git diff --name-only "$COMMIT_RANGE")
else
changed_files=$(git diff --name-only HEAD~1..HEAD)
fi
# Filter for source code files
source_files=$(echo "$changed_files" | grep -E "\.(ts|tsx|js|jsx|py|go)$")
Step 2: Check for stub patterns
For each changed file, check for common stub indicators:
for file in $source_files; do
echo "Checking $file for stubs..."
# Check 1: Comment-based stubs
stub_count=$(grep -E "(TODO|FIXME|PLACEHOLDER|XXX)" "$file" 2>/dev/null | wc -l | tr -d ' ')
if [ "$stub_count" -gt 0 ]; then
echo "⚠️ WARNING: Found $stub_count stub indicators in $file"
grep -n -E "(TODO|FIXME|PLACEHOLDER)" "$file" | head -3
fi
# Check 2: Empty function bodies
empty_functions=$(grep -E "function.*\{\s*\}|const.*=>.*\{\s*\}" "$file" 2>/dev/null | wc -l | tr -d ' ')
if [ "$empty_functions" -gt 0 ]; then
echo "❌ ERROR: Found $empty_functions empty functions in $file"
echo " Empty functions must be implemented before merge"
fi
# Check 3: Return null/undefined
null_returns=$(grep -E "return (null|undefined);" "$file" 2>/dev/null | wc -l | tr -d ' ')
if [ "$null_returns" -gt 0 ]; then
echo "⚠️ WARNING: Found $null_returns null/undefined returns in $file"
echo " Verify these are intentional, not stubs"
fi
# Check 4: Substantive content check
substantive_lines=$(grep -vE "^\s*(//|/\*|\*|import|export|$)" "$file" 2>/dev/null | wc -l | tr -d ' ')
if [[ "$file" == *.tsx ]] && [ "$substantive_lines" -lt 10 ]; then
echo "⚠️ WARNING: Component $file only has $substantive_lines substantive lines"
echo " Components should typically be >10 lines"
fi
# Check 5: Mock/test data in production
mock_data=$(grep -E "const.*(mock|test|dummy|fake).*=" "$file" 2>/dev/null | wc -l | tr -d ' ')
if [ "$mock_data" -gt 0 ]; then
echo "⚠️ WARNING: Found $mock_data references to mock/test data in $file"
echo " Ensure these are not placeholders for production code"
fi
done
Step 3: Add findings to review synthesis
Include stub detection results in the review output:
## Implementation Completeness
**Stub Detection Results:**
✅ **Fully Implemented Files:**
- src/components/UserProfile.tsx (42 substantive lines)
- src/api/users.ts (67 substantive lines)
⚠️ **Files with Warnings:**
- src/components/Dashboard.tsx
- 3 TODO comments (non-blocking)
- Consider addressing before release
❌ **Files Requiring Implementation:**
- src/utils/analytics.ts
- 2 empty functions detected (BLOCKING)
- Must implement before merge
**Verification Levels:**
- Level 1 (Exists): 5/5 files ✅
- Level 2 (Substantive): 3/5 files ⚠️
- Level 3 (Wired): 4/5 files ✅
- Level 4 (Functional): Tests pending
**Recommendation:**
- Fix empty functions in analytics.ts before merge
- Address TODO comments in Dashboard.tsx in follow-up PR
- All other files meet implementation standards
Stub Detection Reference
See .claude/references/stub-detection.md for comprehensive patterns and detection strategies.
When to Block Merge
BLOCKING Issues (must fix):
- ❌ Empty function bodies
- ❌ Mock data in production code paths
- ❌ Components not imported/wired anywhere
- ❌ API endpoints returning empty objects
NON-BLOCKING Issues (note in review):
- ⚠️ TODO/FIXME comments (create follow-up tickets)
- ⚠️ Null returns (if intentional)
- ⚠️ Low line count (if appropriate for the component)
Post Review to PR (v8.44.0)
After generating the review synthesis, check if the current branch has an open PR and offer to post findings as a PR comment.
Step 1: Detect Open PR
# Check if we're on a branch with an open PR
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
PR_NUM=""
if [[ -n "$CURRENT_BRANCH" && "$CURRENT_BRANCH" != "main" && "$CURRENT_BRANCH" != "master" ]]; then
if command -v gh &>/dev/null; then
PR_NUM=$(gh pr list --head "$CURRENT_BRANCH" --json number --jq '.[0].number' 2>/dev/null || echo "")
fi
fi
Step 2: Post Review Comment
If an open PR exists, post the review findings as a PR comment:
if [[ -n "$PR_NUM" ]]; then
echo "Found open PR #${PR_NUM} on branch ${CURRENT_BRANCH}"
# Build the review comment body from synthesis
REVIEW_BODY="## Code Review — Claude Octopus
${REVIEW_SYNTHESIS}
*Review generated by Claude Octopus (/octo:review)*
*Providers: 🔴 Codex | 🟡 Gemini | 🔵 Claude*"
# Post as PR comment
gh pr comment "$PR_NUM" --body "$REVIEW_BODY"
echo "Review posted to PR #${PR_NUM}"
# Update agent registry if this agent is tracked
REGISTRY="${HOME}/.claude-octopus/plugin/scripts/agent-registry.sh"
if [[ -x "$REGISTRY" ]]; then
AGENT_ID=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
"$REGISTRY" update "$AGENT_ID" --pr "$PR_NUM" 2>/dev/null || true
fi
fi
If no PR exists: Skip posting, present review in terminal only.
If gh CLI not available: Skip posting, suggest user install GitHub CLI.
When to Auto-Post vs Ask
- Auto-post: When invoked as part of
/octo:deliver,/octo:factory, or/octo:embrace(automated workflows) - Ask first: When invoked standalone via
/octo:review— use AskUserQuestion:"PR #N found. Post review findings as a PR comment?" Options: "Yes, post to PR", "No, terminal only"
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核