shfmt-formatting

Format shell scripts with shfmt across POSIX, Bash, mksh, and Bats dialects.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Standardizes shell script formatting to improve readability and maintain consistency.

Core Features & Use Cases

  • Indentation & Spacing: Consistent indentation and spacing rules.
  • Dialects: POSIX, Bash, mksh, and Bats formatting support.
  • Automation: Integrate with editors and CI pipelines.

Quick Start

Run shfmt on a sample script to reformat it with default options.

Frequently Asked Questions about shfmt-formatting

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

FAQPage Schema
How do I format shell scripts consistently across my project?

Shell script formatting standardizes indentation, spacing, and syntax across POSIX, Bash, mksh, and Bats dialects. shfmt parses scripts into an AST and outputs a canonical format, ensuring consistency without manual effort or project-specific style debates.

Can I automate shell script formatting in my editor?

Yes, shfmt integrates with VS Code, Vim, Neovim, Emacs, and JetBrains IDEs for automated on-save formatting. Configure your editor to run shfmt on shell scripts, eliminating manual reformatting and enabling consistent output across team workflows.

What does shfmt actually format in shell scripts?

shfmt formats indentation, spacing, redirections, here-docs, function declarations, and case statements. It preserves here-doc indentation and important constructs while applying dialect-specific rules, resulting in readable, standardized shell code.

Does shfmt work with POSIX and Bash scripts?

shfmt supports POSIX, Bash, mksh, and Bats dialects. Specify your target dialect and shfmt applies appropriate formatting rules, letting you standardize scripts written in different shell languages within the same project.

Why should I use a formatter instead of manual shell script formatting?

Formatters eliminate style inconsistencies, reduce review friction, and enforce standards automatically. shfmt's AST-based approach ensures correctness across complex constructs like here-docs and nested functions, freeing teams from formatting debates.