Context Engineering

Category: Core Concepts Last updated: December 28, 2025

Overview

Context Engineering is the foundational practice of deliberately structuring information so AI agents understand what you need. It's about organizing your requirements, constraints, examples, and domain knowledge in a way that enables AI coding agents to build what you actually want, rather than what they infer from ambiguous prompts.

In the era of AI-assisted development, the quality of your outputs depends directly on the quality of your inputs. Context engineering transforms "vibe coding"—where developers iteratively nudge AI toward desired outcomes—into a systematic approach where clear, structured context guides AI agents to correct implementations from the start.

Whether you're using tactical approaches like plan mode or strategic frameworks like Spec-Driven Development, context engineering is the underlying practice that makes AI collaboration effective.

Why Context Engineering Matters

AI coding agents are powerful pattern matchers and code generators, but they lack deep understanding of your specific goals, constraints, and domain requirements. Without deliberate context engineering:

Structured context engineering addresses these issues by making your intent explicit, verifiable, and machine-readable.

Context Engineering in Practice

Poor Context Engineering

Vague prompts that leave too much to AI interpretation:

"Add user authentication to the app. Make it secure and easy to use."

This lacks critical details: What authentication method? What security requirements? What does "easy to use" mean? Which parts of the app need protection?

Good Context Engineering

Structured, explicit context that guides AI to the right implementation:

"Implement email/password authentication with the following requirements:
  • Use JWT tokens with 24-hour expiration
  • Passwords must meet OWASP guidelines (min 12 chars, mixed case, numbers, special chars)
  • Rate limit login attempts: max 5 per 15 minutes per IP
  • Protected routes: /dashboard, /settings, /api/* (except /api/public/*)
  • Redirect authenticated users away from /login and /signup
  • Store refresh tokens in httpOnly cookies
Use our existing User model and Postgres database. Follow the authentication patterns from the existing session middleware."

This provides clear requirements, constraints, and references to existing patterns.

Approaches to Context Engineering

Context engineering exists on a spectrum from tactical to strategic:

Tactical: Plan Mode

In plan mode, context engineering happens through conversational prompts and incremental clarification. You provide context as needed, AI proposes a plan, you refine it, and implementation proceeds. This works well for small features and exploratory work but requires active oversight to prevent drift.

Learn more about Plan Mode vs Spec-Driven Development →

Strategic: Spec-Driven Development

Spec-Driven Development (SDD) is a strategic approach to context engineering where you create structured specification documents that serve as the authoritative source of truth. These specs explicitly define requirements, scenarios, and acceptance criteria before implementation begins.

SDD tools like OpenSpec, GitHub Spec Kit, and Kiro provide frameworks for maintaining these specifications and keeping them synchronized with your codebase.

Choosing Your Approach

The right level of context engineering depends on your project's complexity, team size, and need for long-term maintainability. Many teams use both: plan mode for quick prototypes and experiments, SDD for production features and complex systems.

Understand the differences between Vibe Coding and SDD →

Learn More