feat(cli): add --recursive flag for multi-skill directory scanning
Summary
When a directory contains multiple independent skills (each with its own SKILL.md) but no root-level SKILL.md, SkillSpector previously treated the entire tree as one monolithic skill — summing all findings into a single inflated score and reporting the skill name as "unknown".
Changes
multi_skill.py: New module withdetect_skills()that identifies directories containing 2+ sub-skills by scanning forSKILL.mdin immediate subdirectories. Extracts skill names from frontmatter with directory-name fallback.--recursive(-r) CLI flag: When set, invokes the LangGraph workflow once per detected sub-skill, producing per-skill reports and a combined summary table.- Auto-detection warning: When
--recursiveis NOT specified but multiple skills are detected, prints a warning guiding users to the correct flag. - JSON combined output: With
--recursive --format json --output, writes a structured combined report with per-skill scores.
Example
$ skillspector scan ./skill-collection/ --recursive
Multi-skill directory detected: 3 skills found
[1/3] Scanning weather-lookup (weather-lookup/)
Score: 15/100 (LOW)
[2/3] Scanning email-sender (email-sender/)
Score: 42/100 (MEDIUM)
[3/3] Scanning file-manager (file-manager/)
Score: 8/100 (LOW)
═══ Multi-Skill Summary ═══
Skill Score Severity Findings
────────────────────────────── ──────── ──────────── ──────────
weather-lookup 15 LOW 3
email-sender 42 MEDIUM 7
file-manager 8 LOW 2
Design Decisions
| Decision | Rationale |
|---|---|
| Require >= 2 sub-skills for multi-skill detection | Avoids false positives on single-skill repos |
Root SKILL.md always wins |
Preserves backward compatibility for monorepos with a parent skill |
| Hidden directories skipped | Standard convention (.git, .venv, etc.) |
| Graph invoked per sub-skill (not batched) | Each skill gets independent context, manifest, and score |
Test Plan
- [x] 12 unit tests covering detection, name extraction, edge cases (empty dirs, single sub-skill, hidden dirs, root override, fallback names, lowercase skill.md)
- [x] Full test suite: 688 passed, 0 failures, 0 regressions
- [x]
ruff checkandruff formatclean
Fixes #136
PS: These issues were found while running bunch of skill evals using SkillSpector and hence raising all the issues so that i can use these with correct reference to Upstream code
Thanks for the approval! Addressed the non-blocking nits:
- Help text clarified —
--recursivenow says "scan directories containing multiple skills (immediate subdirectories with SKILL.md) independently" instead of just "multi-skill directories" - Dead code removed —
finally: passeliminated - Typing fixed —
_scan_multi_skillnow takesMultiSkillDetectionResultdirectly (imported at top level) instead ofobject+ assert - Findings count source — summary table and JSON output now use
filtered_findings(falling back tofindings) for consistency with per-skill reports
Items 5 (symlink guard) and 6 (orchestration tests) noted for follow-up — keeping this PR focused on the current nits.