refactor: convert json-pretty format skill to command #2
65
plugins/json-pretty/commands/format.md
Normal file
65
plugins/json-pretty/commands/format.md
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
description: "Format, validate, or minify JSON without external online services"
|
||||||
|
allowed-tools: Bash
|
||||||
|
---
|
||||||
|
|
||||||
|
## When to Use
|
||||||
|
|
||||||
|
Use when the user asks to:
|
||||||
|
- "prettify json"
|
||||||
|
- "format json"
|
||||||
|
- "pretty print json"
|
||||||
|
- "validate json"
|
||||||
|
- "clean up json"
|
||||||
|
- Or mentions wanting to format/prettify JSON data
|
||||||
|
|
||||||
|
## Tool Location
|
||||||
|
|
||||||
|
`${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py`
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# From file
|
||||||
|
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py input.json
|
||||||
|
|
||||||
|
# From stdin/pipe
|
||||||
|
cat data.json | python3 ${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py
|
||||||
|
echo '{"foo":"bar"}' | python3 ${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py
|
||||||
|
|
||||||
|
# Save to file
|
||||||
|
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py input.json -o output.json
|
||||||
|
|
||||||
|
# Options
|
||||||
|
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py input.json --indent 4 # Custom indentation
|
||||||
|
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py input.json --sort-keys # Sort object keys
|
||||||
|
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py input.json --compact # Minify instead of prettify
|
||||||
|
```
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
- `-o, --output FILE`: Write to file instead of stdout
|
||||||
|
- `-i, --indent N`: Indentation spaces (default: 2)
|
||||||
|
- `-s, --sort-keys`: Sort object keys alphabetically
|
||||||
|
- `-c, --compact`: Compact output (minify)
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
**Prettify inline JSON:**
|
||||||
|
```bash
|
||||||
|
echo '{"name":"cal","items":[1,2,3]}' | python3 ${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py
|
||||||
|
```
|
||||||
|
|
||||||
|
**Format a file:**
|
||||||
|
```bash
|
||||||
|
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py messy.json -o clean.json
|
||||||
|
```
|
||||||
|
|
||||||
|
**Sort keys and use 4-space indent:**
|
||||||
|
```bash
|
||||||
|
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/json-pretty.py data.json --indent 4 --sort-keys
|
||||||
|
```
|
||||||
|
|
||||||
|
## Privacy Note
|
||||||
|
|
||||||
|
Built specifically to avoid posting potentially sensitive JSON to online prettifier services.
|
||||||
@ -1,67 +0,0 @@
|
|||||||
---
|
|
||||||
name: format
|
|
||||||
description: Format, validate, or minify JSON without external online services
|
|
||||||
---
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
Use when the user asks to:
|
|
||||||
- "prettify json"
|
|
||||||
- "format json"
|
|
||||||
- "pretty print json"
|
|
||||||
- "validate json"
|
|
||||||
- "clean up json"
|
|
||||||
- Or mentions wanting to format/prettify JSON data
|
|
||||||
|
|
||||||
## Tool Location
|
|
||||||
|
|
||||||
`~/.claude/skills/json-pretty/json-pretty.py`
|
|
||||||
|
|
||||||
Symlinked to `~/.local/bin/json-pretty` for PATH access.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# From file
|
|
||||||
json-pretty input.json
|
|
||||||
|
|
||||||
# From stdin/pipe
|
|
||||||
cat data.json | json-pretty
|
|
||||||
echo '{"foo":"bar"}' | json-pretty
|
|
||||||
|
|
||||||
# Save to file
|
|
||||||
json-pretty input.json -o output.json
|
|
||||||
|
|
||||||
# Options
|
|
||||||
json-pretty input.json --indent 4 # Custom indentation
|
|
||||||
json-pretty input.json --sort-keys # Sort object keys
|
|
||||||
json-pretty input.json --compact # Minify instead of prettify
|
|
||||||
```
|
|
||||||
|
|
||||||
## Options
|
|
||||||
|
|
||||||
- `-o, --output FILE`: Write to file instead of stdout
|
|
||||||
- `-i, --indent N`: Indentation spaces (default: 2)
|
|
||||||
- `-s, --sort-keys`: Sort object keys alphabetically
|
|
||||||
- `-c, --compact`: Compact output (minify)
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
**Prettify inline JSON:**
|
|
||||||
```bash
|
|
||||||
echo '{"name":"cal","items":[1,2,3]}' | json-pretty
|
|
||||||
```
|
|
||||||
|
|
||||||
**Format a file:**
|
|
||||||
```bash
|
|
||||||
json-pretty messy.json -o clean.json
|
|
||||||
```
|
|
||||||
|
|
||||||
**Sort keys and use 4-space indent:**
|
|
||||||
```bash
|
|
||||||
json-pretty data.json --indent 4 --sort-keys
|
|
||||||
```
|
|
||||||
|
|
||||||
## Privacy Note
|
|
||||||
|
|
||||||
Built specifically to avoid posting potentially sensitive JSON to online prettifier services.
|
|
||||||
Loading…
Reference in New Issue
Block a user