🔧Tool Prompts/file-ops
File Write Tool
src/tools/FileWriteTool/prompt.ts
Prompt Engineering Insight
The Write tool prompt is deliberately minimal but uses strong behavioral constraints to steer toward the Edit tool for modifications. The mandatory Read-before-Write prerequisite prevents accidental overwrites. The prohibition against documentation file creation is a notable guardrail that prevents the model from proactively generating unwanted files.
Techniques Used
behavioral-constraintsguardrailstool-use-guidancescope-limiting
prompt
Writes a file to the local filesystem.
Usage:
- This tool will overwrite the existing file if there is one at the provided path.
- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.
- Prefer the Edit tool for modifying existing files — it only sends the diff. Only use this tool to create new files or for complete rewrites.
- NEVER create documentation files (*.md) or README files unless explicitly requested by the User.
- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.
Tags
filewritecreatefilesystemoverwrite
Appears in use cases
This prompt is a step in curated flows that show how pieces of Claude Code connect for real tasks.