deep-analysis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Deep 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
undefined
markdown
undefined

Code 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

关键问题

IDSeverityLocationIssueRecommendation
C1Criticalfile:line[Issue][Fix]
C2Criticalfile:line[Issue][Fix]
编号严重程度位置问题建议
C1Criticalfile:line[Issue][Fix]
C2Criticalfile:line[Issue][Fix]

High Priority Findings

高优先级问题

IDSeverityLocationIssueRecommendation
H1Highfile:line[Issue][Fix]
编号严重程度位置问题建议
H1Highfile:line[Issue][Fix]

Medium Priority Findings

中优先级问题

[...]
[...]

Low Priority / Suggestions

低优先级/建议项

[...]
[...]

Metrics

指标

MetricValueTargetStatus
Test Coverage75%80%⚠️
Cyclomatic Complexity12<10⚠️
Technical Debt4.2d<3d
Security Score8/109/10⚠️
指标当前值目标值状态
测试覆盖率75%80%⚠️
圈复杂度12<10⚠️
技术债务4.2d<3d
安全评分8/109/10⚠️

Recommendations

建议

  1. Immediate: [Critical fixes]
  2. Short-term: [Within sprint]
  3. Long-term: [Tech debt reduction]
  1. 紧急处理:[修复关键问题]
  2. 短期:[当前迭代内完成]
  3. 长期:[减少技术债务]

Sign-off

确认签字

  • All critical issues addressed
  • High priority issues have timeline
  • Audit findings documented in backlog
undefined
  • 所有关键问题已处理
  • 高优先级问题已有时间规划
  • 审计发现已记录在待办事项中
undefined

Security Threat Model Template

安全威胁建模模板

markdown
undefined
markdown
undefined

Threat 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

资产

AssetDescriptionSensitivityOwner
User DataPII, credentialsCriticalAuth Team
API KeysService credentialsHighDevOps
Business DataTransactionsHighProduct
资产描述敏感度负责人
用户数据PII、凭证Critical认证团队
API密钥服务凭证HighDevOps团队
业务数据交易数据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

仿冒

ThreatLikelihoodImpactMitigation
Credential theftMediumHighMFA, rate limiting
Session hijackingLowHighSecure cookies, HTTPS
威胁可能性影响缓解措施
凭证窃取MediumHigh多因素认证、速率限制
会话劫持LowHigh安全Cookie、HTTPS

Tampering

篡改

ThreatLikelihoodImpactMitigation
SQL injectionMediumCriticalParameterized queries
Data modificationLowHighIntegrity checks
威胁可能性影响缓解措施
SQL注入MediumCritical参数化查询
数据修改LowHigh完整性校验

Repudiation

抵赖

[...]
[...]

Information Disclosure

信息泄露

[...]
[...]

Denial of Service

拒绝服务

[...]
[...]

Elevation of Privilege

权限提升

[...]
[...]

Attack Vectors

攻击向量

  1. Vector 1: [Description]
    • Entry point: [Where]
    • Technique: [How]
    • Mitigation: [Defense]
  1. 向量1:[描述]
    • 入口点:[位置]
    • 技术手段:[方式]
    • 缓解措施:[防御方案]

Risk Matrix

风险矩阵

ThreatLikelihoodImpactRisk ScorePriority
T1HighCritical9P1
T2MediumHigh6P2
T3LowMedium3P3
威胁可能性影响风险评分优先级
T1HighCritical9P1
T2MediumHigh6P2
T3LowMedium3P3

Security Controls

安全控制措施

ControlTypeStatusCoverage
WAFPreventive✅ ActiveExternal
SASTDetective✅ CI/CDCode
DASTDetective⚠️ PartialRuntime
EncryptionPreventive✅ ActiveData
控制措施类型状态覆盖范围
WAF预防性✅ 已启用外部
SAST检测性✅ CI/CD集成代码层面
DAST检测性⚠️ 部分启用运行时
加密预防性✅ 已启用数据层面

Recommendations

建议

  1. [Priority 1 recommendations]
  2. [Priority 2 recommendations]
  3. [Priority 3 recommendations]
undefined
  1. [优先级1建议]
  2. [优先级2建议]
  3. [优先级3建议]
undefined

Performance Analysis Template

性能分析模板

markdown
undefined
markdown
undefined

Performance Analysis Report

性能分析报告

System: [System name] Period: [Date range] Environment: [Production/Staging]
系统:[系统名称] 周期:[日期范围] 环境:[生产/预发布]

Executive Summary

执行摘要

[Key findings and recommendations]
[关键发现与建议]

Performance Metrics

性能指标

Response Times

响应时间

EndpointP50P95P99TargetStatus
/api/users45ms120ms350ms<200ms
/api/search230ms890ms2.1s<500ms
/api/reports1.2s3.4s8.2s<2s
接口P50P95P99目标值状态
/api/users45ms120ms350ms<200ms
/api/search230ms890ms2.1s<500ms
/api/reports1.2s3.4s8.2s<2s

Throughput

吞吐量

ServiceCurrent RPSPeak RPSCapacityUtilization
API1,2002,4005,00048%
Worker5008001,00080%
服务当前RPS峰值RPS容量利用率
API1,2002,4005,00048%
工作节点5008001,00080%

Resource Utilization

资源利用率

ResourceAveragePeakThresholdStatus
CPU45%78%80%⚠️
Memory62%85%85%⚠️
Disk I/O30%55%70%
Network25%40%60%
资源平均值峰值阈值状态
CPU45%78%80%⚠️
内存62%85%85%⚠️
磁盘I/O30%55%70%
网络25%40%60%

Bottleneck Analysis

瓶颈分析

Identified Bottlenecks

已识别瓶颈

  1. Database Queries (High Impact)
    • Location:
      /api/search
      endpoint
    • Cause: Missing index on
      created_at
      column
    • Impact: 890ms P95 latency
    • Fix: Add composite index
  2. Memory Pressure (Medium Impact)
    • Location: Report generation service
    • Cause: Large dataset loading into memory
    • Impact: GC pauses, OOM risks
    • Fix: Implement streaming/pagination
  1. 数据库查询(高影响)
    • 位置:
      /api/search
      接口
    • 原因:
      created_at
      字段缺少索引
    • 影响:P95延迟达890ms
    • 修复方案:添加复合索引
  2. 内存压力(中影响)
    • 位置:报表生成服务
    • 原因:大型数据集加载至内存
    • 影响:GC停顿、OOM风险
    • 修复方案:实现流式处理/分页

Load Test Results

负载测试结果

ScenarioUsersDurationErrorsAvg Response
Baseline10010min0%120ms
Normal50030min0.1%180ms
Peak100015min2.3%450ms
Stress20005min15%2.1s
场景用户数持续时间错误率平均响应时间
基准测试10010min0%120ms
正常负载50030min0.1%180ms
峰值负载100015min2.3%450ms
压力测试20005min15%2.1s

Optimization Recommendations

优化建议

Quick Wins (This Sprint)

快速见效(当前迭代)

  1. Add database indexes - Expected: 40% improvement
  2. Enable query caching - Expected: 25% improvement
  3. Optimize N+1 queries - Expected: 30% improvement
  1. 添加数据库索引 - 预期提升:40%
  2. 启用查询缓存 - 预期提升:25%
  3. 优化N+1查询 - 预期提升:30%

Medium Term (Next Quarter)

中期(下一季度)

  1. Implement read replicas
  2. Add CDN for static assets
  3. Optimize serialization
  1. 实现只读副本
  2. 为静态资源添加CDN
  3. 优化序列化过程

Long Term (6+ Months)

长期(6个月以上)

  1. Service decomposition
  2. Event-driven architecture
  3. Edge computing deployment
  1. 服务拆分
  2. 事件驱动架构
  3. 边缘计算部署

Capacity Planning

容量规划

TimeframeExpected LoadCurrent CapacityGapAction
3 months+25%5,000 RPSMonitor
6 months+50%5,000 RPS⚠️Scale
12 months+100%5,000 RPSRedesign
undefined
时间范围预期负载当前容量差距行动
3个月+25%5,000 RPS监控
6个月+50%5,000 RPS⚠️扩容
12个月+100%5,000 RPS重构
undefined

Architecture Review Template

架构评审模板

markdown
undefined
markdown
undefined

Architecture 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

组件

ComponentPurposeTechnologyOwner
API GatewayRequest routingKongPlatform
Auth ServiceAuthenticationKeycloakSecurity
Core APIBusiness logicPython/FastAPIBackend
DatabaseData persistencePostgreSQLData
组件用途技术栈负责人
API网关请求路由Kong平台团队
认证服务身份认证Keycloak安全团队
核心API业务逻辑Python/FastAPI后端团队
数据库数据持久化PostgreSQL数据团队

Data Flow

数据流

  1. User request → API Gateway
  2. API Gateway → Auth validation
  3. Auth → Core API
  4. Core API → Database
  5. Response → User
  1. 用户请求 → API网关
  2. API网关 → 认证校验
  3. 认证服务 → 核心API
  4. 核心API → 数据库
  5. 响应 → 用户

Evaluation Criteria

评估标准

Scalability

可扩展性

AspectCurrentTargetGapScore
Horizontal scalingManualAutoYes6/10
Database scalingSingleShardedYes5/10
CachingRedisDistributedNo8/10
维度当前状态目标状态差距评分
水平扩容手动自动6/10
数据库扩容单节点分片5/10
缓存Redis分布式8/10

Reliability

可靠性

AspectCurrentTargetGapScore
Availability99.5%99.9%Yes7/10
Disaster recoveryManualAutoYes5/10
Data backupDailyReal-timeYes6/10
维度当前状态目标状态差距评分
可用性99.5%99.9%7/10
灾难恢复手动自动5/10
数据备份每日实时6/10

Maintainability

可维护性

AspectCurrentTargetGapScore
Code modularityMediumHighYes6/10
DocumentationPartialCompleteYes5/10
Test coverage70%85%Yes7/10
维度当前状态目标状态差距评分
代码模块化中等6/10
文档部分完善完整5/10
测试覆盖率70%85%7/10

Technical Debt Assessment

技术债务评估

ItemImpactEffortPriorityAge
Legacy auth systemHighHighP12y
Monolithic APIMediumHighP21.5y
Missing monitoringMediumLowP11y
影响工作量优先级存在时长
遗留认证系统HighHighP12年
单体APIMediumHighP21.5年
缺失监控MediumLowP11年

Recommendations

建议

Immediate (0-3 months)

紧急(0-3个月)

  1. [Recommendation 1]
  2. [Recommendation 2]
  1. [建议1]
  2. [建议2]

Short-term (3-6 months)

短期(3-6个月)

  1. [Recommendation 1]
  2. [Recommendation 2]
  1. [建议1]
  2. [建议2]

Long-term (6-12 months)

长期(6-12个月)

  1. [Recommendation 1]
  2. [Recommendation 2]
  1. [建议1]
  2. [建议2]

Decision Log

决策日志

DecisionRationaleAlternatives ConsideredDate
[Decision 1][Why][Options][Date]
undefined
决策理由备选方案日期
[决策1][原因][选项][日期]
undefined

Integration 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

最佳实践

  1. Use appropriate templates: Match template to analysis type
  2. Be systematic: Follow the template structure completely
  3. Quantify findings: Use metrics and severity ratings
  4. Prioritize actionable: Focus on findings that can be fixed
  5. Document evidence: Link to specific code/logs/data
  6. Track progress: Update findings as they're addressed
  1. 使用合适的模板:根据分析类型匹配对应的模板
  2. 保持系统性:严格遵循模板结构
  3. 量化发现:使用指标和严重程度评级
  4. 优先处理可执行项:聚焦可修复的问题
  5. 记录证据:关联到具体的代码/日志/数据
  6. 跟踪进度:随着问题处理更新发现内容

See Also

相关链接

  • [[extended-thinking]] - Enable deep reasoning capabilities
  • [[complex-reasoning]] - Reasoning frameworks
  • [[testing]] - Validation strategies
  • [[debugging]] - Issue investigation
  • [[extended-thinking]] - 启用深度推理能力
  • [[complex-reasoning]] - 推理框架
  • [[testing]] - 验证策略
  • [[debugging]] - 问题排查