shellcheck — скилл для Claude Code: что делает и как установить
Скилл shellcheck находит синтаксические ошибки, проблемы с кавычками и несовместимости с POSIX в bash- и sh-скриптах, а также генерирует готовые diff-исправления.
MIT 129 установок ★ 17 обновлён 2026-10-14
npx skills add julianobarbosa/claude-code-skills --skill shellcheck -a claude-codeЧто делает shellcheck
Скилл маршрутизирует задачи статического анализа shell-скриптов по четырём сценариям: проверка (Analyze), исправление (Fix), настройка проекта (Setup) и разбор кодов ошибок (Explain). При выполнении рабочих процессов он отправляет оповещения на локальный вебхук http://localhost:8888/notify.
Инструмент проверяет скрипты на базе ShellCheck: находит неэкранированные переменные (SC2086, SC2046), неиспользуемые параметры (SC2034) и проблемы синтаксиса. Диалект интерпретатора определяется строго по шебангу, поэтому файл с #!/bin/sh не пропустит специфичные для bash массивы или конструкцию [[ ]].
Подключаемые через source библиотеки анализируются только при наличии флага -x или явных директив # shellcheck source=.... Если в скрипте нарушен синтаксис, автоматическая генерация патчей через -f diff не сработает до ручного устранения ошибок парсинга.
Какие задачи решает
- найти пропущенные кавычки и ошибки разделения слов в bash-скриптах
- настроить конфигурационный файл
.shellcheckrcи pre-commit хуки - расшифровать коды предупреждений вроде SC2086
- сгенерировать и применить diff-патчи к проблемным сценариям
Примеры запросов агенту
- Проверь скрипт deploy.sh через shellcheck и покажи ошибки
- Исправь ошибки shellcheck в директории scripts/
- Объясни код ошибки SC2086 и покажи примеры исправления
Как установить shellcheck
1Через Skills CLI (Vercel)
npx skills add julianobarbosa/claude-code-skills --skill shellcheck -a claude-code2Вручную: положить файлы
~/.claude/skills/shellcheck/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/shellcheck/
1Через Skills CLI (Vercel)
npx skills add julianobarbosa/claude-code-skills --skill shellcheck -a codex2Вручную: положить файлы
.agents/skills/shellcheck/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add julianobarbosa/claude-code-skills --skill shellcheck -a cursor2Вручную: положить файлы
.cursor/skills/shellcheck/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install julianobarbosa/claude-code-skills skills/shellcheck2Вручную: положить файлы
.github/skills/shellcheck/SKILL.md1Через Skills CLI (Vercel)
npx skills add julianobarbosa/claude-code-skills --skill shellcheck -a gemini-cli2Командой платформы
gemini skills install https://github.com/julianobarbosa/claude-code-skills --path skills/shellcheckВручную: положить файлы
.devin/skills/shellcheck/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add julianobarbosa/claude-code-skills --skill shellcheck -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о shellcheck
Как установить shellcheck в Claude Code?
Выполните команду npx skills add julianobarbosa/claude-code-skills --skill shellcheck -a claude-code. Конфигурация сохранится в ~/.claude/skills/shellcheck/SKILL.md.
Что делает скилл shellcheck?
Он связывает ассистента со статическим анализатором ShellCheck, позволяя находить ошибки в скриптах bash и sh, применять исправления и генерировать настройки линтера.
Почему анализ пропускает файлы, подключённые через source?
ShellCheck не отслеживает внешние файлы по умолчанию. Для их включения нужно запускать утилиту с ключом -x или добавлять в код директиву # shellcheck source=./lib.sh.
Исходный текст
SKILL.md · MIT
---
name: shellcheck
description: 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.
---
# 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:**
1. **Send voice notification**:
```bash
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 &
```
2. **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
```bash
# 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
```bash
# 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 -p` introspection, or sourced into another script trigger "unused" false positives. Use `# shellcheck disable=SC2034` with a comment explaining the indirection — don't silence globally.
- **Shebang determines the dialect, not the filename:** `script.sh` with `#!/bin/sh` is checked as POSIX sh and rejects bashisms like `[[ ]]` or arrays. Either set the correct shebang or pass `-s bash` explicitly; never rely on the `.sh` extension.
- **`shellcheck -e SC2086,SC2046` in `.shellcheckrc` hides 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 `-x` flag:** `source ./lib.sh` is not analyzed by default. Run with `shellcheck -x script.sh` for full coverage, or add `# shellcheck source=./lib.sh` directives. CI configs frequently miss this and ship un-linted sourced files.
- **`-f diff` patches assume the script parses cleanly:** Syntax errors prevent the auto-fix output entirely, with no clear message. If `-f diff` produces nothing, run without `-f` first and fix parse errors before re-running for patches.
© julianobarbosa · MIT · julianobarbosa/claude-code-skills