code-context-finder

Automatically find relevant context from knowledge graph and code relationships while coding. Detects when context would be helpful (new files, unfamiliar code, architectural decisions) and surfaces related entities, prior decisions, and code dependencies.

242 stars

Best use case

code-context-finder is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Automatically find relevant context from knowledge graph and code relationships while coding. Detects when context would be helpful (new files, unfamiliar code, architectural decisions) and surfaces related entities, prior decisions, and code dependencies.

Automatically find relevant context from knowledge graph and code relationships while coding. Detects when context would be helpful (new files, unfamiliar code, architectural decisions) and surfaces related entities, prior decisions, and code dependencies.

Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.

Practical example

Example input

Use the "code-context-finder" skill to help with this workflow task. Context: Automatically find relevant context from knowledge graph and code relationships while coding. Detects when context would be helpful (new files, unfamiliar code, architectural decisions) and surfaces related entities, prior decisions, and code dependencies.

Example output

A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.

When to use this skill

  • Use this skill when you want a reusable workflow rather than writing the same prompt again and again.

When not to use this skill

  • Do not use this when you only need a one-off answer and do not need a reusable workflow.
  • Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/code-context-finder/SKILL.md --create-dirs "https://raw.githubusercontent.com/aiskillstore/marketplace/main/skills/89jobrien/code-context-finder/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/code-context-finder/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How code-context-finder Compares

Feature / Agentcode-context-finderStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Automatically find relevant context from knowledge graph and code relationships while coding. Detects when context would be helpful (new files, unfamiliar code, architectural decisions) and surfaces related entities, prior decisions, and code dependencies.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# 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 discussions
```

### 2. 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:

```python
# 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:

```markdown
## 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\|import X"` |
| Find callers | `grep -r "function("` |
| Find implementations | `grep -r "def function\|class Class"` |
| 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 detection
- `search_patterns.md` - Common search patterns for code relationships

### scripts/

- `find_code_relationships.py` - Analyze imports, dependencies, and call graphs

Related Skills

json-to-llm-context

242
from aiskillstore/marketplace

Turn JSON or PostgreSQL jsonb payloads into compact readable context for LLMs. Use when a user wants to compress JSON, reduce token usage, summarize API responses, or convert structured data into model-friendly text without dumping raw paths.

opencontext

242
from aiskillstore/marketplace

Persistent memory and context management for AI agents using OpenContext. Keep context across sessions/repos/dates, store conclusions, and provide document search workflows.

hig-project-context

242
from aiskillstore/marketplace

Create or update a shared Apple design context document that other HIG skills use to tailor guidance. Use when the user says 'set up my project context,' 'what platforms am I targeting,' 'configure HIG settings,' or when starting a new Apple platform project.

ddd-context-mapping

242
from aiskillstore/marketplace

Map relationships between bounded contexts and define integration contracts using DDD context mapping patterns.

context7-auto-research

242
from aiskillstore/marketplace

Automatically fetch latest library/framework documentation for Claude Code via Context7 API

context-window-management

242
from aiskillstore/marketplace

Strategies for managing LLM context windows including summarization, trimming, routing, and avoiding context rot Use when: context window, token limit, context management, context engineering, long context.

context-manager

242
from aiskillstore/marketplace

Elite AI context engineering specialist mastering dynamic context management, vector databases, knowledge graphs, and intelligent memory systems. Orchestrates context across multi-agent workflows, enterprise AI systems, and long-running projects with 2024/2025 best practices. Use PROACTIVELY for complex AI orchestration.

context-management-context-save

242
from aiskillstore/marketplace

Use when working with context management context save

context-management-context-restore

242
from aiskillstore/marketplace

Use when working with context management context restore

context-driven-development

242
from aiskillstore/marketplace

Use this skill when working with Conductor's context-driven development methodology, managing project context artifacts, or understanding the relationship between product.md, tech-stack.md, and workflow.md files.

code-refactoring-context-restore

242
from aiskillstore/marketplace

Use when working with code refactoring context restore

c4-context

242
from aiskillstore/marketplace

Expert C4 Context-level documentation specialist. Creates high-level system context diagrams, documents personas, user journeys, system features, and external dependencies. Synthesizes container and component documentation with system documentation to create comprehensive context-level architecture. Use when creating the highest-level C4 system context documentation.