---
name: whitespace
description: Fix trailing whitespace and ensure files end with newlines. Use this skill when preparing code for commit or when whitespace issues are detected.
---

# Whitespace

Fix whitespace issues in source code: trailing whitespace and missing final newlines.

## Actions

### Check for issues (dry-run)
```bash
<skills>/whitespace/scripts/whitespace-check.sh [directory] [extensions]
```

### Fix issues
```bash
<skills>/whitespace/scripts/whitespace-fix.sh [directory] [extensions]
```

Default extensions: `jl,py,js,ts,tsx,rs,go,md,json,yaml,yml,toml,sh`

Default directory: current working directory (`.`)

## What Gets Fixed

1. **Trailing whitespace** - spaces/tabs at end of lines
2. **Final newline** - ensures files end with exactly one newline

## Notes

- Scripts require GNU sed (Linux default, install via `brew install gnu-sed` on macOS)
- Binary files and `.git` directory are excluded
- Always review changes with `git diff` after running
