format

format is a command for coding agents from HKTITAN/cursor-best-practices. It costs 0 tokens per session (277 once invoked), scanned A, original, MIT.

A command that applies the project's code-formatting rules using the formatter configured for the language or repository. Code formatting changes layout and style without changing its intended behavior.

In plain words
What is it for?
Use it to format selected files, changed files, or a wider project scope with tools such as Prettier, Black, rustfmt, or gofmt.
Why use it?
It saves time spent fixing whitespace and style differences and checks that the result remains consistently formatted.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/hktitan/cursor-best-practices/format
Clone the repo
git clone --depth 1 https://github.com/HKTITAN/cursor-best-practices

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for format

README.md
[![agentmods](https://agentmods.dev/badge/commands/hktitan/cursor-best-practices/format.svg)](https://agentmods.dev/commands/hktitan/cursor-best-practices/format)
Your own site
<a href="https://agentmods.dev/commands/hktitan/cursor-best-practices/format"><img src="https://agentmods.dev/badge/commands/hktitan/cursor-best-practices/format.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 277 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00277
Opus 5 $0.00000 $0.00138
Sonnet 5 $0.00000 $0.00055
Haiku 4.5 $0.00000 $0.00028

Measured 3d ago against content hash 2bf8422cdc7b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

format scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

cursor-best-practices/assets/templates/commands/format.md · 28 lines

What it actually says

Format code according to the project's formatting standards.

Steps

  1. Identify formatter

    • Check for project formatters (e.g. Prettier, Black, rustfmt, gofmt, prettier, dprint).
    • Look for configuration files (.prettierrc, pyproject.toml, rustfmt.toml, etc.).
  2. Format files

    • If I @-mentioned specific files, format only those.
    • Otherwise, format all files in the current scope (changed files, or entire project if requested).
    • Use the appropriate command (e.g. prettier --write, black ., cargo fmt, gofmt -w).
  3. Verify formatting

    • Re-run formatter to ensure all files are properly formatted.
    • Check that no formatting conflicts exist.
  4. Report

    • List which files were formatted.
    • Note any files that couldn't be formatted (e.g. unsupported file types).
    • If formatting changed behavior or structure, note it.

Rules

  • Apply project rules from .cursor/rules or AGENTS.md when relevant (e.g. formatting style preferences).
  • Preserve code functionality; formatting should only change whitespace and style, not logic.
  • If the project doesn't have a formatter configured, suggest setting one up.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 28 lines · 0 tokens per session scan A 2bf8422cdc7b

Subscribe to this mod's changes

format is a command published in the GitHub repository HKTITAN/cursor-best-practices (5 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 277 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.