| name | inspecting-skills |
| description | Discovers and indexes Python code in skills, enabling cross-skill imports. Use when importing functions from other skills or analyzing skill codebases. |
| metadata | {"version":"1.0.2"} |
Inspecting Skills
Discover Python code across skills and enable universal imports. Solves the dash-underscore naming mismatch between skill directories (e.g., browsing-bluesky) and Python imports (e.g., browsing_bluesky).
Installation
import sys
sys.path.insert(0, '/home/user/claude-skills')
from inspecting_skills import setup_skill_path, skill_import
Quick Start
Import a Skill
from inspecting_skills import skill_import
bsky = skill_import("browsing-bluesky")
posts = bsky.search_posts("python")
search, profile = skill_import("browsing-bluesky", ["search_posts", "get_profile"])
Enable Transparent Imports
from inspecting_skills import setup_skill_path
setup_skill_path("/home/user/claude-skills")
from browsing_bluesky import search_posts, get_profile
from remembering import remember, recall
Discover Available Skills
from inspecting_skills import list_importable_skills
skills = list_importable_skills()
for s in skills:
print(f"{s['name']} -> import {s['module_name']}")
Core Functions
Discovery
| Function | Purpose |
|---|
discover_skill(path) | Analyze a single skill directory |
discover_all_skills(root) | Find all skills with Python code |
find_skill_by_name(name, root) | Find skill by name (either form) |
skill_name_to_module(name) | Convert "browsing-bluesky" to "browsing_bluesky" |
Indexing
| Function | Purpose |
|---|
index_skill(layout) | Extract symbols from a discovered skill |
index_all_skills(root) | Index all skills in repository |
generate_registry(root, output) | Create registry.json manifest |
Importing
| Function | Purpose |
|---|
setup_skill_path(root) | Enable transparent skill imports |
skill_import(name, symbols) | Import skill or specific symbols |
register_skill(name, path) | Register skill at custom path |
list_importable_skills() | List all importable skills |
Skill Layouts
Skills organize Python code in three patterns:
1. Scripts Directory
browsing-bluesky/
SKILL.md
__init__.py # Re-exports from scripts/
scripts/
__init__.py
bsky.py # Main implementation
2. Root-Level Modules
remembering/
SKILL.md
__init__.py # Re-exports functions
memory.py # Core functionality
boot.py
config.py
3. Simple Package
simple-skill/
SKILL.md
__init__.py # Contains all code
Generating a Registry
Create a registry.json for offline symbol lookup:
from inspecting_skills import generate_registry
from pathlib import Path
registry = generate_registry(
Path("/home/user/claude-skills"),
output_path=Path("registry.json")
)
Indexing a Single Skill
from inspecting_skills import discover_skill, index_skill
from pathlib import Path
layout = discover_skill(Path("/home/user/claude-skills/remembering"))
print(f"Layout: {layout.layout_type}")
print(f"Has __init__.py: {layout.has_init}")
print(f"Python files: {[f.name for f in layout.python_files]}")
index = index_skill(layout)
for module in index.modules:
print(f"\n{module.file_path}:")
for sym in module.symbols:
print(f" {sym.kind} {sym.name}{sym.signature or ''}")
Integration with mapping-codebases
This skill complements mapping-codebases which generates _MAP.md files:
- mapping-codebases: Static documentation via tree-sitter, multi-language
- inspecting-skills: Runtime import support, Python-focused, dynamic discovery
Use both together:
mapping-codebases for navigation and code review
inspecting-skills for actual code imports and execution
Troubleshooting
Import Errors
from inspecting_skills import discover_skill
layout = discover_skill(Path("/path/to/skill"))
print(layout.has_init)
from inspecting_skills import get_skills_root
print(get_skills_root())
import ast
init_code = open("/path/to/skill/__init__.py").read()
Path Not Found
from inspecting_skills import set_skills_root
set_skills_root("/home/user/claude-skills")
API Reference
SkillLayout
@dataclass
class SkillLayout:
name: str
path: Path
layout_type: str
python_files: list[Path]
has_init: bool
entry_module: str
SkillIndex
@dataclass
class SkillIndex:
name: str
module_name: str
layout_type: str
modules: list[ModuleIndex]
exports: list[str]
Symbol
@dataclass
class Symbol:
name: str
kind: str
signature: str | None
line: int | None
docstring: str | None
children: list[Symbol]