json-formatter
Validate, format, and minify JSON files when users request JSON validation, formatting, or ask to validate their JSONs
When & Why to Use This Skill
The JSON Formatter skill is a specialized utility designed to streamline the management of JSON data. It provides essential capabilities for validating syntax integrity, pretty-printing code for enhanced readability, and minifying files for production optimization. By offering precise error reporting with line numbers and safety-first diff previews, it ensures that developers can manipulate complex data structures with confidence and efficiency.
Use Cases
- Debugging Syntax Errors: Quickly locate and resolve structural issues in JSON configuration files or API responses with detailed error messages and line-number references.
- Enhancing Code Readability: Convert compact or unformatted JSON data into a clean, human-readable format using standardized 2-space indentation for easier peer review and documentation.
- Production Payload Optimization: Minify JSON files by removing unnecessary whitespace to reduce file size and improve transmission speeds for web applications and APIs.
- Data Integrity Verification: Automatically validate large JSON datasets before processing or database ingestion to prevent runtime errors caused by malformed data.
- Version Control Safety: Review proposed changes through clear diff previews before writing to disk, ensuring that only intended modifications are applied to sensitive data files.
| name | json-formatter |
|---|---|
| description | Validate, format, and minify JSON files when users request JSON validation, formatting, or ask to validate their JSONs |
| allowed-tools | [Read, Bash] |
JSON Formatter Skill
Format, validate, and minify JSON files with precision and safety.
Capabilities
This skill provides comprehensive JSON processing:
- Validation: Parse and validate JSON syntax, reporting errors with line numbers
- Formatting: Pretty-print JSON with configurable indentation (default 2 spaces)
- Minification: Remove all unnecessary whitespace for production use
- Safety: Always show diffs before writing changes
- Metrics: Report file size before and after operations
Usage
When a user requests JSON processing, this skill:
- Reads the target JSON file
- Validates the syntax
- Asks user preference: format or minify
- Shows the proposed changes
- Reports size difference
- Writes the result
Instructions
For any JSON file operation:
- Always validate before processing
- Use 2-space indentation for formatting
- Preserve UTF-8 encoding
- Show clear error messages with line numbers for invalid JSON
- Never modify files without showing diffs first
- Handle nested objects and arrays correctly
- Support both single files and batch operations