agentleFS
benshapyrobenshapyro/cadre-devkit-claude/skills/code-formatter/SKILL.md

code-formatter

Skill9 starsChanged 12 months agoMITView on GitHub

Formats code according to Ben's style guidelines for TypeScript, Python, and general best practices. Use when formatting code, fixing linting issues, checking naming conventions, organizing imports, or when user mentions formatting, style, linting, Prettier, Black, or ESLint.

  • Reads credentials

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 13 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use trailing commas for multi-line objects and arrays

    line 45
  2. Very specific:

    Use explicit imports (no wildcard *)

    line 70
  3. Very specific:

    Prefer async/await over .then() chains

    line 85
  4. Very specific:

    Avoid any type (use unknown if type is truly unknown)

    line 102
  5. Distinctive:

    Use type annotations for function parameters and returns

    line 104
  6. Distinctive:

    Use type hints where beneficial

    line 130
  7. Distinctive:

    Write comments only for non-obvious logic

    line 151
  8. Distinctive:

    Keep comments updated with code changes

    line 153
  9. Distinctive:

    Check file naming convention

    line 213
  10. Distinctive:

    Verify variable/class naming follows standards

    line 214
  11. Distinctive:

    Ensure imports are explicit and properly ordered

    line 215
  12. Distinctive:

    Check line length (max 100 chars)

    line 216
  13. Distinctive:

    Add trailing commas to multi-line structures

    line 217
  14. Distinctive:

    Add type annotations where missing (TypeScript/Python)

    line 219
  15. Distinctive:

    Remove unnecessary comments, add helpful ones

    line 220
  16. Distinctive:

    Always provide a summary of changes made and reasoning for significant modifications.

    line 223

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Code Formatter Skill

Apply consistent code formatting and style according to established guidelines.

Formatting Standards

File Naming

  • All files: lowercase_with_underscores
  • Examples: user_service.py, api_client.ts, data_helper.js

Variable Naming

  • Variables/Functions: camelCase
  • Classes/Components: PascalCase
  • Constants: UPPER_CASE_SNAKE_CASE
// Good
const userName = 'John';
const API_KEY = 'secret';

class UserService {}
function getUserData() {}

// Bad
const UserName = 'John';
const api_key = 'secret';

class userService {}
function get_user_data() {}

Code Style

Line Length

  • Maximum 100 characters per line
  • Break long lines logically at operators or delimiters

Commas

  • Use trailing commas for multi-line objects and arrays
// Good
const config = {
  host: 'localhost',
  port: 3000,
  timeout: 5000,  // trailing comma
};

const items = [
  'first',
  'second',
  'third',  // trailing comma
];

// Bad
const config = {
  host: 'localhost',
  port: 3000,
  timeout: 5000  // missing trailing comma
};

Imports

  • Use explicit imports (no wildcard *)
  • ES Modules only (no require)
  • Group imports: external libraries first, then internal modules
// Good
import { useState, useEffect } from 'react';
import { fetchUser } from '../api/users';

// Bad
import * from 'react';
const users = require('../api/users');

Async/Await

  • Prefer async/await over .then() chains
// Good
async function fetchData() {
  const response = await apiClient.get('/data');
  return response.data;
}

// Bad
function fetchData() {
  return apiClient.get('/data').then(res => res.data);
}

TypeScript Standards

  • Enable strict mode
  • Avoid any type (use unknown if type is truly unknown)
  • Define interfaces for object shapes
  • Use type annotations for function parameters and returns
// Good
interface User {
  id: number;
  name: string;
  email: string;
}

async function getUser(id: number): Promise<User> {
  const response = await fetch(`/api/users/${id}`);
  return response.json();
}

// Bad
async function getUser(id) {
  const response = await fetch(`/api/users/${id}`);
  return response.json();
}

Python Standards (PEP 8)

  • 4 spaces for indentation (no tabs)
  • Snake_case for functions and variables
  • PascalCase for classes
  • Use type hints where beneficial
# Good
def calculate_total(items: list[dict]) -> float:
    """Calculate total price of items."""
    return sum(item['price'] for item in items)

class UserService:
    """Service for user operations."""
    pass

# Bad
def CalculateTotal(items):
    return sum(item['price'] for item in items)

class user_service:
    pass

Comments

  • Write comments only for non-obvious logic
  • Explain "why" not "what"
  • Keep comments updated with code changes
// Good
// Use exponential backoff to avoid overwhelming the API during outages
const retryDelay = Math.pow(2, attemptNumber) * 1000;

// Bad
// Set retry delay
const retryDelay = Math.pow(2, attemptNumber) * 1000;

Formatting Tools

JavaScript/TypeScript

  • Prettier: For consistent formatting
  • ESLint: For code quality and style enforcement
# Format with Prettier
npx prettier --write "src/**/*.{ts,tsx,js,jsx}"

# Lint with ESLint
npx eslint src/ --fix

Python

  • Black: For formatting
  • isort: For import sorting
# Format code
black .

# Sort imports
isort .

# Both together
black . && isort .

Common Formatting Issues

Fix These Automatically

  1. Inconsistent indentation
  2. Missing trailing commas
  3. Lines exceeding 100 characters
  4. Inconsistent quote styles (prefer single quotes for TS, double for Python)
  5. Extra whitespace
  6. Import ordering

Require Manual Review

  1. Complex expressions that need breaking
  2. Unclear variable names
  3. Missing type annotations
  4. Ambiguous logic requiring comments

Formatting Process

When formatting code:

  1. Check file naming convention
  2. Verify variable/class naming follows standards
  3. Ensure imports are explicit and properly ordered
  4. Check line length (max 100 chars)
  5. Add trailing commas to multi-line structures
  6. Replace .then() with async/await
  7. Add type annotations where missing (TypeScript/Python)
  8. Remove unnecessary comments, add helpful ones
  9. Verify consistent indentation

Always provide a summary of changes made and reasoning for significant modifications.


Version

  • v1.1.0 (2025-12-05): Added allowed-tools restriction, enriched trigger keywords
  • v1.0.0 (2025-11-15): Initial version

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.