touch_file

Installation
SKILL.md

touch_file

When a Write or Edit tool call fails while trying to create a new file, recover by using touch via the Bash tool to create the empty file first, then retry the Write.

Why this matters

The Write tool can fail when creating new files — often because parent directories don't exist, or the filesystem needs the file to be created differently. Rather than giving up or trying workarounds, a quick mkdir -p + touch reliably sets up the file path so the Write tool succeeds on retry.

Recovery steps

When Write or Edit fails on a new file (not an existing one):

  1. Create parent directories — run mkdir -p <parent-directory> via Bash to ensure the full directory path exists.
  2. Create the empty file — run touch <filepath> via Bash.
  3. Retry the Write — use the Write tool again with the same content. It should succeed now.

You can combine steps 1 and 2:

Related skills

More from trtmn/agent-skills

Installs
3
First Seen
Mar 24, 2026