A comprehensive template for getting started with Context Engineering - the discipline of engineering context for AI coding assistants so they have the information necessary to get the job done end to end.
Context Engineering is 10x better than prompt engineering and 100x better than vibe coding.
# 1. Clone this template
git clone https://github.com/coleam00/Context-Engineering-Intro.git
cd Context-Engineering-Intro
# 2. Set up Codex project guidance
# Edit AGENTS.md (and nested files if needed) to capture your rules and workflows
# 3. Add examples (highly recommended)
# Place relevant code examples in the examples/ folder
# 4. Register Codex prompts
python scripts/install_codex_prompts.py --dry-run
python scripts/install_codex_prompts.py
# 5. Create your initial feature request
# Edit INITIAL.md with feature requirements and references
# 6. Generate a comprehensive PRP (Product Requirements Prompt)
# Run /generate-prp in Codex CLI or Cursor and provide the feature file path when prompted
# 7. Execute the PRP to implement your feature
# Run /execute-prp with the PRP path; follow the plan and validation gates
- What is Context Engineering?
- Template Structure
- Step-by-Step Guide
- Writing Effective INITIAL.md Files
- The PRP Workflow
- Using Examples Effectively
- Best Practices
Context Engineering represents a paradigm shift from traditional prompt engineering:
Prompt Engineering:
- Focuses on clever wording and specific phrasing
- Limited to how you phrase a task
- Like giving someone a sticky note
Context Engineering:
- A complete system for providing comprehensive context
- Includes documentation, examples, rules, patterns, and validation
- Like writing a full screenplay with all the details
- Reduces AI Failures: Most agent failures aren't model failures - they're context failures
- Ensures Consistency: AI follows your project patterns and conventions
- Enables Complex Features: AI can handle multi-step implementations with proper context
- Self-Correcting: Validation loops allow AI to fix its own mistakes
context-engineering-intro/
βββ AGENTS.md # Codex-native project guidance (authoritative)
βββ codex/
β βββ README.md # Codex workflow quickstart
β βββ config/
β β βββ config.toml.example # Sample Codex CLI config
β βββ prompts/
β βββ execute-prp.md # Slash prompt for PRP execution
β βββ generate-prp.md # Slash prompt for PRP generation
βββ PRPs/
β βββ templates/
β β βββ prp_base.md # Base template for PRPs
β βββ EXAMPLE_multi_agent_prp.md # Example PRP
βββ examples/ # Codex-focused examples and guides
βββ scripts/
β βββ install_codex_prompts.py # Prompt installer script
βββ tests/
β βββ test_install_codex_prompts.py # Installer test coverage
βββ INITIAL.md # Feature request template
βββ INITIAL_EXAMPLE.md # Example feature request
βββ README.md # This file
βββ PLANNING.md # Architecture and planning scratchpad
βββ TASK.md # Running log of completed work
This template doesn't focus on RAG and tools with context engineering because I have a LOT more in store for that soon. ;)
The AGENTS.md
file contains project-wide rules that Codex CLI and Cursor follow in every
conversation. The template includes:
- Project awareness: Reading planning docs, checking tasks
- Code structure: File size limits, module organization
- Testing requirements: Unit test patterns, coverage expectations
- Style conventions: Language preferences, formatting rules
- Documentation standards: Docstring formats, commenting practices
You can use the provided template as-is or customize it for your project. Include reminders for
someone on the team to run /status
at session start (the agent cannot trigger it automatically)
and /plan on
for multi-step work.
Edit INITIAL.md
to describe what you want to build:
## FEATURE:
[Describe what you want to build - be specific about functionality and requirements]
## EXAMPLES:
[List any example files in the examples/ folder and explain how they should be used]
## DOCUMENTATION:
[Include links to relevant documentation, APIs, or MCP server resources]
## OTHER CONSIDERATIONS:
[Mention any gotchas, specific requirements, or things AI assistants commonly miss]
See INITIAL_EXAMPLE.md
for a complete example.
PRPs (Product Requirements Prompts) are comprehensive implementation blueprints that include:
- Complete context and documentation
- Implementation steps with validation
- Error handling patterns
- Test requirements
They are similar to PRDs (Product Requirements Documents) but are crafted more specifically to instruct an AI coding assistant.
Run in Codex CLI or Cursor:
/generate-prp
Note: Codex slash prompts live in codex/prompts/
. Provide the target file path in the
conversation when running the command because Codex CLI does not pass $ARGUMENTS
automatically.
codex/prompts/generate-prp.md
documents the research and authoring workflow.codex/prompts/execute-prp.md
defines the implementation loop and validation gates.
This command will:
- Read your feature request
- Research the codebase for patterns
- Search for relevant documentation
- Create a comprehensive PRP in
PRPs/your-feature-name.md
Once generated, execute the PRP to implement your feature:
/execute-prp
Before executing, confirm the PRP file path is in the conversation so Codex can load it.
The AI coding assistant will:
- Read all context from the PRP
- Create a detailed implementation plan
- Execute each step with validation
- Run tests and fix any issues
- Ensure all success criteria are met
FEATURE: Be specific and comprehensive
- β "Build a web scraper"
- β "Build an async web scraper using BeautifulSoup that extracts product data from e-commerce sites, handles rate limiting, and stores results in PostgreSQL"
EXAMPLES: Leverage the examples/ folder
- Place relevant code patterns in
examples/
- Reference specific files and patterns to follow
- Explain what aspects should be mimicked
DOCUMENTATION: Include all relevant resources
- API documentation URLs
- Library guides
- MCP server documentation
- Database schemas
OTHER CONSIDERATIONS: Capture important details
- Authentication requirements
- Rate limits or quotas
- Common pitfalls
- Performance requirements
The command follows this process:
-
Research Phase
- Analyzes your codebase for patterns
- Searches for similar implementations
- Identifies conventions to follow
-
Documentation Gathering
- Fetches relevant API docs
- Includes library documentation
- Adds gotchas and quirks
-
Blueprint Creation
- Creates step-by-step implementation plan
- Includes validation gates
- Adds test requirements
-
Quality Check
- Scores confidence level (1-10)
- Ensures all context is included
- Load Context: Reads the entire PRP
- Plan: Creates detailed task list using TodoWrite
- Execute: Implements each component
- Validate: Runs tests and linting
- Iterate: Fixes any issues found
- Complete: Ensures all requirements met
See PRPs/EXAMPLE_multi_agent_prp.md
for a complete example of what gets generated.
The examples/
folder is critical for success. AI coding assistants perform much better when they can see patterns to follow.
-
Code Structure Patterns
- How you organize modules
- Import conventions
- Class/function patterns
-
Testing Patterns
- Test file structure
- Mocking approaches
- Assertion styles
-
Integration Patterns
- API client implementations
- Database connections
- Authentication flows
-
CLI Patterns
- Argument parsing
- Output formatting
- Error handling
examples/
βββ README.md # Explains what each example demonstrates
βββ cli.py # CLI implementation pattern
βββ agent/ # Agent architecture patterns
β βββ agent.py # Agent creation pattern
β βββ tools.py # Tool implementation pattern
β βββ providers.py # Multi-provider pattern
βββ tests/ # Testing patterns
βββ test_agent.py # Unit test patterns
βββ conftest.py # Pytest configuration
- Don't assume the AI knows your preferences
- Include specific requirements and constraints
- Reference examples liberally
- More examples = better implementations
- Show both what to do AND what not to do
- Include error handling patterns
- PRPs include test commands that must pass
- AI will iterate until all validations succeed
- This ensures working code on first try
- Include official API docs
- Add MCP server resources
- Reference specific documentation sections
- Add your conventions
- Include project-specific rules
- Define coding standards