JavaScript is disabled. Some features may not work.
"Context Engineering in Practice: Give Your AI the Right Information" | SkillsNav Blog
🇺🇸 English🇨🇳 中文
SkillsNav
Home

"Context Engineering in Practice: Give Your AI the Right Information"

2026-06-24 · context engineering prompt optimization advanced

Prompt Engineering tells AI what to do. Context Engineering tells AI what to look at.

What Is Context Engineering?

Prompt Engineering = tell AI "what to do" Context Engineering = tell AI "what to see"

Example:

Scenario Prompt Engineering Context Engineering
Fix a bug "Fix this login bug" "Fix this login bug. Here's the relevant code, error logs, and how similar bugs were fixed before"
Build a feature "Implement user auth" "Implement user auth. Here's the existing user model, API routes, test framework config"

Three Principles

1. Relevance > Completeness

❌ "Here's my entire project, help me refactor"
✅ "Here's the auth module (200 lines), help me refactor the login logic"

2. Structured > Raw Data

❌ Paste 10 code files
✅ List file names, purposes, key functions in a table, then paste only the 3 most critical files

3. Fresh > Historical

❌ "Here's our architecture doc (from 2023)"
✅ "Here's our current architecture, last updated last week"

Practical Tips

Use CLAUDE.md for Persistent Context

# CLAUDE.md
## Project
React + TypeScript e-commerce app

## Stack
- React 18, TypeScript 5
- Zustand, Tailwind CSS
- Vitest, Playwright

## Conventions
- Components: PascalCase
- Utils: camelCase

This file auto-loads every conversation — a few hundred tokens that save you from re-explaining your project.

Use Summaries Instead of Full Files

"This is the auth module (500 lines). Summary:
- JWT authentication
- 3 routes: login, register, refresh
- Passwords hashed with bcrypt

Here's the login route code (50 lines): [paste code]"

Process Large Tasks in Batches

❌ Ask AI to handle 10 files at once
✅ Split into 3 batches of 3-4 files each

Tools

Tool Purpose What We Know
context7 Auto-fetch latest library docs Know it exists, haven't deeply tested
headroom Compress tool outputs Know it exists, haven't deeply tested
CLAUDE.md Project-level context We use it, works well

Common Mistakes

  1. Information overload — 50 files when 3 would do
  2. Too little context — "write a function" with no specs
  3. Outdated info — old docs instead of current code

Summary

  1. Selectivity: Only give AI what it needs
  2. Structure: Use tables, lists, hierarchies
  3. Freshness: Give accurate, current information

These are experience-based suggestions, not rigorously tested conclusions. Different scenarios may need different approaches.


Context Engineering is a developing field. If you have better practices, share them on GitHub.

Related Skills