core-rewritelisted
Install: claude install-skill AirMile/claude-config
# Rewrite
Rewrite freewritten text in a chosen writing style, or check text for style compliance.
## 1. Parse Input
The argument can take these forms:
- `[style] [text]` — rewrite text
- `[style] @path/to/file.md` — read file, rewrite content
- `check [style] [text|@path]` — compliance check, no rewrite
- `[text]` — ask which style, then rewrite
- (empty) — ask for both style and text
Detection order:
1. If first token equals `check`: set `mode = "check"`, shift it off. Otherwise `mode = "rewrite"`.
2. Discover available styles:
```bash
# Primary: user-owned styles
ls ~/.claude/styles/*.md 2>/dev/null | xargs -I{} basename {} .md
# Fallback if directory is empty or doesn't exist:
ls "$CONFIG_REPO/skills/shared/styles/style-*.md" 2>/dev/null | xargs -I{} basename {} .md | sed 's/^style-//'
```
If no styles are found, output: "No styles configured. Add style files to `~/.claude/styles/` — see `skills/shared/styles/style-example.md` for the format." Then stop.
3. Next token: match against discovered style names. On match, set `style` and shift it off. Otherwise `style = null`.
4. Remaining argument: if it starts with `@`, read the file at that path and use its content as `text`. Otherwise treat the remainder as `text`.
If `style` is null, ask (present the discovered style names as options, using the first non-header line of each style file as its description):
```yaml
header: "Style"
question: "Which writing style?"
options:
- label: "{style-name}"