def
Locate symbol definitions quickly (precise for Python via AST; conservative candidates for other languages) and print a bounded context packet.
When & Why to Use This Skill
This Claude skill facilitates rapid symbol definition discovery and context extraction across various programming languages. By leveraging AST-based precision for Python and heuristic candidates for other languages, it allows developers to instantly locate where classes, methods, or variables are defined, providing a bounded context packet that streamlines code navigation, refactoring, and debugging without manual file searching.
Use Cases
- Efficient Code Navigation: Quickly jump to the definition of a specific class or method in a large codebase to understand its implementation details.
- Context-Aware Refactoring: Retrieve high-signal code snippets for specific symbols to ensure accurate changes and impact analysis during refactoring tasks.
- Streamlined Code Review: Obtain immediate context for unfamiliar symbols mentioned in pull requests without the need to manually browse the entire repository.
- Cross-Language Symbol Search: Use heuristic-based searching to find potential definition candidates in non-Python projects, aiding in polyglot development.
| name | def |
|---|---|
| description | Locate symbol definitions quickly (precise for Python via AST; conservative candidates for other languages) and print a bounded context packet. |
def
Use this skill when
- You need definition locations for a symbol without opening files manually.
- You want minimal, high-signal context for review or refactor work.
Commands
# Auto (tries Python-precise, then other languages as candidates)
def MyClass .
# Prefer Python precision and include a small snippet
def MyClass . --lang py -C 2
# Methods / dotted qualnames (Python): find `Class.method`
def MyClass.__init__ mypkg --lang py -C 1
# Bias path ranking if you know where code likely lives
def MyClass . --prefer torch --prefer aten
Notes
- Python results are AST-validated (low false positives).
- Non-Python results are heuristic candidates; use
ctxto confirm if ambiguous.