بنقرة واحدة
context-engineering
// Active context curation to fight context rot. Curates what goes into limited context window from constantly evolving information universe. 39% improvement, 84% token reduction.
// Active context curation to fight context rot. Curates what goes into limited context window from constantly evolving information universe. 39% improvement, 84% token reduction.
Systematic methodology for identifying, capturing, and documenting reusable patterns from implementations. Enables automatic learning and knowledge-core.md updates. Claude invokes this after successful implementations to preserve institutional knowledge.
Systematic validation methodology for ResearchPacks and Implementation Plans. Provides scoring rubrics and quality gates to ensure outputs meet standards before proceeding to next phase. Prevents garbage-in-garbage-out scenarios.
Systematic approach for creating minimal-change, reversible implementation plans. Claude invokes this skill when transforming requirements/research into executable blueprints. Emphasizes simplicity, safety, and clear verification steps.
Systematic approach for gathering authoritative, version-accurate documentation. Claude invokes this skill when research is needed before implementation. Ensures truth over speed while achieving both.
| name | context-engineering |
| description | Active context curation to fight context rot. Curates what goes into limited context window from constantly evolving information universe. 39% improvement, 84% token reduction. |
| auto_invoke | true |
| tags | ["context","curation","optimization","memory"] |
This skill provides a systematic methodology for active context curation - the art and science of optimizing what goes into the limited context window from the constantly evolving universe of possible information.
Context Engineering: The art and science of curating what goes into the limited context window from the constantly evolving universe of possible information.
Evolution: Natural progression of prompt engineering
Claude will automatically invoke this skill when:
Context Rot is Real: Information degrades as conversation lengthens
Finite Attention Budget: Models have limited attention; optimize for signal
Active Curation: Editing context is not cheating, it's engineering
CLAUDE.md as Structure: Folder/file structure is context engineering
With Context Engineering:
Example:
Automatic Triggers:
Manual Triggers (user-initiated):
/context analyze - Analyze current context configuration/context optimize - Actively prune and reorganize/context reset - Fresh start for new projectsStep 1: Identify Stale Information
Step 2: Archive to knowledge-core.md
Step 3: Remove from Active Context
Step 4: Verify Context Quality
✅ Include:
npm install && npm run db:migrate before testing"❌ Avoid:
# Project Name
## Quick Context
[2-3 sentences about what this project does]
## Development Environment
[Specific setup steps for THIS project]
## Architecture Patterns
[High-level patterns used in THIS codebase]
## Conventions
[Project-specific conventions that differ from defaults]
## Common Tasks
[Frequently performed workflows specific to THIS project]
## Import User Preferences
@~/.claude/agentic-substrate-personal.md
Example:
## API Implementation Pattern
Example 1: GET /users/:id
[Show complete example]
Example 2: POST /orders
[Show complete example]
Example 3: PATCH /products/:id
[Show complete example]
Before:
Our authentication system uses JWT tokens. JWT tokens are JSON Web Tokens
that encode user information. We use JWT tokens for API authentication.
JWT tokens expire after 1 hour. JWT tokens are signed with HS256.
After (75% token reduction):
Authentication: JWT (HS256, 1hr expiry)
Example:
/src/
/api/ → API layer (REST endpoints)
/services/ → Business logic
/models/ → Data models
/utils/ → Shared utilities
/config/ → Configuration
This structure tells Claude the architecture without verbose explanation.
Load: Bring relevant context for current task
# Working on authentication now
@docs/authentication-architecture.md
Edit: Remove stale/irrelevant information
# Remove old API patterns that are no longer used
Archive: Preserve learnings to knowledge-core.md
# knowledge-core.md
## Authentication Implementation (2025-10-15)
Implemented JWT auth with refresh tokens.
Pattern: See /src/services/auth-service.js
Learnings: [what we learned]
Reload: Fetch archived context when needed again
# Switching back to authentication work
@knowledge-core.md#authentication-implementation
Claude has these tools available for context management:
Read: Load context from CLAUDE.md, knowledge-core.md
Edit: Update context files to remove stale info
Write: Archive learnings to knowledge-core.md
Grep: Find relevant context across codebase
❌ Don't: Keep all information in context "just in case"
✅ Do: Archive to knowledge-core.md, reload when needed
After completing API integration task, switching to UI work
Step 1: Archive API learnings
# knowledge-core.md
## API Integration Pattern (2025-10-18)
Integrated Stripe API v2023-10-16.
Pattern: See /src/services/payment-service.js
Learnings:
- Use idempotency keys for all payment requests
- Webhook signature verification is mandatory
- Test mode uses sk_test_, live uses sk_live_
Step 2: Remove API-specific context from active memory
Step 3: Load UI patterns and conventions
# CLAUDE.md
## UI Development (Active Task)
Framework: React 18
Styling: Tailwind CSS
Component library: shadcn/ui
Pattern: Atomic design (atoms → molecules → organisms)
Step 4: Verify context optimization
1. Conversation Scope (current session)
2. Project Scope (CLAUDE.md)
3. Knowledge Scope (knowledge-core.md)
4. User Scope (~/.claude/agentic-substrate-personal.md)
Promote (Conversation → Project):
Archive (Conversation → Knowledge):
Demote (Project → Knowledge):
Reload (Knowledge → Conversation):
Context engineering integrates with Claude Code's memory system:
Memory Hierarchy (4 levels):
/Library/Application Support/ClaudeCode/CLAUDE.md) - Organization-wide./CLAUDE.md) - Team-shared~/.claude/CLAUDE.md) - Personal preferences@path/to/file.md) - Modular organizationImport Syntax:
# Load user preferences
@~/.claude/agentic-substrate-personal.md
# Load project-specific patterns
@.claude/templates/agents-overview.md
@.claude/templates/skills-overview.md
Benefits:
Symptom: Model performance degrades over long conversations Solution: Regular pruning at 50-message intervals
Symptom: Too much context, model misses key details Solution: Archive historical content to knowledge-core.md
Symptom: Same information repeated in multiple places Solution: Use references/imports instead of duplication
Symptom: Outdated patterns or deprecated approaches in context Solution: Regular CLAUDE.md review and updates
Symptom: Model lacks necessary project-specific information Solution: Document critical patterns in CLAUDE.md
Before considering context optimized:
Track these metrics to measure context engineering effectiveness:
Token Efficiency:
Quality Metrics:
Knowledge Preservation:
Context engineering is not optional - it's the foundation of sustainable, high-performance agent interactions.
Remember: Every token in context either helps or hurts. Make each one count.