AgentSkillsCN

slop-detector

分析仓库架构,识别 TypeScript/JavaScript 代码库中的结构性松散之处。当您需要审视文件夹结构、发现过度工程化问题、降低复杂度,或清理项目组织时,可使用此技能。该技能可检测过深的目录层级、单文件夹结构、桶状文件、空目录、企业级层嗅觉、镜像结构,以及零散的类型与工具。当您收到分析架构、审视项目结构、查找分层问题,或简化代码库组织的请求时,该技能便会自动触发。

SKILL.md
--- frontmatter
name: slop-detector
description: Analyze repository architecture to identify structural slop in TypeScript/JavaScript codebases. Use when reviewing folder structure, finding over-engineering, reducing complexity, or cleaning up project organization. Detects excessive directory depth, single-file folders, barrel files, empty directories, enterprise layer smell, mirrored structures, and scattered types/utils. Triggers on requests to analyze architecture, review project structure, find layering issues, or simplify codebase organization.

Slop Detector

Analyze repository architecture to identify structural slop: excessive layering, fragmentation, and organizational overhead.

Workflow

1. Run Architecture Scan

bash
bash /path/to/skill/scripts/analyze-slop.sh <repository-path> [output-dir]
  • Default output: ./docs/slop-report-YYYYMMDD-HHMMSS.md
  • Creates docs/ folder if missing

2. Patterns Detected

PatternProblemFix
🪆 Deep nesting (5+ levels)Hard to navigateFlatten structure
📁 Single-file directoriesUnnecessary fragmentationMove file up or merge
🛢️ Barrel files (index.ts)Circular deps, bundle bloatDirect imports
🕳️ Empty directoriesDead codeRemove
🏢 Enterprise layersPassthrough overheadConsolidate or justify
🪞 Mirrored structuresSame entity in many placesColocate by feature
📝 Centralized typesScattered from implementationColocate with code
🧰 Utils/helpers foldersDumping groundsMove to consumers

3. Review Checklist

For each flagged item, ask:

  1. Layers: What value does this layer add? (validation, caching, logging, transformation)
  2. Directories: Could this folder be flattened or merged?
  3. Separation: Should these files be colocated by feature instead?

Pattern Reference

See references/slop-patterns.md for:

  • Architecture anti-patterns with examples
  • Feature-based vs layer-based organization
  • When layering is justified

Output

Report saved to docs/slop-report-YYYYMMDD-HHMMSS.md with:

  • Issues by category
  • Summary metrics (dirs, files, depth)
  • Actionable recommendations