| name | posix-shell-validator |
| description | Validate scripts for POSIX compliance with portability checks, bashism detection, and cross-platform compatibility. |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep |
| graph | {"domains":["domain:software-engineering"],"specializations":["specialization:cli-mcp-development"],"skillAreas":["skill-area:cli-design","skill-area:mcp-server-implementation","skill-area:cross-platform-desktop"],"roles":["role:backend-engineer","role:platform-engineer"],"workflows":["workflow:feature-development"],"topics":["topic:developer-experience"]} |
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
arr=(a b c)
${arr[0]}
[[ $x == y ]]
[[ $x =~ regex ]]
${var/old/new}
${var,,}
${var^^}
((x++))
$((x**2))
cat <<< "$var"
diff <(cmd1) <(cmd2)
{1..10}
file.{txt,md}
local var
source file
function name { }
Validation Script
#!/bin/sh
check_file() {
file="$1"
errors=0
head -1 "$file" | grep -q '^#!/bin/bash' && {
echo "WARNING: $file uses bash shebang"
errors=$((errors + 1))
}
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
}
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