Skip to content
Back to skills

1928 Analyze 71a0640d

BSecurity

Analyze shell scripts with ShellCheck and present findings.

  • 9 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 31, 2026
toolsshellbashgit

Security analysis

B75/100
  • criticalPipes output to a shell interpreter
  • criticalPipes output to a shell interpreter

Pro scans all 2 files and shows the line behind each finding

Scanned May 31, 2026

npx -y skills add tools-only/X-Skills --skill 1928-analyze_71a0640d --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 1928 Analyze 71a0640d?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 1928 Analyze 71a0640d
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-1928-analyze-71a0640d/badge)](https://www.skillsdirectory.com/skills/tools-only-1928-analyze-71a0640d)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Analyze Workflow

Analyze shell scripts with ShellCheck and present findings.

## Trigger

- "shellcheck this script"
- "lint my shell script"
- "check for shell errors"
- "analyze bash script"

## Process

### 1. Identify Scripts

Find shell scripts to analyze:

```bash
# Single file provided
shellcheck "$FILE"

# Find all scripts in directory
find . -type f \( -name "*.sh" -o -name "*.bash" -o -name "*.zsh" \) ! -path "./.git/*"

# Or detect by shebang
find . -type f ! -path "./.git/*" -exec sh -c '
    head -1 "$1" | grep -qE "^#!.*(bash|sh|zsh|ksh)" && echo "$1"
' _ {} \;
```

### 2. Run ShellCheck

```bash
# JSON output for parsing
shellcheck -f json "$SCRIPTS" 2>/dev/null

# GCC format for quick viewing
shellcheck -f gcc "$SCRIPTS"

# With all optional checks enabled
shellcheck -o all -f json "$SCRIPTS"
```

### 3. Parse and Present Results

Group findings by severity:

```bash
# Count by severity
shellcheck -f json script.sh | jq 'group_by(.level) | map({level: .[0].level, count: length})'
```

### 4. Output Format

Present findings in structured format:

```markdown
## ShellCheck Analysis: script.sh

### Summary
- **Errors:** 2
- **Warnings:** 5
- **Info:** 3
- **Style:** 1

### Findings

#### Errors (Must Fix)

**SC2086** (line 15): Double quote to prevent globbing and word splitting.
```bash
# Line 15
echo $variable
# Fix
echo "$variable"
```
[Wiki: SC2086](https://www.shellcheck.net/wiki/SC2086)

#### Warnings

**SC2046** (line 23): Quote this to prevent word splitting.
```bash
# Line 23
files=$(ls *.txt)
# Fix
files="$(ls *.txt)"
```
[Wiki: SC2046](https://www.shellcheck.net/wiki/SC2046)

### Quick Fixes

Apply auto-fixes with:
```bash
shellcheck -f diff script.sh | patch -p1
```
```

## Example Invocations

```bash
# Basic analysis
shellcheck script.sh

# Strict analysis (all checks)
shellcheck -o all -S warning script.sh

# Check multiple files
shellcheck scripts/*.sh

# Recursive directory
find . -name "*.sh" -exec shellcheck {} +

# With specific shell
shellcheck -s bash script.sh
```

## Integration with Workflows

After analysis, suggest:

1. **Auto-fix available issues:**
   ```bash
   shellcheck -f diff script.sh | patch -p1
   ```

2. **Configure suppressions** for false positives

3. **Set up pre-commit hook** for continuous validation

Files in this skill

  • README.md885 B
  • skill.md2.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.