Shell Style Guide
Developmentshell-style-guideShell Style Guide is an Agent Skill for development published in the aquasecurity/tracee repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Enforce Tracee shell standards with shellcheck and shfmt. Use when editing shell scripts, YAML run blocks, or shell code blocks in markdown.
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/aquasecurity/tracee/blob/HEAD/.cursor/skills/shell-style-guide/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/shell-style-guide, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Shell Style Guide
Quick Start
Apply these requirements for any shell work:
- ShellCheck must pass with zero errors.
- Format with shfmt based on shell type.
- Use braces for variable expansion (
${var}). - Keep
scripts/lib*.shPOSIX sh compatible.
Commands
- Bash file:
shfmt -i 4 -ci -bn -sr -w <file>shellcheck -s bash <file>
- POSIX sh file:
shfmt -p -i 4 -ci -bn -sr -w <file>shellcheck -s sh <file>
- Library file:
shfmt -p -i 4 -ci -bn -sr -w scripts/lib_example.shshellcheck -s sh -x scripts/lib_example.sh
Core Rules
- Use
#!/bin/bashfor executables unless strict POSIX compatibility is required. - Use
#!/bin/shforscripts/lib*.sh. - Do not use Bash-only features in POSIX sh (
local, arrays,[[ ]], process substitution). - Quote expansions and use explicit error handling (
set -euo pipefailfor Bash,set -eufor POSIX). - For POSIX sh helper variables in non-library scripts, use single underscore namespacing.
Detailed Reference
For the complete Tracee shell style details, see reference.md.