Logo di Context Engineering

Context Engineering

Community
nimadorostkar
context-engineering

Use when managing what an LLM sees. Covers context-window budgeting, retrieval and compaction, memory across turns, tool-result pruning, and the failure modes that come from too much context rather than too little. Trigger on "model gets worse as the conversation gets longer", "context window keeps filling up". Do not use for state that persists across sessions — see the agent-memory skill; for retrieval over a document corpus, see the rag skill.

Panoramica

Autorenimadorostkar
RepositoryClaude-Skills-collection
Nome della skillcontext-engineering
Stelle
34
Fork
4
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da nimadorostkar su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Context Engineering in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/nimadorostkar/Claude-Skills-collection/tree/main/skills/ai/context-engineering
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/nimadorostkar/Claude-Skills-collection.git /tmp/Claude-Skills-collection
mkdir -p .claude/skills
cp -r /tmp/Claude-Skills-collection/skills/ai/context-engineering .claude/skills/context-engineering
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Context Engineering in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Context Engineering non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Context Engineering non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Context Engineering

Purpose

Decide what an LLM sees, and what it does not. Context is a finite budget with a nonlinear cost curve: more context is not more capability, and past a point it is actively less.

When to Use

  • Building an agent or assistant that runs over many turns.
  • A model that performs worse as the conversation gets longer.
  • Managing tool results, retrieved documents, or long files.
  • Reducing token cost in a long-running system.

Capabilities

  • Context budgeting and allocation.
  • Retrieval: putting the right thing in, not everything.
  • Compaction and summarization of history.
  • Memory: what persists across sessions, and in what form.
  • Tool-result pruning and progressive disclosure.

Inputs

  • The task, and what information it genuinely requires.
  • The context window and its cost.
  • The failure symptom, if the system is degrading over long runs.

Outputs

  • A context budget with an allocation per component.
  • A compaction strategy that preserves what matters.
  • Measurably better performance on long tasks.

Workflow

  1. Budget the window explicitly — System prompt, tools, retrieved context, history, and the response all compete for the same space. Decide the allocation rather than letting history consume everything.
  2. Retrieve narrowly — Ten highly relevant chunks outperform a hundred marginally relevant ones. Irrelevant context does not sit inertly; it distracts.
  3. Compact, do not truncate — Dropping the oldest turns loses the decisions that explain the current state. Summarize the history into the facts and decisions that are still live.
  4. Prune tool results — A tool returning 50 KB of JSON when the agent needs three fields is spending the budget on noise. Filter at the tool boundary.
  5. Disclose progressively — Provide a file listing, not the files. Let the model request what it actually needs. This is how a large codebase fits in a small window.
  6. Externalize memory — Long-lived state belongs in a file or a store the model can read and write, not in a conversation history that grows without bound.

Best Practices

  • Long context degrades attention. A model given 200,000 tokens of context often performs worse than the same model given the 5,000 tokens that mattered. Adding context is not free.
  • Information in the middle of a long context is attended to least. Put the critical instruction at the start or the end, not buried in the middle.
  • Compaction is lossy by design. Preserve the decisions, the constraints, and the unresolved questions; discard the exploration that led to them.
  • A tool that returns raw API output is a context leak. Wrap it, select the fields, and return a summary with a way to fetch the detail.
  • Cache the stable prefix. A system prompt and tool definitions that do not change should be cached rather than re-sent and re-processed each turn.
  • Write important state to a file. A note the model writes and re-reads survives compaction; a fact buried in turn 12 does not.

Examples

Explicit context budget:

text
Window: 200,000 tokens. Allocation:

  System prompt + skill      4,000    stable, cached
  Tool definitions           3,000    stable, cached
  Working memory file        2,000    the agent's own notes, re-read each turn
  Retrieved context         20,000    top-k, re-retrieved per turn, not accumulated
  Conversation history      40,000    compacted when it exceeds this
  Tool results              30,000    pruned; only the most recent kept in full
  Reserve for response      16,000
                          --------
                           115,000    leaving deliberate headroom

Rules:
  - History exceeding 40k triggers compaction, not truncation.
  - Retrieved context is replaced each turn, never appended — otherwise it
    grows monotonically and crowds out everything else.
  - Tool results older than 3 turns are replaced by a one-line summary.

Compaction that preserves what matters:

python
COMPACTION_PROMPT = """\
Summarize the conversation so far into a working state document. This summary
replaces the full history, so anything you omit is lost permanently.

Preserve:
- The user's goal and any constraints they stated.
- Decisions made, and the reason for each.
- Facts discovered (file paths, API shapes, error messages, values).
- What has been tried and failed, so it is not retried.
- Open questions and the current next step.

Discard:
- Exploration that led nowhere.
- Full file contents (keep the path and what was learned from it).
- Tool call mechanics and intermediate output.

Write it as a factual state document, not a narrative."""

Progressive disclosure instead of loading everything:

python
# Wrong: 400 files, 2M tokens, does not fit and would not help if it did.
context = "\n".join(read(f) for f in repo.all_files())

# Right: give the model a map, and a tool to fetch what it decides it needs.
context = repo.tree(max_depth=3)          # ~2,000 tokens
tools = [read_file, grep, list_directory] # the model pulls what it needs

Notes

  • The "lost in the middle" effect is well-documented: retrieval accuracy for a fact placed in the middle of a long context is substantially lower than for the same fact at either end. Placement is not neutral.
  • Prompt caching makes a large stable prefix cheap after the first call. It changes the economics of a long system prompt entirely — but only if the prefix is genuinely stable, byte for byte.
  • The instinct to give the model more context is usually wrong. The instinct to give it better context is usually right.

Domande frequenti

Cosa fa la skill IA Context Engineering?

Use when managing what an LLM sees. Covers context-window budgeting, retrieval and compaction, memory across turns, tool-result pruning, and the failure modes that come from too much context rather than too little. Trigger on "model gets worse as the conversation gets longer", "context window keeps filling up". Do not use for state that persists across sessions — see the agent-memory skill; for retrieval over a document corpus, see the rag skill.

Perché usare Context Engineering su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Context Engineering è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Context Engineering in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/nimadorostkar/Claude-Skills-collection/tree/main/skills/ai/context-engineering. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Context Engineering?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Context Engineering?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Context Engineering: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Context Engineering è gratuita?

Sì. È pubblicata su GitHub da nimadorostkar con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇