format

Formats bash scripts with shfmt and validates shell and YAML files with shellcheck and yamllint.

Updated Jun 2, 2026
One-click install
npx skills add https://github.com/lfuuu/claude-rules --skill format-lfuuu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: format
Source: https://github.com/lfuuu/claude-rules/tree/main/shared-skills/process/format
Command: npx skills add https://github.com/lfuuu/claude-rules --skill format-lfuuu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires shfmt, shellcheck, yamllint.

What problem does it solve? Bash scripts and YAML configs in the kube_ci repository drift out of style over time, and running formatters blindly on every edit creates noisy diffs or breaks legacy scripts. This Skill applies shfmt, shellcheck, and yamllint in a controlled, on-demand way with repo-specific rules. ## Core Features & Use Cases - Bash formatting with shfmt: Applies shfmt -w -i 4 -ci -sr to *.sh/*.bash files, including extensionless bash files like k8s_defs and productlist_official via forced -ln bash. - Lint and validation: Runs shellcheck (ignoring SC1091 for source ../utils/*.sh patterns) and yamllint on Helm/k8s YAML under minikube_dev/setup/. - Check-only mode: The --check flag performs a dry-run (shfmt -d) for pre-commit verification without modifying files. - Use Case: After mass edits in utils/, run the skill on the whole repo before committing to get a report of changed files, shellcheck warnings, and yamllint issues while skipping gitignored clones under <env>/products/. ## Quick Start Ask the assistant to run the format skill on the utils directory, or on the entire repo with the check flag, to format bash scripts and report shellcheck and yamllint findings.

Frequently Asked Questions about format

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

FAQPage Schema
How do I format bash scripts with shfmt?

Run shfmt with the flags -w -i 4 -ci -sr to write changes in place using 4-space indentation, case alignment, and spaced redirects. Point it at specific *.sh files or directories, and use -d instead of -w for a diff-only dry run.

How to format bash files without a .sh extension using shfmt?

shfmt skips extensionless files by default, so force the language with the -ln bash flag, for example shfmt -ln bash -w -i 4 k8s_defs. This is required for files like k8s_defs and productlist_official in kube_ci.

Which shellcheck warnings should be ignored in legacy bash scripts?

SC1091 is ignored globally because shellcheck cannot resolve relative sources like source ../utils/01-build-push.sh. SC2086 and SC2155 are only fixed in new edits, not mass-applied, to avoid breaking legacy behavior.

Can yamllint automatically fix YAML formatting issues?

No, yamllint only reports issues and cannot rewrite files. It is used here in a relaxed mode (line-length 200, document-start disabled) to check Helm values under minikube_dev/setup/ without enforcing strict style.

What files should not be formatted in this repository?

Do not format clones under <env>/products/**, the local gitignored <env>/productlist file, or generated values_*.yaml files in minikube_dev/setup/. Formatting them creates uncommittable diffs or corrupts working copies of external repos.