
shellcheck
Shell script static analysis and linting. USE WHEN shellcheck, lint shell, bash lint, sh lint, script analysis, shell errors, SC codes, shell best practices. Comprehensive shell script validation with CI/CD integration.
- Installs
- 124
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/julianobarbosa/claude-code-skills --skill shellcheck- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads shellcheck automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
ShellCheck - Shell Script Static Analysis
Auto-routes when user mentions shellcheck, shell linting, bash script analysis, or SC error codes.
Overview
ShellCheck is a GPLv3-licensed static analysis tool that identifies bugs in bash/sh shell scripts. It detects:
- Syntax errors and parsing issues
- Semantic problems causing unexpected behavior
- Quoting issues and word splitting bugs
- POSIX compatibility warnings
- Style and best practice violations
Voice Notification
When executing a workflow, do BOTH:
-
Send voice notification:
curl -s -X POST http://localhost:8888/notify \ -H "Content-Type: application/json" \ -d '{"message": "Running the WORKFLOWNAME workflow from the ShellCheck skill"}' \ > /dev/null 2>&1 & -
Output text notification:
Running the **WorkflowName** workflow from the **ShellCheck** skill...
Workflow Routing
| Workflow | Trigger | File |
|---|---|---|
| Analyze | "shellcheck this", "lint script", "check shell" | Workflows/Analyze.md |
| Fix | "fix shell errors", "apply shellcheck fixes" | Workflows/Fix.md |
| Setup | "setup shellcheck", "configure shellcheck" | Workflows/Setup.md |
| Explain | "explain SC2086", "what is SC code" | Workflows/Explain.md |
Quick Reference
Basic Usage
# Check a script
shellcheck myscript.sh
# Specify shell dialect
shellcheck -s bash myscript.sh
# Exclude specific codes
shellcheck -e SC2086,SC2046 myscript.sh
# Output formats
shellcheck -f gcc myscript.sh # Editor integration
shellcheck -f json myscript.sh # Machine readable
shellcheck -f diff myscript.sh # Auto-fix patches
Common SC Codes
| Code | Issue | Fix |
|---|---|---|
| SC2086 | Unquoted variable | "$var" |
| SC2046 | Unquoted command substitution | "$(cmd)" |
| SC2034 | Unused variable | Remove or export |
| SC2154 | Unassigned variable | Assign or disable |
| SC2155 | Declare and assign separately | Split declaration |
Inline Directives
# Disable for next command
# shellcheck disable=SC2086
echo $var
# Disable for entire file (after shebang)
#!/bin/bash
# shellcheck disable=SC2086,SC2046
Full Documentation
- Error Codes:
SkillSearch('shellcheck error codes')-> loads ErrorCodes.md - Configuration:
SkillSearch('shellcheck config')-> loads Configuration.md - CI/CD Integration:
SkillSearch('shellcheck ci')-> loads Integration.md - Best Practices:
SkillSearch('shellcheck practices')-> loads BestPractices.md
Examples
Example 1: Analyze a script
User: "shellcheck my deploy script"
-> Invokes Analyze workflow
-> Runs shellcheck with JSON output
-> Presents findings grouped by severity
-> Suggests fixes with wiki links
Example 2: Fix common issues
User: "fix the shellcheck errors in scripts/"
-> Invokes Fix workflow
-> Generates diff output
-> Applies fixes interactively
-> Re-runs validation
Example 3: Setup for project
User: "setup shellcheck for this repo"
-> Invokes Setup workflow
-> Creates .shellcheckrc
-> Adds pre-commit hook
-> Configures CI workflow
Example 4: Explain an error code
User: "what does SC2086 mean?"
-> Invokes Explain workflow
-> Fetches wiki documentation
-> Shows examples and fixes
-> Provides context-specific guidance
Gotchas
- SC2086 is wrong inside
[[ ]]: Bash's[[ ]]does not word-split, so[[ -n $var ]]is safe unquoted. Disabling SC2086 on[[ ]]blocks is a sign you're applying the lint to the wrong construct, not a sign the rule is broken. - SC2034 fires on indirectly-used variables: Variables consumed via
${!prefix*}indirection,declare -pintrospection, or sourced into another script trigger "unused" false positives. Use# shellcheck disable=SC2034with a comment explaining the indirection — don't silence globally. - Shebang determines the dialect, not the filename:
script.shwith#!/bin/shis checked as POSIX sh and rejects bashisms like[[ ]]or arrays. Either set the correct shebang or pass-s bashexplicitly; never rely on the.shextension. shellcheck -e SC2086,SC2046in.shellcheckrchides real bugs: Project-wide disables compound — a year later nobody remembers why and unquoted expansions ship to prod. Prefer inline disables with a justification comment over global suppression.- Source-following requires
-xflag:source ./lib.shis not analyzed by default. Run withshellcheck -x script.shfor full coverage, or add# shellcheck source=./lib.shdirectives. CI configs frequently miss this and ship un-linted sourced files. -f diffpatches assume the script parses cleanly: Syntax errors prevent the auto-fix output entirely, with no clear message. If-f diffproduces nothing, run without-ffirst and fix parse errors before re-running for patches.
FAQ
What does the shellcheck skill do?
Shell script static analysis and linting. USE WHEN shellcheck, lint shell, bash lint, sh lint, script analysis, shell errors, SC codes, shell best practices. Comprehensive shell script validation with CI/CD integration.
How do I install shellcheck?
Run npx skills add https://github.com/julianobarbosa/claude-code-skills --skill shellcheck in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/shellcheck/ (personal) or .claude/skills/shellcheck/ (project).
Which AI agents can use shellcheck?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is shellcheck safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains shellcheck?
It is published by julianobarbosa in julianobarbosa/claude-code-skills. It has 124 recorded installs.
More from julianobarbosa/claude-code-skills
markitdown
julianobarbosa/claude-code-skills
Guide for using Microsoft MarkItDown - a Python utility for converting files to Markdown. Use when converting PDF, Word, PowerPoint, Excel, images, audio, HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs, Jupyter notebooks, RSS feeds, or Wikipedia pages to Markdown format. Also use for document processing pipelines, LLM preprocessing, or text extraction tasks.
obsidian-vault-management
julianobarbosa/claude-code-skills
Creates, edits, and manages Obsidian vault content including notes, templates, daily notes, and dataview queries. Use when working with markdown files in an Obsidian vault, creating notes, writing templates, building dataview queries, or organizing knowledge management content.
neovim
julianobarbosa/claude-code-skills
Open the skill to read its SKILL.md instructions.
markitdown-skill
julianobarbosa/claude-code-skills
Guide for using Microsoft MarkItDown - a Python utility for converting files to Markdown. Use when converting PDF, Word, PowerPoint, Excel, images, audio, HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs, Jupyter notebooks, RSS feeds, or Wikipedia pages to Markdown format. Also use for document processing pipelines, LLM preprocessing, or text extraction tasks.
obsidian
julianobarbosa/claude-code-skills
Open the skill to read its SKILL.md instructions.
argocd-advanced
julianobarbosa/claude-code-skills
Open the skill to read its SKILL.md instructions.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.