Agent skill
simple-task
Format and validate JSON data structures. Use when you need to pretty-print JSON, validate syntax, or convert between compact and formatted JSON.
Install this agent skill to your Project
npx add-skill https://github.com/tnez/dot-agents/tree/main/skills/examples/simple-task
SKILL.md
Simple Task - JSON Formatter
Format and validate JSON data structures with consistent styling.
When to Use This Skill
Use this skill when you need to:
- Pretty-print JSON for readability
- Validate JSON syntax
- Convert compact JSON to formatted JSON
- Ensure consistent JSON formatting
- Debug JSON structure issues
Process
Step 1: Receive JSON Input
Accept JSON data in one of these forms:
- Raw JSON string
- JSON file path
- Inline JSON object
Step 2: Validate Syntax
Check if the JSON is valid:
- Attempt to parse the JSON
- Identify syntax errors if present
- Report specific error location and type
Step 3: Format JSON
Apply consistent formatting:
- Use 2-space indentation
- Sort keys alphabetically (optional)
- Ensure trailing newline
Step 4: Output Result
Provide the formatted JSON:
- Display formatted output
- Save to file if requested
- Report any validation errors
Examples
Example 1: Basic Formatting
Input:
{ "name": "John", "age": 30, "city": "New York" }
Process:
- Parse JSON (valid)
- Apply 2-space indentation
- Format output
Expected Output:
{
"name": "John",
"age": 30,
"city": "New York"
}
Example 2: Validation Error
Input:
{ "name": "John", "age": 30 }
Process:
- Attempt to parse
- Detect syntax error (trailing comma)
- Report error location
Expected Output:
Error: Invalid JSON syntax
Line 1, position 25: Unexpected token }
Trailing comma not allowed in JSON
Example 3: Nested Structure
Input:
{
"user": {
"name": "Alice",
"contact": { "email": "alice@example.com", "phone": "555-0123" }
},
"active": true
}
Process:
- Parse complex nested structure
- Apply formatting recursively
- Maintain key order
Expected Output:
{
"user": {
"name": "Alice",
"contact": {
"email": "alice@example.com",
"phone": "555-0123"
}
},
"active": true
}
Best Practices
- Always validate before formatting
- Use consistent indentation (2 spaces recommended)
- Preserve data types (numbers, booleans, null)
- Handle edge cases (empty objects, arrays)
- Provide clear error messages for invalid JSON
Common Pitfalls
- Trailing commas: Not valid in standard JSON
- Single quotes: JSON requires double quotes
- Unquoted keys: Keys must be quoted strings
- Comments: Not supported in standard JSON
- Special characters: Must be properly escaped
Dependencies
No external dependencies required. Uses standard JSON parsing capabilities.
Error Handling
Invalid JSON:
- Report syntax error with location
- Suggest common fixes
- Do not attempt to format
Empty Input:
- Return empty object
{}or array[] - Do not error on empty input
File Not Found:
- Report file path error
- Suggest checking path
- Do not continue processing
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
get-weather
Fetch and display current weather information for a specified location using wttr.in. Use when the user asks for weather conditions, forecasts, or temperature information.
find-local-events
Search for local events, activities, and happenings in a specified location and timeframe. Use when the user asks about events, concerts, festivals, meetups, or things to do in a specific area.
skill-evaluator
Evaluate agent skill quality using rubric-based assessment. Use when assessing skill effectiveness, identifying improvement opportunities, or ensuring quality standards.
skill-browser
Discover, browse, and compare agent skills from repositories. Shows new skills, updates, and helps users find relevant skills. Use when exploring available skills or checking for updates.
install-skill
Install agent skills from various sources including local paths, GitHub URLs, or the dot-agents repository. Use when adding new skills to a project or user environment.
skill-tester
Test and validate agent skills against the Agent Skills Specification v1.0. Use before deploying skills to ensure spec compliance and catch structural issues.
Didn't find tool you were looking for?