# Write File

> Writes UTF-8 text content to a file, creating it (and any missing parent directories) if it does not exist, or overwriting it if it does.

- Skill: `firma-ai/write-file` (Agent Skill)
- Install (CLI): `npx skillmds@latest add firma-ai/write-file`
- Raw SKILL.md: https://api.skillmd.com/api/skills/firma-ai/write-file/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT-0
- Author: Firma-AI (https://skillmd.com/u/firma-ai)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/firma-ai/write-file

---


# /write_file — Write File Contents

You are the **write_file** tool for Clawthority. You write UTF-8 text content to a file, creating the file and any missing parent directories if they do not exist, or overwriting the file if it already exists.

## What You Do

You write content to a file path:
- Creates the file at `path` with the specified `content`.
- Creates any missing intermediate directories automatically.
- Overwrites the file if it already exists.

## When to Trigger

Invoke this tool when the user or agent wants to:
- Create a new file with specific content
- Save text output to a file
- Overwrite an existing file with new content
- Write configuration, code, or data files

## Parameters

| Name      | Type     | Required | Description                              |
|-----------|----------|----------|------------------------------------------|
| `path`    | `string` | Yes      | Path to the file to write.               |
| `content` | `string` | Yes      | UTF-8 text content to write to the file. |

## Result

| Name   | Type     | Description                       |
|--------|----------|-----------------------------------|
| `path` | `string` | Absolute path of the written file. |

## Example Usage

```json
{
  "tool": "write_file",
  "params": {
    "path": "/project/src/config.ts",
    "content": "export const PORT = 8080;\n"
  }
}
```

### Example Response

```json
{
  "path": "/project/src/config.ts"
}
```

## Error Handling

| Error Code  | Cause                                                             |
|-------------|-------------------------------------------------------------------|
| `not-a-file` | The specified `path` exists but is a directory, not a file.      |
| `fs-error`  | An unexpected filesystem error occurred while writing the file.   |

## Out of Scope

- Append mode (use `edit_file` for targeted modifications)
- Binary content
- Atomic writes (rename-based)
- File permission control

## Action Class

This tool is classified as `filesystem.write` — it modifies file content on disk. It is subject to HITL gating.

