deep-analysis
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDeep Analysis Skill
深度分析Skill
Comprehensive analytical templates for thorough investigation, audits, and evaluations leveraging extended thinking capabilities.
借助扩展思维能力,为全面调查、审计和评估提供综合性分析模板。
When to Use
使用场景
- Code audits requiring systematic review
- Security assessments and threat modeling
- Performance analysis and optimization planning
- Architecture reviews and technical debt assessment
- Incident post-mortems and root cause analysis
- Compliance audits and risk assessments
- 代码审计:需要系统性评审的场景
- 安全评估与威胁建模
- 性能分析与优化规划
- 架构评审与技术债务评估
- 事后复盘与根本原因分析
- 合规审计与风险评估
Analysis Templates
分析模板
Code Audit Template
代码审计模板
markdown
undefinedmarkdown
undefinedCode Audit Report
代码审计报告
Repository: [repo-name]
Scope: [files/modules audited]
Date: [YYYY-MM-DD]
Auditor: Claude + [Human reviewer]
代码仓库:[repo-name]
审计范围:[被审计的文件/模块]
日期:[YYYY-MM-DD]
审计人员:Claude + [人工评审员]
Executive Summary
执行摘要
[2-3 sentence overview of findings]
[2-3句话概述审计发现]
Audit Criteria
审计标准
- Code quality and maintainability
- Security vulnerabilities
- Performance concerns
- Test coverage
- Documentation completeness
- Dependency health
- 代码质量与可维护性
- 安全漏洞
- 性能问题
- 测试覆盖率
- 文档完整性
- 依赖健康状况
Critical Findings
关键问题
| ID | Severity | Location | Issue | Recommendation |
|---|---|---|---|---|
| C1 | Critical | file:line | [Issue] | [Fix] |
| C2 | Critical | file:line | [Issue] | [Fix] |
| 编号 | 严重程度 | 位置 | 问题 | 建议 |
|---|---|---|---|---|
| C1 | Critical | file:line | [Issue] | [Fix] |
| C2 | Critical | file:line | [Issue] | [Fix] |
High Priority Findings
高优先级问题
| ID | Severity | Location | Issue | Recommendation |
|---|---|---|---|---|
| H1 | High | file:line | [Issue] | [Fix] |
| 编号 | 严重程度 | 位置 | 问题 | 建议 |
|---|---|---|---|---|
| H1 | High | file:line | [Issue] | [Fix] |
Medium Priority Findings
中优先级问题
[...]
[...]
Low Priority / Suggestions
低优先级/建议项
[...]
[...]
Metrics
指标
| Metric | Value | Target | Status |
|---|---|---|---|
| Test Coverage | 75% | 80% | ⚠️ |
| Cyclomatic Complexity | 12 | <10 | ⚠️ |
| Technical Debt | 4.2d | <3d | ❌ |
| Security Score | 8/10 | 9/10 | ⚠️ |
| 指标 | 当前值 | 目标值 | 状态 |
|---|---|---|---|
| 测试覆盖率 | 75% | 80% | ⚠️ |
| 圈复杂度 | 12 | <10 | ⚠️ |
| 技术债务 | 4.2d | <3d | ❌ |
| 安全评分 | 8/10 | 9/10 | ⚠️ |
Recommendations
建议
- Immediate: [Critical fixes]
- Short-term: [Within sprint]
- Long-term: [Tech debt reduction]
- 紧急处理:[修复关键问题]
- 短期:[当前迭代内完成]
- 长期:[减少技术债务]
Sign-off
确认签字
- All critical issues addressed
- High priority issues have timeline
- Audit findings documented in backlog
undefined- 所有关键问题已处理
- 高优先级问题已有时间规划
- 审计发现已记录在待办事项中
undefinedSecurity Threat Model Template
安全威胁建模模板
markdown
undefinedmarkdown
undefinedThreat Model: [System/Component Name]
威胁建模:[系统/组件名称]
Version: [1.0]
Last Updated: [YYYY-MM-DD]
Classification: [Internal/Confidential]
版本:[1.0]
最后更新日期:[YYYY-MM-DD]
保密级别:[内部/机密]
System Overview
系统概述
[Brief description of the system being modeled]
[对建模系统的简要描述]
Assets
资产
| Asset | Description | Sensitivity | Owner |
|---|---|---|---|
| User Data | PII, credentials | Critical | Auth Team |
| API Keys | Service credentials | High | DevOps |
| Business Data | Transactions | High | Product |
| 资产 | 描述 | 敏感度 | 负责人 |
|---|---|---|---|
| 用户数据 | PII、凭证 | Critical | 认证团队 |
| API密钥 | 服务凭证 | High | DevOps团队 |
| 业务数据 | 交易数据 | High | 产品团队 |
Trust Boundaries
信任边界
┌─────────────────────────────────────────┐
│ External (Untrusted) │
│ [Internet Users] [Third-party APIs] │
└──────────────────┬──────────────────────┘
│ WAF/Load Balancer
┌──────────────────┴──────────────────────┐
│ DMZ (Semi-trusted) │
│ [API Gateway] [CDN] [Public Services] │
└──────────────────┬──────────────────────┘
│ Internal Firewall
┌──────────────────┴──────────────────────┐
│ Internal (Trusted) │
│ [App Servers] [Databases] [Queues] │
└─────────────────────────────────────────┘┌─────────────────────────────────────────┐
│ External (Untrusted) │
│ [Internet Users] [Third-party APIs] │
└──────────────────┬──────────────────────┘
│ WAF/Load Balancer
┌──────────────────┴──────────────────────┐
│ DMZ (Semi-trusted) │
│ [API Gateway] [CDN] [Public Services] │
└──────────────────┬──────────────────────┘
│ Internal Firewall
┌──────────────────┴──────────────────────┐
│ Internal (Trusted) │
│ [App Servers] [Databases] [Queues] │
└─────────────────────────────────────────┘Threat Categories (STRIDE)
威胁类别(STRIDE模型)
Spoofing
仿冒
| Threat | Likelihood | Impact | Mitigation |
|---|---|---|---|
| Credential theft | Medium | High | MFA, rate limiting |
| Session hijacking | Low | High | Secure cookies, HTTPS |
| 威胁 | 可能性 | 影响 | 缓解措施 |
|---|---|---|---|
| 凭证窃取 | Medium | High | 多因素认证、速率限制 |
| 会话劫持 | Low | High | 安全Cookie、HTTPS |
Tampering
篡改
| Threat | Likelihood | Impact | Mitigation |
|---|---|---|---|
| SQL injection | Medium | Critical | Parameterized queries |
| Data modification | Low | High | Integrity checks |
| 威胁 | 可能性 | 影响 | 缓解措施 |
|---|---|---|---|
| SQL注入 | Medium | Critical | 参数化查询 |
| 数据修改 | Low | High | 完整性校验 |
Repudiation
抵赖
[...]
[...]
Information Disclosure
信息泄露
[...]
[...]
Denial of Service
拒绝服务
[...]
[...]
Elevation of Privilege
权限提升
[...]
[...]
Attack Vectors
攻击向量
- Vector 1: [Description]
- Entry point: [Where]
- Technique: [How]
- Mitigation: [Defense]
- 向量1:[描述]
- 入口点:[位置]
- 技术手段:[方式]
- 缓解措施:[防御方案]
Risk Matrix
风险矩阵
| Threat | Likelihood | Impact | Risk Score | Priority |
|---|---|---|---|---|
| T1 | High | Critical | 9 | P1 |
| T2 | Medium | High | 6 | P2 |
| T3 | Low | Medium | 3 | P3 |
| 威胁 | 可能性 | 影响 | 风险评分 | 优先级 |
|---|---|---|---|---|
| T1 | High | Critical | 9 | P1 |
| T2 | Medium | High | 6 | P2 |
| T3 | Low | Medium | 3 | P3 |
Security Controls
安全控制措施
| Control | Type | Status | Coverage |
|---|---|---|---|
| WAF | Preventive | ✅ Active | External |
| SAST | Detective | ✅ CI/CD | Code |
| DAST | Detective | ⚠️ Partial | Runtime |
| Encryption | Preventive | ✅ Active | Data |
| 控制措施 | 类型 | 状态 | 覆盖范围 |
|---|---|---|---|
| WAF | 预防性 | ✅ 已启用 | 外部 |
| SAST | 检测性 | ✅ CI/CD集成 | 代码层面 |
| DAST | 检测性 | ⚠️ 部分启用 | 运行时 |
| 加密 | 预防性 | ✅ 已启用 | 数据层面 |
Recommendations
建议
- [Priority 1 recommendations]
- [Priority 2 recommendations]
- [Priority 3 recommendations]
undefined- [优先级1建议]
- [优先级2建议]
- [优先级3建议]
undefinedPerformance Analysis Template
性能分析模板
markdown
undefinedmarkdown
undefinedPerformance Analysis Report
性能分析报告
System: [System name]
Period: [Date range]
Environment: [Production/Staging]
系统:[系统名称]
周期:[日期范围]
环境:[生产/预发布]
Executive Summary
执行摘要
[Key findings and recommendations]
[关键发现与建议]
Performance Metrics
性能指标
Response Times
响应时间
| Endpoint | P50 | P95 | P99 | Target | Status |
|---|---|---|---|---|---|
| /api/users | 45ms | 120ms | 350ms | <200ms | ✅ |
| /api/search | 230ms | 890ms | 2.1s | <500ms | ❌ |
| /api/reports | 1.2s | 3.4s | 8.2s | <2s | ❌ |
| 接口 | P50 | P95 | P99 | 目标值 | 状态 |
|---|---|---|---|---|---|
| /api/users | 45ms | 120ms | 350ms | <200ms | ✅ |
| /api/search | 230ms | 890ms | 2.1s | <500ms | ❌ |
| /api/reports | 1.2s | 3.4s | 8.2s | <2s | ❌ |
Throughput
吞吐量
| Service | Current RPS | Peak RPS | Capacity | Utilization |
|---|---|---|---|---|
| API | 1,200 | 2,400 | 5,000 | 48% |
| Worker | 500 | 800 | 1,000 | 80% |
| 服务 | 当前RPS | 峰值RPS | 容量 | 利用率 |
|---|---|---|---|---|
| API | 1,200 | 2,400 | 5,000 | 48% |
| 工作节点 | 500 | 800 | 1,000 | 80% |
Resource Utilization
资源利用率
| Resource | Average | Peak | Threshold | Status |
|---|---|---|---|---|
| CPU | 45% | 78% | 80% | ⚠️ |
| Memory | 62% | 85% | 85% | ⚠️ |
| Disk I/O | 30% | 55% | 70% | ✅ |
| Network | 25% | 40% | 60% | ✅ |
| 资源 | 平均值 | 峰值 | 阈值 | 状态 |
|---|---|---|---|---|
| CPU | 45% | 78% | 80% | ⚠️ |
| 内存 | 62% | 85% | 85% | ⚠️ |
| 磁盘I/O | 30% | 55% | 70% | ✅ |
| 网络 | 25% | 40% | 60% | ✅ |
Bottleneck Analysis
瓶颈分析
Identified Bottlenecks
已识别瓶颈
-
Database Queries (High Impact)
- Location: endpoint
/api/search - Cause: Missing index on column
created_at - Impact: 890ms P95 latency
- Fix: Add composite index
- Location:
-
Memory Pressure (Medium Impact)
- Location: Report generation service
- Cause: Large dataset loading into memory
- Impact: GC pauses, OOM risks
- Fix: Implement streaming/pagination
-
数据库查询(高影响)
- 位置:接口
/api/search - 原因:字段缺少索引
created_at - 影响:P95延迟达890ms
- 修复方案:添加复合索引
- 位置:
-
内存压力(中影响)
- 位置:报表生成服务
- 原因:大型数据集加载至内存
- 影响:GC停顿、OOM风险
- 修复方案:实现流式处理/分页
Load Test Results
负载测试结果
| Scenario | Users | Duration | Errors | Avg Response |
|---|---|---|---|---|
| Baseline | 100 | 10min | 0% | 120ms |
| Normal | 500 | 30min | 0.1% | 180ms |
| Peak | 1000 | 15min | 2.3% | 450ms |
| Stress | 2000 | 5min | 15% | 2.1s |
| 场景 | 用户数 | 持续时间 | 错误率 | 平均响应时间 |
|---|---|---|---|---|
| 基准测试 | 100 | 10min | 0% | 120ms |
| 正常负载 | 500 | 30min | 0.1% | 180ms |
| 峰值负载 | 1000 | 15min | 2.3% | 450ms |
| 压力测试 | 2000 | 5min | 15% | 2.1s |
Optimization Recommendations
优化建议
Quick Wins (This Sprint)
快速见效(当前迭代)
- Add database indexes - Expected: 40% improvement
- Enable query caching - Expected: 25% improvement
- Optimize N+1 queries - Expected: 30% improvement
- 添加数据库索引 - 预期提升:40%
- 启用查询缓存 - 预期提升:25%
- 优化N+1查询 - 预期提升:30%
Medium Term (Next Quarter)
中期(下一季度)
- Implement read replicas
- Add CDN for static assets
- Optimize serialization
- 实现只读副本
- 为静态资源添加CDN
- 优化序列化过程
Long Term (6+ Months)
长期(6个月以上)
- Service decomposition
- Event-driven architecture
- Edge computing deployment
- 服务拆分
- 事件驱动架构
- 边缘计算部署
Capacity Planning
容量规划
| Timeframe | Expected Load | Current Capacity | Gap | Action |
|---|---|---|---|---|
| 3 months | +25% | 5,000 RPS | ✅ | Monitor |
| 6 months | +50% | 5,000 RPS | ⚠️ | Scale |
| 12 months | +100% | 5,000 RPS | ❌ | Redesign |
undefined| 时间范围 | 预期负载 | 当前容量 | 差距 | 行动 |
|---|---|---|---|---|
| 3个月 | +25% | 5,000 RPS | ✅ | 监控 |
| 6个月 | +50% | 5,000 RPS | ⚠️ | 扩容 |
| 12个月 | +100% | 5,000 RPS | ❌ | 重构 |
undefinedArchitecture Review Template
架构评审模板
markdown
undefinedmarkdown
undefinedArchitecture Review
架构评审
System: [System name]
Version: [Current architecture version]
Review Date: [YYYY-MM-DD]
Participants: [Team members]
系统:[系统名称]
版本:[当前架构版本]
评审日期:[YYYY-MM-DD]
参与人员:[团队成员]
Current Architecture
当前架构
System Diagram
系统架构图
[Include architecture diagram or ASCII representation][包含架构图或ASCII表示]Components
组件
| Component | Purpose | Technology | Owner |
|---|---|---|---|
| API Gateway | Request routing | Kong | Platform |
| Auth Service | Authentication | Keycloak | Security |
| Core API | Business logic | Python/FastAPI | Backend |
| Database | Data persistence | PostgreSQL | Data |
| 组件 | 用途 | 技术栈 | 负责人 |
|---|---|---|---|
| API网关 | 请求路由 | Kong | 平台团队 |
| 认证服务 | 身份认证 | Keycloak | 安全团队 |
| 核心API | 业务逻辑 | Python/FastAPI | 后端团队 |
| 数据库 | 数据持久化 | PostgreSQL | 数据团队 |
Data Flow
数据流
- User request → API Gateway
- API Gateway → Auth validation
- Auth → Core API
- Core API → Database
- Response → User
- 用户请求 → API网关
- API网关 → 认证校验
- 认证服务 → 核心API
- 核心API → 数据库
- 响应 → 用户
Evaluation Criteria
评估标准
Scalability
可扩展性
| Aspect | Current | Target | Gap | Score |
|---|---|---|---|---|
| Horizontal scaling | Manual | Auto | Yes | 6/10 |
| Database scaling | Single | Sharded | Yes | 5/10 |
| Caching | Redis | Distributed | No | 8/10 |
| 维度 | 当前状态 | 目标状态 | 差距 | 评分 |
|---|---|---|---|---|
| 水平扩容 | 手动 | 自动 | 是 | 6/10 |
| 数据库扩容 | 单节点 | 分片 | 是 | 5/10 |
| 缓存 | Redis | 分布式 | 否 | 8/10 |
Reliability
可靠性
| Aspect | Current | Target | Gap | Score |
|---|---|---|---|---|
| Availability | 99.5% | 99.9% | Yes | 7/10 |
| Disaster recovery | Manual | Auto | Yes | 5/10 |
| Data backup | Daily | Real-time | Yes | 6/10 |
| 维度 | 当前状态 | 目标状态 | 差距 | 评分 |
|---|---|---|---|---|
| 可用性 | 99.5% | 99.9% | 是 | 7/10 |
| 灾难恢复 | 手动 | 自动 | 是 | 5/10 |
| 数据备份 | 每日 | 实时 | 是 | 6/10 |
Maintainability
可维护性
| Aspect | Current | Target | Gap | Score |
|---|---|---|---|---|
| Code modularity | Medium | High | Yes | 6/10 |
| Documentation | Partial | Complete | Yes | 5/10 |
| Test coverage | 70% | 85% | Yes | 7/10 |
| 维度 | 当前状态 | 目标状态 | 差距 | 评分 |
|---|---|---|---|---|
| 代码模块化 | 中等 | 高 | 是 | 6/10 |
| 文档 | 部分完善 | 完整 | 是 | 5/10 |
| 测试覆盖率 | 70% | 85% | 是 | 7/10 |
Technical Debt Assessment
技术债务评估
| Item | Impact | Effort | Priority | Age |
|---|---|---|---|---|
| Legacy auth system | High | High | P1 | 2y |
| Monolithic API | Medium | High | P2 | 1.5y |
| Missing monitoring | Medium | Low | P1 | 1y |
| 项 | 影响 | 工作量 | 优先级 | 存在时长 |
|---|---|---|---|---|
| 遗留认证系统 | High | High | P1 | 2年 |
| 单体API | Medium | High | P2 | 1.5年 |
| 缺失监控 | Medium | Low | P1 | 1年 |
Recommendations
建议
Immediate (0-3 months)
紧急(0-3个月)
- [Recommendation 1]
- [Recommendation 2]
- [建议1]
- [建议2]
Short-term (3-6 months)
短期(3-6个月)
- [Recommendation 1]
- [Recommendation 2]
- [建议1]
- [建议2]
Long-term (6-12 months)
长期(6-12个月)
- [Recommendation 1]
- [Recommendation 2]
- [建议1]
- [建议2]
Decision Log
决策日志
| Decision | Rationale | Alternatives Considered | Date |
|---|---|---|---|
| [Decision 1] | [Why] | [Options] | [Date] |
undefined| 决策 | 理由 | 备选方案 | 日期 |
|---|---|---|---|
| [决策1] | [原因] | [选项] | [日期] |
undefinedIntegration with Extended Thinking
与扩展思维的集成
For deep analysis tasks, use maximum thinking budget:
python
response = client.messages.create(
model="claude-opus-4-5-20250514",
max_tokens=32000,
thinking={
"type": "enabled",
"budget_tokens": 25000 # Maximum budget for deep analysis
},
system="""You are a senior technical analyst performing a
comprehensive review. Use structured analysis templates and
document all findings systematically.""",
messages=[{
"role": "user",
"content": "Perform a security threat model for..."
}]
)对于深度分析任务,请使用最大思维预算:
python
response = client.messages.create(
model="claude-opus-4-5-20250514",
max_tokens=32000,
thinking={
"type": "enabled",
"budget_tokens": 25000 # 深度分析的最大预算
},
system="""你是一名资深技术分析师,正在进行全面评审。请使用结构化分析模板,系统记录所有发现。""",
messages=[{
"role": "user",
"content": "为...进行安全威胁建模"
}]
)Best Practices
最佳实践
- Use appropriate templates: Match template to analysis type
- Be systematic: Follow the template structure completely
- Quantify findings: Use metrics and severity ratings
- Prioritize actionable: Focus on findings that can be fixed
- Document evidence: Link to specific code/logs/data
- Track progress: Update findings as they're addressed
- 使用合适的模板:根据分析类型匹配对应的模板
- 保持系统性:严格遵循模板结构
- 量化发现:使用指标和严重程度评级
- 优先处理可执行项:聚焦可修复的问题
- 记录证据:关联到具体的代码/日志/数据
- 跟踪进度:随着问题处理更新发现内容
See Also
相关链接
- [[extended-thinking]] - Enable deep reasoning capabilities
- [[complex-reasoning]] - Reasoning frameworks
- [[testing]] - Validation strategies
- [[debugging]] - Issue investigation
- [[extended-thinking]] - 启用深度推理能力
- [[complex-reasoning]] - 推理框架
- [[testing]] - 验证策略
- [[debugging]] - 问题排查