š Context Engineering Quick Reference
1. Fundamental Principles
Clarity
- Use unambiguous instructions ā the model should not guess.
- Be specific: "Write a report" is bad; "Write a markdown report with 4 sections: Overview, Analysis, Recommendations, Conclusion" is good.
- One main intent per prompt.
Structure
Layer 1: System Identity ā Who are you, what do you know, how do you speak.
Layer 2: Task Definition ā What exactly needs to be done.
Layer 3: Input / Context ā Data to process.
Layer 4: Constraints ā Rules, limitations, forbidden things.
Layer 5: Output Format ā How the response should look.
Layer 6: Few-Shot Examples ā Quality samples.
Layer 7: Verification ā Check before final answer.
Token Efficiency
- Every token must deliver value ā no filler words.
- Use skeletal structures instead of long prose.
- Compress repetitive information into shorthand notations.
2. Chain of Thought (CoT)
Before giving the final answer, the model must reason step by step. This improves accuracy on complex tasks by 30-70%.
"Think step by step before answering."
3. Dynamic Context
Conditional instructions that change based on input:
If the request includes [condition A], use [rule A]. Otherwise, use [default rule].
4. Meta Prompting
Using a prompt to generate better prompts. The model acts as a prompt engineer.
"Your task is to create a SYSTEM PROMPT for an LLM that will [description]."
5. Context Window Management
- Prioritization: Place most important info at the end (recent token bias).
- Summarization: Long documents ā summary + key fragments.
- Chunking: Split into parts and iterate.
6. Self-Consistency
Generate multiple answers and pick the most consistent one.
"Generate 3 different answers, then select the best one based on [criteria]."
7. Reflection
After generating, the model checks its own work:
"After writing the answer, check: Are there logical errors? Are all constraints followed? Is the format correct? If you find an error, fix it and explain."
8. Iteration & Versioning
- Start with a basic prompt ā test.
- Add persona ā test.
- Add few-shot examples ā test.
- Add constraints ā test.
- Optimize token count ā test.
- A/B test variants.
- Keep a benchmark dataset for evaluation.
9. Safety & Guardrails
- Never give medical, legal, or financial advice without disclaimers.
- Never invent facts or cite non-existent sources.
- Never generate harmful, discriminatory, or inappropriate content.
- If input contains PII, refuse or redact.
- Always include disclaimer when providing [medical/legal/financial] information.
10. Token Efficiency Rules
Always follow the 35 Token Efficiency Rules in the 35 Rules tab to minimize token usage while maximizing output quality.