SkillSpector icon indicating copy to clipboard operation
SkillSpector copied to clipboard

feat(cli): add --recursive flag for multi-skill directory scanning

Open mimran-khan opened this issue 5 months ago • 2 comments

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 with detect_skills() that identifies directories containing 2+ sub-skills by scanning for SKILL.md in 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 --recursive is 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 check and ruff format clean

Fixes #136

mimran-khan avatar Jun 22 '26 17:06 mimran-khan

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

mimran-khan avatar Jun 22 '26 19:06 mimran-khan

Thanks for the approval! Addressed the non-blocking nits:

  1. Help text clarified — --recursive now says "scan directories containing multiple skills (immediate subdirectories with SKILL.md) independently" instead of just "multi-skill directories"
  2. Dead code removed — finally: pass eliminated
  3. Typing fixed — _scan_multi_skill now takes MultiSkillDetectionResult directly (imported at top level) instead of object + assert
  4. Findings count source — summary table and JSON output now use filtered_findings (falling back to findings) 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.

mimran-khan avatar Jun 22 '26 19:06 mimran-khan