Agent skill
shellcheck
Lint and fix shell script issues using ShellCheck. Use when the user says "check this script", "lint shell", "shellcheck", "fix script warnings", "validate bash", or asks to review a shell script for issues.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/shellcheck-mhalder-dotfiles
SKILL.md
ShellCheck
Lint shell scripts and fix common issues using ShellCheck.
Instructions
- Run ShellCheck on the script
- Analyze findings by severity
- Explain each issue clearly
- Provide fixes for each issue
Run ShellCheck
# Basic check
shellcheck script.sh
# With severity filter
shellcheck --severity=warning script.sh
# Specific shell dialect
shellcheck --shell=bash script.sh
# Output formats
shellcheck --format=json script.sh
shellcheck --format=gcc script.sh
# Check multiple files
shellcheck *.sh
Common issues and fixes
SC2086: Double quote to prevent globbing
# Bad
rm $file
echo $var
# Good
rm "$file"
echo "$var"
SC2046: Quote command substitution
# Bad
rm $(find . -name "*.tmp")
# Good
rm "$(find . -name "*.tmp")"
# Or for multiple results:
find . -name "*.tmp" -delete
SC2006: Use $() instead of backticks
# Bad
date=`date`
# Good
date=$(date)
SC2164: Use cd ... || exit
# Bad
cd /some/dir
do_something
# Good
cd /some/dir || exit 1
do_something
SC2155: Declare and assign separately
# Bad
local var=$(command)
# Good
local var
var=$(command)
SC2162: Read without -r mangles backslashes
# Bad
read line
# Good
read -r line
SC2034: Variable appears unused
# Check if it's exported or used in eval/source
# Or prefix with _ to indicate intentionally unused
_unused_var="value"
Disable warnings
# Disable for next line
# shellcheck disable=SC2086
echo $unquoted_var
# Disable for entire file (at top)
# shellcheck disable=SC2034,SC2086
# Disable for block
# shellcheck disable=SC2086
{
echo $var1
echo $var2
}
Output format
## Issues Found
### Errors (must fix)
- Line 10, SC2086: Double quote to prevent globbing and word splitting
### Warnings (should fix)
- Line 15, SC2155: Declare and assign separately to avoid masking return values
### Suggestions
- Line 20, SC2034: UNUSED_VAR appears unused (verify or prefix with _)
## Fixed Code
[Show corrected version]
Rules
- MUST run shellcheck before reviewing manually
- MUST explain why each issue matters
- MUST provide specific fix for each issue
- Never ignore errors (SC level error)
- Always explain when disabling is appropriate
- Offer to auto-fix simple issues with Edit tool
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
riot-games
Manage Riot Games account, track stats across League, Valorant, and more
parcel
Provides comprehensive guidance for Parcel bundler including zero-configuration setup, asset handling, hot module replacement, and production builds. Use when the user asks about Parcel, needs to set up a build tool quickly, or work with Parcel's automatic configuration.
bbs
Manage issues with The Fold's CAS-native BBS (Bulletin Board System). Use for creating, updating, searching, and tracking issues. Invoke when the user wants to create tickets, find work, check issue status, or manage dependencies.
jito-bundles-and-priority-fees
Master Jito bundles for MEV protection and priority fee optimization on Solana - bundle submission, tip strategies, and transaction landing. Use for trading bots, high-priority transactions, and MEV-aware applications.
observability-monitoring-monitor-setup
You are a monitoring and observability expert specializing in implementing comprehensive monitoring solutions. Set up metrics collection, distributed tracing, log aggregation, and create insightful da
makefile-review
Didn't find tool you were looking for?