Skip to content
kosmos-xray logo

Kosmos X-Ray Skill

kosmos-xray

Context-efficient codebase exploration using AST analysis. Use when exploring Kosmos architecture, understanding code structure, or preparing documentation for AI programmers. Triggers: xray, map structure, skeleton, interface, architecture, explore kosmos, warm start, token budget, context compr...

mattnigh/skills_collection0installs24stars

SKILL.md

Full skill instructions

Kosmos X-Ray Skill

Specialized tools for analyzing the Kosmos codebase efficiently within limited context windows. Uses AST parsing to extract structural information (classes, methods, signatures) without loading implementation details, achieving ~95% token reduction.

Enhanced Features (v2)

The skeleton extractor now captures:

  • Pydantic/​dataclass fields - name: str = Field(...) visible in output
  • Decorators - @dataclass, @property, @tool shown above definitions
  • Global constants - CONFIG_VAR = "value" at module level
  • Line numbers - Every definition includes # L{line} for navigation

IMPORTANT: Always use these features when exploring - they reveal data structures that would otherwise appear as empty pass statements.

When to Use This Skill

  • Exploring the codebase - Map directory structure before diving into files
  • Understanding architecture - Extract class hierarchies and dependencies
  • Understanding data models - Skeleton shows Pydantic fields that define the data
  • Onboarding - Generate documentation for new AI programmers
  • Context management - Identify large files that should use skeleton view instead of full read

Core Tools

1. mapper.py - Directory Structure Map

Shows file tree with token estimates. Identifies context hazards (large files).

# Map entire project
python .claude/​skills/​kosmos-xray/​scripts/​mapper.py

# Map specific directory
python .claude/​skills/​kosmos-xray/​scripts/​mapper.py kosmos/​workflow/

# Get summary only (no tree) - RECOMMENDED FIRST STEP
python .claude/​skills/​kosmos-xray/​scripts/​mapper.py --summary

# JSON output for parsing
python .claude/​skills/​kosmos-xray/​scripts/​mapper.py --json

2. skeleton.py - Interface Extraction (Enhanced)

Extracts Python file skeletons via AST. Now shows Pydantic fields, decorators, constants, and line numbers.

# Single file skeleton (includes line numbers by default)
python .claude/​skills/​kosmos-xray/​scripts/​skeleton.py kosmos/​workflow/​research_loop.py

# Directory with pattern filter
python .claude/​skills/​kosmos-xray/​scripts/​skeleton.py kosmos/ --pattern "**/​base*.py"

# Filter by priority (critical, high, medium, low) - USE THIS FOR ONBOARDING
python .claude/​skills/​kosmos-xray/​scripts/​skeleton.py kosmos/ --priority critical

# Include private methods (_method) for internal understanding
python .claude/​skills/​kosmos-xray/​scripts/​skeleton.py kosmos/​agents/ --private

# Omit line numbers if not needed
python .claude/​skills/​kosmos-xray/​scripts/​skeleton.py kosmos/​config.py --no-line-numbers

# JSON output for programmatic use
python .claude/​skills/​kosmos-xray/​scripts/​skeleton.py kosmos/​models/ --json

What skeleton.py reveals:

# Before (old behavior): Data models appeared empty
class Hypothesis(BaseModel):
    pass

# After (enhanced): Full data structure visible
@dataclass
class PaperAnalysis:  # L34
    paper_id: str  # L36
    executive_summary: str  # L37
    confidence_score: float  # L42

3. dependency_graph.py - Import Analysis

Maps import relationships between modules. Identifies architectural layers and circular dependencies.

# Analyze dependencies (text output)
python .claude/​skills/​kosmos-xray/​scripts/​dependency_graph.py kosmos/

# With root package name (recommended)
python .claude/​skills/​kosmos-xray/​scripts/​dependency_graph.py kosmos/ --root kosmos

# Focus on specific area
python .claude/​skills/​kosmos-xray/​scripts/​dependency_graph.py kosmos/ --focus workflow

# Generate Mermaid diagram for documentation - USE FOR WARM_START.md
python .claude/​skills/​kosmos-xray/​scripts/​dependency_graph.py kosmos/ --root kosmos --mermaid

# Combined: Mermaid focused on workflow
python .claude/​skills/​kosmos-xray/​scripts/​dependency_graph.py kosmos/ --root kosmos --mermaid --focus workflow

# JSON output
python .claude/​skills/​kosmos-xray/​scripts/​dependency_graph.py kosmos/ --json

Recommended Workflow (Use ALL Features)

  1. Survey first - mapper.py --summary to see codebase size and large files
  2. X-ray critical classes - skeleton.py --priority critical to see core interfaces WITH FIELDS
  3. Generate architecture diagram - dependency_graph.py --mermaid for visual map
  4. Verify imports - Run import checks before documenting entry points
  5. Read selectively - Only read full implementation when skeleton isn't enough

Best Practices

DO:

  • Always use --priority critical first to understand core architecture
  • Use --mermaid output for documentation diagrams
  • Check line numbers when you need to reference specific code
  • Use --private when understanding internal agent behavior
  • Verify imports before documenting them as entry points

DON'T:

  • Read full files when skeleton would suffice (wastes context)
  • Ignore large file warnings from mapper.py
  • Skip the Pydantic fields - they define the data contracts
  • Forget to include line numbers in documentation references

Integration with kosmos_architect Agent

This skill is automatically loaded by the kosmos_architect agent. You can also use it directly for targeted analysis.

# Use the agent for full onboarding documentation (uses ALL features)
@kosmos_architect generate

# Or use individual tools directly
@kosmos-xray Map the workflow directory

Configuration Files

  • configs/​ignore_patterns.json - Directories and files to skip
  • configs/​priority_modules.json - Module priority levels and patterns

Context Budget Guidelines

OperationTypical TokensUse When
mapper.py --summary~500First exploration
mapper.py full~2-5KUnderstanding structure
skeleton.py (1 file)~200-500Understanding interface
skeleton.py --priority critical~5KCore architecture
dependency_graph.py text~2-3KArchitecture analysis
dependency_graph.py --mermaid~500Documentation diagrams
Full file readVariesNeed implementation details

For detailed API documentation, see reference.md. For quick command reference, see CHEATSHEET.md.

More skills from mattnigh

spring-framework-patterns logo
mattnigh/skills_collection

spring-framework-patterns

Comprehensive Spring Framework and Spring Boot best practices including dependency injection patterns, bean lifecycle and scopes, REST API development, Spring Data JPA, service layer design, Spring Security, testing strategies, caching, AOP, async processing, error handling, and common anti-patte...

24 0
View

TypeScript厳格モードによる型安全性設計を専門とするスキル。 📖 参照書籍: - 『Effective TypeScript』(Dan Vanderkam): 型設計 📚 リソース参照: - `resources/Level1_basics.md`: レベル1の基礎ガイド - `resources/Level2_intermediate.md`: レベル2の実務ガイド - `resources/Level3_advanced.md`: レベル3の応用ガイド - `resources/Level4_expert.md`: レベル4の専門ガイド - `resources/di...

24 0
View
deploying-cloud-k8s logo
mattnigh/skills_collection

deploying-cloud-k8s

Deploys applications to cloud Kubernetes (AKS/GKE/DOKS) with CI/CD pipelines. Use when deploying to production, setting up GitHub Actions, troubleshooting deployments. Covers build-time vs runtime vars, architecture matching, and battle-tested debugging.

24 0
View
moai-alfred-agent-guide logo
mattnigh/skills_collection

moai-alfred-agent-guide

19-agent team structure, decision trees for agent selection, Haiku vs Sonnet model selection, and agent collaboration principles. Use when deciding which sub-agent to invoke, understanding team responsibilities, or learning multi-agent orchestration.

24 0
View
mermaid-diagram-generator logo
mattnigh/skills_collection

mermaid-diagram-generator

Converts architecture descriptions, module specs, or workflow docs into Mermaid diagrams. Use when visualizing brick module relationships, workflows (DDD, investigation), or system architecture. Supports: flowcharts, sequence diagrams, class diagrams, state machines, entity relationship diagrams,...

24 0
View
pre-flight-check logo
mattnigh/skills_collection

pre-flight-check

INVOKE FIRST before any code work. Validates git workflow (branch, issue, worklog) and checks approach. Use at START of every task and END before completing. Prevents skipped steps.

24 0
View
browser-dev-tools logo
mattnigh/skills_collection

browser-dev-tools

This skill should be used when working with browser-rendered artifacts (i.e. Bun, React/React Native) to proactively validate that development work on localhost is being built appropriately and to support debugging browser-rendered content. Use this skill after making frontend changes to verify t...

24 0
View
lead-dev logo
mattnigh/skills_collection

lead-dev

Lead Développeur - Coordination technique opérationnelle, code review, mentoring et livraison. Pair de web-dev-process au niveau OPÉRATIONS.

24 0
View
worker-monitor logo
mattnigh/skills_collection

worker-monitor

Monitor Docker workers, RQ queue health, and auto-scale workers (max 4). Use when: checking job progress, monitoring queue depth, scaling workers up/down, diagnosing slow processing, or waiting for jobs to complete. Referenced by data-quality skill during reprocessing.

24 0
View
quality-advisor logo
mattnigh/skills_collection

quality-advisor

Proactive quality guidance system that monitors artifact creation and provides real-time feedback on documentation quality

24 0
View
bump-version logo
mattnigh/skills_collection

bump-version

This skill should be used when the user wants to bump the version number in the workspace. It updates versions across all pyproject.toml files (root, tde, and tda packages) and the CHANGELOG.md to keep them synchronized.

24 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View