mcpField
S
sc-analyze

sc-analyze

github.com/tony363测试与质量2094 次安装30 周前更新
代码仓库

关于 sc-analyze

sc-analyze 是用于检查代码质量、安全、性能和架构问题的分析与故障排查技能。它可排列发现项优先级、提出建议,并可选择应用安全修复,同时支持 PAL MCP 分析和调试。

主要功能

  1. 01覆盖四类代码分析
  2. 02排查错误与构建问题
  3. 03提供优先级发现项和建议
  4. 04可选自动应用安全修复
  5. 05支持文本、JSON 和报告输出

适用场景

  1. 01检查源代码中的安全问题
  2. 02诊断构建失败或运行时错误
  3. 03调查性能缓慢问题
  4. 04评估架构与依赖关系

MCP 相关

使用 PAL MCP 工具进行深入调查、调试、代码审查和验证;也可使用 Rube MCP 进行外部分析、通知和工单创建。

安装

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

$npx skills add https://github.com/tony363/superclaude --skill sc-analyze

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

详细介绍

分析与故障排查技能

具备问题诊断和解决能力的多领域代码分析。

快速开始

# Quality analysis
/sc:analyze [target] --focus quality|security|performance|architecture

# Troubleshooting mode
/sc:analyze [issue] --troubleshoot --focus bug|build|performance|deployment

# With auto-fix
/sc:analyze "TypeScript errors" --troubleshoot --focus build --fix

行为流程

  1. 发现 - 对源文件分类并检测语言
  2. 扫描 - 应用特定领域的分析技术
  3. 评估 - 生成按优先级排序并标注严重程度的发现
  4. 建议 - 制定可执行的建议
  5. 报告 - 呈现包含指标的全面分析

标志

标志类型默认值描述
--focusstringqualityquality、security、performance、architecture、bug、build、deployment
--troubleshootboolfalse启用问题诊断模式
--traceboolfalse为调试进行详细的跟踪分析
--fixboolfalse自动应用安全修复
--depthstringstandardquick、standard、deep
--formatstringtexttext、json、report

分析领域

质量分析
  • 代码异味和可维护性问题
  • 模式违规和反模式
  • 技术债务评估
安全分析
  • 漏洞扫描
  • 合规性验证
  • 身份验证/授权审查
性能分析
  • 瓶颈识别
  • 资源利用模式
  • 优化机会
架构分析
  • 组件耦合评估
  • 依赖项分析
  • 设计模式评估

故障排查模式

启用 --troubleshoot 时:

关注点行为
bug错误分析、堆栈跟踪、代码检查
build构建日志、依赖项、配置验证
performance指标分析、瓶颈识别
deployment环境分析、服务验证

示例

深入分析安全问题
/sc:analyze src/auth --focus security --depth deep
修复构建失败
/sc:analyze "compilation errors" --troubleshoot --focus build --fix
性能诊断
/sc:analyze "slow API response" --troubleshoot --focus performance --trace

MCP 集成

PAL MCP(始终使用)
工具使用时机用途
mcp__pal__thinkdeep复杂问题通过假设检验进行多阶段调查
mcp__pal__debugBug 故障排查系统性根因分析
mcp__pal__codereview质量分析全面的代码质量、安全和性能审查
mcp__pal__consensus关键发现对安全/架构问题进行多模型验证
mcp__pal__challenge不确定的发现针对模糊问题进行批判性思考
mcp__pal__apilookup依赖项问题获取当前 API 文档以解决版本冲突
PAL 使用模式
# Deep investigation (--depth deep)
mcp__pal__thinkdeep(
    step="Investigating performance bottleneck in API layer",
    hypothesis="Database queries lack proper indexing",
    confidence="medium",
    relevant_files=["/src/api/users.py"]
)

# Security analysis (--focus security)
mcp__pal__codereview(
    review_type="security",
    findings="Authentication, authorization, injection vectors",
    issues_found=[{"severity": "high", "description": "SQL injection risk"}]
)

# Critical finding validation
mcp__pal__consensus(
    models=[
        {"model": "gpt-5.2", "stance": "for"},
        {"model": "gemini-3-pro", "stance": "against"}
    ],
    step="Evaluate: Is this a critical security vulnerability?"
)
Rube MCP(按需使用)
工具使用时机用途
mcp__rube__RUBE_SEARCH_TOOLS外部分析查找安全扫描器、代码检查工具
mcp__rube__RUBE_MULTI_EXECUTE_TOOL问题跟踪为发现的问题创建工单
mcp__rube__RUBE_REMOTE_WORKBENCH批量分析处理大型代码库
Rube 使用模式
# Find and create Jira tickets for findings
mcp__rube__RUBE_SEARCH_TOOLS(queries=[
    {"use_case": "create jira issue", "known_fields": "project:SECURITY"}
])

# Notify team of critical findings
mcp__rube__RUBE_MULTI_EXECUTE_TOOL(tools=[
    {"tool_slug": "SLACK_SEND_MESSAGE", "arguments": {"channel": "#security", "text": "Critical finding..."}}
])

标志(扩展)

标志类型默认值描述
--pal-deepboolfalse使用 PAL thinkdeep 进行多阶段分析
--pal-reviewboolfalse使用 PAL codereview 进行全面审查
--consensusboolfalse使用 PAL consensus 处理关键发现
--notifystring-通过 Rube 通知(slack、jira、email)
--create-ticketsboolfalse通过 Rube 为发现的问题创建工单

工具协调

  • Glob - 文件发现和结构分析
  • Grep - 模式分析和代码搜索
  • Read - 源码检查和配置分析
  • Bash - 外部工具执行
  • Write - 报告生成
  • PAL MCP - 多模型分析、调试、代码审查
  • Rube MCP - 外部通知、工单创建

评论

支持 Markdown