Mastering Context Engineering (3): Practice - Project Setup
Mastering Context Engineering (3): Practice - Project Setup
"The best engineers stopped writing prompts in 2025. Context engineering means building dynamic systems that deliver the right information, right format, right time." — The Digital Speaker, 2025
Introduction
In the previous article, we covered the theoretical foundations of Context Engineering. Now it's time for practice.
After reading this article, you will be able to:
- Build context documents for your project
- Optimize Cursor for Context Engineering
- Connect external knowledge to AI with MCP
- Have ready-to-use templates
Part 1: Context Document Design
1.1 Complete CONTEXT.md Guide
File Location and Naming:
project-root/
├── CONTEXT.md # Project-wide context
├── .cursorrules # Cursor-specific rules
├── agents.md # AI agent instructions (optional)
├── src/
│ ├── auth/
│ │ └── CONTEXT.md # Module-specific context (optional)
│ └── ...
Full CONTEXT.md Structure:
# Project Context
## Overview
[What the project is, why it exists - 2-3 sentences]
## Problem Statement
[Core problem being solved]
## Architecture
[System structure overview]
## Tech Stack
[Technology list with versions]
## Directory Structure
[Key directory explanations]
## Conventions
[Coding conventions, naming rules]
## Constraints
[Technical/business constraints]
## Key Decisions
[Major architecture decisions with reasoning]
## History
[Important change history]
## Lessons Learned
[Past failures and lessons]
## Glossary
[Project-specific terminology]
## Current Focus
[Currently active work areas]
1.2 Section Writing Guide
Overview Example:
## Overview
StoniStudio is a technical blog platform based on Next.js 14.
Uses MDX for interactive technical content,
supports dark theme and Korean/English multilingual.
**Core Values:**
- Developer experience first
- Performance and accessibility
- Content-centric design
Key Decisions Example:
## Key Decisions
### 1. App Router Selection (2024-10)
**Decision:** Use App Router instead of Pages Router
**Reason:**
- Reduced bundle size with Server Components
- Layout system utilization
- Future-oriented architecture
**Trade-off:** Learning curve, some library compatibility
1.3 agents.md / CLAUDE.md
AI agent-specific instruction file:
# AI Agent Instructions
## Persona
You are a senior developer on this project.
You prioritize code quality, performance, and accessibility.
## Communication Style
- Explain reasoning for code changes
- Ask questions about uncertain parts
## Priorities
1. Maintain existing code style
2. Type safety
3. Performance optimization
4. Accessibility
## Before Writing Code
1. Check related existing code
2. Review CONTEXT.md constraints
3. Check for similar implementations
## What NOT to Do
- Change existing API signatures (without discussion)
- Add new dependencies (without approval)
- Make performance-impacting changes (without benchmarks)
Part 2: Cursor Setup
2.1 Complete .cursorrules Guide
Cursor automatically reads the .cursorrules file at project root.
Basic Structure:
# Project Rules for Cursor
## Project Context
[Project overview - key points from CONTEXT.md]
## Tech Stack
[Tech stack summary]
## Code Style
[Coding conventions]
## File Patterns
[Per-file rules with examples]
## Common Patterns
[Frequently used pattern examples]
## Forbidden Patterns
[Prohibited patterns]
2.2 Frontend Project Example
# Cursor Rules - Next.js Blog
## Project Context
Next.js 14 App Router based technical blog.
MDX for content, Tailwind CSS styling.
Static generation for AWS S3/CloudFront deployment.
## Code Style
### TypeScript
- strict mode required
- no any, use unknown
- prefer interface (type only for unions)
- explicit function return types
### React
- functional components only
- Props defined with interface
- custom hooks use 'use' prefix
## Forbidden Patterns
❌ any type
❌ console.log (use logger)
❌ inline styles
❌ useEffect for data fetching (use server components)
❌ class components
Part 3: MCP (Model Context Protocol) Usage
3.1 What is MCP?
Model Context Protocol (MCP) is a standard protocol for connecting LLMs to external context sources.
Thoughtworks Technology Radar Vol. 33:
"Every major technology vendor is building agent-awareness into their platforms, largely thanks to the Model Context Protocol (MCP)."
3.2 Key MCP Servers
- Filesystem MCP - Local file system access
- GitHub MCP - Repository information, issues, PRs
- Database MCP - PostgreSQL, MySQL schema and queries
- Context7 MCP - External documentation integration
3.3 MCP Setup in Claude Desktop
Config file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Basic configuration:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/projects"
]
}
}
}
Part 4: Templates and Checklists
4.1 Setup Completion Checklist
## Context Engineering Setup Checklist
### Documentation
- [ ] Create CONTEXT.md
- [ ] Write Overview section
- [ ] Document Tech Stack
- [ ] Define Conventions
- [ ] Record Key Decisions
- [ ] Specify Constraints
### Cursor Setup
- [ ] Create .cursorrules
- [ ] Define code style
- [ ] Add file pattern examples
- [ ] Specify forbidden patterns
### MCP (Optional)
- [ ] Identify needed MCP servers
- [ ] Configure settings file
- [ ] Test connections
### Team Sharing
- [ ] Share documents with team
- [ ] Collect feedback
- [ ] Establish regular update schedule
4.2 Common Mistakes and Solutions
| Mistake | Problem | Solution |
|---|---|---|
| Too long CONTEXT.md | AI misses key points | Keep essentials, details in separate files |
| No updates | Outdated info causes confusion | Establish regular review schedule |
| Vague constraints | AI interprets differently | Include specific examples |
| Lack of examples | Desired style not conveyed | Code examples for each pattern |
Conclusion: Start Now
What We Learned
- CONTEXT.md Writing - 12-section structure with examples
- Cursor Optimization - .cursorrules structure and patterns
- MCP Usage - Role, structure, and key servers
- Templates and Checklists - Ready-to-use resources
Next Article Preview
Article 4: Context Engineering Practice - Development Workflow will cover:
- 20 context-first conversation patterns
- Detailed 4-phase workflow guide
- Maintaining context continuity in iteration
- Real development scenario walkthroughs
Today's Tasks
- Create CONTEXT.md (30 min) - Copy template, customize for your project
- Create .cursorrules (20 min) - Copy basic structure, add conventions
- Test (10 min) - Request simple task in Cursor, verify context is reflected
References
- Thoughtworks. (2025, November). "Technology Radar Vol. 33." - MCP related
- Anthropic. "Model Context Protocol Documentation."
- Cursor. "Cursor Rules Documentation."
The next article covers workflows for applying Context Engineering in daily development. Did you create your CONTEXT.md today? Share your experience.
