Claude
Skills
Sign in
Back

agent-skills-context-engineering

Included with Lifetime
$97 forever

```markdown

AI Agents

What this skill does

```markdown
---
name: agent-skills-context-engineering
description: Comprehensive collection of Agent Skills for context engineering, multi-agent architectures, memory systems, and production agent systems using Claude Code, Cursor, and other AI platforms.
triggers:
  - "context engineering for agents"
  - "build multi-agent system"
  - "install agent skills claude code"
  - "context window management"
  - "agent memory architecture"
  - "optimize agent context"
  - "implement BDI mental states"
  - "design agent evaluation framework"
---

# Agent Skills for Context Engineering

> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.

A comprehensive, open collection of Agent Skills focused on context engineering — the discipline of curating what enters an LLM's context window to maximize agent effectiveness. Covers foundational context mechanics, multi-agent architectures, memory systems, tool design, evaluation, and cognitive modeling.

## What This Project Does

Context engineering is about managing the **holistic set of tokens** that enter a model's attention budget: system prompts, tool definitions, retrieved documents, message history, and tool outputs. This repository provides structured, installable skills that teach AI coding agents these principles across any platform.

Key problems addressed:
- **Lost-in-the-middle**: Models degrade when relevant content is buried in long contexts
- **Context poisoning/distraction**: Irrelevant tokens degrade reasoning quality
- **Attention scarcity**: More tokens ≠ better outcomes; fewer high-signal tokens do
- **Multi-agent coordination**: How agents hand off context without loss

## Installation

### Claude Code (Plugin Marketplace)

```bash
# Register the marketplace
/plugin marketplace add muratcankoylan/Agent-Skills-for-Context-Engineering

# Install individual plugin bundles
/plugin install context-engineering-fundamentals@context-engineering-marketplace
/plugin install agent-architecture@context-engineering-marketplace
/plugin install agent-evaluation@context-engineering-marketplace
/plugin install agent-development@context-engineering-marketplace
/plugin install cognitive-architecture@context-engineering-marketplace
```

### Cursor

Listed on [Cursor Plugin Directory](https://cursor.directory/plugins/context-engineering). Install via the Cursor plugin panel or reference `.plugin/plugin.json` directly.

### Manual / Custom Agent

Clone and reference skill files directly:

```bash
git clone https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering.git
```

Load skill content from `skills/<skill-name>/SKILL.md` into your agent's system prompt or context.

## Plugin Bundles

| Plugin | Skills Included |
|--------|-----------------|
| `context-engineering-fundamentals` | context-fundamentals, context-degradation, context-compression, context-optimization |
| `agent-architecture` | multi-agent-patterns, memory-systems, tool-design, filesystem-context, hosted-agents |
| `agent-evaluation` | evaluation, advanced-evaluation |
| `agent-development` | project-development |
| `cognitive-architecture` | bdi-mental-states |

## Repository Structure

```
Agent-Skills-for-Context-Engineering/
├── .plugin/
│   └── plugin.json              # Open Plugins manifest
├── skills/
│   ├── context-fundamentals/    # Context anatomy, token budgets
│   ├── context-degradation/     # Failure modes and diagnostics
│   ├── context-compression/     # Compression and summarization
│   ├── context-optimization/    # Caching, masking, compaction
│   ├── multi-agent-patterns/    # Orchestrator, peer, hierarchical
│   ├── memory-systems/          # Short/long-term, graph memory
│   ├── tool-design/             # Effective tool construction
│   ├── filesystem-context/      # File-based context offloading
│   ├── hosted-agents/           # Sandboxed background agents
│   ├── evaluation/              # Agent evaluation frameworks
│   ├── advanced-evaluation/     # LLM-as-a-Judge techniques
│   ├── project-development/     # LLM project methodology
│   └── bdi-mental-states/       # BDI cognitive architecture
└── examples/
    ├── digital-brain-skill/     # Personal OS for founders
    ├── x-to-book-system/        # Multi-agent X→book pipeline
    ├── llm-as-judge-skills/     # TypeScript evaluation tools
    └── book-sft-pipeline/       # Style transfer fine-tuning
```

## Core Concepts

### Context Window Anatomy

```python
# The five components competing for attention budget
context = {
    "system_prompt": "...",          # Role, instructions, constraints
    "tool_definitions": [...],       # Available tools and schemas
    "retrieved_documents": [...],    # RAG results, memory lookups
    "message_history": [...],        # Conversation turns
    "tool_outputs": [...],           # Results from tool calls
}

# Token budget allocation example
TOTAL_BUDGET = 128_000  # tokens
budget = {
    "system_prompt":      2_000,   # 1.6%  — keep tight
    "tool_definitions":   5_000,   # 3.9%  — prune unused tools
    "retrieved_documents":40_000,  # 31%   — highest ROI
    "message_history":   70_000,   # 55%   — compress aggressively
    "tool_outputs":      11_000,   # 8.5%  — offload to filesystem
}
```

### Context Degradation Patterns

```python
# Pattern 1: Lost-in-the-middle
# Critical information placed in the center of a long context
# degrades recall significantly. Always place key info at edges.

def order_context_for_attention(documents: list[str], query: str) -> list[str]:
    """Place most relevant documents first and last."""
    scored = rank_by_relevance(documents, query)
    n = len(scored)
    ordered = [None] * n
    # High relevance → positions 0 and -1
    for i, doc in enumerate(scored):
        if i % 2 == 0:
            ordered[i // 2] = doc          # fill from front
        else:
            ordered[n - 1 - i // 2] = doc  # fill from back
    return ordered

# Pattern 2: Context poisoning
# Contradictory or stale information causes unpredictable behavior
def validate_context_consistency(facts: list[dict]) -> list[dict]:
    """Remove contradicting or outdated facts before injection."""
    seen_keys = {}
    clean = []
    for fact in sorted(facts, key=lambda f: f["timestamp"], reverse=True):
        key = fact["subject"] + fact["predicate"]
        if key not in seen_keys:
            seen_keys[key] = True
            clean.append(fact)
    return clean
```

### Context Compression

```python
import anthropic

client = anthropic.Anthropic()  # uses ANTHROPIC_API_KEY env var

def compress_conversation(
    messages: list[dict],
    keep_last_n: int = 10,
    model: str = "claude-opus-4-5",
) -> list[dict]:
    """
    Compress long conversation history into a summary + recent tail.
    Preserves decisions, outcomes, and key entities.
    """
    if len(messages) <= keep_last_n:
        return messages

    to_compress = messages[:-keep_last_n]
    recent = messages[-keep_last_n:]

    summary_prompt = f"""Summarize this conversation segment.
Preserve: decisions made, key entities, open questions, errors encountered.
Discard: pleasantries, repetition, superseded plans.

Conversation:
{format_messages(to_compress)}
"""

    response = client.messages.create(
        model=model,
        max_tokens=1024,
        messages=[{"role": "user", "content": summary_prompt}],
    )

    summary_message = {
        "role": "assistant",
        "content": f"[COMPRESSED HISTORY]\n{response.content[0].text}",
    }

    return [summary_message] + recent


def format_messages(messages: list[dict]) -> str:
    return "\n".join(
        f"{m['role'].upper()}: {m['content']}" for m in messages
    )
```

### Multi-Agent Patterns

```python
# Orchestrator pattern — one agent routes, subagents execute
class OrchestratorAgent:
    def __init__(self, subagents: dict[str, "SubAgent"]):
        self.subagents = subagents
        self.client = anthropic.Anthropic()

    def route(self, task: str) -> str:
        """D

Related in AI Agents