# 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.
  - Can two readers identify the same obligation? [Contribute evidence](https://github.com/seikika/seikika/issues/new?title=Evidence+review+%C2%B7+shfmt+%C2%B7+Definition&body=Practice%3A+shfmt%0ACriterion%3A+definition+%28rubric+v1%29%0ACan+two+readers+identify+the+same+obligation%3F%0A%0APublished+judgment%3A+unknown%0ANo+reviewed+evidence+is+recorded+for+this+dimension.%0A%0AProposed+judgment+and+rationale%3A%0A%0APublic+source+or+reproduction+%28include+version%2C+inputs+and+observed+result%29%3A)
- **Measurement** (verified) — The documented shfmt -d invocation emits a diff against the formatter's result without editing the shell files. Reviewed 2026-11-28. [Cited source](https://raw.githubusercontent.com/mvdan/sh/master/cmd/shfmt/shfmt.1.scd)
- **Conformance** (unknown) — No reviewed evidence is recorded for this dimension.
  - What would demonstrate a violation? [Contribute evidence](https://github.com/seikika/seikika/issues/new?title=Evidence+review+%C2%B7+shfmt+%C2%B7+Conformance&body=Practice%3A+shfmt%0ACriterion%3A+conformance+%28rubric+v1%29%0AWhat+would+demonstrate+a+violation%3F%0A%0APublished+judgment%3A+unknown%0ANo+reviewed+evidence+is+recorded+for+this+dimension.%0A%0AProposed+judgment+and+rationale%3A%0A%0APublic+source+or+reproduction+%28include+version%2C+inputs+and+observed+result%29%3A)
- **CI enforcement** (verified) — Seikika’s shell regression job enforces shfmt formatting on Bats files before executing the tests. Reviewed 2026-11-28. [Cited 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.
  - Can a newcomer complete a first run? [Contribute evidence](https://github.com/seikika/seikika/issues/new?title=Evidence+review+%C2%B7+shfmt+%C2%B7+Getting+started&body=Practice%3A+shfmt%0ACriterion%3A+firstRun+%28rubric+v1%29%0ACan+a+newcomer+complete+a+first+run%3F%0A%0APublished+judgment%3A+unknown%0ANo+reviewed+evidence+is+recorded+for+this+dimension.%0A%0AProposed+judgment+and+rationale%3A%0A%0APublic+source+or+reproduction+%28include+version%2C+inputs+and+observed+result%29%3A)
- **Real-world adoption** (verified) — Seikika’s shell regression job enforces shfmt formatting on Bats files before executing the tests. Reviewed 2026-11-28. [Cited 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.
  - Can an agent act on a specific finding? [Contribute evidence](https://github.com/seikika/seikika/issues/new?title=Evidence+review+%C2%B7+shfmt+%C2%B7+Agent+guidance&body=Practice%3A+shfmt%0ACriterion%3A+guidance+%28rubric+v1%29%0ACan+an+agent+act+on+a+specific+finding%3F%0A%0APublished+judgment%3A+unknown%0ANo+reviewed+evidence+is+recorded+for+this+dimension.%0A%0AProposed+judgment+and+rationale%3A%0A%0APublic+source+or+reproduction+%28include+version%2C+inputs+and+observed+result%29%3A)
- **Agent portability** (unknown) — No reviewed evidence is recorded for this dimension.
  - Does the practice work in two agent harnesses? [Contribute evidence](https://github.com/seikika/seikika/issues/new?title=Evidence+review+%C2%B7+shfmt+%C2%B7+Agent+portability&body=Practice%3A+shfmt%0ACriterion%3A+portability+%28rubric+v1%29%0ADoes+the+practice+work+in+two+agent+harnesses%3F%0A%0APublished+judgment%3A+unknown%0ANo+reviewed+evidence+is+recorded+for+this+dimension.%0A%0AProposed+judgment+and+rationale%3A%0A%0APublic+source+or+reproduction+%28include+version%2C+inputs+and+observed+result%29%3A)

## 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)
