3. Prompting for developers

8 cards

Review this deck
All cards in this deck

5 components of a good prompt

Context, task, constraints, examples, verification.

Most often skipped component

Verification: a test command, type check, lint or sample output so Claude checks itself before reporting done.

Good debug prompt

Concrete symptom, reproduction command, ask for the root cause before fixing, scope limit, a stop point when it goes out of scope.

Good test-writing prompt

Test the expected behavior in the spec, not what the code currently does; list places where code deviates from the spec instead of fixing them.

Good refactor prompt

Measurable goal, no behavior change, existing tests pass without editing tests, small steps, plan first and wait for approval.

XML tags in prompts

Wrap data (logs, issues, docs) in tags to separate it from instructions; reduces data being mistaken for commands.

Give reasons instead of shouting

"Don't use console.log because it has no request ID" works better than capitals and "EXTREMELY IMPORTANT"; over-emphasis makes the model over-apply.

Review prompt with criteria

Correctness, security, consistency with sibling code (name a reference file), style only when it affects readability; every finding has file:line and severity.

3. Prompting for developers – Flashcards – Claude | Học Dev