home/productivity/exercise-01-prompt-patterns

Exercise 01 Prompt Patterns

GPTClaudeDeepSeek··309 copies·updated 2026-07-14
exercise-01-prompt-patterns.prompt
# exercise-01: Prompt Patterns

**Estimated effort:** 2 hours

## Objective

Apply the core prompting patterns — instruction, role, few-shot examples, and decomposition — to a single task and watch how each move changes the output. By the end you will have four versions of a prompt for the same problem, a short notes file explaining what each change bought you, and a clear sense of which patterns are worth their tokens for *your* task.

## Background

This exercise covers material from:

- [Chapter 1 — Prompting as Engineering](../01-prompting-as-engineering.md)
- [Chapter 2 — Anatomy of an Effective Prompt](../02-anatomy-of-an-effective-prompt.md)
- [Chapter 3 — Few-Shot Prompting](../03-few-shot-prompting.md)
- [Chapter 4 — Decomposition, Chain-of-Thought, and Multi-Step Prompts](../04-decomposition-and-reasoning.md)

## Prerequisites

- Completed `mod-101-llm-fundamentals` exercise-01 (you can make a chat call and parse the response).
- An API key for one provider (Anthropic or OpenAI is fine). Set a small spend cap; this exercise should cost cents.
- Python 3.10+ or Node 20+, and the relevant SDK installed.

## The task

You are building a triage step for an e-commerce support inbox. Given a raw customer message, the model must produce:

- A **category**, one of: `billing`, `shipping`, `returns`, `product`, `other`, `unknown`.
- An **urgency**, one of: `low`, `normal`, `high`.
- A one-sentence **summary** (≤ 140 characters) suitable for a ticket title.

Use the same dataset for every version of the prompt so changes are attributable. A reasonable corpus is in `inputs.txt` below — copy it into your repo, or write your own 8–12 messages that include the obvious cases plus a few edge cases (empty input, multilingual content, an ambiguous one, an angry one, a polite one with no actual issue).

when to use it

Community prompt sourced from the open-source GitHub repo ai-engineering-curriculum/agentic-ai-developer-learning (MIT). A "Exercise 01 Prompt Patterns" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

productivitycommunitydeveloper

source

ai-engineering-curriculum/agentic-ai-developer-learning · MIT