Skills bash-defensive-patterns
๐Ÿ“ฆ

bash-defensive-patterns

Content revision r2 Medium Risk โš™๏ธ External commands๐Ÿ“ Filesystem access

Write Safer Production Bash Scripts

Shell scripts often fail through unsafe inputs, weak cleanup, or hidden command errors. This skill provides defensive patterns for reliable Bash automation.

Supports: Claude Codex Code(CC)
๐Ÿ“Š 70 Adequate

Install with my Agent

Copy this request to your Agent. It includes the canonical Skill page and manifest.

Agent request
Review the Skillstore skill "bash-defensive-patterns" from https://skillstore.io/skills/sickn33-bash-defensive-patterns.md and its manifest at https://skillstore.io/api/skills/sickn33-bash-defensive-patterns/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.

Your Agent should still show its plan and request any confirmation required by the security policy.

Test it

Using "bash-defensive-patterns". Review a backup script that uses unquoted paths and deletes temporary files.

Expected outcome:

A prioritized review identifies path splitting and unsafe cleanup, then recommends quoted variables, guarded deletion, and tested exit traps.

Using "bash-defensive-patterns". Design a reliable CI helper that accepts an output path.

Expected outcome:

  • Validate the output option before use.
  • Create parent directories deliberately.
  • Log failures to standard error.
  • Support dry-run behavior.
  • Return meaningful exit statuses.

Using "bash-defensive-patterns". Improve a script that launches several background jobs.

Expected outcome:

A process-management design records child identifiers, handles termination signals, waits for children, and reports partial failures.

Security Audit

Medium Risk
v5 โ€ข 8/14/2026 Open versioned report

All 41 static findings are false positives caused by inert Markdown examples, shell syntax, safe redirections, or inline code formatting. One semantic issue remains: two examples install destructive cleanup traps before safely initializing TMPDIR, creating a narrow arbitrary-deletion risk.

2
Files scanned
570
Lines analyzed
0
Review items
0
False positives ignored

Confirmed security concerns (1)

Medium
Cleanup Trap Uses TMPDIR Before Trusted Initialization
Two examples install an rm -rf cleanup trap before assigning TMPDIR. An early exit or signal could make cleanup use an inherited environment value.
The trap is visibly registered before TMPDIR receives a trusted mktemp result, and its action recursively removes the expanded path.

Risk Factors

โš™๏ธ External commands (30)
๐Ÿ“ Filesystem access (8)
Audited by: codex View Audit History โ†’
Share & cite this report

Share the versioned assessment report, neutral badge, embed card, and citations. Skillstore reports evidence without deciding whether this Skill is safe.

Open versioned report
Security Assessment

Copy report link

https://skillstore.io/skills/sickn33-bash-defensive-patterns/audits/5?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_report

Markdown badge

[![Skillstore security assessment](https://skillstore.io/badges/skills/sickn33-bash-defensive-patterns/security.svg)](https://skillstore.io/skills/sickn33-bash-defensive-patterns?utm_source=security_passport_badge)

HTML badge

<a href="https://skillstore.io/skills/sickn33-bash-defensive-patterns?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/sickn33-bash-defensive-patterns/security.svg" alt="Skillstore security assessment" loading="lazy"></a>

Embed card

<iframe src="https://skillstore.io/embed/skills/sickn33-bash-defensive-patterns.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>
Academic citations (APA ยท BibTeX ยท CFF)

APA citation

sickn33. (2026). bash-defensive-patterns security audit report (audit version 5) [Author version unspecified]. Skillstore. https://skillstore.io/skills/sickn33-bash-defensive-patterns/audits/5

BibTeX citation

@techreport{sickn33-sickn33-bash-defensive-patterns-2026, author = {sickn33}, title = {bash-defensive-patterns security audit report (audit version 5)}, institution = {Skillstore}, year = {2026}, number = {5}, url = {https://skillstore.io/skills/sickn33-bash-defensive-patterns/audits/5}, note = {Author version unspecified} }

CITATION.cff

cff-version: 1.2.0 message: "If you use this Skill, cite its author and this versioned security audit report." title: "bash-defensive-patterns security audit report (audit version 5)" version: "unspecified" type: report authors: - name: "sickn33" date-released: "2026-08-14" url: "https://skillstore.io/skills/sickn33-bash-defensive-patterns/audits/5" identifiers: - type: other value: "skillstore:sickn33-bash-defensive-patterns:audit:5" description: "Skillstore immutable audit report identifier"

Compare variants

2 installable variants

Each author remains a separate installable skill. The recommended variant is ranked by Skillstore evidence.

Why this variant is first

Highest Skillstore Score
wshobson Recommended

wshobson-bash-defensive-patterns

Skillstore Score 78
Evidence Confidence High
Skillstore usage 14
Updated

2026-08-21

sickn33 Current

sickn33-bash-defensive-patterns

Skillstore Score 70
Evidence Confidence High
Skillstore usage 10
Updated

2026-08-21

Skillstore Score

Why this score Evidence Confidence: High
55
Architecture
85
Maintainability
87
Content
68
Community
91
Spec Compliance

What You Can Build

Harden Deployment Automation

Review deployment scripts for input validation, cleanup, failure handling, and safe file operations.

Build Reliable CI Jobs

Create pipeline scripts that report failures clearly and clean temporary resources.

Improve System Utilities

Refactor administration scripts with dry-run controls, logging, dependency checks, and signal handling.

Try These Prompts

Add Basic Safety
Review this Bash script. Add strict mode, quote variables, validate required inputs, and explain each safety change.
Add Cleanup and Logging
Improve this Bash script with guarded temporary resources, cleanup traps, structured logging, and useful error messages.
Harden a Pipeline Script
Refactor this CI Bash script for idempotency, dependency checks, safe argument parsing, dry-run support, and predictable failure behavior.
Perform a Defensive Audit
Audit this production Bash script for injection, race conditions, unsafe deletion, signal handling, portability, and error propagation. Prioritize findings and propose fixes.

Best Practices

  • Confirm the Bash version, operating system, permissions, and execution environment.
  • Test success, failure, interruption, and repeated execution paths.
  • Use dry runs and explicit confirmation before destructive operations.

Avoid

  • Do not interpolate untrusted text into shell command strings.
  • Do not delete paths unless ownership and expected location are verified.
  • Do not rely on strict mode without explicit error handling and tests.

Frequently Asked Questions

Does this skill support POSIX sh?
No. Many patterns use Bash-specific features such as arrays, process substitution, and double-bracket conditionals.
Can it review an existing script?
Yes. Provide the script and describe its environment, inputs, permissions, and expected behavior.
Will strict mode make every script safe?
No. Strict mode exposes some failures, but validation, quoting, cleanup, and targeted tests remain necessary.
Can it create CI/CD scripts?
Yes. It can draft Bash pipeline helpers with logging, dependency checks, failure handling, and cleanup.
Does it run generated commands?
No. Review and test all generated scripts in a controlled environment before production use.
How should destructive operations be handled?
Use dry-run modes, explicit confirmation, path validation, least privilege, and backups appropriate to the environment.

Developer Details

Author

sickn33

License

MIT

Skillstore revision

r2

Version notice

The author did not declare a version.

Ref

5a26d1d61d694db29af9b138c661c1981076d9df

Maintenance freshness

8/15/2026

Usage

8 downloads ยท 90 views

File structure

๐Ÿ“ resources/

๐Ÿ“„ implementation-playbook.md

๐Ÿ“„ SKILL.md

More from sickn33

View all
View all