Claude Prompt Techniques
Define the goal, relevant context and output structure before choosing stylistic language.
#Make the task observable
Instead of “write a program,” specify a Python function taking a list of strings, retaining items longer than five characters and sorting them alphabetically, with type hints and a docstring.
Explain the situation, source materials, audience and constraints. Request JSON, a table, bullets, code or a plan-before-implementation explicitly.
#Separate complex inputs
XML tags or clearly named sections can distinguish background, data, constraints and output format. A relevant role narrows the task:
textYou are a frontend reviewer. Prioritize bugs, regressions and accessibility issues.
Examples are useful for fixed output formats, labels and rewriting patterns.
#Engineering requests
Provide environment/framework details, say whether the task is explanation/review/implementation, list assumptions and request a plan for complex work.
textFirst explain the current state. Then propose a plan. List the files you expect to touch. Only after that, write the code.
#Problem-solving brief
textProblem: [observed behavior] Environment: [relevant versions] Already tried: [attempts and results] Please identify likely causes, propose a bounded solution and explain how to verify it.
#Learning brief
textExplain [concept] for someone with [background]. Include a one-sentence definition, the problem it solves, a basic example and important limitations.
#Common failures
Too many unrelated goals, missing constraints, abstract acceptance criteria and unspecified format weaken the result. Do not assume earlier conversations are available: provide the relevant code and the requested next change. State edge cases and performance requirements where they matter.