Shell Best Practices
CheckedEnsures shell commands adhere to secure coding practices, minimizing vulnerabilities and maximizing efficiency.
Install on your platform
Showing Claude Code. One command installs this skill into any of the agents below.
- 1
Run this in your project
terminal$ npx skills add thebushidocollective/han --skill shell-best-practices -a claude-code Uses the open-source
skillsCLI and needs Node.js. Add-gto install it for your user instead of this project.
What we know about this skill
Publisher
thebushidocollective
Taken from the source listing. We haven't verified who controls this account.
Install target
Live repository
Not pinned. Installing fetches whatever the repository holds at the time you run the command.
Automated safety checks
This skill passed all 6 checks. We read its files at one commit and looked for the things that make a skill dangerous to run — not for whether it works.
Declares what it does: passed
SKILL.md parses and declares a name and a description.
SKILL.md exists, its frontmatter parses, and it declares a name and a description.
No undeclared network calls: passed
Makes no network calls.
Every host the skill dials — from its scripts, its config endpoints or the commands it tells the agent to run — is either well-known package and API infrastructure or declared in its own frontmatter. Links in documentation are not counted.
No obfuscated payloads: passed
No encoded or obfuscated payloads.
No base64, hex or compressed blob is decoded and then executed, and no encoded shell commands.
No credential access: passed
Reads no keys, tokens, keychains or credential files.
Neither the code nor the SKILL.md instructions read SSH keys, cloud credentials, keychains, token stores, browser cookie databases or dotfiles that hold secrets.
No pipe-to-shell installers: passed
No pipe-to-shell or download-and-run installers.
No `curl … | sh` pattern, in the code or in the instructions, that runs code fetched at run time.
Pinned to a commit: passed
Scanned thebushidocollective/han at 19caa51d5f.
The exact upstream commit SHA that was scanned is recorded, so the result refers to specific bytes.
- Commit
- 19caa51d5f
- Scanned
- 1 file, 583 lines
About this skill
What it does
This skill helps AI agents generate shell scripts that adhere to secure coding best practices. It provides guidance on script foundation, strict error handling, variable management, and error messaging, ensuring scripts are robust, maintainable, and minimize potential vulnerabilities. The skill promotes efficient scripting by incorporating recommendations for shebang selection, quoting variables, using meaningful names, and implementing proper exit codes.
When to use it
- When generating shell scripts that require a high level of security and reliability.
- To ensure newly created scripts follow consistent coding standards and best practices.
- For automating tasks where errors could have significant consequences.
- When needing assistance with structuring the initial framework for a new shell script, including headers and variable declarations.
Key capabilities
- Shebang Selection: Guidance on choosing appropriate shebang lines (e.g.,
/usr/bin/env bash,/bin/bash,/bin/sh). - Strict Error Handling: Promotes the use of
set -euo pipefailfor robust error checking. - Variable Quoting: Emphasizes the importance of quoting variables to prevent word splitting and glob expansion.
- Meaningful Variable Names: Encourages using descriptive variable names instead of single-letter abbreviations.
- Default Values: Provides methods for assigning default values to variables if they are unset or empty.
- Readonly and Local Variables: Guidance on declaring constants with
readonlyand function-local variables withlocal. - Exit Codes: Recommends using meaningful exit codes (e.g.,
EXIT_SUCCESS,EXIT_FAILURE). - Cleanup Traps: Suggests implementing cleanup traps to handle temporary files and restore state.
Example prompts
- "Generate a shell script that lists all
.txtfiles in the current directory, ensuring proper error handling." - "Create a bash script with a header template including description and usage instructions."
- "Write a shell script to copy a file, using best practices for variable quoting."
Tips & gotchas
- The skill focuses on shell scripting best practices, not general programming concepts.
- Pay attention to the recommendations regarding
set -euo pipefailas they are crucial for error handling. - The script header template is a suggestion, and can be customized based on project needs.