Skip to content
Skills Library
AI & agents · Planning

rag-vs-context-engineering

/rag-vs-context-engineering

Decide between RAG, long-context, structured tool retrieval, and prompt-only approaches for grounding an LLM in private or fresh data. Use when the user is designing a knowledge-grounded agent or chatbot and mentions RAG, vector search, embeddings, retrieval, chunking, long context, context window, tool retrieval, hybrid search, rerank, or asks "do I need RAG?" / "should I just use a big context window?".

Licence
Apache-2.0
Last repository change
08.07.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 08.07.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Decide between RAG, long-context, structured tool retrieval, and prompt-only approaches for grounding an LLM in private or fresh data. Use when the user is designing a knowledge-grounded agent or chatbot and mentions RAG, vector search, embeddings, retrieval, chunking, long context, context window, tool retrieval, hybrid search, rerank, or asks "do I need RAG?" / "should I just use a big context window?".

Triggers from the description

do I need RAG?should I just use a big context window?
Original author description

Decide between RAG, long-context, structured tool retrieval, and prompt-only approaches for grounding an LLM in private or fresh data. Use when the user is designing a knowledge-grounded agent or chatbot and mentions RAG, vector search, embeddings, retrieval, chunking, long context, context window, tool retrieval, hybrid search, rerank, or asks "do I need RAG?" / "should I just use a big context window?".

How it works

  1. When to use this skill
  2. Decision flow
  3. The patterns in one line each
  4. Anti-patterns to flag immediately
  5. Questions to ask the user
  6. The hard line
  7. Why this exists
  8. References
  9. Related skills
Original SKILL.md headings · 76 lines, 761 words
SKILL.md preview
---
name: rag-vs-context-engineering
description: >-
  Decide between RAG, long-context, structured tool retrieval, and prompt-only
  approaches for grounding an LLM in private or fresh data. Use when the user
  is designing a knowledge-grounded agent or chatbot and mentions RAG, vector
  search, embeddings, retrieval, chunking, long context, context window, tool
  retrieval, hybrid search, rerank, or asks "do I need RAG?" / "should I just
  use a big context window?".
tags:
  - rag
  - retrieval
  - context-engineering
  - architecture
---

# RAG vs. Context Engineering

Retrieval is one tool in context engineering, not the whole job.

Most "RAG problems" are actually context-engineering problems: wrong granularity, wrong source, wrong ordering, wrong refresh policy. Picking RAG before you've decided what context the model actually needs is putting the engine before the chassis.

## When to use this skill

- The user is sketching a knowledge-grounded agent and reaches for embeddings reflexively.
- The user is debugging "the model gives wrong answers" and has not measured retrieval quality independently.
- The user is choosing between RAG, long-context-stuffing, structured tool calls, or fine-tuning.
- The user is mid-build and asking why their RAG isn't working.

## Decision flow

1. **Does the answer live in a known, small, stable document?** → no retrieval. Put it in the system prompt. Cache the prefix.
2. **Does the answer live in a structured store (DB, API, spreadsheet)?** → not RAG. Give the model a **typed tool** to query it. Schemas beat embeddings for structured data.
3. **Does the answer live in a corpus that fits the context window after filtering on a cheap signal (date, tag, user-id)?** → load the filtered subset directly. Retrieval is overkill.
4. **Is the corpus large, unstructured, and the query semantic?** → **RAG**. But measure retrieval quality before measuring answer quality.
5. **Is freshness critical (minutes, not days)?** → tool-call retrieval at query time, not a pre-indexed embedding store.
6. **Is the relevant context interactive (chat history, scratchpad, ongoing task)?** → working memory, not retrieval. Manage it explicitly.

## The patterns in one line each

- **Prompt-only** — put the knowledge in the system prompt. Fastest, cheapest, easiest to debug.
- **Structured tool retrieval** — model issues a typed query against a real backend. The right answer for structured data.
- **Filtered context load** — pull the candidate set by metadata, hand the model the whole filtered slice.
- **Embedding RAG** — semantic chunk search. Right answer for unstructured semantic queries over large corpora.
- **Hybrid retrieval** — embeddings + lexical (BM25) + rerank. Default to this when embedding RAG underperforms.
- **Long-context-stuffing** — dump the corpus into the prompt. Works for ≤200k-token corpora; fails on cost and latency at scale.
- **Fine-tuning** — only when the task is a *style* or *format* the base model can't produce; never as a substitute for retrieval.

## Anti-patterns to flag immediately

- **Chunk-and-pray.** Fixed-size chunks with no structural awareness; the answer always straddles two chunks.
- **Embeddings without rerank.** Top-k by cosine alone is a baseline, not a system.
- **RAG over a structured database.** Embedding rows is almost never better than letting the model write a query.
- **Dumping the whole DB into the context.** Cheap until it isn't — and silently degrades the model's attention to what matters.
- **Single-stage retrieval for multi-hop questions.** If the query needs evidence A *and* B, one retrieval pass will miss one of them.
- **No retrieval eval, only answer eval.** You can't fix what you can't isolate.
- **Refreshing the whole index nightly when only 1% changes.** Incremental indexing exists.

## Questions to ask the user

1. What is the **corpus shape** — structured (rows, columns), semi-structured (markdown, JSON), or unstructured (PDFs, transcripts)?
2. What is the **corpus size** in tokens, not documents?
3. How fresh does the answer need to be?
4. What is the **query shape** — factoid, multi-hop, summarisation, action?
5. Is the relevant context **per-user** (tenant-scoped) or global?
6. What does a **wrong answer** cost — annoyance, money, legal exposure?

If you can't answer (1) and (2), you cannot pick a retrieval strategy. Stop and measure.

## The hard line

**Show me your retrieval evals before you show me your embeddings.** Recall@k on a labelled set is the only honest signal. Without it, you're tuning vibes.

## Why this exists

Most "RAG isn't working" complaints in the wild are misdiagnosed retrieval problems hidden under prompt tweaking. Naming the layers — corpus, retrieval, context assembly, generation — lets you debug them independently and pick the right pattern instead of the trendy one. See [link to article on context engineering].

## References

- `references/retrieval-patterns.md` — when each pattern wins, with worked examples.
- `references/retrieval-evals.md` — recall@k, MRR, and how to build a labelled set without months of work.
- `references/chunking.md` — structural chunking, overlap, and metadata.

## Related skills

- Token cost of long context — [[agent-cost-modeling]].
- Retrieval latency budget — [[latency-budgeting]].
- Retrieval pattern is an architectural decision — [[agent-architecture-patterns]].
- Tool-based retrieval ↔ tool schema — [[tool-use-schema-design]].
- Retrieved-doc injection — [[guardrails-and-safety]].
Files in this package (3)
  • EXAMPLES.md 1 KB
  • SKILL.md 5 KB
  • TRANSCRIPT.md 4 KB

Versions

The database has no other skills named rag-vs-context-engineering.

Database snapshot: 13.11.2026 · package version 213746885187 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 98rag-expert
    Expert Retrieval-Augmented Generation: chunking, embeddings, vector/hybrid search, reranking, and grounded answers. Trigger keywords: RAG, retrieval, embeddings, vector database, chunking, reranking, hybrid search, BM25, grounding, citations, hallucination, context window,…
  • 100rag-architecture
    Use when designing or fixing a retrieval system for an LLM application — deciding between RAG, cache-augmented generation and plain long context, chunking strategy, hybrid dense+lexical retrieval, reranking, embedding-model and vector-store selection, metadata filtering and…
  • 100rag-systems
    Designs, builds and debugs retrieval-augmented generation (RAG) - ingestion and parsing, chunking, embeddings, hybrid search with reranking, access control at retrieval time, grounded answers with citations, and retrieval and answer evaluation. Use when building search or Q&A…
  • 90rag-implementation
    Retrieval-Augmented Generation patterns including chunking, embeddings, vector stores, and retrieval optimization Use when: rag, retrieval augmented, vector search, embeddings, semantic search.
  • 100rag-engineer
    Expert in building Retrieval-Augmented Generation systems. Masters embedding models, vector databases, chunking strategies, and retrieval optimization for LLM applications. Use when: building RAG, vector search, embeddings, semantic search, document retrieval.
  • 100rag-engineer
    Expert in building Retrieval-Augmented Generation systems. Masters embedding models, vector databases, chunking strategies, and retrieval optimization for LLM applications. Use when: building RAG, vector search, embeddings, semantic search, document retrieval.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.