HomeHelp CenterBest PracticesUnderstanding Context for AI-Assisted Development
Understanding Context for AI-Assisted Development
Learn about the four types of context (Business, Domain/Functional, Technical Strategy, Technical Context) that AI agents need to generate high-quality, aligned code.
ai-adoption best-practices context specifications
When working with AI agents to generate code, the single most important factor determining quality is context. Unlike human developers who can infer missing information, ask clarifying questions, and notice when specifications are outdated, AI agents require explicit, structured context to generate code that aligns with your business goals, follows your architectural patterns, and integrates correctly with your existing codebase.
This article explains the four types of context every AI agent needs, what each should contain, and how to structure them for maximum effectiveness.
The difference between productive AI-assisted development and the “vibe
coding trap” is context. Without structured
context, AI agents generate code that works in isolation but doesn’t
follow your architectural patterns, integrate with your existing
codebase, or align with your business priorities.
Without context, a prompt like “Add a shopping cart feature” produces
code that works in isolation but uses inconsistent patterns, ignores
your technical standards, misses functional requirements and edge cases,
and fails to align with business priorities—creating technical debt.
With context—technical strategy, project structure, functional
requirements, and business goals—the same prompt generates code that
follows established patterns, maintains codebase consistency, handles
all specified edge cases, integrates seamlessly, and supports your
business objectives. This is what transforms AI from a code generator
into a genuine productivity multiplier.
%%{init: {"flowchart": {"htmlLabels": false}} }%%
graph LR
subgraph contexts[" "]
BC["Business Context
WHY we build"]
FC["Functional Context
WHAT it should do"]
TS["Technical Strategy
HOW to build it"]
TC["Technical Context
WHERE code goes"]
end
BC -.->|Business priorities| AI[AI Agent]
FC -.->|Requirements| AI
TS -.->|Patterns & standards| AI
TC -.->|Integration points| AI
AI -->|Generates| Code["High-Quality
Aligned Code"]
What it answers: Why are we building this? What are the business priorities?
Purpose: Ensures AI agents make decisions that align with business goals and can prioritize correctly when trade-offs arise.
What to include:
Company overview and market position
Strategic objectives for the current quarter/year
Key Performance Indicators (KPIs) and success metrics
Budget and timeline constraints
Stakeholder priorities
Risk assessment
Trade-off guidelines (e.g., “Security over performance”, “Timeline over features”)
When AI needs this:
Assisting with architectural decisions
Helping prioritize features
Proposing technical solutions aligned with business goals
Evaluating trade-offs between competing approaches
Which capabilities need this: Typically capabilities at Planning and Requirements phases.
TIP
Sourcing Context from Existing Documents
You don’t need to write business context from scratch. This information typically exists in strategic planning documents (Confluence, Notion), OKR documents (Google Docs, Office 365), or product roadmaps.
Using MCP (Model Context Protocol): You can fetch content directly from these sources using MCP (@confluence Get Q2 Product Strategy, @notion Fetch Company OKRs, @googledocs Load Strategic Plan).
Best Practice: Sync to local files instead of loading via MCP on every prompt. MCP calls are slower (2-5 seconds vs < 100ms), count against token usage, and depend on external service availability. Recommended workflow: initial sync from MCP, save to ai-docs/context/business-context.md, commit to repository, reference local files in prompts, periodically re-sync when sources change.
Functional context can become very long when defining all flows for an entire application. Consider splitting it into separate files with a parent document that references specific user journeys:
ai-docs/specs/
├── domain-functional-context.md # Parent document with overview
Follow Zalando RESTful API Guidelines for all endpoints.
Key principles:
- Resource-oriented URLs (`/carts/{id}` not `/getCart`)
- HTTP verbs match operations (GET, POST, PUT, DELETE)
- Consistent error responses (RFC 7807 Problem Details)
- Versioning via Accept header when needed
Full guidelines: `docs/resources/technical/api-guidelines.md`
## Architecture Decision Records
Key architectural decisions are documented in `docs/adrs/`.
Review relevant ADRs when implementing features that may be
impacted by past decisions.
TIP
AI agents can help you implement a lightweight ADR process for
tracking architecture decisions. Learn how in our capability
Architecture Decision Records.
What it answers: Where does this code go? What existing code should I reference?
Purpose: Shows AI agents how to integrate new code with your existing
codebase by providing project structure, file organization, and reference
examples. By defining clear structure and organization patterns, AI agents
can find what they need more easily and load only relevant context rather
than scanning the entire repository. This becomes particularly valuable in
large codebases where loading everything would be inefficient and
overwhelming.
What to include:
Project Structure: Directory layout
File Naming Conventions: Naming patterns
Package Descriptions: What each directory contains
Key Files to Reference: Well-implemented examples
Integration Points: Where new code connects
Exclusion Zones: Code AI should NOT scan (e.g., legacy packages)
When AI needs this:
Adding new files
Referencing existing code
Understanding project organization
Integrating with existing systems
Which capabilities need this: Typically all capabilities from Design through Maintenance.
AGENTS.md represents a widely adopted pattern for providing context to
AI coding agents. The concept of storing AI agent instructions in a
dedicated file at the repository root has become a de facto standard
across the industry, though the specific filename and format conventions
vary by tool.
Think of it this way:
README.md is for humans (project introduction, contribution
guidelines)
AGENTS.md is for AI agents (context documents, workflows, patterns)
This pattern is supported by major AI coding tools including OpenAI
Codex/Copilot, Google Gemini/Jules, Anthropic Claude Code, Cursor,
Factory Droid, Aider, RooCode, and Zed. This widespread adoption means
you can write context documents once and use them across different AI
tools.
While the AGENTS.md pattern is universal, different tools also use their
own specific formats:
CLAUDE.md (Claude Code): Claude Code’s context file format
.cursorrules (Cursor): Cursor’s context file format
.mdc (Unified Format): A proposed cross-tool format combining YAML
frontmatter for metadata with Markdown content for instructions,
aiming for compatibility across Claude Code and Cursor
Best practice: Use AGENTS.md as the entry point that references your
four detailed context documents. This approach follows widely adopted
patterns, works across AI coding tools, keeps AGENTS.md concise, and
maintains detailed context in specialized files.
Example AGENTS.md structure:
AGENTS.md
## Context Documents
When working on this project, reference:
1. ai-docs/context/business-context.md - Business priorities
Don’t try to document your entire system at once. Start with one
vertical slice—a complete feature from user interface through business
logic to data storage.
Iterate incrementally:
Document one feature thoroughly
Validate it by building something with AI assistance
Refine the context based on what worked or didn’t
Only then move to the next feature
Fill gaps as you discover them: If you realize context for a
related feature is missing, add it when needed. AI can help draft
context documentation, but humans must provide accurate business
priorities, functional requirements, and technical guidelines.
If you have AGENTS.md or CLAUDE.md properly configured, AI agents will
automatically reference your context documents—you don’t need to list
them in every prompt. This saves time and ensures consistency.
With AGENTS.md configured (recommended):
Add a "Save for Later" feature to the shopping cart.
Requirements:
- Available for authenticated users only
- Items saved for later remain for 90 days
- Move items between cart and saved list
The AI agent automatically reads your context from the files specified
in AGENTS.md.
Without AGENTS.md (manual reference):
Add a "Save for Later" feature to the shopping cart.
Context:
- See ai-docs/context/business-context.md for priorities
- See ai-docs/specs/cart-spec.md for cart flows
- See ai-docs/context/technical-strategy.md for patterns
Requirements:
[same as above]
Explicit references are still useful when you need to call
attention to a specific section or document that’s particularly relevant
to the current task.
TIP
Learn how to structure prompts and tasks for AI agents in our
Task-Driven Development guide.
It shows you how to break down features into manageable tasks that
leverage your context documents effectively.
“We use price locking (capturing unit price at time of add) to prevent user frustration at checkout when prices increase. Users see the same price from add-to-cart through payment.”
Context engineering is the broader concept that includes spec-driven development. Understanding how these work together is key to maximizing AI coding effectiveness.
✅ Good: “Users can add products to cart. Max 50 items. If product out of stock, show error. If low stock (< 5), show warning. Lock unit price at time of add.”
Ready to implement context-driven development? We’ve created a comprehensive AI Coding Checklist that provides a step-by-step framework for setting up context documents, testing with AI, and iterating on your approach.
Context is the difference between AI agents that generate technical debt and AI agents that genuinely multiply your productivity. The four context types provide a comprehensive framework:
Business Strategy and Context - The why and business priorities
Domain and Functional Context - The what and functional requirements
Technical Strategy and Guidelines - The how and architectural standards
Technical Context - The where and integration points
Start small with one feature, create clear context documents, reference them in your prompts, and keep them updated. The investment in creating good context documents pays dividends in code quality, consistency, and development velocity.
The examples throughout this article demonstrate the level of detail needed for effective AI-assisted development. You can copy and adapt these templates to your own projects.
Context engineering is the practice of providing AI agents with structured, explicit information about your business goals, functional requirements, technical standards, and project structure. It transforms AI from generating code that works in isolation to generating code that aligns with your architecture, follows your patterns, and integrates correctly with your existing systems.
What's the relationship between context engineering and spec-driven development?
Context engineering is the broader concept that includes spec-driven development.
At StrategyRadar.ai, we distinguish between static context and dynamic context:
Static Context (the four context types):
Business priorities, technical standards, coding patterns, project structure
Remains relatively stable across features
Updates quarterly or when architectural decisions change
Dynamic Context (specs in spec-driven development):
Master spec: Complete snapshot of current system architecture, evolving as the system grows
Task specs: Specifications for individual changes within each task
The key insight: both the four static context types AND the specs provide context to AI. Static context defines “how we always work,” while specs (master + task) provide the evolving “snapshot of what the system is and what we’re changing.”
Spec-driven development is part of context engineering—it’s the dynamic, evolving layer that complements the stable baseline context.
New features: Need all four contexts (Business, Functional, Technical Strategy, Technical Context)
Bug fixes: Usually need Technical Strategy and Technical Context, optionally Functional
Refactoring: Need Technical Strategy and Technical Context only
Documentation: Need Functional and Technical Context
The rule: provide what AI needs to understand why, what, how, and where for the specific task.
Where should I store context documents?
Store context in your git repository, typically in ai-docs/context/ directory:
business-context.md - Business priorities and goals
functional-context.md - Functional requirements and flows
technical-strategy.md - Architecture patterns and standards
technical-context.md - Project structure and integration points
Reference these from AGENTS.md or CLAUDE.md so AI agents automatically load them. This keeps context versioned with code and ensures AI always has current information.
How is context engineering different from documentation?
The content can be very similar, but the approach differs:
Traditional documentation (for humans):
Rich historical context and explanations
Trade-off discussions and reasoning narratives
Often becomes outdated and consulted rarely
Context engineering (for AI):
Concise, actionable constraints and edge cases
Direct specifications without narrative
Living documents, referenced frequently, updated with code changes
The key difference isn’t what information you capture, but how you structure it: context documents are explicit, parseable, and constantly used by AI, while traditional docs are narrative and consulted occasionally by humans.
Can AI help me create context documents?
Use AI cautiously as a writing assistant only. AI can help rephrase and format content, but you must provide the substance and always validate the output.
Business Context: You must write this. AI cannot infer your priorities, trade-offs, or strategic goals.
Functional Context: Not recommended. AI analyzing your codebase will hallucinate heavily. If you use it, treat it purely as a writing assistant to rephrase content you provide—never trust AI to extract functional requirements from code.
Technical Strategy: You must write this. AI cannot know why you made architectural decisions or what patterns you want to follow.
Technical Context: AI can attempt reverse-engineering your project structure, but only if you already know the codebase well enough to validate every detail it produces.
The risk: incorrect context produces incorrect code. When in doubt, write it yourself.
How often should I update context documents?
Update context when it changes:
Business Context: When priorities shift (quarterly reviews, new OKRs)
Functional Context: When requirements change (new features, business rule changes)
Technical Strategy: When architectural decisions are made (new patterns, tech stack changes)
Technical Context: When project structure evolves (new directories, refactoring)
Make context updates part of your pull request checklist. If code changes how the system works, update the relevant context document in the same PR.