Cheat sheet · Build products
Prompt Engineering cheat sheet
Opens with creditsA quick-revision book on writing prompts that work the same way twice: how a good prompt is built, when examples and step-by-step reasoning help, how to get clean JSON back, and how to test prompts like code. It works with any chat model or LLM API.
Chapters
8 chapters · 55 concepts
1Anatomy of a promptThe parts every reliable prompt has: a role, a clear task, the context the model cannot guess, explicit rules and the shape of the answer.8 concepts
- 1What a prompt isA prompt is everything the model reads before it answers: the system prompt, earlier messages, pasted documents and your latest request.
- 2System promptA message sent before the conversation that sets the role, tone, rules and constraints for every reply.
- 3Role promptingTelling the model who it is, such as "You are a database engineer reviewing schema changes", to steer vocabulary, depth and priorities.
- 4Be specific and directState the goal, the audience, the length, the format and what "done" looks like, as if briefing a smart new hire on day one.
- 5Give the why and the contextExplain the purpose behind a rule and include the facts the model needs: the stack, the data, who reads the output and what it will be used for.
- 6Delimiters and XML tagsWrapping each part of the prompt in clear markers such as
<document>,<instructions>or triple quotes so the model knows what is data and what is… - 7Say what to do, not only what not to doPhrase rules positively: "Write in flowing paragraphs" instead of "Do not use Markdown".
- 8Prompt templates and variablesA fixed prompt with slots such as
{{QUESTION}}that your code fills in for each request.
8 in this chapterOpen this chapter2Zero-shot and few-shot promptingWhen to rely on instructions alone and when to show the model worked examples of the input and output you want.6 concepts
- 1Zero-shot promptingAsking for a task with instructions only and no examples.
- 2Few-shot promptingIncluding a few input and output pairs before the real input so the model copies the pattern, format and tone.
- 3Diverse, representative examplesChoose examples that cover different cases, including tricky ones, rather than three near-copies of the easy case.
- 4Mark examples clearlyWrap each example in
<example>tags or a consistent heading and keep them separate from the real input. - 5Output primers and prefillEnding the prompt with the start of the answer, such as
Label:or an opening{, so the model continues in that shape. - 6When examples beat instructionsUse examples for format, tone and fuzzy labels; use instructions for hard rules, limits and anything that must never happen.
6 in this chapterOpen this chapter- Chain of thought and reasoningGetting the model to work through a problem before it answers, and splitting big jobs into smaller prompts.7 conceptsOpens with credits
- Structured outputGetting JSON, lists and fixed labels your code can parse, and what to do when the output does not parse.7 conceptsOpens with credits
- Long inputs and contextWorking with documents, long chats and big codebases: where to put things, how to ground answers and how to keep costs down.7 conceptsOpens with credits
- Prompts for codeGetting useful code, reviews and bug fixes out of a model: what context to give and what to ask for.7 conceptsOpens with credits
- Prompts for learningUsing a model as a tutor that makes you think, rather than a machine that does your homework.6 conceptsOpens with credits
- Testing and securing promptsTreating prompts like code: test sets, versioning, sampling settings and defending against prompt injection.7 conceptsOpens with credits
- 9Glossary, A to ZEvery concept in the sheet and the smaller terms it uses, in one list.62 terms
About this sheet
Prompt anatomy, few-shot examples, chain of thought, structured output, long context, prompts for code and study, and testing prompts.
Related on Sefism
Picked from the other libraries by shared topics.
Roadmaps
See allBest practices
See all- Best Practices for AI Coding AssistantsHow to get reliable code from AI coding assistants and agents: instruction files, task prompts, verification, review, security, dependencies and session hygiene.
- Best Practices for Building LLM AppsHow to build LLM apps and agents that hold up in production: prompts, evals, prompt injection, tool permissions, cost, logging and privacy.
- Prompt Engineering Best PracticesHow to write prompts that work the same way on the hundredth input as on the first: clear instructions, structure, examples, reasoning, output control and testing.
Checklists
See all- RAG Production ChecklistA RAG production checklist: chunking, embeddings, hybrid search, reranking, per-user permissions, citations, evals, re-indexing and cost, with how to verify each check.
- LLM Evaluation ChecklistAn LLM evaluation checklist: success criteria, eval datasets, code and model graders, judge calibration, agent evals, safety tests and production monitoring, with how to verify each check.
- AI Feature Launch ChecklistAn AI feature launch checklist: use case fit, evals, UX for errors, disclosure, human override, abuse filters, rate limits, cost caps, prompt privacy, monitoring and rollback.
Project structures
See all- GenAI RAG app (FastAPI) project structureFor developers turning a "chat with your documents" demo into an app people can rely on. A FastAPI backend where every layer has a home: ingestion workers, retrieval, prompts as versioned files, model clients with fallbacks and cost caps, guards, evals that gate CI, and tracing, so a wrong answer can be traced to the step that caused it.
- AI agent with an MCP server project structureFor developers who want to give AI assistants safe access to their own data or API. A TypeScript MCP server built on the official SDK, organised by feature (tasks, projects) with each feature owning its tools, resources and prompts, served over stdio for local hosts and Streamable HTTP with OAuth for remote ones, plus a small agent and the evals that prove a model can use it.
- Machine learning project project structureFor students and analysts whose model works in a notebook and now needs to be reproducible, reviewable, served and watched. It starts from the Cookiecutter Data Science v2 layout (immutable raw data, numbered notebooks, a real Python package) and grows into versioned data with DVC, typed parameters, data validation with pandera, experiment tracking and a model registry with MLflow, a FastAPI prediction service, drift monitoring and, for a team, scheduled retraining, model cards, fairness checks and shadow deployment.
Career questions
See all- Which AI tools do employers expect junior developers to know in 2026?Employers rarely require a specific brand. They expect you to use an AI coding assistant well (in the editor and in the terminal), to review and test what it produces, to call an LLM API in a small feature, and to explain when you would not use AI. Pick one assistant, learn it properly, and show judgement in your projects.
- Is it bad that I rely on ChatGPT or Cursor and cannot write code from scratch?Using AI tools is fine and increasingly expected. Being unable to write, debug or explain code without them is a real risk, because interviews, reviews and production incidents test exactly that. Keep the tools, but rebuild the ability to think and code independently first.
- How do I use AI to become a better engineer instead of becoming dependent on it?Decide the job AI does before you open it. Use it as a tutor, reviewer and sparring partner that explains and challenges, not a vending machine that hands you finished code. Attempt first, ask second, and always be able to explain and defend what you ship.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
- 1:1 Mentorship
- Fresh Graduate Mentorship
- Career Guidance
Brand deals, promos and partnerships: tauseeffayyaz@gmail.com