
Code Context Finder
- 36 installs
- 4 repo stars
- Updated April 11, 2026
- 89jobrien/steve
code-context-finder is a Claude Code skill that surfaces relevant context while coding by combining knowledge-graph (MCP memory) search with code-relationship analysis of imports, callers, and tests.
About
code-context-finder is a Claude Code skill that surfaces relevant context while coding by combining knowledge-graph search with code-relationship analysis. It detects when context would help (unfamiliar files, new features, debugging, refactoring) and retrieves prior decisions from an MCP memory graph plus imports, callers, and tests via grep. A developer uses it to understand a codebase before making changes and to record decisions afterward. It ships a script to analyze code relationships.
- Surfaces relevant context by combining knowledge-graph search with code-relationship analysis
- Uses MCP memory tools plus grep to find imports, callers, and prior decisions
- Smart detection triggers on unfamiliar files, new features, debugging, and refactoring
Code Context Finder by the numbers
- 36 all-time installs (skills.sh)
- Ranked #8,608 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Jul 28, 2026 (Skillselion catalog sync)
code-context-finder capabilities & compatibility
- Capabilities
- context retrieval · knowledge graph search · code relationship analysis · dependency mapping
- Use cases
- research · refactoring · debugging · documentation
- Pricing
- Free
What code-context-finder says it does
Find and surface relevant context while coding by combining knowledge graph search with code relationship analysis.
Use MCP memory tools to find relevant entities:
npx skills add https://github.com/89jobrien/steve --skill code-context-finderAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 36 |
|---|---|
| repo stars | ★ 4 |
| Last updated | April 11, 2026 |
| Repository | 89jobrien/steve ↗ |
What it does
Surface prior decisions and code dependencies from a knowledge graph and grep while coding, before making changes.
Who is it for?
Pulling prior decisions and code dependencies from a knowledge graph and grep before editing code
Skip if: Codebases without an MCP memory/knowledge-graph server to query
When should I use this skill?
Opening an unfamiliar file, starting a new feature, debugging, refactoring, or making architectural decisions
What you get
A synthesized context report of knowledge-graph entities, code relationships, and suggested actions before a change.
- synthesized context report (knowledge graph entities, code relationships, suggested actions)
By the numbers
- 6 documented context triggers (unfamiliar file, new feature, debugging, refactoring, architectural decisions, config/inf
Files
Code Context Finder
Overview
Find and surface relevant context while coding by combining knowledge graph search with code relationship analysis. Uses smart detection to identify when additional context would be helpful, then retrieves:
- Knowledge graph entities: Prior decisions, project context, related concepts
- Code relationships: Dependencies, imports, function calls, class hierarchies
When to Use (Smart Detection)
This skill activates automatically when detecting:
| Trigger | What to Search |
|---|---|
| Opening unfamiliar file | Knowledge graph for file/module context, code for imports/dependencies |
| Working on new feature | Prior decisions, related concepts, similar implementations |
| Debugging errors | Related issues, error patterns, affected components |
| Refactoring code | Dependent files, callers/callees, test coverage |
| Making architectural decisions | Past ADRs, related design docs, established patterns |
| Touching config/infra files | Related deployments, environment notes, past issues |
For detection triggers reference, load references/detection_triggers.md.
Core Workflow
1. Detect Context Need
Identify triggers that suggest context would help:
Signals to watch:
- New/unfamiliar file opened
- Error messages mentioning unknown components
- Questions about "why" or "how" something works
- Changes to shared/core modules
- Architectural or design discussions2. Search Knowledge Graph
Use MCP memory tools to find relevant entities:
# Search for related context
mcp__memory__search_nodes(query="<topic>")
# Open specific entities if known
mcp__memory__open_nodes(names=["entity1", "entity2"])
# View relationships
mcp__memory__read_graph()Search strategies:
- Module/file names → project context
- Error types → past issues, solutions
- Feature names → prior decisions, rationale
- People names → ownership, expertise
3. Analyze Code Relationships
Find code-level context:
# Find what imports this module
grep -r "from module import" --include="*.py"
grep -r "import module" --include="*.py"
# Find function callers
grep -r "function_name(" --include="*.py"
# Find class usages
grep -r "ClassName" --include="*.py"
# Find test coverage
find . -name "*test*.py" -exec grep -l "module_name" {} \;For common search patterns, load references/search_patterns.md.
4. Synthesize Context
Present findings concisely:
## Context Found
**Knowledge Graph:**
- [Entity]: Relevant observation
- [Decision]: Prior architectural choice
**Code Relationships:**
- Imported by: file1.py, file2.py
- Depends on: module_a, module_b
- Tests: test_module.py (5 tests)
**Suggested Actions:**
- Review [entity] before modifying
- Consider impact on [dependent files]Quick Reference
Knowledge Graph Queries
| Intent | Query Pattern |
|---|---|
| Find project context | search_nodes("project-name") |
| Find prior decisions | search_nodes("decision") or search_nodes("<feature>") |
| Find related concepts | search_nodes("<concept>") |
| Find people/owners | search_nodes("<person-name>") |
| Browse all | read_graph() |
Code Relationship Queries
| Intent | Command |
|---|---|
| Find importers | `grep -r "from X import\ |
| Find callers | grep -r "function(" |
| Find implementations | `grep -r "def function\ |
| Find tests | find -name "*test*" -exec grep -l "X" |
| Find configs | grep -r "X" *.json *.yaml *.toml |
Integration with Coding Workflow
Before Making Changes
1. Check knowledge graph for context on module/feature 2. Find all files that import/depend on target 3. Locate relevant tests 4. Review prior decisions if architectural
After Making Changes
1. Update knowledge graph if significant decision made 2. Note new patterns or learnings 3. Add observations to existing entities
When Debugging
1. Search knowledge graph for similar errors 2. Find all code paths to affected component 3. Check for related issues/decisions 4. Document solution if novel
Resources
references/
detection_triggers.md- Detailed trigger patterns for smart detectionsearch_patterns.md- Common search patterns for code relationships
scripts/
find_code_relationships.py- Analyze imports, dependencies, and call graphs
Detection Triggers Reference
Detailed patterns for smart context detection while coding.
File-Based Triggers
New/Unfamiliar Files
Signals:
- First time opening a file in session
- File in unfamiliar directory/module
- File with complex imports or dependencies
Context to retrieve:
- Knowledge graph: module purpose, related decisions
- Code: imports, dependents, tests
Core/Shared Modules
Signals:
- File in
core/,shared/,common/,utils/directories - File imported by 5+ other files
- File with
__init__.pyexports
Context to retrieve:
- All importers (impact analysis)
- Related tests
- Prior changes/decisions
Configuration Files
Signals:
.env,.yaml,.json,.tomlconfig filessettings.py,config.py- CI/CD files (
.github/,Dockerfile)
Context to retrieve:
- Knowledge graph: deployment notes, environment specifics
- Related infrastructure decisions
Action-Based Triggers
Making Changes
Signals:
- Edit tool invoked on file
- Multiple files being modified
- Refactoring patterns detected (rename, move, extract)
Context to retrieve:
- Dependent files
- Test coverage
- Prior decisions on module
Debugging
Signals:
- Error messages in conversation
- Stack traces
- "why", "broken", "failing" in user message
Context to retrieve:
- Knowledge graph: similar errors, past issues
- Error handling patterns in codebase
- Related components
Architectural Discussion
Signals:
- Keywords: "should we", "design", "architecture", "pattern"
- Mentions of trade-offs or alternatives
- New feature planning
Context to retrieve:
- Knowledge graph: ADRs, design decisions
- Similar implementations
- Established patterns
Keyword Triggers
High-Priority Keywords
| Keyword | Context to Search |
|---|---|
migrate, migration | Past migrations, schema changes |
deprecate, remove | Dependents, usage patterns |
security, auth | Security decisions, auth patterns |
performance, optimize | Benchmarks, past optimizations |
test, coverage | Test files, coverage reports |
Module/Feature Keywords
When user mentions specific modules or features:
1. Search knowledge graph for entity 2. Find related files in codebase 3. Locate tests for that module
Context Freshness
Always Fetch Fresh
- Dependent file lists (code changes frequently)
- Test file locations
- Import relationships
Cache-Friendly
- Knowledge graph entities (update less frequently)
- Architecture decisions (stable)
- Project conventions
Integration Points
IDE Events (if available)
- File opened → check familiarity
- File saved → check for architectural changes
- Error diagnostics → search for similar issues
Conversation Patterns
- Question about unfamiliar code → fetch context
- Request to modify shared code → impact analysis
- Debugging session → search past issues
Search Patterns Reference
Common patterns for finding code relationships and context.
Python Projects
Import Analysis
# Find all files importing a module
grep -r "from module_name import" --include="*.py"
grep -r "import module_name" --include="*.py"
# Find relative imports
grep -r "from \. import" --include="*.py"
grep -r "from \.module import" --include="*.py"
# Find wildcard imports (code smell)
grep -r "from .* import \*" --include="*.py"Function/Class Usage
# Find function calls
grep -rn "function_name(" --include="*.py"
# Find class instantiations
grep -rn "ClassName(" --include="*.py"
# Find class inheritance
grep -rn "class.*\(.*ClassName" --include="*.py"
# Find decorator usage
grep -rn "@decorator_name" --include="*.py"Test Discovery
# Find test files for a module
find . -name "test_*.py" -o -name "*_test.py" | xargs grep -l "module_name"
# Find pytest markers
grep -rn "@pytest.mark" --include="*.py"
# Find test classes
grep -rn "class Test" --include="*.py"TypeScript/JavaScript Projects
Import Analysis
# ES6 imports
grep -r "import.*from ['\"].*module" --include="*.ts" --include="*.tsx"
# Require statements
grep -r "require(['\"].*module" --include="*.js" --include="*.ts"
# Dynamic imports
grep -r "import(['\"]" --include="*.ts" --include="*.tsx"Component Usage (React)
# Find component usage
grep -rn "<ComponentName" --include="*.tsx" --include="*.jsx"
# Find hook usage
grep -rn "use[A-Z][a-zA-Z]*(" --include="*.ts" --include="*.tsx"
# Find context usage
grep -rn "useContext(" --include="*.tsx"Test Discovery
# Find test files
find . -name "*.test.ts" -o -name "*.spec.ts"
# Find test blocks
grep -rn "describe\|it\|test(" --include="*.test.ts"Cross-Language Patterns
Configuration References
# Find env var usage
grep -rn "process\.env\|os\.environ\|getenv"
# Find config file reads
grep -rn "\.json\|\.yaml\|\.toml\|\.env" --include="*.py" --include="*.ts"API Endpoints
# Find route definitions
grep -rn "@app\.route\|@router\.\|app\.get\|app\.post"
# Find API calls
grep -rn "fetch(\|axios\.\|requests\."Database Queries
# Find SQL queries
grep -rn "SELECT\|INSERT\|UPDATE\|DELETE" --include="*.py" --include="*.ts"
# Find ORM usage
grep -rn "\.query\|\.filter\|\.find\|\.create"Knowledge Graph Search Patterns
By Entity Type
# Find all projects
search_nodes("project")
# Find all decisions
search_nodes("decision")
# Find all concepts
search_nodes("concept")
# Find all tools
search_nodes("tool")By Context
# Find by feature name
search_nodes("authentication")
search_nodes("payment")
# Find by technology
search_nodes("postgres")
search_nodes("redis")
# Find by person
search_nodes("joe")
search_nodes("team")Relationship Queries
# View full graph structure
read_graph()
# Open specific related entities
open_nodes(["entity1", "entity2"])Output Formatting
Dependency Report
## Dependencies for `module_name`
**Imports (what this module uses):**
- `dependency1` - used for X
- `dependency2` - used for Y
**Imported by (what uses this module):**
- `consumer1.py:15` - function call
- `consumer2.py:42` - class instantiation
**Tests:**
- `test_module.py` - 12 tests
- `integration/test_flow.py` - 3 testsImpact Analysis Report
## Impact Analysis: Changing `function_name`
**Direct callers (will break if signature changes):**
- `file1.py:23`
- `file2.py:45`
**Indirect impact (uses callers):**
- `file3.py` imports `file1`
- `file4.py` imports `file2`
**Test coverage:**
- Direct: `test_function.py` (5 tests)
- Integration: `test_flow.py` (2 tests)
**Knowledge graph context:**
- Related decision: "Use X pattern for Y"
- Prior issue: "Fixed similar bug in Z"#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.12"
# ///
"""Find code relationships: imports, dependents, callers, and tests.
Usage:
uv run find_code_relationships.py <file_or_module> [--type imports|dependents|callers|tests|all]
Examples:
uv run find_code_relationships.py src/auth/service.py --type all
uv run find_code_relationships.py auth_service --type dependents
"""
from __future__ import annotations
import argparse
import re
from dataclasses import dataclass, field
from pathlib import Path
@dataclass
class CodeRelationships:
target: str
imports: list[str] = field(default_factory=list)
imported_by: list[tuple[str, int]] = field(default_factory=list) # (file, line)
callers: list[tuple[str, int, str]] = field(default_factory=list) # (file, line, context)
tests: list[str] = field(default_factory=list)
def find_python_imports(file_path: Path) -> list[str]:
"""Extract imports from a Python file."""
imports = []
try:
content = file_path.read_text(encoding="utf-8", errors="ignore")
# Match: import X, from X import Y
import_pattern = re.compile(
r"^(?:from\s+([\w.]+)\s+import|import\s+([\w.]+))", re.MULTILINE
)
for match in import_pattern.finditer(content):
module = match.group(1) or match.group(2)
if module:
imports.append(module)
except Exception:
pass
return imports
def find_dependents(
target: str, root: Path, extensions: tuple[str, ...] = (".py",)
) -> list[tuple[str, int]]:
"""Find files that import the target module."""
dependents = []
target_patterns = [
re.compile(rf"from\s+{re.escape(target)}\s+import"),
re.compile(rf"import\s+{re.escape(target)}(?:\s|$|,)"),
re.compile(rf"from\s+[\w.]*{re.escape(target)}\s+import"),
]
for file_path in root.rglob("*"):
if file_path.suffix not in extensions:
continue
if "__pycache__" in str(file_path) or ".git" in str(file_path):
continue
try:
content = file_path.read_text(encoding="utf-8", errors="ignore")
for i, line in enumerate(content.splitlines(), 1):
for pattern in target_patterns:
if pattern.search(line):
dependents.append((str(file_path.relative_to(root)), i))
break
except Exception:
pass
return dependents
def find_callers(
target: str, root: Path, extensions: tuple[str, ...] = (".py",)
) -> list[tuple[str, int, str]]:
"""Find files that call a function or use a class."""
callers = []
# Pattern for function calls or class instantiation
call_pattern = re.compile(rf"\b{re.escape(target)}\s*\(")
for file_path in root.rglob("*"):
if file_path.suffix not in extensions:
continue
if "__pycache__" in str(file_path) or ".git" in str(file_path):
continue
try:
content = file_path.read_text(encoding="utf-8", errors="ignore")
for i, line in enumerate(content.splitlines(), 1):
if call_pattern.search(line):
callers.append((str(file_path.relative_to(root)), i, line.strip()[:80]))
except Exception:
pass
return callers
def find_tests(target: str, root: Path) -> list[str]:
"""Find test files that reference the target."""
tests = []
test_patterns = ["test_*.py", "*_test.py", "tests/**/*.py"]
for pattern in test_patterns:
for test_file in root.glob(pattern):
if "__pycache__" in str(test_file):
continue
try:
content = test_file.read_text(encoding="utf-8", errors="ignore")
if target in content:
tests.append(str(test_file.relative_to(root)))
except Exception:
pass
return list(set(tests))
def analyze(target: str, root: Path, analysis_type: str = "all") -> CodeRelationships:
"""Run relationship analysis on target."""
result = CodeRelationships(target=target)
# If target is a file, get its module name
target_path = root / target if not Path(target).is_absolute() else Path(target)
module_name = target
if target_path.exists() and target_path.is_file():
# Extract module name from file path
module_name = target_path.stem
if analysis_type in ("all", "imports"):
result.imports = find_python_imports(target_path)
if analysis_type in ("all", "dependents"):
result.imported_by = find_dependents(module_name, root)
if analysis_type in ("all", "callers"):
result.callers = find_callers(module_name, root)
if analysis_type in ("all", "tests"):
result.tests = find_tests(module_name, root)
return result
def format_output(result: CodeRelationships) -> str:
"""Format analysis results as markdown."""
lines = [f"# Code Relationships: `{result.target}`\n"]
if result.imports:
lines.append("## Imports (dependencies)")
for imp in sorted(set(result.imports)):
lines.append(f"- `{imp}`")
lines.append("")
if result.imported_by:
lines.append("## Imported By (dependents)")
for file, line in sorted(set(result.imported_by)):
lines.append(f"- `{file}:{line}`")
lines.append("")
if result.callers:
lines.append("## Callers")
for file, line, context in result.callers[:20]: # Limit output
lines.append(f"- `{file}:{line}` - `{context}`")
if len(result.callers) > 20:
lines.append(f"- ... and {len(result.callers) - 20} more")
lines.append("")
if result.tests:
lines.append("## Tests")
for test in sorted(result.tests):
lines.append(f"- `{test}`")
lines.append("")
if not any([result.imports, result.imported_by, result.callers, result.tests]):
lines.append("No relationships found.")
return "\n".join(lines)
def main() -> None:
parser = argparse.ArgumentParser(description="Find code relationships for a file or module")
parser.add_argument("target", help="File path or module/function name to analyze")
parser.add_argument(
"--type",
choices=["imports", "dependents", "callers", "tests", "all"],
default="all",
help="Type of analysis to perform",
)
parser.add_argument(
"--root",
type=Path,
default=Path.cwd(),
help="Root directory to search (default: current directory)",
)
args = parser.parse_args()
result = analyze(args.target, args.root, args.type)
print(format_output(result))
if __name__ == "__main__":
main()
Related skills
FAQ
How does it find context?
It searches a knowledge graph via MCP memory tools for prior decisions and entities, then uses grep to find imports, callers, class usages, and tests.
When does it activate?
On triggers like opening an unfamiliar file, working on a new feature, debugging errors, refactoring, or making architectural decisions.