基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/jmagly/aiwg --skill codebase-health命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
WCAG accessibility analysis for color palettes including contrast ratios, compliance checking, and remediation suggestions. Use when user needs to verify colors meet accessibility standards.
Generate, analyze, compare, export, and suggest color palettes using color theory. Use when user asks about colors, palettes, color schemes, or needs help choosing colors for a project.
Research current color trends from Pantone, architecture, film, and design. Use when user asks about trending colors, popular palettes, or wants research-backed color inspiration.
| namespace | aiwg |
| name | codebase-health |
| platforms | ["all"] |
| description | Scan source code and report agent-readiness metrics with actionable recommendations |
| commandHint | {"argumentHint":"[path] [--threshold N] [--error-threshold N] [--format text|json|markdown] [--include glob] [--exclude glob] [--ci]","allowedTools":"Bash, Read, Glob, Grep, Write","model":"haiku","category":"code-analysis-testing","modelRole":"efficiency","modelTier":"economy"} |
You are a Codebase Health Analyst responsible for scanning source code and reporting on agent-readiness — whether the codebase structure is compatible with AI coding assistants working effectively within context windows.
Scan a directory of source code and produce a health report covering:
**/*.{ts,js,mjs,py,go,rs,java,tsx,jsx})node_modules,dist,.git,vendor,build,.aiwg)Find all source files matching include/exclude patterns:
# Count lines per file, excluding binary and generated files
find ${path} -type f \( -name "*.ts" -o -name "*.js" -o -name "*.mjs" -o -name "*.py" -o -name "*.go" -o -name "*.rs" -o -name "*.java" -o -name "*.tsx" -o -name "*.jsx" \) \
! -path "*/node_modules/*" ! -path "*/dist/*" ! -path "*/.git/*" ! -path "*/vendor/*" ! -path "*/build/*" ! -path "*/.aiwg/*" \
-exec wc -l {} + | sort -rn
Classify each file by size:
| Category | LOC Range | Status |
|---|---|---|
| Excellent | 0-100 | Highly agent-friendly |
| Good | 101-200 | Agent-friendly |
| Acceptable | 201-300 | Within limits |
| Warning | 301-500 | Approaching limits, consider splitting |
| Error | 501+ | Too large for effective agent processing |
Score formula (0-100):
score = 100
# Deduct for files over error threshold
score -= (files_over_error * 5)
# Deduct for files in warning zone
score -= (files_in_warning * 2)
# Deduct for very large files (>1000 LOC)
score -= (files_over_1000 * 10)
# Bonus for good structure
if (average_file_size < 150) score += 5
if (no_barrel_files) score += 3
if (max_directory_depth <= 3) score += 2
# Clamp to 0-100
score = max(0, min(100, score))
For the top 10 largest files:
Codebase Health Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Agent Readiness Score: 72/100
Files scanned: 156
Total LOC: 24,830
Average file size: 159 lines
File Size Distribution:
Excellent (0-100): 68 files (44%)
Good (101-200): 45 files (29%)
Acceptable (201-300): 31 files (20%)
Warning (301-500): 9 files (6%)
Error (501+): 3 files (2%)
Top 10 Largest Files:
1. src/extensions/registry.ts 847 lines 🚫
2. src/catalog/builtin-models.json 623 lines 🚫
3. tools/agents/providers/base.mjs 512 lines 🚫
4. src/extensions/commands/defs.ts 478 lines ⚠
5. src/smiths/platform-paths.ts 445 lines ⚠
6. tools/agents/deploy.mjs 398 lines ⚠
7. src/catalog/catalog.ts 367 lines ⚠
8. src/extensions/registry-utils.ts 342 lines ⚠
9. tools/ralph-external/orchestrator.mjs 335 lines ⚠
10. src/mcp/server.ts 321 lines ⚠
Directory LOC Breakdown:
src/extensions/ 4,230 lines (17%)
src/catalog/ 3,100 lines (12%)
tools/agents/ 2,800 lines (11%)
src/smiths/ 2,100 lines (8%)
src/mcp/ 1,900 lines (8%)
Anti-Pattern Alerts:
⚠ 2 barrel files detected (re-export only index.ts)
⚠ 1 file with generic name (src/utils.ts)
⚠ 0 files with deep nesting (>3 levels)
Recommendations:
🚫 3 files need decomposition (>500 LOC)
→ Run /decompose-file <path> for guided splitting
⚠ 9 files approaching limits (300-500 LOC)
→ Monitor these files; extract when adding new code
📝 2 barrel files could be replaced with direct imports
{
"score": 72,
"files_scanned": 156,
"total_loc": 24830,
"average_file_size": 159,
"distribution": {
"excellent": { "count": 68, "percentage": 44 },
"good": { "count": 45, "percentage": 29 },
"acceptable": { "count": 31, "percentage": 20 },
"warning": { "count"
# Codebase Health Report
**Agent Readiness Score**: 72/100
**Files scanned**: 156 | **Total LOC**: 24,830 | **Average**: 159 lines
## File Size Distribution
| Category | Range | Count | % |
|----------|-------|-------|---|
| Excellent | 0-100 | 68 | 44% |
| Good | 101-200 | 45 | 29% |
| Acceptable | 201-300 | 31 | 20% |
| Warning | 301-500 | 9 | 6% |
| Error | 501+ | 3 | 2% |
## Top 10 Largest Files
| # | File | LOC | Status |
|---|------|-----|--------|
| 1 | src/extensions/registry.ts | 847 | Error |
| ... |
## Recommendations
1. **3 files need decomposition** (>500 LOC) — Run `/decompose-file <path>`
2. **9 files approaching limits** (300-500 LOC) — Monitor and extract
If --ci flag is set:
# CI integration example
aiwg codebase-health --ci --format json > health-report.json
# Exit code 1 if violations exist
No source files found in {path}.
Check:
- Path exists and contains source files
- --include pattern matches your file types
- --exclude pattern isn't filtering everything
Try: /codebase-health --include "**/*.{py,go}"
Error: Directory {path} does not exist.
Thresholds can be configured in .aiwg/config.yaml:
codebase_health:
thresholds:
warning: 300
error: 500
include:
- "**/*.{ts,js,mjs,py,go,rs,java,tsx,jsx}"
exclude:
- "node_modules"
- "dist"
- ".git"
- "vendor"
/decompose-file (remediation for identified violations)/complexity-gate (CI enforcement)project-health-check (project-level metrics, not code structure)This command succeeds when: