Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

code-context

FreeNo executable scriptsNot checked

This skill should be used when the user asks to "understand a codebase", "get code context", "research a library", "explore a repository", "find code…

FradSerby FradSer★ 598 GitHub stars

About this skill

Code Context Retrieval

This skill provides 5 methods for retrieving code context. Select methods based on the target: public GitHub repos, library docs, code search, direct inspection, or post-clone web enrichment.

Token Isolation (Critical)

Never run any external lookup in the main context. Always spawn Task agents:

  • DeepWiki: Agent calls read_wiki_structure / read_wiki_contents / ask_wiki_question, extracts architecture summary and key relationships, returns concise overview.
  • Context7: Agent calls resolve-library-id then query-docs, extracts the minimum viable API surface and usage examples, returns copyable snippets with version notes.
  • Exa: Agent calls get_code_context_exa, extracts minimum viable snippets, deduplicates near-identical results (mirrors, forks, repeated StackOverflow answers), returns copyable snippets + brief explanation.
  • Git clone: Agent clones to /tmp/, reads entry points and core modules, runs rm -rf cleanup, returns file structure summary and key patterns.
  • Web Search+Fetch: Agent runs WebSearch with version-anchored queries derived from clone findings, calls WebFetch on high-signal URLs, returns only validated insights cross-referenced against cloned code.

Main context stays clean regardless of search volume. Only final summaries return to the caller.

Method 1: DeepWiki (AI-powered repo documentation)

Best for: Well-known public GitHub repositories where you need architecture overview, component explanations, or high-level understanding fast.

Tools: read_wiki_structure, read_wiki_contents, ask_wiki_question

Process:

  1. Call read_wiki_structure with the owner/repo (e.g., "facebook/react") to get topic list
  2. Call read_wiki_contents for relevant topics, or ask_wiki_question for targeted queries
  3. Use when you need: architecture diagrams, component relationships, design decisions

Strengths: Zero setup, instant AI-summarized documentation, good for onboarding to unfamiliar repos.

Limitations: Only works for public GitHub repos; coverage varies by project popularity.

Method 2: Context7 (library documentation)

Best for: Getting up-to-date API docs, usage examples, and version-specific documentation for npm/pip packages and frameworks.

Tools: resolve-library-id, query-docs

Process:

  1. Call resolve-library-id with the library name (e.g., "react", "fastapi") to get the canonical ID
  2. When the user specifies a version (e.g., "react@18"), select the matching version from the versions list returned by resolve-library-id and append it to the library ID path (e.g., /facebook/react/18.3.1)
  3. Call query-docs with libraryId and query — these are the only two parameters

Query tips: Be specific -- "useCallback dependency array" beats "react hooks". Include the framework version when known.

Version pinning: Encode version into the library ID path (e.g., /vercel/next.js/v14.3.0-canary.87), not as a separate parameter. Use the versions list from resolve-library-id to pick the correct slug.

Strengths: Always current docs, supports version pinning, covers thousands of libraries, excellent for API reference.

Limitations: Requires the library to be indexed; less useful for internal/private packages.

Method 3: Exa Code Search (web-wide code examples)

Best for: Finding real-world usage patterns, StackOverflow-style answers, GitHub Gist examples, and code snippets from across the web.

Tool: get_code_context_exa

Setup: Works without an API key (free tier with rate limits). For higher limits, set the EXA_API_KEY environment variable.

Process:

  1. Call get_code_context_exa with a precise query
  2. Set tokensNum based on need: 3000 for quick examples, 8000 for comprehensive patterns
  3. Verify publication dates on results; prefer recent sources

Query writing guidance:

  • Include the language or framework: "TypeScript React" not just "React"
  • Include the version when relevant: "Next.js 14 app router"
  • Use exact identifiers: "useServerAction" not "server action hook"
  • Add the pattern type: "example", "error handling", "migration guide"
  • Example: "TypeScript Next.js 14 app router server action error handling example"

Strengths: Finds diverse real-world examples, not limited to official docs, surfaces community solutions.

Limitations: Results may be outdated; always check publication dates and verify against official docs.

Method 4: Git Clone (direct code inspection)

Best for: Private repositories, detailed implementation review, running local analysis, or when other methods lack depth.

Process:

  1. Run git clone <repo-url> /tmp/<repo-name> --depth=1 to fetch the code
  2. Read key files: entry points, configuration, core modules
  3. Map the file structure and search for patterns across the codebase
  4. Clean up when done: rm -rf /tmp/<repo-name>

Strengths: Full code access, work

Full SKILL.md on GitHub

Install code-context in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

FAQ

What does the code-context skill do?

This skill should be used when the user asks to "understand a codebase", "get code context", "research a library", "explore a repository", "find code examples", "look up documentation", asks a natural-language code/technology question (e.g. "how does X work", "X vs Y", "best practice for Z"), or wants to understand how a specific project, library, or concept works before making changes.

How do I install the code-context skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the code-context skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare code-context with