
Biome Format
- 3 repo stars
- Updated June 5, 2026
- xtone/ai_development_tools
Automatically runs the Biome formatter on JavaScript and TypeScript files every time they are saved, enforcing consistent code style without manual intervention.
About
biome-format is a Claude Code hook that triggers the Biome code formatter automatically whenever a JavaScript or TypeScript file is saved during a session. It eliminates the need to manually run formatting commands, keeping codebases consistently styled as you work. A developer or team member reaches for it when they want Biome's fast, opinionated formatting to apply silently in the background without interrupting their workflow.
- Biome formatter runs automatically on file save
- Supports JavaScript and TypeScript files
- Zero-configuration hooks integration
- Plugs into Claude Code hooks system
- MIT licensed
Biome Format by the numbers
- Data as of Jul 7, 2026 (Skillselion catalog sync)
/plugin marketplace add xtone/ai_development_tools/plugin install biome-format@xtone-ai-development-toolsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| repo stars | ★ 3 |
|---|---|
| Last updated | June 5, 2026 |
| Repository | xtone/ai_development_tools ↗ |
What it does
Automatically runs the Biome formatter on JavaScript and TypeScript files every time they are saved, enforcing consistent code style without manual intervention.
Who is it for?
JS/TS developers who want Biome formatting applied silently on every save
Skip if: Projects using Prettier or non-JS languages
What you get
- auto-formatted JS/TS files
README.md
Biome Format Hook
JavaScriptおよびTypeScriptファイルの編集時に自動的にBiomeフォーマッターを実行するClaude Code hookです。
機能
- JavaScript/TypeScriptファイル(
.js,.jsx,.ts,.tsx)の編集時に自動的にBiomeフォーマットを実行 - 編集されたファイルのディレクトリから上位ディレクトリへ遡って
biome.jsonを自動検索 - どのカレントディレクトリから実行されても正しく動作
biome.json設定ファイルがある場合のみフォーマットを実行
セットアップ
1. スクリプトの配置
このディレクトリの biome_format.sh を ~/bin/ ディレクトリにコピーします。
$ mkdir -p ~/bin
$ cp biome_format.sh ~/bin/
$ chmod +x ~/bin/biome_format.sh
注意: Claude Code hookは相対パスで指定するとカレントディレクトリが不定であるため正しく実行できないケースがあります。必ず絶対パス(~/bin/biome_format.sh)を使用してください。
2. Claude Code hookの設定
Claude Codeの設定で以下のhookを追加してください:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "~/bin/biome_format.sh"
}
]
}
]
}
}
3. スクリプトの設定(オプション)
必要に応じて、biome_format.sh 内の対象ファイル拡張子を変更できます:
# 対象ファイル拡張子のリスト
TARGET_EXTENSIONS=("ts" "tsx" "js" "jsx")
デフォルトでは、JavaScript/TypeScriptの一般的な拡張子(.js, .jsx, .ts, .tsx)が対象です。
プロジェクトディレクトリの設定は不要です。スクリプトが自動的に編集されたファイルから最も近いbiome.jsonを探します。
前提条件
npx @biomejs/biomeコマンドが実行可能であること- フォーマット対象のファイルまたはその上位ディレクトリに
biome.json設定ファイルが存在すること
動作
- Claude CodeでJavaScript/TypeScriptファイルを編集(Edit, Write, MultiEditツール使用時)
- スクリプトが自動的に実行される
- 対象ファイルがJavaScript/TypeScriptファイルかチェック
- ファイルパスを絶対パスに変換
- 編集されたファイルのディレクトリから上位ディレクトリへ遡って
biome.jsonを検索 biome.jsonが見つかった場合、npx @biomejs/biome format --config-path --writeを実行
biome.json検索の仕組み
スクリプトは編集されたファイルのディレクトリから開始し、ルートディレクトリ(/)に到達するまで親ディレクトリを遡ってbiome.jsonを探します。
最初に見つかったbiome.jsonを使用してフォーマットを実行します。
これにより、モノリポ構造でも各プロジェクトのbiome.jsonを正しく認識できます。
注意事項
- スクリプトファイルに実行権限が必要です(
chmod +x biome_format.sh) - Biomeがプロジェクトにインストールされているか、npxで利用可能である必要があります
- 大きなファイルの場合、フォーマット処理に時間がかかる場合があります