Install
$ agentstack add skill-prasad-nimbalkar-claude-agent-skills-code-formatter ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Code Formatter
Why this skill exists
Every language has a canonical formatter. Using the wrong tool (or formatting by hand) produces inconsistent results. This skill routes to the right formatter for each language and handles common installation issues.
When to use
- User pastes code and wants it formatted/cleaned up
- User uploads a file and asks for style fixes
- User wants code to conform to a specific style guide
Step-by-step procedure
Step 1 — Detect language
# If a file is provided
file /mnt/user-data/uploads/code_file
# or check extension: .py .js .ts .go .rs .sql .json .yaml .html .css
Step 2 — Format by language
Python → black + isort
pip install black isort --break-system-packages -q
# Format in place
black /mnt/user-data/uploads/script.py
isort /mnt/user-data/uploads/script.py
# Preview changes without writing (check mode)
black --check --diff /mnt/user-data/uploads/script.py
Also run flake8 for lint issues:
pip install flake8 --break-system-packages -q
flake8 /mnt/user-data/uploads/script.py --max-line-length=88
JavaScript / TypeScript → prettier
npm install -g prettier --silent
prettier --write /mnt/user-data/uploads/script.js
prettier --write /mnt/user-data/uploads/component.tsx
Go → gofmt
gofmt -w /mnt/user-data/uploads/main.go
# Show diff only (no write):
gofmt -d /mnt/user-data/uploads/main.go
Rust → rustfmt
rustfmt /mnt/user-data/uploads/main.rs
SQL → sqlfluff
pip install sqlfluff --break-system-packages -q
sqlfluff fix /mnt/user-data/uploads/query.sql --dialect postgres
# Dialects: ansi, postgres, mysql, bigquery, snowflake, sqlite
JSON → jq or python
# Pretty print
jq . /mnt/user-data/uploads/data.json > /mnt/user-data/outputs/data_formatted.json
# Python (handles edge cases better)
python3 -c "
import json, sys
with open('/mnt/user-data/uploads/data.json') as f:
data = json.load(f)
with open('/mnt/user-data/outputs/data_formatted.json', 'w') as f:
json.dump(data, f, indent=2, ensure_ascii=False)
print('Done')
"
YAML → yamllint + yq
pip install yamllint --break-system-packages -q
yamllint /mnt/user-data/uploads/config.yaml
# Format/normalize with yq
yq eval '.' /mnt/user-data/uploads/config.yaml > /mnt/user-data/outputs/config_formatted.yaml
HTML / CSS → prettier
prettier --write /mnt/user-data/uploads/index.html
prettier --write /mnt/user-data/uploads/styles.css
Step 3 — Copy result to outputs
cp /mnt/user-data/uploads/script.py /mnt/user-data/outputs/script_formatted.py
echo "Formatted file ready for download"
Step 4 — Report changes
Always tell the user:
- What formatter was used and version
- What changed (lines modified, errors fixed)
- Any remaining lint warnings that require manual fixes
# Show what changed
diff /mnt/user-data/uploads/original.py /mnt/user-data/outputs/script_formatted.py
Edge cases
| Situation | Fix | |-----------|-----| | Formatter not installed | Install inline with pip/npm as shown above | | Syntax error prevents formatting | Report the error location; don't format broken code | | User has custom config (.prettierrc, pyproject.toml) | Ask if they want to upload it; use it if provided | | Mixed language file (e.g., JSX) | Use prettier with --parser babel flag | | Very long lines user wants to keep | black --line-length 120 or prettier --print-width 120 | | SQL dialect unknown | Default to ansi; ask user if result looks wrong |
Output format
Formatted with: black 24.x + isort 5.x
Changes: 47 lines reformatted, 3 imports reordered
Warnings: 2 lines exceed 88 chars (E501) — manual review needed
Output: /mnt/user-data/outputs/script_formatted.py
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: prasad-nimbalkar
- Source: prasad-nimbalkar/claude-agent-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.