Skip to content
engineering workbench.by StudyPort Academy
Learning path
Foundations18 minLESSON 02 / 6

Context-rich prompts

01

Understand the idea

"Fix my login" invites a generic essay. Naming expected behavior, constraints, and the failing surface gets help you can actually use.

Why vague prompts fail

A short is not automatically a clear one. "Fix my login" contains a topic and no failure. The model then optimizes for a common essay about authentication in general. That can be fluent and still useless for the cookie that never arrives.

AI Lab · prompt rewrite

"Fix my login" produced a generic essay

Vague prompt

Fix my login. It doesn't work.

Poor output it produced

Authentication is an important part of modern applications. Consider using OAuth 2.0 with a trusted identity provider, hashing passwords with bcrypt, and adding multi-factor authentication. Here is a high-level checklist for secure login flows, session cookies, and JWT best practices...

The pieces of a strong prompt

Pin four things: the symptom, expected versus actual behavior, the stack and failing surface, and constraints. Add what you already tried so the model does not replay dead ends. Those pieces turn a chat into something closer to a bug ticket an engineer could act on.

Vague versus usable asks
ElementVagueUsable
Symptomlogin broken200 JSON ok, no Set-Cookie
Expectedmake it workredirect to /dashboard with wb_session
Stackmy appNext.js route handler + cookie session helper
Constraintsnonekeep cookies; no OAuth migration

Constraints are part of the question

Without constraints, models "helpfully" propose migrations, new libraries, or greenfield rewrites. If you must keep the current session design, say so. Constraints are not rudeness; they are the shape of an acceptable answer.

Relevant code and errors beat summaries

Prefer exact error text and the smallest code that demonstrates the failure. Paraphrases lose the detail a model needs to stay aligned with your runtime. If a header is missing, say the header name. If a status code is wrong, say the number.

Check the reply against what you asked

When the answer arrives, score it against your prompt: did it respect constraints, address the stated symptom, and stay on the named stack? If not, the next message should correct the miss - not accept a polished digression.

02

Mental model

FOLLOW THE VALUE

symptom
expected vs actual
narrow problem

Stop inventing bugs.

01 / 03Trace the transformation

03

Live example

Logs move from a vague ask to the ingredients of a usable prompt.

Opening editor…
LIVE PREVIEW
Console 0

Your console output appears here.

Saved on this deviceJavaScript · ES2022
04

Guided challenge

Name a real constraint

The third log says vibes. Change it to constraints.

Opening editor…
LIVE PREVIEW
Console 0

Your console output appears here.

Saved on this deviceJavaScript · ES2022

EXPECTED CONSOLE OUTPUT

fix my login
expected Set-Cookie; actual 200 without cookie
constraints
stack
usable-prompt

Hints 0/2

    Use all hints or make 3 failed runs (0/3).

    05

    Free sandbox

    Make a variation, test an assumption, or break the example on purpose. This draft is saved separately.

    Opening editor…
    LIVE PREVIEW
    Console 0

    Your console output appears here.

    Saved on this deviceJavaScript · ES2022
    06

    Quiz

    A quick check for understanding. Retry as often as you like; your learning path stays open.

    01What does a strong debugging prompt usually include?
    02Why do vague prompts often get generic output?

    Ready to call this one understood?

    Mark this lesson complete to earn 100 XP. You can always revisit it.

    Sign in to save progress
    Next lesson