shfmt-configuration

Configure shfmt formatting for shell scripts via .shfmt.toml and EditorConfig.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill shfmt-configuration
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shfmt-configuration
Source: https://github.com/TheBushidoCollective/han/tree/main/jutsu/jutsu-shfmt/skills/shfmt-configuration
Command: npx skills add https://github.com/TheBushidoCollective/han --skill shfmt-configuration

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill configures shfmt for shell script formatting, including toml config and EditorConfig integration.

Core Features & Use Cases

  • Configuration Files: Standardized shfmt.toml setup.
  • EditorConfig: Alignment with editor-wide rules.
  • Usage: Enforce consistent shell script formatting across projects.

Quick Start

Add a minimal .shfmt.toml with indentation and shell settings.

Frequently Asked Questions about shfmt-configuration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce consistent shell script formatting across my project?

Shell script formatting consistency is enforced through shfmt configuration. Create a .shfmt.toml file in your project root to define rules like indentation style, shell dialect (bash, posix, mksh, bats), and spacing preferences. These settings apply uniformly to all shell scripts when shfmt runs, eliminating manual formatting decisions across your team.

Can I use shfmt with EditorConfig in my project?

Yes. shfmt integrates with EditorConfig to align shell formatting with editor-wide rules. Map shfmt options like indent_size and binary_next_line to EditorConfig properties in your .editorconfig file. This ensures formatting consistency whether developers use shfmt directly or through their editor.

What shell dialects does shfmt support for formatting?

shfmt supports posix, bash, mksh, and bats shell dialects. You specify the target dialect in .shfmt.toml via the shell setting. This lets you enforce dialect-specific formatting rules—such as function declaration style or command substitution syntax—tailored to your project's shell requirements.

How do I configure indentation and spacing rules for shell scripts?

Configure indentation and spacing in .shfmt.toml using options like indent (number of spaces), space_redirects (spacing around redirects), keep_padding (preserve alignment), and func_next_line (function brace placement). Each option controls specific formatting aspects; combine them to define your team's shell formatting standard.

What takes precedence when shfmt has conflicting configuration sources?

shfmt applies configuration in order of precedence: command-line flags override EditorConfig settings, which override .shfmt.toml defaults. This hierarchy lets you set baseline rules in .shfmt.toml, refine them per-directory in EditorConfig, and override both temporarily via CLI for one-off runs.

Do I need to configure switch-case and binary operator formatting separately?

Yes. shfmt provides separate .shfmt.toml options: switch_case_indent controls case statement indentation, and binary_next_line places binary operators at line start or end. Configure each independently to match your project's style for conditionals and multi-line expressions.