⚠
Privacy Notice: When you sign in with GitHub, your quiz attempts are stored in Google Firebase so you can track your progress. This data is only accessible to the course instructor, is not otherwise shared, and will be deleted at the end of the semester. For earlier deletion, contact the instructor. Prefer to stay anonymous? Use guest mode or a GitHub account without your real name.
Loading...

06 Prompt Strategy Diagnosis: 12 Cards

Score: 0 / 36

Goal

In this quiz you treat a dozen real-world software-development prompts as objects of study. For each card you answer two graded questions — first the examples axis (zero-shot vs few-shot), then the additive techniques present — and then read the instructor-key reveal and write a free-text reflection. By the end you will:

  1. Recognise the named patterns from chapter 16 (pattern library) in unfamiliar prompts;
  2. Predict failure modes mechanistically rather than after-the-fact;
  3. Separate influence (what the prompt biases) from enforcement (tests, schemas, CI, review) — the three-layer model from chapter 8;
  4. Improve weak prompts surgically rather than by making them longer.

Lecture 7 will revisit the agentic and tool-grounded cards in the orchestration-layer story.

Learning objectives

After working through this quiz, you should be able to:

  1. Classify prompt strategies used in software-development tasks.
  2. Identify evidence for that classification in the prompt text.
  3. Explain why a prompt strategy may be appropriate or inappropriate for a given task.
  4. Recognize likely failure modes, including factual hallucination, structural hallucination, overconfident explanations, format drift, missing context, and false confidence.
  5. Separate influence from enforcement by deciding what can be handled through prompting and what requires tools, tests, schemas, CI, review, or other deterministic checks.
  6. Improve prompts by adding missing context, examples, constraints, output formats, validation steps, or tool instructions.
  7. Avoid prompt folklore by justifying prompt design decisions mechanistically and practically.

Required prior concepts

You should already be familiar with:

  • zero-shot prompting
  • few-shot prompting
  • role prompting / role priming
  • rubric-based prompting
  • structured-output prompting
  • chain-of-thought / planning prompts
  • context grounding
  • tool-augmented prompting
  • retrieval-augmented generation
  • hallucination types (chapter 5)
  • influence layer vs. enforcement layer vs. human layer (chapter 8)
  • validation through tests, schemas, linters, type checkers, CI, and code review

Two axes, not one menu

The single most important idea in this quiz is that examples are a separate question from everything else. “Did this prompt use worked examples?” is a binary axis — every prompt is either zero-shot or few-shot, and a prompt can be few-shot and also use a role, a rubric, structured output, and so on. The older single-checkbox design entangled these: it forced you to decide whether “zero-shot” belonged in the same list as “structured-output,” which has no clean answer, so the key silently used an unstated rule and the same evidence was marked correct on one card and wrong on another.

The fix is to ask two questions per card:

  • Q-A (the examples axis): zero-shot or few-shot? A single binary choice with a printed rule — see below.
  • Q-B (the additive techniques): which of the six additive techniques (role, rubric, structured-output, CoT, context grounding, tool-augmented) are present? Zero-shot/few-shot is not an option here, and neither is validation/enforcement.

This way every graded answer is uniquely derivable from a printed rule, and “few-shot” never competes with “structured-output” for a slot.

How this quiz’s categories map to the lecture’s pattern library

Chapter 16 names six patterns. This quiz uses a broader taxonomy that includes orchestration-adjacent categories (tool-augmented, structured-output) and the “outside the prompt” layer. The mapping:

Lecture pattern (chapter 16) Quiz category
Zero-shot Examples axis (Q-A)
Temperature not exercised here — see "Temperature Experiments" exercise
Few-shot Examples axis (Q-A)
Chain-of-thought Chain-of-thought / planning (Q-B)
Self-consistency not exercised here — orchestration concern, Lecture 7
Role priming Role priming (Q-B)

The additional additive techniques appear in the reference sheet below because real software-development prompts compose them with the lecture’s patterns:

  • Rubric-based prompting — explicit evaluation criteria layered on top of role priming or structured-output prompting.
  • Structured-output prompting — the influence-layer version of constrained decoding (§15.1). Prompting for JSON is not the same as enforcing JSON.
  • Context grounding — directly applies the attention-competition point from Lecture 5: relevant context concentrates the model’s attention on what matters, while irrelevant context adds distractors that can pull the next-token decision off course.
  • Tool-augmented prompting — moves work out of the prompt and into the orchestration layer (Lecture 7).

Prompt strategy reference sheet

Use this as your cheat sheet while answering. The examples axis (zero-shot / few-shot) is the binary question Q-A; the six additive techniques are the Q-B menu. The “How to decide this box” column is the printed rule that makes every graded answer uniquely derivable.

Strategy Axis or technique Short description How to decide this box Main risk
Zero-shot vs Few-shot Examples axis (Q-A, binary) Whether the prompt demonstrates the desired behaviour with worked examples Few-shot iff the prompt contains ≥1 worked example demonstrating the desired input→output behaviour or style to imitate — including an example built on a sibling artifact (a different function/endpoint/record). The single artifact the task operates ON (function-under-test, report-to-classify, diff-to-review) is NOT a demonstration. Otherwise zero-shot. Zero-shot: generic/underspecified output. Few-shot: examples may bias wrongly or overfit
Role priming Additive technique (Q-B) Assign a professional role or perspective An "Act as a <role>" / "You are a <role>" expertise persona. "You are helping in our X project" is membership, not a role. Role does not guarantee expertise or correctness
Rubric-based prompting Additive technique (Q-B) Provide evaluation criteria/checklist An explicit list of evaluation criteria / scoring dimensions to judge against — not a list that merely organises output sections. May become checklist-like and miss context
Structured-output prompting Additive technique (Q-B) Request a fixed output format (table, JSON, sections) A concrete output-format spec — a named serialization (JSON/YAML/table), an enum of allowed values, an "only output X" shape, OR a section schema whose parts are explicitly named/enumerated as a labeled list. Two prose imperatives joined by "and" ("explain the cause AND propose a fix") are a task description, NOT structured-output. Format is influenced, not guaranteed (§15.1)
Chain-of-thought / planning Additive technique (Q-B) Ask for stepwise reasoning, plan, or rationale Explicit "think step by step" / "show your reasoning" / "first plan, then…". A bare "explain" does NOT count. Visible reasoning may be verbose or unfaithful (§13.5)
Context grounding Additive technique (Q-B) Provide relevant project/code/docs/context Embedded background the model conditions on while producing output about something else (project conventions, related/example code, docs, a diff, a stack trace + surrounding code). The artifact that IS the task's direct object does not count. Irrelevant or stale context can mislead
Tool-augmented prompting Additive technique (Q-B) Instruct model to use tools, docs, tests, APIs The prompt names a tool/resource to invoke ("use the web search tool", "run the test suite"). Merely implying tool use ("commit them") does not count. Tool outputs must be checked and scoped (Lecture 7)

Note — validation/enforcement is not on the graded menu. External checks (schema validation, tests, CI, review) are chapter 8’s enforcement layer — the thing prompting cannot do. It is not a prompting strategy, so it has been removed from the Q-B menu. It lives only in the reflection’s “what does the task NEED outside the prompt?” prompt.

Prompting belongs to the influence layer. Tests, schemas, static analysis, CI, sandboxing, and review belong to the enforcement and human layers.

How the quiz is structured

Each card produces two graded questions plus one ungraded reflection:

  1. Examples axis (multiple-choice). Zero-shot or few-shot? Graded; immediate feedback on submit, and the key reveals.
  2. Additive techniques (multiple-select). Which of the six additive techniques are present? Graded by exact-set match.
  3. Reflection (free-text, ungraded). Write out the primary lever, the textual evidence, why the strategy fits or doesn’t, the failure modes, what belongs outside the prompt, and your improved rewrite. After you click Submit & reveal reference, the reference answer for each field reveals so you can compare. Your text stays in your browser (localStorage) only; nothing is sent to Firebase. This is the part where the actual learning happens.

That means the deck has 12 cards = 24 graded questions + 12 ungraded reflections = 36 total. The score on the progress bar reflects the 24 graded questions only.

A note on “anti-pattern” cards

Cards 5, 7, 10, 11, and 12 are deliberately weak prompts. The anti-pattern judgment lives in the reflection — specifically in what the task NEEDS that the prompt does not provide — never in the graded checkboxes. The graded classification of a weak zero-shot prompt is still zero-shot on the axis, plus whatever additive techniques (often None-of-these) are actually present. What makes a card an anti-pattern is whether that classification is the right tool for the task, which is an appropriateness judgment you record in the reflection. Reveal the explanation and write the reflection to learn why the strategy is the wrong fit.

Where to go for the group-workshop format

This page is the interactive self-study version. If you want to run the same twelve cards as a group workshop in class — with the instructor warm-up, group activity options, rubric, grading scale, and debrief questions — the companion exercise page is the instructor and group-workshop guide.

Final takeaway. Prompting is influence. Software engineering turns influence into reliable systems.

Question1 Code Generation

Card 1: Simple code generation (normalize_email) — a contrastive triple

Task: Generate a helper function for a Python project. Here is the same task written three ways. Read all three, then answer this question and the next.

Version 1a — bare:

Write a Python function `normalize_email` that strips whitespace, lowercases,
and raises ValueError unless there is exactly one @.

Version 1b — with worked examples:

Write a Python function `normalize_email` that strips whitespace, lowercases,
and raises ValueError unless there is exactly one @.

Examples:
normalize_email("  Foo@Bar.COM ")  ->  "foo@bar.com"
normalize_email("a@@b.com")        ->  ValueError

Version 1c — with an output constraint:

Write a Python function `normalize_email` that strips whitespace, lowercases,
and raises ValueError unless there is exactly one @.

Only output the function. No prose.

Three versions of the SAME task are shown. Which is the FEW-SHOT version (contains worked example calls)?

Question2 Code Generation

Card 1 continued — same three versions of normalize_email as above.

Which version adds a STRUCTURED-OUTPUT constraint?

Question3 Code Generation

Card 1 reflection — the normalize_email triple

Now write out your full diagnosis for Card 1 in plain prose. There is no automatic grading — after you submit, the reference answer for each field reveals so you can compare.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

Question4 Code Generation

Card 2: Project-style code generation (get_user_by_id)

Task: Generate code that follows an existing project style.

Prompt:

You are helping in our Python backend project.

Implement a function that loads a user by ID and returns `None` if the user is not found.

Use our project style:

Example 1:
```python
def get_order_by_id(db: Session, order_id: UUID) -> Order | None:
    result = db.execute(select(Order).where(Order.id == order_id))
    return result.scalar_one_or_none()
```

Example 2:
```python
def get_invoice_by_id(db: Session, invoice_id: UUID) -> Invoice | None:
    result = db.execute(select(Invoice).where(Invoice.id == invoice_id))
    return result.scalar_one_or_none()
```

Now write:

```python
def get_user_by_id(db: Session, user_id: UUID) -> User | None:
    ...
```

Only output the completed function.

Does this prompt use worked examples? (the examples axis)

Question5 Code Generation

Card 2 continued — same get_user_by_id prompt as above.

Which ADDITIVE techniques are present? Select all that apply.

Select all that apply:

Question6 Code Generation

Card 2 reflection — get_user_by_id

Now write out your full diagnosis for Card 2 in plain prose. There is no automatic grading — after you submit, the reference answer for each field reveals.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

Question7 Code Review

Card 3: Code review

Task: Review a pull request for maintainability and security.

Prompt:

Act as a senior backend engineer and security-conscious code reviewer.

Review the following pull request diff. Use this rubric:

1. Correctness risks
2. Security risks
3. Maintainability issues
4. Missing tests
5. Unclear naming or API design
6. Suggestions that are nice-to-have rather than required

For each finding, output:

- severity: critical / major / minor / suggestion
- file or function
- issue
- why it matters
- recommended change

Do not rewrite the whole patch. Focus on review comments.

Here is the diff:

[DIFF]

Does this prompt use worked examples? (the examples axis)

Question8 Code Review

Card 3 continued — same code-review prompt as above.

Which ADDITIVE techniques are present? Select all that apply.

Select all that apply:

Question9 Code Review

Card 3 reflection — code review prompt

Now write out your full diagnosis for Card 3 in plain prose. After you submit, the reference answer for each field reveals.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

Question10 Debugging

Card 4: Bug diagnosis with stack trace

Task: Diagnose a runtime bug.

Prompt:

I get this error:

```text
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
```

Here is the buggy function:

```python
def total_price(items):
    total = 0
    for item in items:
        total += item.discounted_price()
    return total
```

For reference, from our pricing module `pricing/discounts.py`, here is the
method each item exposes (it returns `None` when no active discount applies):

```python
class Item:
    def discounted_price(self) -> float | None:
        if self._active_discount is None:
            return None
        return self.base_price * (1 - self._active_discount.rate)
```

Explain the likely cause and propose a fix.

Does this prompt use worked examples? (the examples axis)

Question11 Debugging

Card 4 continued — same stack-trace prompt as above.

Which ADDITIVE techniques are present? Select all that apply.

Select all that apply:

Question12 Debugging

Card 4 reflection — stack-trace debugging

Now write out your full diagnosis for Card 4 in plain prose. After you submit, the reference answer for each field reveals.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

Question13 Test Generation

Card 5: Test generation (minimal)

Task: Generate tests for an existing function.

Prompt:

Write tests for this function:

```python
def is_valid_age(age: int) -> bool:
    return age >= 18 and age <= 120
```

Does this prompt use worked examples? (the examples axis)

Question14 Test Generation

Card 5 continued — same minimal test-generation prompt as above.

Which ADDITIVE techniques are present? Select all that apply.

Select all that apply:

Question15 Test Generation

Card 5 reflection — minimal test-generation prompt

Now write out your full diagnosis for Card 5 in plain prose. After you submit, the reference answer for each field reveals.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

Question16 Requirements

Card 6: Requirements clarification

Task: Turn vague stakeholder notes into acceptance criteria.

Prompt:

Act as a product-minded requirements engineer.

Turn these stakeholder notes into acceptance criteria.

Use this format:

- User story
- Acceptance criteria in Given/When/Then format
- Open questions
- Assumptions you made

Important: Do not silently invent requirements. If something is unclear, put it under Open questions.

Stakeholder notes:

"Users should be able to export their data. It should be fast and secure. Admins need some kind of overview. Also we need this for compliance next quarter."

Does this prompt use worked examples? (the examples axis)

Question17 Requirements

Card 6 continued — same requirements prompt as above.

Which ADDITIVE techniques are present? Select all that apply.

Select all that apply:

Question18 Requirements

Card 6 reflection — requirements clarification

Now write out your full diagnosis for Card 6 in plain prose. After you submit, the reference answer for each field reveals.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

Question19 External API

Card 7: External API usage (Stack Exchange)

Task: Write code using an unfamiliar third-party API.

Familiar setup, deliberate framing. This prompt is the unaided zero-shot version of the Stack Exchange API task you saw in Lecture 2’s Stack Overflow Challenge and that the lecture worked through in §12.6.

Prompt:

Write Python code that uses the Stack Exchange API to get the number of questions posted per month for the last six months.

Use the correct endpoint and return a dictionary mapping `YYYY-MM` to question count.

Does this prompt use worked examples? (the examples axis)

Question20 External API

Card 7 continued — same Stack Exchange API prompt as above.

Which ADDITIVE techniques are present? Select all that apply.

Select all that apply:

Question21 External API

Card 7 reflection — Stack Exchange API

Now write out your full diagnosis for Card 7 in plain prose. You met this prompt before in Lecture 2’s Stack Overflow Challenge and the lecture walked through it in §12.6; this is the formal strategy + failure-mode + improvement version. After you submit, the reference answer for each field reveals.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

Question22 Structured Extraction

Card 8: Structured output for pipeline integration

Task: Extract machine-readable metadata from a bug report.

Prompt:

Extract the following fields from the bug report and return JSON:

- title: string
- severity: one of [low, medium, high, critical]
- affected_component: string or null
- reproduction_steps: array of strings
- expected_behavior: string or null
- actual_behavior: string or null
- missing_information: array of strings

Bug report:

"Checkout sometimes crashes after I apply a coupon. I expected the discount to be applied, but instead I got a 500 error. This happened yesterday on mobile. I don't know if it also happens on desktop."

Does this prompt use worked examples? (the examples axis)

Question23 Structured Extraction

Card 8 continued — same bug-report extraction prompt as above.

Which ADDITIVE techniques are present? Select all that apply.

Select all that apply:

Question24 Structured Extraction

Card 8 reflection — bug-report extraction

Now write out your full diagnosis for Card 8 in plain prose. After you submit, the reference answer for each field reveals.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

Question25 Architecture

Card 9: Architecture decision support

Task: Compare architectural options.

Prompt:

Act as a pragmatic software architect.

We need to decide how to process image uploads in our web application.

Compare these options:

1. Process synchronously in the request.
2. Store the image and process it in a background worker.
3. Send it to an external image-processing service.

Use this decision rubric:

- latency
- implementation complexity
- operational complexity
- failure handling
- scalability
- cost
- security/privacy
- developer experience

Output:

1. A comparison table.
2. A recommendation for a small startup team.
3. Conditions under which your recommendation would change.
4. Assumptions you are making.

Does this prompt use worked examples? (the examples axis)

Question26 Architecture

Card 9 continued — same architecture-decision prompt as above.

Which ADDITIVE techniques are present? Select all that apply.

Select all that apply:

Question27 Architecture

Card 9 reflection — architecture decision support

Now write out your full diagnosis for Card 9 in plain prose. After you submit, the reference answer for each field reveals.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

Question28 Security

Card 10: Security-sensitive code (JWT middleware)

Task: Add authentication middleware.

Prompt:

Write Express.js middleware that checks whether a request has a valid JWT.

If the token is valid, attach the user ID to `req.userId` and call `next()`.
If invalid, return HTTP 401.

Does this prompt use worked examples? (the examples axis)

Question29 Security

Card 10 continued — same JWT middleware prompt as above.

Which ADDITIVE techniques are present? Select all that apply.

Select all that apply:

Question30 Security

Card 10 reflection — JWT middleware

Now write out your full diagnosis for Card 10 in plain prose. After you submit, the reference answer for each field reveals.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

Question31 Agentic

Card 11: Agentic repository task

Task: Ask an AI coding agent to modify a repository.

Prompt:

Implement issue #214.

Make the necessary changes and commit them.

Stem note. A prompt that merely implies tool use (“commit them”) does not name a tool, so per the tool-augmented decision rule the tool box stays unchecked here. The real point — that this task NEEDS scoped tool use, branch protection, and review — belongs in the reflection, not the graded checkboxes.

Does this prompt use worked examples? (the examples axis)

Question32 Agentic

Card 11 continued — same agentic prompt as above.

Which ADDITIVE techniques are present? Select all that apply.

Select all that apply:

Question33 Agentic

Card 11 reflection — agentic repository task

Now write out your full diagnosis for Card 11 in plain prose. After you submit, the reference answer for each field reveals.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

Question34 Anti-patterns

Card 12: Overuse of chain-of-thought

Task: Classify a bug report.

Prompt:

Think step by step in great detail. Show all your reasoning.

Classify this bug report as one of:
- UI
- backend
- database
- infrastructure
- unclear

Bug report:
"The save button turns gray and nothing happens after I upload a profile picture."

Does this prompt use worked examples? (the examples axis)

Question35 Anti-patterns

Card 12 continued — same chain-of-thought prompt as above.

Which ADDITIVE techniques are present? Select all that apply.

Select all that apply:

Question36 Anti-patterns

Card 12 reflection — over-applied chain-of-thought

Now write out your full diagnosis for Card 12 in plain prose. After you submit, the reference answer for each field reveals.

Write your answer in each field. After you submit, the reference answer reveals. (No automatic grading; your text stays in your browser only.)

© 2026 Dominik Müller   •  Powered by Soopr   •  Theme  Moonwalk