bloat-detector

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Table of Contents

目录

Bloat Detector

代码膨胀检测器

Systematically detect and eliminate codebase bloat through progressive analysis tiers.
通过渐进式分析层级,系统性地检测并消除代码库膨胀问题。

Bloat Categories

代码膨胀类别

CategoryExamples
CodeDead code, God classes, Lava flow, duplication
AI-GeneratedTab-completion bloat, vibe coding, hallucinated deps
DocumentationRedundancy, verbosity, stale content, slop
DependenciesUnused imports, dependency bloat, phantom packages
Git HistoryStale files, low-churn code, massive single commits
类别示例
代码类Dead code, God classes, Lava flow, 代码重复
AI生成类自动补全冗余、Vibe coding、幻觉依赖
文档类文档冗余、冗长表述、过时内容、Slop
依赖类未使用的导入、依赖膨胀、幽灵包
Git历史类陈旧文件、低变更频率代码、超大单次提交

Quick Start

快速开始

Tier 1: Quick Scan (2-5 min, no tools)

Tier 1: 快速扫描(2-5分钟,无需工具)

bash
/bloat-scan
Detects: Large files, stale code, old TODOs, commented blocks, basic duplication
bash
/bloat-scan
检测内容:大文件、陈旧代码、过时TODO、注释代码块、基础代码重复

Tier 2: Targeted Analysis (10-20 min, optional tools)

Tier 2: 定向分析(10-20分钟,可选工具)

bash
/bloat-scan --level 2 --focus code   # or docs, deps
Adds: Static analysis (Vulture/Knip), git churn hotspots, doc similarity
bash
/bloat-scan --level 2 --focus code   # or docs, deps
新增检测:静态分析(Vulture/Knip)、Git变更热点、文档相似度

Tier 3: Deep Audit (30-60 min, full tooling)

Tier 3: 深度审计(30-60分钟,完整工具链)

bash
/bloat-scan --level 3 --report audit.md
Adds: Cross-file redundancy, dependency graphs, readability metrics
bash
/bloat-scan --level 3 --report audit.md
新增检测:跨文件冗余、依赖图谱、可读性指标

When To Use

适用场景

DoDon't
Context usage > 30%Active feature development
Quarterly maintenanceTime-sensitive bugs
Pre-release cleanupCodebase < 1000 lines
Before major refactoringTools unavailable (Tier 2/3)
适用不适用
上下文使用率 > 30%功能开发活跃期
季度维护处理时间敏感型Bug
发布前清理代码库规模 < 1000行
重大重构前工具不可用(Tier 2/3)

When NOT To Use

不适用场景

  • Active feature development
  • Time-sensitive bugs
  • Codebase < 1000 lines
  • 功能开发活跃期
  • 处理时间敏感型Bug
  • 代码库规模 < 1000行

Confidence Levels

置信度等级

LevelConfidenceAction
HIGH90-100%Safe to remove
MEDIUM70-89%Review first
LOW50-69%Investigate
等级置信度操作建议
90-100%可安全移除
70-89%先进行评审
50-69%深入调查

Prioritization

优先级计算

Priority = (Token_Savings × 0.4) + (Maintenance × 0.3) + (Confidence × 0.2) + (Ease × 0.1)
Priority = (Token_Savings × 0.4) + (Maintenance × 0.3) + (Confidence × 0.2) + (Ease × 0.1)

Module Architecture

模块架构

Tier 1 (always available):
  • See
    modules/quick-scan.md
    - Heuristics, no tools
  • See
    modules/git-history-analysis.md
    - Staleness, churn, vibe coding signatures
Tier 2 (optional tools):
  • See
    modules/code-bloat-patterns.md
    - Anti-patterns (God class, Lava flow)
  • See
    modules/ai-generated-bloat.md
    - AI-specific patterns (Tab bloat, hallucinations)
  • See
    modules/documentation-bloat.md
    - Redundancy, readability, slop detection
  • See
    modules/static-analysis-integration.md
    - Vulture, Knip
Shared:
  • See
    modules/remediation-types.md
    - DELETE, REFACTOR, CONSOLIDATE, ARCHIVE
Tier 1(始终可用):
  • 查看
    modules/quick-scan.md
    - 启发式分析,无需工具
  • 查看
    modules/git-history-analysis.md
    - 代码陈旧度、变更频率、Vibe coding特征
Tier 2(可选工具):
  • 查看
    modules/code-bloat-patterns.md
    - 反模式(God class, Lava flow)
  • 查看
    modules/ai-generated-bloat.md
    - AI专属膨胀模式(自动补全冗余、幻觉依赖)
  • 查看
    modules/documentation-bloat.md
    - 文档冗余、可读性、Slop检测
  • 查看
    modules/static-analysis-integration.md
    - Vulture, Knip
通用模块
  • 查看
    modules/remediation-types.md
    - DELETE、REFACTOR、CONSOLIDATE、ARCHIVE

Auto-Exclusions

自动排除项

Always excludes:
.venv
,
__pycache__
,
.git
,
node_modules
,
dist
,
build
,
vendor
Also respects:
.gitignore
,
.bloat-ignore
默认排除目录:
.venv
,
__pycache__
,
.git
,
node_modules
,
dist
,
build
,
vendor
同时遵循:
.gitignore
,
.bloat-ignore
配置规则

Safety

安全保障

  • Never auto-delete - all changes require approval
  • Dry-run support -
    --dry-run
    for previews
  • Backup branches - created before bulk changes
  • 绝不自动删除 - 所有变更需人工审批
  • 支持试运行 - 使用
    --dry-run
    参数预览变更效果
  • 备份分支 - 批量变更前自动创建备份分支

Related

相关工具

  • bloat-auditor
    agent - Executes scans
  • unbloat-remediator
    agent - Safe remediation
  • context-optimization
    skill - MECW principles
  • bloat-auditor
    agent - 执行扫描任务
  • unbloat-remediator
    agent - 安全修复代码膨胀
  • context-optimization
    skill - 遵循MECW原则