Claude 4 prompt engineering best practices
LLM
prompting
https://docs.claude.com/en/docs/build-with-claude/prompt-engineering/claude-4-best-practices
- Give clear, explicit instructions
- Providing context or motivation behind your instructions
- Explain why you want the task done.
- Give good examples
- using Claude in an agent harness that compacts context or allows saving context to external files (like in Claude Code), tell it:
- Your context window will be automatically compacted as it approaches its limit, allowing you to continue working indefinitely from where you left off. Therefore, do not stop tasks early due to token budget concerns. As you approach your token budget limit, save your current progress and state to memory before the context window refreshes. Always be as persistent and autonomous as possible and complete tasks fully, even if the end of your budget is approaching. Never artificially stop any task early regardless of the context remaining.
- “tasks spanning multiple context windows”
- Is that like projects? Or with agents?
- Set things up in the first context window.