vm-skeleton-extractor
Skill detail with category, linked agents, and source metadata.
vm-skeleton-extractor
Deterministic script that extracts a logic skeleton from every source file -- imports, class/function declarations, conditions, state updates, API calls, returns, exports, error handling, accessibility attributes, and timers. Uses calibrated regex from script-config.json plus skeleton-specific patterns. Produces intermediate/skeletons.json with one entry per file containing tagged skeleton lines and compression ratio. Runs in ~30 seconds for 3,700 files.
Source: .github/skills/code-generation/vm-skeleton-extractor/SKILL.md
Used By Agents
Preview
View source preview (first 3000 chars)
# vm-skeleton-extractor
## When to Use This Skill
- Phase 4a-SKEL of the RE pipeline (after LOC/complexity, before AI file analysis)
- When preparing lightweight input for AI summarization instead of full source files
- Any time a compressed logic-only representation of source files is needed
## Unitary Function
**ONE responsibility:** For every source file, extract tagged logic lines (imports, declarations, conditions, calls, returns) into a compressed skeleton that preserves control flow structure while discarding boilerplate.
## NOT RESPONSIBLE FOR
- Summarizing files (that is 3b File Summarizer)
- Determining whether skeleton mode is safe (that is vm-skeleton-feasibility-checker)
- Signature extraction (that is vm-deterministic-extractor Phase 2)
- Any AI analysis
## Prerequisite
`intermediate/skeleton-feasibility.json` must exist with `overall.recommendation = "skeleton_safe"`. If absent or `"skeleton_risky"`, the orchestrator should skip this phase and use full-file reads instead.
## Input
```json
{
"repo_path": "/absolute/path/to/repo",
"output_dir": "docs/codebase-analysis",
"file_metrics_path": "docs/codebase-analysis/intermediate/file-metrics.json",
"checklist_path": "docs/codebase-analysis/checklist.json"
}
```
## Tag Vocabulary
| Tag | What It Captures | Regex Pattern |
|---|---|---|
| `IMP` | Import/require statements | `^\s*import\s` or `require\(` |
| `CLS` | Class declarations | `(export\s+)?(default\s+)?class\s+\w+` |
| `FN` | Named function/const declarations | `(export\s+)?(const\|let\|var\|function\|async)\s+\w+\s*[=(]` with `=>`/`function`/`(` |
| `METH` | Class method declarations | `(async\s+)?\w+\s*\([^)]*\)\s*\{` (not if/for/while/switch) |
| `IF` | Conditional branches | `\bif\s*\(` |
| `ELIF` | Else-if / else branches | `else\s*(if\s*\(\|{)` |
| `SW` | Switch statements | `\bswitch\s*\(` |
| `CASE` | Case labels | `^\s*case\s+` |
| `ASYN` | Async/Promise patterns | `new\s+Promise\|\.then\s*\(\|\.catch\s*\(\|await\s+` |
| `STATE` | State mutations (React/Redux) | `setState\s*\(\|dispatch\s*\(\|store\.` |
| `API` | API/service calls | `fetch\s*\(\|axios\.\|\.get\s*\(\|\.post\s*\(\|\.put\s*\(\|\.delete\s*\(\|Service\.` |
| `RET` | Return statements | `^\s*return\b` |
| `EXP` | Module exports | `export\s+default\|module\.exports` |
| `HOC` | Higher-order component wrappers | `connect\s*\(\|mapStateToProps\|mapDispatchToProps` |
| `ERR` | Error handling | `(try\|catch\|finally)\s*[\({]\|throw\s+` |
| `XFRM` | Data transformations | `\.(map\|filter\|reduce\|find\|forEach)\s*\(` with variable assignment |
| `A11Y` | Accessibility attributes | `aria-\w+=\|role=["']\|tabIndex=` |
| `TIMER` | Timer/debounce patterns | `setTimeout\s*\(\|setInterval\s*\(\|clearTimeout\|clearInterval\|debounce\|throttle` |
| `GLOBAL` | Global object access patterns | `app\.\w+\.\w+\(\|window\.\w+\.\w+\(` |
## Script
Cross-platform Python. No external dependencies.
```python
#!/usr/bin/env python3
"""
vm-skeleton-extractor: E