| name | bash-linux |
| description | Bash/Linux terminal mastery. Shell scripting, piping, stream redirection, process substitution, strict mode (set -euo pipefail), AWK, ripgrep parsing, and robust error handling. Use when writing CI scripts, debugging POSIX environments, or manipulating text pipelines. |
| allowed-tools | Read, Write, Edit, Glob, Grep |
| version | 2.0.0 |
| last-updated | "2026-04-02T00:00:00.000Z" |
| applies-to-model | gemini-2.5-pro, claude-3-7-sonnet |
| routing | {"domain":"general","tier":"basic"} |
Hallucination Traps (Read First)
- ❌ Scripts without
set -euo pipefail -> ✅ Always enable strict mode to catch silent failures
- ❌ Using
[ ] instead of [[ ]] for conditionals -> ✅ [[ ]] handles spaces in variables and supports regex
- ❌ Parsing
ls output -> ✅ Use find or glob expansion instead; ls output is not portable
- ❌
cat file | grep (useless use of cat) -> ✅ grep pattern file directly
Bash & Linux — Shell Scripting Mastery
1. Bash Strict Mode (Mandatory)
Always start every single bash script with strict compilation flags.
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
unset MY_VAR
rm -rf "/some/path/${MY_VAR}"
2. Advanced Stream Manipulation
Piping allows passing stdout from one program into stdin of another.
cat file.txt | grep "error"
grep "error" file.txt
rg "error" file.txt
diff <(curl -s api.com/v1) <(curl -s api.com/v2)
command > output.txt 2> error.txt
command > all.txt 2>&1
command &> all.txt
command >/dev/null 2>&1
3. AWK and Stream Formatting
AWK is a complete programming language designed for text processing.
ps aux | grep node | awk '{print $2}'
cat data.csv | awk -F ',' '{sum+=$3} END {print sum}'
sed -n '5,10p' file.txt
4. Modern CLI Alternatives (The 2026 Stack)
Standard POSIX tools are reliable but slow. Use modern Rust-based alternatives when available in CI/CD.
| Task | Legacy POSIX | Modern Alternative | Why? |
|---|
| Find files | find . -name "*.ts" | fd -e ts | Context-aware, respects .gitignore, 10x faster. |
| Search text | grep -r "auth" | rg "auth" | Ripgrep uses multi-threading and SIMD instructions. |
| Inspect JSON | grep / awk | jq '.users[].id' | jq explicitly parses and filters valid JSON arrays/objects. |
| Process monitoring | top | htop / btm | Interactive metrics. |
| Check curl | curl -i | httpie / xh | Colorized, structured JSON networking. |
5. File System Traps & Quoting
If a filename contains a space and you didn't quote your variable, your script will crash or delete the wrong files.
rm $FILE
rm "$FILE"
FILES=("file 1.txt" "file 2.txt")
for file in "${FILES[@]}"; do
echo "Processing: $file"
done
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
- Over-engineering: Proposing complex abstractions or distributed systems when a simpler approach suffices.
- Hallucinated Libraries/Methods: Using non-existent methods or packages. Always
// VERIFY or check package.json / requirements.txt.
- Skipping Edge Cases: Writing the "happy path" and ignoring error handling, timeouts, or data validation.
- Context Amnesia: Forgetting the user's constraints and offering generic advice instead of tailored solutions.
- Silent Degradation: Catching and suppressing errors without logging or re-raising.
Slash command: /review or /tribunal-full
Active reviewers: logic-reviewer · security-auditor
❌ Forbidden AI Tropes
- Blind Assumptions: Never make an assumption without documenting it clearly with
// VERIFY: [reason].
- Silent Degradation: Catching and suppressing errors without logging or handling.
- Context Amnesia: Forgetting the user's constraints and offering generic advice instead of tailored solutions.
Review these questions before confirming output:
✅ Did I rely ONLY on real, verified tools and methods?
✅ Is this solution appropriately scoped to the user's constraints?
✅ Did I handle potential failure modes and edge cases?
✅ Have I avoided generic boilerplate that doesn't add value?
🛑 Verification-Before-Completion (VBC) Protocol
CRITICAL: You must follow a strict "evidence-based closeout" state machine.
- ❌ Forbidden: Declaring a task complete because the output "looks correct."
- ✅ Required: You are explicitly forbidden from finalizing any task without providing concrete evidence (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
Pre-Flight Checklist
VBC Protocol (Verification-Before-Completion)
You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
🤖 LLM-Specific Traps
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
- Over-engineering: Proposing complex abstractions or distributed systems when a simpler approach suffices.
- Hallucinated Libraries/Methods: Using non-existent methods or packages. Always
// VERIFY or check package.json / requirements.txt.
- Skipping Edge Cases: Writing the "happy path" and ignoring error handling, timeouts, or data validation.
- Context Amnesia: Forgetting the user's constraints and offering generic advice instead of tailored solutions.
- Silent Degradation: Catching and suppressing errors without logging or re-raising.
🏛️ Tribunal Integration (Anti-Hallucination)
Slash command: /review or /tribunal-full
Active reviewers: logic-reviewer · security-auditor
❌ Forbidden AI Tropes
- Blind Assumptions: Never make an assumption without documenting it clearly with
// VERIFY: [reason].
- Silent Degradation: Catching and suppressing errors without logging or handling.
- Context Amnesia: Forgetting the user's constraints and offering generic advice instead of tailored solutions.
✅ Pre-Flight Self-Audit
Review these questions before confirming output:
✅ Did I rely ONLY on real, verified tools and methods?
✅ Is this solution appropriately scoped to the user's constraints?
✅ Did I handle potential failure modes and edge cases?
✅ Have I avoided generic boilerplate that doesn't add value?
🛑 Verification-Before-Completion (VBC) Protocol
CRITICAL: You must follow a strict "evidence-based closeout" state machine.
- ❌ Forbidden: Declaring a task complete because the output "looks correct."
- ✅ Required: You are explicitly forbidden from finalizing any task without providing concrete evidence (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.