Agent Skill
2/7/2026

loctree

Claude-specific loctree skill with PostToolUse hook augmentation for rg/grep results and explicit loct commands.

L
loctree
0GitHub Stars
2Views
npx skills add Loctree/loctree-plugin

SKILL.md

Nameloctree
DescriptionClaude-specific loctree skill with PostToolUse hook augmentation for rg/grep results and explicit loct commands.

name: loctree description: Claude-specific loctree skill with PostToolUse hook augmentation for rg/grep results and explicit loct commands.

Loctree - Codebase Intelligence Skill (Claude)

Loctree provides AST-aware codebase understanding. Unlike text search (grep/ripgrep), loctree understands code structure: symbol definitions, exports, imports, dependencies, and dead code.

When This Skill Activates

This skill is automatically active through the PostToolUse hook. When you use Grep or Bash with rg/grep, loctree automatically augments results with semantic context.

You can also explicitly invoke loctree for deeper analysis.

Automatic Augmentation (Zero Friction)

When you search for code patterns, the hook automatically:

  1. Detects symbol-like patterns (PascalCase, camelCase, snake_case)
  2. Transforms regex to multi-query (A.*BA|B)
  3. Runs loct find to get semantic matches
  4. Adds context: definitions, usages, cross-match files, dead code status

Example: You grep for ApiClient.*request → Hook transforms to request|ApiClient → Returns symbol definitions + semantic matches + cross-match files showing where both terms appear together.

Explicit Commands

loct find <symbol|pattern>

Search for symbol definitions across the codebase.

loct find "MyComponent"           # Single symbol
loct find "SymbolA|SymbolB"       # Multi-query (OR)
loct find "canonical_model|vision" # Find related symbols

Output includes:

  • Symbol matches (definitions)
  • Semantic matches (similar names)
  • Parameter matches (function args)
  • Dead code status

loct impact <file>

Analyze what would break if you change a file.

loct impact src/utils/helpers.ts

Use before refactoring to understand ripple effects.

loct slice <file>

Get the minimal dependency slice for a file.

loct slice src/components/Button.tsx

Shows only the files needed to understand this file.

loct health

Codebase health report: dead code, cycles, duplicates.

loct health

Output includes:

  • Dead exports (unused code)
  • Circular dependencies
  • Duplicate exports (twins)
  • Health score (0-100)

loct focus <directory>

Analyze a specific directory's structure.

loct focus src/api/

loct query who-imports <file>

Find all files that import a given file.

loct query who-imports src/hooks/useAuth.ts

loct --for-ai

Get a comprehensive codebase overview optimized for AI understanding.

loct --for-ai

Run this first when starting work on a new codebase.

Best Practices

  1. Start with loct --for-ai to understand codebase structure
  2. Use loct find instead of grep for symbol searches (10x better results)
  3. Check loct impact before refactoring to avoid breaking changes
  4. Run loct health periodically to catch dead code and cycles

Pattern Recognition

The hook automatically recognizes these patterns:

Pattern TypeExampleAction
PascalCaseMyComponentloct find
camelCasehandleClickloct find
snake_caseuser_serviceloct find or Tauri command
File pathsrc/utils.tsloct slice
Directorysrc/api/loct focus
Multi-termA|B or A.*Bloct find "A|B"
Health keywordsdead, unused, cycleloct health

Cross-Match Files

When searching multiple terms, loctree identifies files containing 2+ different terms - these are often the most relevant files for understanding relationships.

Prerequisites

Install loctree CLI:

cargo install loctree
# or
brew install loctree

Verify installation:

loct --version

Initialize in your project (creates .loctree/ cache):

loct scan

Made with (งಠ_ಠ)ง by the ⌜ Loctree ⌟ 𝖙𝖊𝖆𝖒 (c) 2026 Maciej & Monika + Klaudiusz (AI)

Skills Info
Original Name:loctreeAuthor:loctree