Skip to content
Back to skills

Code Formatting 1

ASecurity

Provides code formatting best practices and granular edit operation guidelines. Use when formatting code, making edits to files, or when determining the proper approach for code modifications. Emphasizes using external formatting tools and breaking down large modifications into atomic, sequential edits for reliability.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
developmentjavascripttypescriptpythonrustgojavabashrefactoring

Works with

  • cli

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill code-formatting-1 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Formatting 1?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Formatting 1
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-code-formatting-1/badge)](https://www.skillsdirectory.com/skills/david-li0406-code-formatting-1)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: code-formatting
description: Provides code formatting best practices and granular edit operation guidelines. Use when formatting code, making edits to files, or when determining the proper approach for code modifications. Emphasizes using external formatting tools and breaking down large modifications into atomic, sequential edits for reliability.
---

# Code Formatting and Structure

Guidelines for code formatting and structuring edit operations to ensure reliability and consistency.

## Always Use External Tools for Formatting

- **Use automated formatting tools** consistently - rely on external CLI tools like `jq`, `prettier`, `black`, etc.
- After JSON edits: `jq . file.json > tmp && mv tmp file.json`
- After code edits: Use project-specific formatters (`npm run format`, `black`, `prettier`, etc.)
- This ensures consistent formatting and avoids human error

### Common Formatting Tools by Language

**JavaScript/TypeScript:**
```bash
# Prettier
npx prettier --write file.js

# Project formatter
npm run format
```

**Python:**
```bash
# Black
black file.py

# isort for imports
isort file.py
```

**JSON:**
```bash
# jq for formatting
jq . file.json > tmp && mv tmp file.json
```

**Go:**
```bash
# gofmt
gofmt -w file.go
```

**Rust:**
```bash
# rustfmt
rustfmt file.rs
```

## Granular Edit Operations

**Break down large modifications into atomic, sequential edits:**

- **Single Edit**: Limit to 50-100 lines maximum
- **MultiEdit**: Use 3-5 operations maximum per call
- **Complex changes**: Use multiple `Edit`/`MultiEdit` calls in sequence
- **Failed edits**: Immediately break into smaller operations and retry

### Edit Strategy Pattern

**Instead of this:**
```
// DON'T: Large complex edit
Edit(entire_function)
```

**Do this:**
```
// DO: Sequential granular edits
Edit(function_signature)
Edit(function_body_part1)
Edit(function_body_part2)
```

### When to Break Down Edits

Break down edits when:
- Modifying more than 50-100 lines at once
- Making changes to multiple logical sections
- Refactoring complex functions or classes
- An edit operation fails - immediately retry with smaller chunks

### Benefits of Granular Edits

1. **Higher reliability**: Smaller edits have fewer points of failure
2. **Better error messages**: Easier to identify what went wrong
3. **Incremental progress**: Partial success is better than complete failure
4. **Easier to verify**: Each change can be validated independently

## Workflow Integration

**Typical formatting workflow:**

1. Make code changes using Edit/MultiEdit tools
2. Apply automated formatter for the language
3. Verify formatting is correct
4. Proceed with next changes

**Example:**
```bash
# After editing Python file
black src/module.py

# After editing JavaScript
npx prettier --write src/component.js

# After editing JSON config
jq . config.json > tmp && mv tmp config.json
```

## Key Principle

**Rely on tools for formatting, rely on granularity for reliability.** Never manually format code when automated tools are available, and always prefer smaller, focused edits over large, complex modifications.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…