Interactive Tools
Prompt Engineering
✨ prompt craft

Prompt Engineering

A practical, interactive reference for crafting precise, context-aware, and iteratively refined prompts.

Master the art of prompt engineering β€” from choosing the right prompt type, to layering context, to diagnosing and fixing failure modes. Whether you're building AI agents, writing system prompts, or refining ad-hoc queries, these patterns will sharpen every interaction.

⚑
Type 01 β€” Zero-shot
Simple tasks Β· Fast turnaround
πŸ“‹
Type 02 β€” Few-shot
Format control Β· Style transfer
🧠
Type 03 β€” Chain-of-thought
Accuracy Β· Complex reasoning
🎭
Type 04 β€” Role / Persona
Domain depth Β· Tone shaping
βš™οΈ
Type 05 β€” System / Meta
Products Β· Consistency across sessions
🧩
Type 06 β€” Decomposition
Long tasks Β· Reliability
Select a prompt type to preview its structure and example.
πŸ“
Skill 1 β€” Specify output format explicitly
Never leave format to chance. Define structure, length, and …
βœ…
Skill 2 β€” Use positive framing (say what TO do)
Models follow positive instructions more reliably than …
🏷️
Skill 3 β€” Separate instructions from content
Use clear delimiters (XML tags) so the model never confuses …
πŸ‘₯
Skill 4 β€” State the audience and purpose
Calibrates vocabulary, depth, and tone automatically without …
πŸ”¬
Skill 5 β€” Request structured reasoning
Put reasoning in a separate XML block so you can verify the …
πŸ“
Skill 6 β€” Constrain length and scope
Without boundaries, models default to over-generating. …
Select a precision skill to compare vague vs. precise prompts.

The 6 Layers of a Production Prompt

Layer 1 🎭 [PERSONA] Persona / Role
Layer 2 🎯 [TASK] Task
Layer 3 πŸ“š [DOMAIN] Domain / Knowledge
Layer 4 πŸ‘₯ [AUDIENCE] Audience
Layer 5 πŸ“„ [FORMAT] Format / Output
Layer 6 πŸ›‘οΈ [CONSTRAINT] Constraint
Click a layer in the stack to view details and code application.

Full Layered Prompt Example

[PERSONA]    You are a senior product manager with 10 years in B2B SaaS.
[TASK]       Review the feature brief below and identify gaps.
[DOMAIN]     Focus on enterprise security and compliance requirements.
[AUDIENCE]   Output is for the engineering team lead.
[FORMAT]     Bullet list: gap Β· why it matters Β· suggested resolution.
[CONSTRAINT] Max 8 bullets. Flag only P0 and P1 issues.

<brief>[paste brief here]</brief>
🌑️
Situational Factors
Capture the circumstances of the task β€” deadline pressure, …
πŸ”§
Technical State
Declare the current tech stack, versions, environment, and …
πŸ“œ
Domain Rules
Standing rules of the field β€” regulatory requirements, style …
πŸ‘€
User Profile
Store expertise level, communication preferences, and known …
πŸ“
History / Prior Turns
Summarize decisions already made to keep a long session …
🚩
Constraints & Flags
Guardrails that apply for every request in this session β€” …
Select a recurring context block to preview how it anchors LLM outputs.

Effect of Recurring Context on Model Behavior

MetricWith Recurring ContextWithout Context
Response relevanceHighVariable
Hallucination riskLowElevated
Follow-up frictionMinimalHigh
Consistency across turnsStrongFragile
Step 1
✏️ Draft a baseline

Write the simplest version that states the goal. Don't over-engineer first. Run it and capture the raw output.

Step 2
πŸ” Diagnose failures

Tag each problem: wrong format, wrong depth, wrong tone, missing info, hallucination, or scope creep. One diagnosis per problem.

Step 3
πŸŽ›οΈ Change one variable

Add a format spec, a role, an example, or a constraint β€” but only one. This tells you exactly what worked.

Step 4
πŸ§ͺ Test on varied inputs

Run the revised prompt on at least 3 different real inputs. A prompt that works for one case but breaks on edge cases isn't done.

Step 5
🚫 Add negative examples

If the model keeps producing something wrong, show what you don't want alongside what you do. Negative examples anchor the boundary.

Step 6
πŸ”’ Lock and document

Save the prompt with version, purpose, example I/O, and known limitations. Treat it like code β€” it needs a changelog.

πŸ“Š #01
-
Symptom:

Output is prose when you needed structured data, or JSON when you needed plain text

Fix:

Specify a formal schema or wrap target outputs in custom tags (e.g., [FORMAT] or <json>). Provide a 1-shot example.

πŸ“ #02
-
Symptom:

Response misses the target expertise level β€” either over-simplifying or over-explaining details

Fix:

Explicitly declare the AUDIENCE layer (e.g., 'expert developer') and specify a strict length/paragraph constraint.

🎯 #03
-
Symptom:

Model wanders into tangential topics, outputs commentary, or over-generates beyond the task

Fix:

Add negative constraints and boundary triggers: 'Only focus on X. Do not write a preamble or introduction.'

πŸŒ€ #04
-
Symptom:

Technically correct but too vague, using clichΓ©s and generic guidance instead of domain-specific solutions

Fix:

Supply a detailed DOMAIN rule or TECHNICAL STATE block, and assign an authoritative expert PERSONA.

πŸ‘» #05
-
Symptom:

Model invents facts, APIs, parameters, or citations when generating answers or reading files

Fix:

Strictly ground the model: 'Answer using only the provided context. If the answer is not present, reply with "UNKNOWN".'

πŸ”„ #06
-
Symptom:

Model repeats instructions, restates its own points, or gets stuck in cyclical phrasing loops

Fix:

Enforce positive framing constraint: 'Ensure each sentence introduces new, non-overlapping information.'

🏷️ #07
-
Symptom:

Model mixes up user input/data with instructions, or ignores rules due to prompt injection

Fix:

Use XML tags (e.g., <data>...</data>) to isolate inputs from instructions, and explicitly tell the model not to execute commands inside the data.

πŸ”¬ #08
-
Symptom:

Model outputs an incorrect final answer immediately, skipping critical intermediate reasoning steps

Fix:

Request structured reasoning first (Chain-of-Thought). Use a <reasoning> block to isolate logic before the final output.

1. Select Prompt Type

Select a scenario to find the recommended prompt type:

2. Build Your Layered Prompt

Live Layered Prompt Preview

Prompt copied to clipboard!

Interactive Tools

Practical tools to help you think systematically, build better AI agents, and master prompt engineering.

Software Engineering Playbooks

Practical, End-to-End implementation guides for building Production-ready Software. Each playbook includes working code, architecture diagrams, and step-by-step instructions.

πŸ€–

Research Agent with Gateway

Build a production-ready AI research agent using Agent Gateway for unified traffic management, authentication, and observability across LLM providers.

Agent Gateway A2A Protocol Multi-Agent
πŸ”—

RAG Pipeline with Vector Database

Implement a complete Retrieval-Augmented Generation pipeline with vector embeddings, semantic search, and context injection for accurate AI responses.

RAG Vector DB Embeddings
πŸ”„

Multi-Agent Orchestration

Create a coordinated multi-agent system with specialized agents, task distribution, and result synthesis for complex problem-solving.

Orchestration Task Distribution Synthesis
1 / 2

Future References

Explore these resources for deeper learning on AI agent development, spec-driven development, and prompt engineering tools.

Spec-Driven Development

Comprehensive guide on Spec-Driven Development practices and methodologies.

Awesome Copilot

Curated list of GitHub Copilot resources, extensions, and best practices.

Promptfoo

Tool for testing, evaluating, and improving LLM prompts and applications.

Prompts.chat

Collection of prompt engineering resources and templates.

Agent Skills

Agent skills resources and documentation for building AI agent skills.

Awesome Skills

Curated list of awesome skill repositories and collections.

Agent Skills Topic

GitHub topic for discovering agent-related skills and repositories.

AI Agent Topic

Trendshift topic for discovering AI agents.

AI Skills Topic

Trendshift topic for discovering AI skills.

Agent Governance Toolkit

Agent governance toolkit.

Pattern Sources

Our patterns are curated from industry-leading sources with proper attribution and licensing compliance.

Refactoring.Guru

Classic GoF design patterns, code smells catalog, and refactoring techniques (https://refactoring.guru).

Enterprise Integration Patterns

65 messaging patterns for integrating enterprise applications by Gregor Hohpe and Bobby Woolf (CC BY 4.0).

Microservices.io

Comprehensive patterns for microservice architectures by Chris Richardson.

Agent Catalog Patterns

Patterns for agentic systems from agentpatternscatalog.org (CC BY 4.0).

OWASP Foundation

Security patterns from OWASP Top 10 for Web Applications, LLM Applications, and Agentic Applications (CC BY-SA 4.0).

Industry Research

ML/AI patterns from Microsoft, Google, Anthropic, and academic research.

AI Agent Patterns

Spec-driven development patterns from Claude, Gemini, OpenAI, and GitHub Copilot on github/spec-kit and OpenSpec.

Data Engineering Leaders

Data platform patterns from Martin Fowler (Data Mesh), Kimball Group (Dimensional Modeling), and cloud providers.

MLOps Best Practices

Data science patterns from MLflow, Great Expectations, and MLOps practitioners.

Streaming & Analytics

Real-time patterns from Confluent/Kafka, Apache projects, and serverless analytics platforms.

Academic Papers

Rigorous ML patterns from peer-reviewed research including data leakage prevention and active learning.

5-Day AI Agents Course

Intensive Vibe Coding Course With Google by Brenda Flynn et al. (2026) on Kaggle.

The Agent Loop

Foundational Agent Definition (Perceive + Act):
Russell, S. J., & Norvig, P. (1995). Artificial Intelligence: A Modern Approach. Prentice Hall. (Current edition: 4th Ed., Pearson, 2020)

Modern Iterative LLM Agent Loop:
Yao, S., Zhao, J., Yu, D., et al. (2022). ReAct: Synergizing Reasoning and Acting in Language Models. arXiv:2210.03629.

Historical Context:
Incorporating AIMA's perceive/act model, Classical robotics' Sense-Plan-Act loop (Brooks, 1986), and ReAct's Thought→Action→Observation cycle.