---
name: step-01-scan
description: Scan all Claude Code components in target directories
next_step: steps/step-02-analyze.md
---

# Step 1: Scan Components

## MANDATORY EXECUTION RULES:
- Scan ALL component types (skills, agents, hooks, settings)
- Record metadata for each component found
- Do NOT validate yet - just inventory

## YOUR TASK:
Discover and inventory all Claude Code components in the resolved scan paths.

---

## EXECUTION SEQUENCE:

### 1. Scan Skills

For each path in {scan_paths}:

```
Search for skills:
  Glob: "{path}/skills/*/SKILL.md"

For each SKILL.md found:
  Read the file
  Extract frontmatter fields:
    - name
    - description
    - disable-model-invocation
    - user-invocable
    - allowed-tools
    - model
    - context
    - agent
    - argument-hint
    - hooks

  Check for supporting directories:
    Glob: "{skill_dir}/steps/step-*.md" → step_count
    Glob: "{skill_dir}/templates/*" → template_count
    Glob: "{skill_dir}/references/*" → reference_count
    Glob: "{skill_dir}/scripts/*" → script_count
    Glob: "{skill_dir}/examples/*" → example_count

  Record in {skills_found}:
    {name, path, frontmatter, step_count, template_count, reference_count, script_count, example_count, line_count}
```

### 2. Scan Agents

```
Search for agents:
  Glob: "{path}/agents/*.md"
  Glob: "{path}/agents/**/*.md"

For each agent .md found:
  Read the file
  Extract frontmatter fields:
    - name
    - description
    - color
    - model
    - tools
    - disallowedTools
    - permissionMode
    - skills
    - hooks

  Record in {agents_found}:
    {name, path, frontmatter, line_count, category}

  category = parent directory name if nested (e.g., "efcore", "gitflow"), else "root"
```

### 3. Scan Hooks

```
Search for hook configurations:
  Read: "{path}/hooks/hooks.json" (if exists)
  Read: "{path}/settings.json" → extract "hooks" section
  Read: "{path}/settings.local.json" → extract "hooks" section (if exists)

For each hook configuration found:
  Extract events (PreToolUse, PostToolUse, Stop, etc.)
  For each event:
    Extract matchers and hook handlers
    Record type (command, prompt, agent)
    Record referenced scripts/files

  Record in {hooks_found}:
    {source_file, event, matcher, type, command_or_prompt, timeout}
```

### 4. Scan Settings

```
Read settings files:
  "{path}/settings.json"
  "{path}/settings.local.json"

Extract:
  - permissions (allow, deny, ask rules)
  - MCP server config
  - plugin config
  - environment variables
  - model settings
```

### 5. Display Inventory Summary

```
Component Inventory:

| Type | Count | Scope |
|------|-------|-------|
| Skills | {skills_found.length} | {scope} |
| Agents | {agents_found.length} | {scope} |
| Hooks | {hooks_found.length} | {scope} |
| Settings files | N | {scope} |

Skills: {list names}
Agents: {list names}
Hooks: {list events}

→ Analyzing components...
```

---

## SUCCESS METRICS:
- All component types scanned
- Metadata extracted for each component
- Counts displayed in summary table
- No components missed

## NEXT STEP:
After showing inventory summary, proceed directly to `./step-02-analyze.md`
