posix-shell-validator

Validate scripts for POSIX compliance with portability checks, bashism detection, and cross-platform compatibility.

509 stars

Best use case

posix-shell-validator is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Validate scripts for POSIX compliance with portability checks, bashism detection, and cross-platform compatibility.

Teams using posix-shell-validator should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/posix-shell-validator/SKILL.md --create-dirs "https://raw.githubusercontent.com/a5c-ai/babysitter/main/library/specializations/cli-mcp-development/skills/posix-shell-validator/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/posix-shell-validator/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How posix-shell-validator Compares

Feature / Agentposix-shell-validatorStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Validate scripts for POSIX compliance with portability checks, bashism detection, and cross-platform compatibility.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# POSIX Shell Validator

Validate scripts for POSIX compliance and portability.

## Capabilities

- Detect bashisms in shell scripts
- Validate POSIX compliance
- Check cross-platform compatibility
- Identify non-portable constructs
- Generate compliance reports
- Suggest portable alternatives

## Usage

Invoke this skill when you need to:
- Validate scripts for POSIX compliance
- Detect bashisms before deployment
- Ensure cross-platform compatibility
- Generate compliance reports

## Common Bashisms to Avoid

```bash
# Bashism → POSIX Alternative

# Arrays
arr=(a b c)           # Use: set -- a b c; or newline-separated
${arr[0]}             # Use: $1 (after set --)

# [[ ]] test
[[ $x == y ]]         # Use: [ "$x" = "y" ]
[[ $x =~ regex ]]     # Use: case or expr

# String substitution
${var/old/new}        # Use: $(echo "$var" | sed 's/old/new/')
${var,,}              # Use: $(echo "$var" | tr '[:upper:]' '[:lower:]')
${var^^}              # Use: $(echo "$var" | tr '[:lower:]' '[:upper:]')

# Arithmetic
((x++))               # Use: x=$((x + 1))
$((x**2))             # Use: $(expr $x \* $x) or awk

# Here strings
cat <<< "$var"        # Use: echo "$var" | cat

# Process substitution
diff <(cmd1) <(cmd2)  # Use: temp files

# Brace expansion
{1..10}               # Use: seq 1 10
file.{txt,md}         # Use: file.txt file.md

# Local variables
local var             # Use: var= (function-scoped in many shells)

# Source
source file           # Use: . file

# Function syntax
function name { }     # Use: name() { }
```

## Validation Script

```bash
#!/bin/sh
# POSIX compliance validator

check_file() {
    file="$1"
    errors=0

    # Check shebang
    head -1 "$file" | grep -q '^#!/bin/bash' && {
        echo "WARNING: $file uses bash shebang"
        errors=$((errors + 1))
    }

    # Check for bashisms
    bashisms='
        \[\[
        \(\(
        \$\{[^}]*//
        \$\{[^}]*,,
        \$\{[^}]*\^\^
        \$\{[^}]*:[-+=?][^}]*\}
        <<<
        <\(
        >\(
        \{[0-9]+\.\.[0-9]+\}
        function[[:space:]]+[a-zA-Z_]
        source[[:space:]]
        declare[[:space:]]
        local[[:space:]]
        readonly[[:space:]]
    '

    for pattern in $bashisms; do
        if grep -En "$pattern" "$file" 2>/dev/null; then
            echo "BASHISM: $file contains: $pattern"
            errors=$((errors + 1))
        fi
    done

    return $errors
}

# Run checkbashisms if available
if command -v checkbashisms >/dev/null 2>&1; then
    checkbashisms -f "$1"
else
    check_file "$1"
fi
```

## Target Processes

- shell-script-development
- cross-platform-cli-compatibility
- cli-unit-integration-testing

Related Skills

design-system-validator

509
from a5c-ai/babysitter

Validate design system compliance in code and detect token usage violations

link-validator

509
from a5c-ai/babysitter

Comprehensive link checking and validation for documentation. Validate internal links, external URLs, anchors, detect redirects, monitor link rot, and generate sitemap validation reports.

code-sample-validator

509
from a5c-ai/babysitter

Extract, validate, and test code samples in documentation. Verify syntax, execute samples, check outputs, validate imports, and ensure code samples are up-to-date with current APIs.

openapi-validator

509
from a5c-ai/babysitter

Validate OpenAPI specifications for correctness, security, and best practices

k8s-validator

509
from a5c-ai/babysitter

Validate Kubernetes manifests for security, best practices, and resource limits

specialization-validator

509
from a5c-ai/babysitter

Validate specialization completeness across all 7 phases, score each phase, identify gaps, and generate validation reports.

process-validator

509
from a5c-ai/babysitter

Validate process JS files for correct SDK patterns, task definitions, syntax, and quality gate implementation.

checklist-validator

509
from a5c-ai/babysitter

Skill for validating research against reporting checklists

math-notation-validator

509
from a5c-ai/babysitter

Validate and standardize mathematical notation

image-algorithm-validator

509
from a5c-ai/babysitter

Medical image processing algorithm validation skill for segmentation, detection, and analysis algorithms

dicom-conformance-validator

509
from a5c-ai/babysitter

DICOM conformance testing and integration skill for medical imaging systems

hipaa-compliance-validator

509
from a5c-ai/babysitter

HIPAA compliance validation skill for genomic data handling and audit