codeprobe
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCode Review Orchestrator
代码审查协调器
READ-ONLY CONSTRAINT
只读约束
THIS SKILL IS STRICTLY READ-ONLY. NEVER modify, write, edit, or delete any user files. NEVER run commands that have side effects (no , no , no file writes, no git commits, no database mutations). If a fix is needed, generate a copy-pasteable fix prompt that the user can run separately. Violations of this constraint are NEVER acceptable, regardless of user request.
npm installpip install本技能严格为只读模式。绝不能修改、写入、编辑或删除任何用户文件。绝不能执行有副作用的命令(如、、文件写入、git提交、数据库变更)。若需要修复,生成可复制粘贴的修复提示供用户单独执行。无论用户如何请求,违反此约束的行为都是绝对不允许的。
npm installpip install1. Command Routing
1. 命令路由
Parse the user's input to extract a subcommand and target path. The input format is:
/codeprobe [subcommand] [path]解析用户输入以提取子命令和目标路径。输入格式如下:
/codeprobe [subcommand] [path]Routing Table
路由表
| Command | Behavior | Sub-skills Invoked |
|---|---|---|
| Full audit — visual health dashboard (category scores, codebase stats, hot spots) followed by detailed P0-P3 findings with fix prompts | All available sub-skills + |
| SOLID principles analysis only | |
| Security audit only | |
| Code smells detection only | |
| Architecture analysis only | |
| Design patterns analysis only | |
| Performance audit only | |
| Error handling audit only | |
| Test quality audit only | |
| Framework best practices only | |
| Top 5 issues — run all sub-skills in scan mode, then generate full detail for top 5 | All available |
| PR-style review on changed files vs branch (default: | All relevant (Phase 3) |
| Generate report from last audit | |
| 命令 | 行为 | 调用的子技能 |
|---|---|---|
| 全面审计——先展示可视化健康仪表盘(分类评分、代码库统计、热点文件),随后提供带有修复提示的详细P0-P3级问题结果 | 所有可用子技能 + |
| 仅进行SOLID原则分析 | |
| 仅进行安全审计 | |
| 仅检测代码异味 | |
| 仅进行架构分析 | |
| 仅进行设计模式分析 | |
| 仅进行性能审计 | |
| 仅进行错误处理审计 | |
| 仅进行测试质量审计 | |
| 仅检查框架最佳实践 | |
| 显示前5个问题——以扫描模式运行所有子技能,然后生成前5个问题的完整详情 | 所有可用子技能 |
| 针对变更文件与指定分支进行PR风格审查(默认分支: | 所有相关子技能(第三阶段) |
| 根据上次审计生成报告 | |
Default Behaviors
默认行为
- No subcommand given: Ask the user what they want. Present the available commands.
- No path given: Use the current working directory.
- Phase 3 stubs: If the user invokes or
diff, respond: "This feature is coming in Phase 3. Available now: audit, solid, security, smells, architecture, patterns, performance, errors, tests, framework, quick."report
- 未指定子命令:询问用户需求,并展示可用命令。
- 未指定路径:使用当前工作目录。
- 第三阶段占位功能:若用户调用或
diff,回复:"此功能将在第三阶段推出。当前可用功能:audit、solid、security、smells、architecture、patterns、performance、errors、tests、framework、quick。"report
2. Stack Auto-Detection
2. 技术栈自动检测
Before routing to any sub-skill, detect the technology stack at the target path. This informs which reference guides to load and pass to sub-skills.
在路由到任何子技能之前,检测目标路径下的技术栈。这将决定加载哪些参考指南并传递给子技能。
Detection Procedure
检测流程
- Use Glob to scan file extensions at the target path (recursive, reasonable depth).
- Apply the following detection rules — multiple stacks can match simultaneously:
| Signal | Stack Detected | Reference to Load |
|---|---|---|
| PHP / Laravel | |
| JavaScript / TypeScript | |
| Python | |
| React / Next.js | |
| SQL / Database | |
| API Design | |
- For each detected stack, attempt to load the corresponding reference file using Read. If the file does not exist yet (Phase 2+), skip silently.
- Collect all loaded references into a context bundle to pass to sub-skills.
- 使用Glob工具递归扫描目标路径下的文件扩展名(扫描深度合理)。
- 应用以下检测规则——可同时匹配多个技术栈:
| 信号 | 检测到的技术栈 | 加载的参考文档 |
|---|---|---|
| PHP / Laravel | |
| JavaScript / TypeScript | |
| Python | |
| React / Next.js | |
| SQL / 数据库 | |
| API设计 | |
- 对于每个检测到的技术栈,尝试使用Read工具加载对应的参考文件。若文件尚未存在(第二阶段及以后),则静默跳过。
- 将所有加载的参考文档收集到上下文包中,传递给子技能。
Reference Loading
参考文档加载
References are loaded from the directory within this skill's own directory. Resolve the path relative to this SKILL.md file's location, NOT the user's project. Use Read with:
references/references/{reference-file}.md(This resolves to the folder next to this SKILL.md file.)
references/If a reference file does not exist, continue without it. Never fail the review because a reference is missing.
参考文档从本技能目录下的文件夹加载。路径相对于本SKILL.md文件的位置解析,而非用户项目路径。使用Read工具加载:
references/references/{reference-file}.md(此路径指向本SKILL.md文件旁的文件夹。)
references/若参考文档不存在,继续执行流程即可,绝不能因缺少参考文档而终止审查。
3. Config Loading
3. 配置加载
Check for a file in the project root (the target path or its ancestor directories).
.codeprobe-config.json检查项目根目录(目标路径或其上级目录)中是否存在文件。
.codeprobe-config.jsonConfig Schema
配置 Schema
json
{
"severity_overrides": {
"long_method_loc": 50,
"large_class_loc": 500,
"deep_nesting_max": 4,
"max_constructor_deps": 6
},
"skip_categories": ["codeprobe-testing"],
"skip_rules": ["SPEC-GEN-001"],
"framework": "laravel",
"extra_references": [],
"report_format": "markdown"
}json
{
"severity_overrides": {
"long_method_loc": 50,
"large_class_loc": 500,
"deep_nesting_max": 4,
"max_constructor_deps": 6
},
"skip_categories": ["codeprobe-testing"],
"skip_rules": ["SPEC-GEN-001"],
"framework": "laravel",
"extra_references": [],
"report_format": "markdown"
}Config Behavior
配置行为
- If absent: All defaults apply. No error.
- : Pass to sub-skills so they adjust thresholds accordingly.
severity_overrides - : Do not invoke the listed sub-skills, even in
skip_categoriesorauditmode.quick - : Pass to sub-skills so they suppress findings with matching IDs.
skip_rules - : If set, skip auto-detection for that framework and force-load the corresponding reference. Other auto-detection still proceeds.
framework - : Additional reference file paths to load and pass to sub-skills.
extra_references - : Output format preference (default:
report_format).markdown
- 配置不存在:应用所有默认值,不报错。
- :传递给子技能,使其相应调整阈值。
severity_overrides - :不调用列出的子技能,即使在
skip_categories或audit模式下也不执行。quick - :传递给子技能,使其屏蔽匹配ID的问题结果。
skip_rules - :若已设置,跳过该框架的自动检测,强制加载对应的参考文档。其他自动检测仍正常执行。
framework - :额外的参考文件路径,将加载并传递给子技能。
extra_references - :输出格式偏好(默认:
report_format)。markdown
4. Sub-Skill Execution
4. 子技能执行
Pre-Loading Phase (runs once before any sub-skill)
预加载阶段(在调用任何子技能前执行一次)
Before invoking any sub-skill, the orchestrator MUST pre-load all shared context:
-
Read the shared preamble from(in this skill's directory). This contains the output contract, execution modes, and constraints shared by all sub-skills.
shared-preamble.md -
Read all source files at the target path:
- Use Glob to find all source files (,
.ts,.tsx,.js,.jsx,.py,.php,.vue,.sql,.cssand config files like.scss,next.config.*,package.json,composer.json,requirements.txt)..env.example - Read each file using Read.
- Size cap: If the codebase has more than 50 source files or total LOC exceeds 10,000 lines, do NOT pre-load all files. Instead, pass only the file listing (paths + line counts) and let sub-agents read files they need. Note this in the agent prompt: "Large codebase — file listing provided, use Read for files you need to inspect."
- Store all file contents as a map: .
{filepath: content}
- Use Glob to find all source files (
-
Read all applicable reference files (already loaded during stack detection in Section 2). Store the content.
在调用任何子技能之前,协调器必须预加载所有共享上下文:
-
读取共享前置内容:从本技能目录下的读取。其中包含所有子技能共享的输出约定、执行模式和约束条件。
shared-preamble.md -
读取目标路径下的所有源文件:
- 使用Glob工具查找所有源文件(、
.ts、.tsx、.js、.jsx、.py、.php、.vue、.sql、.css以及配置文件如.scss、next.config.*、package.json、composer.json、requirements.txt)。.env.example - 使用Read工具读取每个文件。
- 大小限制:若代码库包含超过50个源文件或总行数超过10000行,则不预加载所有文件。仅传递文件列表(路径+行数),让子代理自行读取需要检查的文件。并在代理提示中注明:"大型代码库——已提供文件列表,请使用Read工具读取需要检查的文件。"
- 将所有文件内容存储为映射表:。
{filepath: content}
- 使用Glob工具查找所有源文件(
-
读取所有适用的参考文档(已在第2节的技术栈检测阶段完成加载)。存储文档内容。
Invocation Protocol
调用协议
For each sub-skill to run, spawn an Agent with a prompt that includes:
- The shared preamble (from ) — output contract, modes, constraints.
shared-preamble.md - The sub-skill name to invoke (e.g., ).
codeprobe-security - The mode — one of or
full.scan - Pre-loaded source files — the full content of every source file, formatted as:
=== FILE: {filepath} === {content} === END FILE === - Pre-loaded references — the content of all applicable reference files.
- Config overrides — severity overrides and skip rules from .
.codeprobe-config.json - Target path — so the sub-skill knows the project root for any targeted lookups.
The sub-skill's own SKILL.md contains only its domain-specific detection logic. All shared context (output format, modes, source code, references) comes from the orchestrator's prompt.
Collect findings returned by each sub-skill in the standard output contract format (Section 5).
对于每个要运行的子技能,生成一个Agent,其提示内容包含:
- 共享前置内容(来自)——输出约定、模式、约束条件。
shared-preamble.md - 要调用的子技能名称(如)。
codeprobe-security - 模式——或
full之一。scan - 预加载的源文件——每个源文件的完整内容,格式如下:
=== FILE: {filepath} === {content} === END FILE === - 预加载的参考文档——所有适用参考文档的内容。
- 配置覆盖项——来自的严重程度覆盖规则和跳过规则。
.codeprobe-config.json - 目标路径——让子技能知晓项目根目录,以便进行针对性查找。
子技能自身的SKILL.md仅包含其领域特定的检测逻辑。所有共享上下文(输出格式、模式、源代码、参考文档)均来自协调器的提示。
收集结果:以第5节的标准输出约定格式收集每个子技能返回的问题结果。
Execution Modes
执行模式
| Mode | Used By | Behavior |
|---|---|---|
| | Run complete analysis, return all findings |
| | Count violations, identify top issues, return only counts + top 5 candidates |
| 模式 | 使用场景 | 行为 |
|---|---|---|
| | 执行完整分析,返回所有问题结果 |
| | 统计违规数量,识别主要问题,仅返回数量+前5个候选问题 |
Execution Order
执行顺序
- : Run sub-skills sequentially in this order:
/codeprobe audit,codeprobe-security,codeprobe-error-handling,codeprobe-solid,codeprobe-architecture,codeprobe-patterns,codeprobe-performance,codeprobe-code-smells,codeprobe-testing— all incodeprobe-frameworkmode. Collect all findings. Apply deduplication (Section 7A). Derive category scores from severity counts. Compute hot spots by aggregating findings per file and ranking by distinct-categories-flagged. Also runfullfor codebase stats (skip gracefully if Python 3 unavailable).scripts/file_stats.py - : Run all 9 sub-skills in
/codeprobe quickmode. Collect candidate issues from all. Rank by severity (critical > major > minor > suggestion), then select top 5. Re-run relevant sub-skills inscanmode for just those 5 findings to get complete detail.full
- :按以下顺序依次运行子技能:
/codeprobe audit、codeprobe-security、codeprobe-error-handling、codeprobe-solid、codeprobe-architecture、codeprobe-patterns、codeprobe-performance、codeprobe-code-smells、codeprobe-testing——全部使用codeprobe-framework模式。收集所有问题结果。执行去重操作(第7A节)。根据严重程度统计结果得出分类评分。通过按文件聚合问题结果并按标记的不同分类数量排序,计算热点文件。同时运行full获取代码库统计信息(若Python 3不可用则优雅跳过)。scripts/file_stats.py - :以
/codeprobe quick模式运行所有9个子技能。收集所有候选问题。按严重程度排序(critical > major > minor > suggestion),然后选择前5个问题。针对这5个问题,重新运行相关子技能的scan模式以获取完整详情。full
Available Sub-Skills
可用子技能
- — Security vulnerability detection
codeprobe-security - — Error handling & resilience
codeprobe-error-handling - — SOLID principles analysis
codeprobe-solid - — Architecture analysis
codeprobe-architecture - — Design patterns advisor
codeprobe-patterns - — Performance & scalability
codeprobe-performance - — Code smell detection
codeprobe-code-smells - — Test quality & coverage
codeprobe-testing - — Framework-specific best practices
codeprobe-framework
- — 安全漏洞检测
codeprobe-security - — 错误处理与韧性检查
codeprobe-error-handling - — SOLID原则分析
codeprobe-solid - — 架构分析
codeprobe-architecture - — 设计模式建议
codeprobe-patterns - — 性能与可扩展性检查
codeprobe-performance - — 代码异味检测
codeprobe-code-smells - — 测试质量与覆盖率检查
codeprobe-testing - — 框架特定最佳实践检查
codeprobe-framework
5. Output Contract
5. 输出约定
Every finding from every sub-skill MUST include these fields:
| Field | Required | Description |
|---|---|---|
| Yes | Unique identifier in format |
| Yes | One of: |
| Yes | File path + line range (e.g., |
| Yes | One sentence describing the issue |
| Yes | Concrete proof from the code — quote the relevant lines |
| Yes | What to do to fix it |
| Yes | A copy-pasteable prompt the user can give to Claude Code to apply the fix |
| No | Optional code snippet showing the improved version |
每个子技能返回的每个问题结果必须包含以下字段:
| 字段 | 必填 | 描述 |
|---|---|---|
| 是 | 唯一标识符,格式为 |
| 是 | 以下值之一: |
| 是 | 文件路径+行范围(如 |
| 是 | 描述问题的一句话 |
| 是 | 来自代码的具体证据——引用相关代码行 |
| 是 | 修复建议 |
| 是 | 用户可直接复制粘贴给Claude Code以应用修复的提示语 |
| 否 | 可选的代码片段,展示改进后的版本 |
Finding Format Example
问题结果格式示例
undefinedundefinedSRP-001 | Major | src/UserService.php:45-67
src/UserService.php:45-67SRP-001 | Major | src/UserService.php:45-67
src/UserService.php:45-67Problem: UserService violates Single Responsibility — handles authentication, email sending, and database queries in one class.
Evidence:
Lines 45-50:Lines 52-60:public function authenticate($credentials) { ... }Lines 62-67:public function sendWelcomeEmail($user) { ... }public function findByUsername($name) { ... }
Suggestion: Extract email logic into a dedicated service and database queries into a .
UserMailerUserRepositoryFix prompt:
Refactorto follow Single Responsibility Principle: extractsrc/UserService.phpinto a newsendWelcomeEmail()class andUserMailerinto afindByUsername()class. KeepUserRepositoryinauthenticate()and inject the new dependencies.UserService
---问题: UserService违反单一职责原则——在一个类中处理身份验证、邮件发送和数据库查询。
证据:
第45-50行:第52-60行:public function authenticate($credentials) { ... }第62-67行:public function sendWelcomeEmail($user) { ... }public function findByUsername($name) { ... }
建议: 将邮件逻辑提取到专用的服务中,将数据库查询提取到中。
UserMailerUserRepository修复提示:
重构以遵循单一职责原则:将src/UserService.php提取到新的sendWelcomeEmail()类中,将UserMailer提取到findByUsername()类中。将UserRepository保留在authenticate()中,并注入新的依赖项。UserService
---6. Severity Levels
6. 严重程度等级
| Level | Emoji | Meaning | Examples |
|---|---|---|---|
| Critical | 🔴 | Confirmed bugs, exploitable security vulnerabilities, or data loss/corruption risks that would cause harm in production | SQL injection with user input, missing auth on data-mutating endpoint, race condition causing data corruption, unhandled crash on a core path, missing DB transaction on multi-step writes |
| Major | 🟠 | Significant maintainability, reliability, or scalability problem that increases risk but is not an immediate production defect | Missing tests for critical business logic, large classes, code duplication, missing error handling on external calls, N+1 queries, missing input validation |
| Minor | 🟡 | Code smell, low risk, worth addressing for long-term health | Magic numbers, deep nesting, poor naming, missing edge case tests, verbose error details |
| Suggestion | 🔵 | Improvement idea, nice to have, no real risk if ignored | Pattern opportunities, style improvements, speculative generality |
| 等级 | 表情 | 含义 | 示例 |
|---|---|---|---|
| Critical | 🔴 | 已确认的bug、可利用的安全漏洞或数据丢失/损坏风险,会在生产环境中造成危害 | 用户输入导致的SQL注入、数据变更端点缺少认证、导致数据损坏的竞态条件、核心路径上未处理的崩溃、多步骤写入缺少数据库事务 |
| Major | 🟠 | 显著的可维护性、可靠性或可扩展性问题,会增加风险但并非即时生产缺陷 | 关键业务逻辑缺少测试、大型类、代码重复、外部调用缺少错误处理、N+1查询、缺少输入验证 |
| Minor | 🟡 | 代码异味,低风险,为了长期健康值得修复 | 魔法数字、深层嵌套、命名不佳、缺少边缘情况测试、冗长的错误详情 |
| Suggestion | 🔵 | 改进建议,可有可无,忽略不会带来实际风险 | 设计模式应用机会、风格改进、过度设计 |
Severity Guardrails
严重程度规则
The following are NEVER Critical — classify as Major at most:
- Missing tests (even for critical business logic)
- Code duplication or large classes/files
- Code smells of any kind
- Framework convention violations
- Missing documentation, comments, or type annotations
Critical is reserved exclusively for:
- Confirmed bugs (code that produces wrong results or crashes)
- Exploitable security vulnerabilities (injection, auth bypass, IDOR with proof)
- Data loss or corruption risks (missing transactions, race conditions on writes)
- Sensitive data exposure (secrets in code, credentials in logs)
Sub-skills: do NOT escalate findings beyond the severity specified in your detection table. If your table says "Major," report it as Major even if the specific instance seems severe. The orchestrator's scoring formula accounts for finding counts at each level.
以下情况绝不能归为Critical——最多归为Major:
- 缺少测试(即使是关键业务逻辑)
- 代码重复或大型类/文件
- 任何类型的代码异味
- 违反框架约定
- 缺少文档、注释或类型注解
Critical仅适用于:
- 已确认的bug(产生错误结果或崩溃的代码)
- 可利用的安全漏洞(注入、认证绕过、有证据的IDOR)
- 数据丢失或损坏风险(缺少事务、写入操作的竞态条件)
- 敏感数据泄露(代码中的密钥、日志中的凭证)
子技能注意: 不要将问题结果的严重程度提升到检测表中指定的等级之上。若检测表中标记为“Major”,即使具体实例看似严重,也需报告为Major。协调器的评分公式会考虑各等级的问题数量。
7. Scoring
7. 评分
After collecting all findings, compute scores per category and an overall score.
收集所有问题结果后,计算每个分类的评分和整体评分。
Category Score Formula
分类评分公式
Each penalty component is capped to prevent a single severity level from dominating the score:
crit_penalty = min(50, critical_count * 15)
major_penalty = min(30, major_count * 6)
minor_penalty = min(10, minor_count * 2)
category_score = max(0, 100 - crit_penalty - major_penalty - minor_penalty)Suggestions do not affect the score.
Rationale: Diminishing returns prevent a single severity from flooring the score. A category with 4 criticals scores 40 (not 0), reflecting problems exist but the code is not completely broken. The maximum total penalty from all three levels combined is 90, so a score of 0 requires extreme findings across all severities.
每个惩罚组件都有上限,防止单一严重程度等级主导评分:
crit_penalty = min(50, critical_count * 15)
major_penalty = min(30, major_count * 6)
minor_penalty = min(10, minor_count * 2)
category_score = max(0, 100 - crit_penalty - major_penalty - minor_penalty)Suggestion级别的问题不影响评分。
原理: 边际递减效应防止单一严重程度等级将评分降至最低。一个有4个Critical问题的分类评分为40(而非0),反映代码存在问题但并未完全失效。三个等级的最大总惩罚为90,因此评分为0需要所有严重程度等级都出现极端问题。
Category Weights
分类权重
| Category | Weight |
|---|---|
| Security | 20% |
| SOLID | 15% |
| Architecture | 15% |
| Error Handling | 12% |
| Performance | 12% |
| Test Quality | 10% |
| Code Smells | 8% |
| Design Patterns | 4% |
| Framework | 4% |
All 9 categories are active. Weights sum to 100%.
| 分类 | 权重 |
|---|---|
| Security | 20% |
| SOLID | 15% |
| Architecture | 15% |
| Error Handling | 12% |
| Performance | 12% |
| Test Quality | 10% |
| Code Smells | 8% |
| Design Patterns | 4% |
| Framework | 4% |
所有9个分类均生效,权重总和为100%。
Overall Score
整体评分
overall = sum(category_score_i * weight_i for each active category)If in excludes some categories, normalize by dividing by the sum of active weights:
skip_categories.codeprobe-config.jsonoverall = sum(category_score_i * weight_i for each active category) / sum(weight_i for each active category)Clamp the result to the range [0, 100].
overall = sum(category_score_i * weight_i for each active category)若中的排除了部分分类,则通过除以生效分类的权重总和进行归一化:
.codeprobe-config.jsonskip_categoriesoverall = sum(category_score_i * weight_i for each active category) / sum(weight_i for each active category)将结果限制在[0, 100]范围内。
Score Interpretation
评分解读
| Range | Status |
|---|---|
| 80-100 | Healthy |
| 60-79 | Needs Attention |
| 0-59 | Critical |
| 范围 | 状态 |
|---|---|
| 80-100 | 健康 |
| 60-79 | 需要关注 |
| 0-59 | 严重 |
7A. Cross-Category Deduplication
7A. 跨分类去重
Before computing scores, deduplicate findings that flag the same issue from multiple categories.
计算评分前,对多个分类标记的同一问题进行去重。
Deduplication Procedure
去重流程
-
Group findings by location. Normalize each finding'sto
location. Two findings overlap if they share the same file AND their line ranges overlap (i.e., start_line_A <= end_line_B AND start_line_B <= end_line_A).{file}:{start_line} -
For each group of overlapping findings from different categories: a. Select a primary finding. Use this priority order:
- Security findings (SEC) take priority for anything involving auth, injection, or data exposure
- Error Handling findings (ERR) take priority for exception/validation issues
- Performance findings (PERF) take priority for query/caching issues
- SOLID findings (SRP/OCP/LSP/ISP/DIP) take priority for structural violations
- Architecture findings (ARCH) take priority for layer/boundary violations
- If still ambiguous, the category with the higher weight (Section 7) wins
b. Mark duplicates. For each non-primary finding in the group, append to its field:
problemand change its severity to[Duplicate of {primary_id} — counted there]so it does not affect the score of its own category. c. Cross-reference the primary. Append to the primary finding'ssuggestionfield:suggestionAlso flagged by: {list of duplicate category:id pairs}
-
Recount severity totals per category after deduplication, then proceed to scoring.
-
按位置分组:将每个问题结果的标准化为
location。若两个问题结果共享同一文件且行范围重叠(即start_line_A <= end_line_B 且 start_line_B <= end_line_A),则视为重叠。{file}:{start_line} -
针对每个来自不同分类的重叠问题组: a. 选择主问题结果:按以下优先级顺序选择:
- 涉及认证、注入或数据泄露的Security问题(SEC)优先
- 涉及异常/验证的Error Handling问题(ERR)优先
- 涉及查询/缓存的Performance问题(PERF)优先
- 涉及结构违规的SOLID问题(SRP/OCP/LSP/ISP/DIP)优先
- 涉及分层/边界违规的Architecture问题(ARCH)优先
- 若仍存在歧义,权重更高的分类(第7节)胜出
b. 标记重复项:对于组中的每个非主问题结果,在其字段后追加:
problem,并将其严重程度改为[重复项,对应主问题ID:{primary_id} — 已在该分类统计],使其不影响自身分类的评分。 c. 交叉引用主问题结果:在主问题结果的suggestion字段后追加:suggestion同时被以下分类标记:{重复分类:ID列表}
-
去重后重新统计各分类的严重程度总数,然后进行评分计算。
Examples
示例
- "Refresh bypasses quota" found as SEC-007, ERR-011, FW-001 at same location: keep SEC-007, mark ERR-011 and FW-001 as duplicates (severity → suggestion).
- "God component" found as SRP-001, SMELL-001, ARCH-005 at same file: keep SRP-001 (SOLID priority for structural), mark others as duplicates.
- Same SRP violation found as SRP-001 and SMELL-001: keep SRP-001, mark SMELL-001 as duplicate.
- "刷新绕过配额"被SEC-007、ERR-011、FW-001在同一位置标记:保留SEC-007,将ERR-011和FW-001标记为重复项(严重程度改为suggestion)。
- "上帝组件"在同一文件被SRP-001、SMELL-001、ARCH-005标记:保留SRP-001(结构问题SOLID优先),将其他标记为重复项。
- 同一SRP违规被SRP-001和SMELL-001标记:保留SRP-001,将SMELL-001标记为重复项。
8. Report Rendering
8. 报告渲染
Render the final output based on the command used.
根据使用的命令渲染最终输出。
/codeprobe audit
— Full Audit Report
/codeprobe audit/codeprobe audit
— 全面审计报告
/codeprobe auditUse the template at (loaded via Read). The template opens with a visual health dashboard (category scores, codebase stats, hot spots) and then uses a tiered output format for findings to control token usage. Render order:
templates/full-audit-report.md- Dashboard header: title line and
Code Health Report — {project}where status is derived from the thresholds in the "Status thresholds" block below.Overall Health: {score}/100 {status_emoji} - Category score bars: a 10-character block-character bar proportional to the score for each of the 9 categories (Architecture, Security, Framework, Performance, SOLID, Design Patterns, Code Smells, Test Quality, Error Handling), followed by .
{score}/100 {status} - Codebase Stats: output of (total files, LOC, backend/frontend split, largest file, test file ratio, comment ratio). If Python 3 is unavailable, omit this block and note: "Install Python 3 for codebase statistics."
scripts/file_stats.py - Hot Spots: top 3 files by distinct-categories-flagged (computed from the same findings that feed the scores).
- Horizontal rule.
- Executive Summary: 2-3 sentences covering the most important findings.
- Critical findings — Full detail: Each critical finding rendered with evidence, suggestion, and fix prompt. These are the most important and justify the token cost.
- Major findings — Summary table: One row per major finding with ID, file, problem, and fix prompt. No evidence block (saves ~200 tokens per finding).
- Minor findings — Counts only: Aggregated count per category. No individual findings listed.
- Suggestions — Counts only: Aggregated count per category. No individual findings listed.
- Prioritized Fix Order: Ordered list of all critical and major fix prompts, ranked by impact.
If the template does not exist, render inline following the same structure.
Status thresholds (applied to overall health and each category score):
- 80-100 = "Healthy"
- 60-79 = "Needs Attention"
- 0-59 = "Critical"
Token budget guidance: For a codebase with ~100 findings, the tiered findings format (steps 7-10) targets ~8,000-12,000 tokens (vs ~40,000 with full detail for all findings). The dashboard adds a small fixed cost (~400 tokens). The user can drill into specific categories with etc. for full detail on any category.
/codeprobe security .使用中的模板(通过Read工具加载)。模板开头为可视化健康仪表盘(分类评分、代码库统计、热点文件),随后采用分层输出格式展示问题结果以控制token使用量。渲染顺序:
templates/full-audit-report.md- 仪表板标题:标题行,以及
代码健康报告 — {project},其中状态由下方“状态阈值”块中的阈值决定。整体健康评分:{score}/100 {status_emoji} - 分类评分条:为9个分类(Architecture、Security、Framework、Performance、SOLID、Design Patterns、Code Smells、Test Quality、Error Handling)分别生成一个10字符的方块字符条,长度与评分成正比,随后显示。
{score}/100 {status} - 代码库统计:的输出结果(总文件数、总行数、前后端拆分、最大文件、测试文件占比、注释占比)。若Python 3不可用,则省略此块并注明:"安装Python 3以获取代码库统计信息。"
scripts/file_stats.py - 热点文件:按标记的不同分类数量排序的前3个文件。
- 水平线分隔。
- 执行摘要:2-3句话概述最重要的问题结果。
- Critical级问题结果——完整详情:每个Critical级问题结果均展示证据、建议和修复提示。这些是最重要的内容,值得消耗token。
- Major级问题结果——摘要表格:每个Major级问题结果占一行,包含ID、文件、问题描述和修复提示。不展示证据块(每个问题结果可节省约200个token)。
- Minor级问题结果——仅统计数量:按分类汇总数量。不列出单个问题结果。
- Suggestion级问题——仅统计数量:按分类汇总数量。不列出单个问题结果。
- 优先修复顺序:所有Critical和Major级修复提示的有序列表,按影响排序。
若模板不存在,则按相同结构直接渲染。
状态阈值(适用于整体健康评分和各分类评分):
- 80-100 = "健康"
- 60-79 = "需要关注"
- 0-59 = "严重"
Token预算指南:对于包含约100个问题结果的代码库,分层结果格式(步骤7-10)目标消耗约8000-12000个token(若所有问题结果均展示完整详情则约消耗40000个token)。仪表板增加少量固定成本(约400个token)。用户可通过等命令深入查看特定分类的完整详情。
/codeprobe security ./codeprobe quick
— Quick Review Summary
/codeprobe quick/codeprobe quick
— 快速审查摘要
/codeprobe quickUse the template at (loaded via Read). If the template does not exist yet, render inline:
templates/quick-review-summary.md- Header: Project name, "Quick Review — Top 5 Issues".
- Top 5 Findings: Full detail for the 5 most impactful issues, each with fix prompt.
- Summary Counts: Total issues found by severity across all categories.
- Next Step: Suggest running for the complete picture.
/codeprobe audit
使用中的模板(通过Read工具加载)。若模板尚未存在,则直接渲染:
templates/quick-review-summary.md- 标题:项目名称,"快速审查——前5个问题"
- 前5个问题结果:5个影响最大的问题的完整详情,每个均包含修复提示。
- 摘要统计:所有分类按严重程度统计的总问题数量。
- 下一步建议:建议运行以获取完整分析结果。
/codeprobe audit
9. Claude.ai Degraded Mode
9. Claude.ai降级模式
Detect whether filesystem access is available. If the user has pasted or uploaded code rather than providing a file path, or if Read/Glob/Grep tools are unavailable:
- Switch to degraded mode: Analyze only the in-context code provided.
- Execute sub-skills sequentially on the pasted code (no parallel agents).
- Skip and all script-dependent steps.
file_stats.py - Skip ,
/codeprobe diff, and the Codebase Stats row of the audit dashboard (still render scores, hot spots, and findings)./codeprobe report - Inform the user: "Running in Claude.ai mode — some features like codebase statistics, diff review, and multi-file analysis are unavailable. Analyzing the provided code directly."
- Still produce findings in the standard output contract format.
- Still compute scores based on findings from available sub-skills.
检测是否可访问文件系统。若用户粘贴或上传代码而非提供文件路径,或Read/Glob/Grep工具不可用:
- 切换到降级模式:仅分析上下文提供的代码。
- 依次执行子技能:对粘贴的代码依次执行子技能(不使用并行代理)。
- 跳过和所有依赖脚本的步骤。
file_stats.py - 跳过、
/codeprobe diff以及审计仪表板的代码库统计行(仍渲染评分、热点文件和问题结果)。/codeprobe report - 告知用户:"当前运行在Claude.ai模式下——部分功能如代码库统计、差异审查和多文件分析不可用。将直接分析提供的代码。"
- 仍按标准输出约定格式生成问题结果。
- 仍根据可用子技能的问题结果计算评分。
10. Phase 3 Stubs
10. 第三阶段占位功能
When the user invokes a command that routes to an unbuilt feature, respond with:
Not yet available. This feature is coming in Phase 3. Currently available commands:
— Full code audit/codeprobe audit <path> — SOLID principles check/codeprobe solid <path> — Security audit/codeprobe security <path> — Code smells detection/codeprobe smells <path> — Architecture analysis/codeprobe architecture <path> — Design patterns analysis/codeprobe patterns <path> — Performance audit/codeprobe performance <path> — Error handling audit/codeprobe errors <path> — Test quality audit/codeprobe tests <path> — Framework best practices/codeprobe framework <path> — Top 5 issues/codeprobe quick <path>
This applies to: , .
diffreport当用户调用指向未实现功能的命令时,回复:
尚未可用。 此功能将在第三阶段推出。当前可用命令:
— 全面代码审计/codeprobe audit <path> — SOLID原则检查/codeprobe solid <path> — 安全审计/codeprobe security <path> — 代码异味检测/codeprobe smells <path> — 架构分析/codeprobe architecture <path> — 设计模式分析/codeprobe patterns <path> — 性能审计/codeprobe performance <path> — 错误处理审计/codeprobe errors <path> — 测试质量审计/codeprobe tests <path> — 框架最佳实践检查/codeprobe framework <path> — 前5个问题/codeprobe quick <path>
此回复适用于:、。
diffreport11. Execution Flow Summary
11. 执行流程摘要
When is invoked, execute this sequence:
/codeprobe- Parse command: Extract subcommand and target path from user input.
- Validate command: Check routing table. If Phase 3 stub, respond with stub message.
- Resolve target path: Use provided path or default to current working directory.
- Load config: Check for at project root. Apply defaults if absent.
.codeprobe-config.json - Auto-detect stack: Scan target path for technology signals. Load matching references.
- Apply config overrides: If is set in config, adjust detection. Apply
frameworkandskip_categories.skip_rules - Execute sub-skills: Route to appropriate sub-skills based on command and mode.
- Collect findings: Aggregate all findings in the output contract format.
- Deduplicate findings: Apply the cross-category deduplication procedure (Section 7A). Adjust severity of duplicates to . Recount severity totals per category.
suggestion - Compute scores: Calculate per-category and overall scores using the post-deduplication severity counts and the formulas in Section 7.
- Render report: Format output using the appropriate template or inline format. Use the tiered output format for .
/codeprobe audit - Present to user: Display the final report.
Remember: This entire process is READ-ONLY. At no point do we modify any user files.
当调用时,执行以下流程:
/codeprobe- 解析命令:从用户输入中提取子命令和目标路径。
- 验证命令:检查路由表。若为第三阶段占位功能,回复占位消息。
- 解析目标路径:使用提供的路径或默认使用当前工作目录。
- 加载配置:检查项目根目录下的。若不存在则应用默认值。
.codeprobe-config.json - 自动检测技术栈:扫描目标路径以获取技术信号。加载匹配的参考文档。
- 应用配置覆盖项:若配置中设置了,调整检测结果。应用
framework和skip_categories。skip_rules - 执行子技能:根据命令和模式路由到相应的子技能。
- 收集问题结果:以输出约定格式聚合所有问题结果。
- 问题结果去重:应用跨分类去重流程(第7A节)。将重复项的严重程度改为。重新统计各分类的严重程度总数。
suggestion - 计算评分:使用去重后的严重程度统计结果和第7节的公式计算各分类评分和整体评分。
- 渲染报告:使用相应模板或直接格式输出。使用分层输出格式。
/codeprobe audit - 展示给用户:显示最终报告。
请记住:整个流程均为只读模式。任何时候都不得修改用户文件。