Claude Code Plugins

Community-maintained marketplace

Feedback

quality-fix-formatting

@mvillmow/ml-odyssey
4
0

Automatically fix code formatting issues using mojo format, markdownlint --fix, and pre-commit hooks. Use when formatting checks fail or before committing code.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name quality-fix-formatting
description Automatically fix code formatting issues using mojo format, markdownlint --fix, and pre-commit hooks. Use when formatting checks fail or before committing code.

Fix Formatting Skill

This skill automatically fixes code formatting issues across all file types.

When to Use

  • User asks to fix formatting (e.g., "fix all formatting issues")
  • Pre-commit checks fail due to formatting
  • Before committing code
  • After writing new code
  • CI formatting checks fail

Auto-Fix Capabilities

Mojo Code (100% auto-fix)

# Format all Mojo files
mojo format src/**/*.mojo

# Automatically fixes:
# - Indentation
# - Spacing around operators
# - Line wrapping
# - Blank lines

Markdown (Partial auto-fix)

# Fix markdown issues
npx markdownlint-cli2 --fix "**/*.md"

# Auto-fixes:
# - Some blank line issues
# - Some spacing issues
#
# Manual fixes needed for:
# - Missing language in code blocks
# - Line length (need to reflow text)

Pre-commit Hooks (100% auto-fix)

# Run all pre-commit hooks
pre-commit run --all-files

# Auto-fixes:
# - Trailing whitespace
# - Missing final newline
# - Mixed line endings
# - YAML formatting

Usage

Fix Everything

# Run all formatters
./scripts/fix_all_formatting.sh

# This:
# 1. Formats all Mojo files
# 2. Fixes markdown issues
# 3. Runs pre-commit hooks
# 4. Reports what was fixed

Fix Specific File Type

# Mojo only
./scripts/fix_formatting.sh --mojo

# Markdown only
./scripts/fix_formatting.sh --markdown

# Pre-commit only
./scripts/fix_formatting.sh --precommit

Fix Specific File

# Fix single Mojo file
mojo format src/tensor.mojo

# Fix single markdown file
npx markdownlint-cli2 --fix README.md

# Fix by pre-commit
pre-commit run --files src/tensor.mojo

Workflow

When Formatting Fails

# 1. Run fix-all
./scripts/fix_all_formatting.sh

# 2. Review changes
git diff

# 3. Stage changes
git add .

# 4. Commit
git commit -m "fix: apply code formatting"

Before Committing

# 1. Fix formatting proactively
./scripts/fix_all_formatting.sh

# 2. Add files
git add .

# 3. Commit (pre-commit will run)
git commit -m "feat: new feature"

After CI Failure

# 1. Pull latest changes
git pull

# 2. Fix formatting
./scripts/fix_all_formatting.sh

# 3. Commit and push
git add .
git commit --amend --no-edit
git push --force-with-lease

Common Fixes

Mojo Formatting

Before:

fn add(x:Int,y:Int)->Int:
    return x+y

After:

fn add(x: Int, y: Int) -> Int:
    return x + y

Markdown Formatting

Before:

Some text before.
```text
code block
```
Some text after.

After:

Some text before.

```text
code block
```

Some text after.

Trailing Whitespace

Before:

line with trailing spaces
another line

After:

line with trailing spaces
another line

Manual Fixes Required

Some issues need manual intervention:

Markdown Language Tags

# Before (need to add manually)
```
code here
```

# After
```python
code here
```

Line Length

# Before (too long)
This is a very long line that exceeds the 120 character limit and should be broken into multiple lines.

# After (manually break)
This is a very long line that exceeds the 120 character limit and should be
broken into multiple lines.

Error Handling

Syntax Errors

Error: Cannot format file.mojo due to syntax error

Fix: Correct syntax errors before formatting

Permission Denied

Error: Permission denied: file.mojo

Fix: Check file permissions

Merge Conflicts

Error: File contains merge conflict markers

Fix: Resolve merge conflicts first

Examples

Fix all formatting:

./scripts/fix_all_formatting.sh

Fix only Mojo:

mojo format src/**/*.mojo

Fix only markdown:

npx markdownlint-cli2 --fix "**/*.md"

Fix and commit:

./scripts/fix_all_formatting.sh
git add .
git commit -m "fix: apply code formatting"

Scripts Available

  • scripts/fix_all_formatting.sh - Fix all formatting
  • scripts/fix_formatting.sh - Fix specific types
  • scripts/check_formatting.sh - Check without fixing

Integration with CI

CI checks formatting but doesn't fix:

- name: Check Formatting
  run: |
    mojo format --check src/**/*.mojo
    npx markdownlint-cli2 "**/*.md"

If CI fails, fix locally and push.

Best Practices

  1. Fix before commit - Always format before committing
  2. Use pre-commit - Let hooks auto-fix on commit
  3. Review changes - Check what was formatted
  4. Commit separately - Formatting changes in separate commit
  5. Don't bypass - Don't use --no-verify to skip formatting

Auto-Fix Summary

Tool Auto-Fix Manual Needed
mojo format 100% None
markdownlint 70% Language tags, line length
pre-commit 100% None

See .pre-commit-config.yaml for formatting configuration.