Codebase context
Create a lightweight codebase_context.md that anchors the idea in the existing repo (modules, constraints, extension points). Generic framework prompt.
Best use case
Codebase context is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Create a lightweight codebase_context.md that anchors the idea in the existing repo (modules, constraints, extension points). Generic framework prompt.
Teams using Codebase context should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/codebase-context/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How Codebase context Compares
| Feature / Agent | Codebase context | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Create a lightweight codebase_context.md that anchors the idea in the existing repo (modules, constraints, extension points). Generic framework prompt.
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.
SKILL.md Source
# Codebase Context — Agent Instructions ## Invocation - `/codebase-context <IDEA_ID>` Where: - `IDEA_REF = $ARGUMENTS` (single token; no spaces) If missing, STOP. --- ## Resolve IDEA_ID (required) Before using any paths: - Call `vf.resolve_idea_id` with `idea_ref = $ARGUMENTS` - Store returned `idea_id` as `IDEA_ID` - Use `IDEA_ID` for all paths and YAML headers --- ## Goal Produce a lightweight, durable “map†of the existing codebase relevant to this idea, focusing on: - where to extend vs create - major boundaries (API layer, core logic, models/state, UI, tests) - any constraints/invariants implied by the current architecture This is NOT a full survey and NOT a task list. It is an early anchor to prevent greenfield assumptions. --- ## Canonical paths (repo-relative) Idea root: - `docs/forge/ideas/<IDEA_ID>/` Inputs (required): - `docs/forge/ideas/<IDEA_ID>/latest/concept_summary.md` - `docs/forge/ideas/<IDEA_ID>/inputs/concept_summary_config.md` Fallback/optional: - `docs/forge/ideas/<IDEA_ID>/latest/idea_normalized.md` - `docs/forge/ideas/<IDEA_ID>/inputs/idea.md` Outputs: - `docs/forge/ideas/<IDEA_ID>/latest/codebase_context.md` - Run snapshot: - `docs/forge/ideas/<IDEA_ID>/runs/<RUN_ID>/outputs/codebase_context.md` Logs: - `docs/forge/ideas/<IDEA_ID>/run_log.md` --- ## Method (generic, repo-aware) 1) Read the concept summary (primary semantic anchor). 2) Identify which kinds of components are likely involved: - API endpoints / controllers / routers - core domain logic / services - data models / schemas / state - UI components - orchestration / simulation engine (if applicable) - tests and fixtures 3) Do a targeted scan of the repo to find: - existing entry points matching the feature area (e.g., control/admin/simulation/session/etc.) - existing patterns for request/response models and state persistence - existing “config†or “policy†mechanisms that constrain behavior 4) Capture only the minimum necessary file/module references (10–25 max): - keep it stable, not exhaustive 5) Write the output artifact. If you are unsure where something lives, state it as a hypothesis + provide search cues (keywords to grep), rather than inventing file paths. --- ## Output format: codebase_context.md Write with YAML header + sections. YAML header shape: --- doc_type: codebase_context idea_id: "<IDEA_ID>" run_id: "<RUN_ID>" generated_by: "Codebase Context" generated_at: "<ISO-8601>" sources: - "docs/forge/ideas/<IDEA_ID>/latest/concept_summary.md" - "docs/forge/ideas/<IDEA_ID>/latest/idea_normalized.md (if used)" status: "Draft" --- # Codebase Context ## Purpose of this map (1 short paragraph) ## High-level architecture boundaries (as observed) - Boundary: ... — responsibility — notes ## Likely extension points - Area: ... — existing component(s) — recommended extension approach ## Key existing concepts to reuse - Concept/Model: ... — where it exists — why it matters ## Constraints implied by current architecture - Constraint: ... — evidence — impact ## Candidate file/module touch list (max ~25) List as bullets with a short reason: - <path-or-module> — why it’s relevant ## Unknowns / where to look next - Unknown: ... — suggested keywords or search locations --- ## Required tool calls 1) vf.start_run with idea_id=<IDEA_ID> (label: codebase-context) 2) Write run snapshot to runs/<RUN_ID>/outputs/codebase_context.md 3) Write latest to latest/codebase_context.md 4) Append a run_log entry with stage codebase.context and outputs.
Related Skills
extracting-ai-context
Extracts and manages AI context (skills, AGENTS.md) from workflow-kotlin library JARs. Use when setting up AI tooling for a workflow-kotlin project, updating skills after a library version change, or configuring agent-specific directories.
deep-codebase-analysis
Agent capable of reading and analyzing the entire source code of a software project to gain a thorough understanding of architecture, communication, design patterns, and business flows. Use when exploring new systems, maintenance, or refactoring.
create-agent-with-sanity-context
Build AI agents with structured access to Sanity content via Context MCP. Covers Studio setup, agent implementation, and advanced patterns like client-side tools and custom rendering.
context-optimizer
Analyzes Copilot Chat debug logs, agent definitions, skills, and instruction files to audit context window utilization. Provides log parsing, turn-cost profiling, redundancy detection, hand-off gap analysis, and optimization recommendations. Use when optimizing agent context efficiency, identifying where to add subagent hand-offs, or reducing token waste across agent systems.
context-fundamentals
Understand the components, mechanics, and constraints of context in agent systems. Use when designing agent architectures, debugging context-related failures, or optimizing context usage.
context-engineering
Use when designing agent system prompts, optimizing RAG retrieval, or when context is too expensive or slow. Reduces tokens while maintaining quality through strategic positioning and attention-aware design.
context-degradation
Recognize patterns of context failure: lost-in-middle, poisoning, distraction, and clash
context-assembler
Assembles relevant context for agent spawns with prioritized ranking. Ranks packages by relevance, enforces token budgets with graduated zones, captures error patterns for learning, and supports configurable per-agent retrieval limits.
agent-context-system
A persistent local-only memory system for AI coding agents. Two files, one idea — AGENTS.md (committed, shared) + .agents.local.md (gitignored, personal). Agents read both at session start, update the scratchpad at session end, and promote stable patterns over time. Works across Claude Code, Cursor, Copilot, Windsurf. Subagent-ready. No plugins, no infrastructure, no background processes.
add-route-context
为Flutter页面添加路由上下文记录功能,支持日期等参数的AI上下文识别。当需要让AI助手通过"询问当前上下文"功能获取页面状态(如日期、ID等参数)时使用。适用场景:(1) 日期驱动的页面(日记、活动、日历等),(2) ID驱动的页面(用户详情、订单详情等),(3) 任何需要AI理解当前页面参数的场景
localsetup-context
Localsetup v2 framework context - overview, invariants, and skills index. Load first when working in a repo that uses Localsetup v2. Use when starting work in this repo or when user asks about framework rules.
context7-skills
Use when a user asks to search, install, list, or remove skills with the Context7 ctx7 skills CLI (including npx ctx7) and needs correct subcommands or client flags.