shell-quality

Format and lint shell scripts using shfmt and shellcheck.

1|Updated Nov 15, 2025
One-click install
npx skills add https://github.com/racurry/neat-little-package --skill shell-quality
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shell-quality
Source: https://github.com/racurry/neat-little-package/tree/main/plugins/mr-sparkle/skills/shell-quality
Command: npx skills add https://github.com/racurry/neat-little-package --skill shell-quality

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Shell scripts require formatting and linting. This skill explains how to use shfmt for formatting and shellcheck for linting, and how to use them together effectively.

Core Features & Use Cases

  • Tool pairing: Always run shfmt (format) then shellcheck (lint)
  • Configuration guidance: EditorConfig and shellcheckrc defaults
  • Practical examples: Catch unquoted variables and typical shell pitfalls

Quick Start

Example user request: Ensure a shell script is properly formatted and linted for portability.

Frequently Asked Questions about shell-quality

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

FAQPage Schema
How do I format and lint shell scripts for quality assurance?

Shell script quality assurance combines formatting with linting. Run shfmt first to format your script, then shellcheck to lint it. This two-step process catches style issues, unquoted variables, and portability problems across Bash, POSIX sh, and related shells.

What's the difference between shfmt and shellcheck, and when do I use each?

shfmt handles formatting—standardizing indentation, spacing, and code structure. shellcheck performs linting—detecting bugs, non-portable constructs, and common shell pitfalls. Always format first with shfmt, then lint with shellcheck to avoid false positives.

How do I configure shfmt and shellcheck for my project?

Both tools read from EditorConfig (.editorconfig) and per-project configuration files. shfmt respects formatting preferences like indentation style and line length, while shellcheck loads its rules from .shellcheckrc. Load your preferences to enforce consistent quality standards across your team.

Can I use shfmt and shellcheck with Bash and POSIX sh in the same project?

Yes. Both shfmt and shellcheck support Bash, POSIX sh, and related shell variants. Configure each tool's dialect settings in EditorConfig or per-project config to handle mixed shells and ensure portability across your scripts.

What do shellcheck error codes (SC###) mean, and how do I interpret them?

shellcheck documents errors as SC-prefixed codes—for example, SC2086 for unquoted variable expansion. Understanding these codes helps you fix underlying shell issues rather than suppressing warnings. The Skill guides common codes to accelerate troubleshooting.

What are common shell script pitfalls that shfmt and shellcheck catch?

Unquoted variables, incorrect quoting, non-portable constructs, and style inconsistencies are frequent issues. shfmt standardizes formatting to prevent accidental errors, while shellcheck detects logic bugs and portability problems before runtime.