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
The 'def' skill is a high-performance code navigation utility designed to locate symbol definitions instantly across complex codebases. By utilizing AST-based precision for Python and heuristic analysis for other languages, it delivers high-signal context packets that streamline code exploration, refactoring, and technical analysis without the need for manual file browsing.
Use Cases
- Refactoring and Code Restructuring: Quickly jump to the definition of classes or methods to understand their implementation before making structural changes.
- Efficient Code Reviews: Retrieve bounded context for specific symbols to verify logic and implementation details directly within the workflow.
- Large-Scale Project Navigation: Locate ambiguous symbols in multi-language repositories using path ranking and language-specific filters to find the 'source of truth' faster.
- Onboarding and Documentation: Generate minimal, high-signal code snippets for specific functions to help team members understand internal APIs.
| 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.