code-auditor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Auditor

代码审计工具

Comprehensive codebase analysis covering architecture, code quality, security, performance, testing, and maintainability.
对代码库进行全面分析,涵盖架构、代码质量、安全性、性能、测试和可维护性。

When to Use

适用场景

  • "audit the code"
  • "analyze code quality"
  • "check for issues"
  • "review the codebase"
  • "find technical debt"
  • "security audit"
  • "performance review"
  • "审计代码"
  • "分析代码质量"
  • "检查问题"
  • "审查代码库"
  • "发现技术债务"
  • "安全审计"
  • "性能评审"

What It Analyzes

分析维度

1. Architecture & Design

1. 架构与设计

  • Overall structure and organization
  • Design patterns in use
  • Module boundaries and separation of concerns
  • Dependency management
  • Architectural decisions and trade-offs
  • 整体结构与组织
  • 所使用的设计模式
  • 模块边界与关注点分离
  • 依赖管理
  • 架构决策与权衡

2. Code Quality

2. 代码质量

  • Complexity hotspots (cyclomatic complexity)
  • Code duplication (DRY violations)
  • Naming conventions and consistency
  • Documentation coverage
  • Code smells and anti-patterns
  • 复杂度热点圈复杂度
  • 代码重复违反DRY原则
  • 命名规范与一致性
  • 文档覆盖率
  • 代码异味与反模式

3. Security

3. 安全性

  • Common vulnerabilities (OWASP Top 10)
  • Input validation and sanitization
  • Authentication and authorization
  • Secrets management
  • Dependency vulnerabilities
  • 常见漏洞OWASP Top 10
  • 输入验证与清理
  • 身份验证与授权
  • 密钥管理
  • 依赖漏洞

4. Performance

4. 性能

  • Algorithmic complexity issues
  • Database query optimization
  • Memory usage patterns
  • Caching opportunities
  • Resource leaks
  • 算法复杂度问题
  • 数据库查询优化
  • 内存使用模式
  • 缓存优化机会
  • 资源泄漏

5. Testing

5. 测试

  • Test coverage assessment
  • Test quality and effectiveness
  • Missing test scenarios
  • Testing patterns and practices
  • Integration vs unit test balance
  • 测试覆盖率评估
  • 测试质量与有效性
  • 缺失的测试场景
  • 测试模式与实践
  • 集成测试与单元测试的平衡

6. Maintainability

6. 可维护性

  • Technical debt assessment
  • Coupling and cohesion
  • Ease of future changes
  • Onboarding friendliness
  • Documentation quality
  • 技术债务评估
  • 耦合度与内聚性
  • 未来变更的易用性
  • 新成员上手友好度
  • 文档质量

Approach

分析流程

  1. Explore using Explore agent (thorough mode)
  2. Identify patterns with Grep and Glob
  3. Read critical files for detailed analysis
  4. Run static analysis tools if available
  5. Synthesize findings into actionable report
  1. 探索:使用Explore Agent深度模式进行代码库探索
  2. 识别模式:借助Grep和Glob工具
  3. 读取关键文件:开展详细分析
  4. 运行静态分析工具:若工具可用
  5. 整合结果:生成可执行的报告

Thoroughness Levels

分析深度等级

  • Quick (15-30 min): High-level, critical issues only
  • Standard (30-60 min): Comprehensive across all dimensions
  • Deep (60+ min): Exhaustive with detailed examples
  • 快速分析15-30分钟:仅覆盖高层级关键问题
  • 标准分析30-60分钟:全面覆盖所有维度
  • 深度分析60分钟以上:详尽分析并提供详细示例

Output Format

输出格式

markdown
undefined
markdown
undefined

Code Audit Report

代码审计报告

Executive Summary

执行摘要

  • Overall health score
  • Critical issues count
  • Top 3 priorities
  • 整体健康评分
  • 关键问题数量
  • 三大优先事项

Findings by Category

各维度发现

Architecture & Design

架构与设计

🔴 High Priority

🔴 高优先级

  • [Finding with file:line reference]
    • Impact: [description]
    • Recommendation: [action]
  • [带文件:行号的问题]
    • 影响:[描述]
    • 建议:[行动方案]

🟡 Medium Priority

🟡 中优先级

...
...

[Other categories]

[其他维度]

Prioritized Action Plan

优先级行动计划

  1. Quick wins (< 1 day)
  2. Medium-term improvements (1-5 days)
  3. Long-term initiatives (> 5 days)
  1. 快速整改<1天
  2. 中期改进1-5天
  3. 长期举措>5天

Metrics

指标

  • Files analyzed: X
  • Lines of code: Y
  • Test coverage: Z%
  • Complexity hotspots: N
undefined
  • 分析文件数:X
  • 代码行数:Y
  • 测试覆盖率:Z%
  • 复杂度热点数:N
undefined

Tools Used

使用工具

  • Task (Explore agent): Thorough codebase exploration
  • Grep: Pattern matching for issues
  • Glob: Find files by type/pattern
  • Read: Detailed file analysis
  • Bash: Run linters, coverage tools
  • Task (Explore Agent):代码库深度探索
  • Grep:问题模式匹配
  • Glob:按类型/模式查找文件
  • Read:文件详细分析
  • Bash:运行代码检查工具、覆盖率工具

Success Criteria

成功标准

  • Comprehensive coverage of all six dimensions
  • Specific file:line references for all findings
  • Severity/priority ratings (Critical/High/Medium/Low)
  • Actionable recommendations (not just observations)
  • Estimated effort for fixes
  • Both quick wins and long-term improvements
  • 全面覆盖六大分析维度
  • 所有发现均附带具体的文件:行号引用
  • 严重程度/优先级评级关键/高/中/低
  • 可执行的建议而非仅观察结果
  • 修复工作的预估工作量
  • 同时包含快速整改项与长期改进举措

Integration

集成能力

  • feature-planning: Plan technical debt reduction
  • test-fixing: Address test gaps identified
  • project-bootstrapper: Set up quality tooling
  • feature-planning:规划技术债务削减方案
  • test-fixing:解决识别出的测试缺口
  • project-bootstrapper:搭建质量工具链

Configuration

配置选项

Can focus on specific areas:
  • Security-only audit
  • Performance-only audit
  • Testing-only assessment
  • Quick architecture review
可聚焦特定领域:
  • 仅安全审计
  • 仅性能审计
  • 仅测试评估
  • 快速架构评审