# shfmt

Format shell scripts consistently

Select a shell dialect and indentation convention. Compare tracked scripts with formatter output in CI so formatting changes stay reviewable.

Category: Formatting
Languages: Shell

## Standard evidence

Rubric v1 · 3/8 verified · 5 unknown · 0 contrary · reviewed 2026-11-28

- **Definition** (unknown) — No reviewed evidence is recorded for this dimension.
- **Measurement** (verified) — The documented shfmt -d invocation emits a diff against the formatter's result without editing the shell files. Reviewed 2026-11-28. [Source](https://raw.githubusercontent.com/mvdan/sh/master/cmd/shfmt/shfmt.1.scd)
- **Conformance** (unknown) — No reviewed evidence is recorded for this dimension.
- **CI enforcement** (verified) — Seikika’s shell regression job enforces shfmt formatting on Bats files before executing the tests. Reviewed 2026-11-28. [Source](https://github.com/seikika/seikika/blob/83a633f9f01eab75d8260695af8a1c02b47dd12c/.github/workflows/ci.yml#L54-L57)
- **Getting started** (unknown) — No reviewed evidence is recorded for this dimension.
- **Real-world adoption** (verified) — Seikika’s shell regression job enforces shfmt formatting on Bats files before executing the tests. Reviewed 2026-11-28. [Source](https://github.com/seikika/seikika/blob/83a633f9f01eab75d8260695af8a1c02b47dd12c/.github/workflows/ci.yml#L54-L57)
- **Agent guidance** (unknown) — No reviewed evidence is recorded for this dimension.
- **Agent portability** (unknown) — No reviewed evidence is recorded for this dimension.

## Adoption

Use shfmt in this repository to meet this standard: Format shell scripts consistently. Select a shell dialect and indentation convention. Compare tracked scripts with formatter output in CI so formatting changes stay reviewable. Inspect the repository configuration, record the baseline and exact reproduction steps, then add the smallest repeatable check that detects a regression.

### Seikika package

[shell (Seikika kit)](https://github.com/seikika/seikika/tree/89eb0a2fcd2ffe67151df43f2a062ebc8a1e497c/packages/shell)

Add github:seikika/seikika/packages/shell@89eb0a2fcd2ffe67151df43f2a062ebc8a1e497c to the include list in .seikika/seikika.yaml. Copy check-shell.py from the pinned package into tools/ and set the command parameter to invoke it on your shell script paths. Run seikika install .seikika from the checkout root.

## References

- [Tool documentation](https://github.com/mvdan/sh)
- [Agent skill](/skills/shfmt/SKILL.md)
