Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Bash Script Generator

ASecurity

Create, generate, write, or scaffold bash/shell scripts (.sh), automation, or CLI tools.

6 stars
0 votes
0 copies
0 views
Added 10/5/2026
toolsgoshellbashdevopssecurityperformance

Works with

cli

Security Analysis

A100/100

Pro scans all 10 files and shows the line behind each finding

Scanned 10/5/2026

$npx -y skills add hybridlabor-api/aos --skill bash-script-generator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bash Script Generator?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Bash Script Generator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hybridlabor-api-bash-script-generator/badge)](https://www.skillsdirectory.com/skills/hybridlabor-api-bash-script-generator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: bash-script-generator
description: Create, generate, write, or scaffold bash/shell scripts (.sh), automation, or CLI tools.
category: engineering-method
source: cc-devops-skills
date_added: "2026-09-25"
---

# Bash Script Generator

## Overview

Generate production-ready Bash scripts with clear requirements capture, deterministic generation flow, and validation-first iteration.

## Trigger Phrases

Use this skill when the user asks to:
- Create, generate, write, or build a Bash/shell script
- Convert manual CLI steps into an automation script
- Build a text-processing script using `grep`, `awk`, or `sed`
- Create an operations helper script, cron script, or CI utility script

Do not use this skill for validating an existing script only. Use `bash-script-validator` for validation-only requests.

## Execution Model

Follow stages in order. Do not skip a stage; use the documented fallback when blocked.

### Stage 0: Preflight

1. Confirm scope and target output path.
2. Confirm shell target:
- Default: `bash`
- If portability is requested: POSIX `sh`
3. Check capabilities and pick fallback path:

| Capability | Default Path | Fallback Path |
|---|---|---|
| Requirement clarification | AskUserQuestion tool | Ask same questions in normal chat; mark unresolved items as assumptions |
| Script scaffold | `bash scripts/generate_script_template.sh ...` | Copy `assets/templates/standard-template.sh` manually or hand-craft minimal scaffold |
| Validation | `bash-script-validator` | Local checks: `bash -n`, `shellcheck` if available, `sh -n` for POSIX mode |

If a fallback path is used, state it explicitly in the final summary.

### Stage 1: Capture Requirements

Collect only what is needed to generate the script correctly:
- Input source and format
- Output destination and format
- Error handling behavior (fail-fast/retry/continue)
- Security constraints (sensitive data, privilege level)
- Performance constraints (large files, parallelism)
- Portability requirement (Bash-only vs POSIX)

Then create a `Captured Requirements` table with stable IDs.

```markdown
## Captured Requirements

| Requirement ID | Description | Source | Implementation Plan |
|---|---|---|---|
| REQ-001 | Parse nginx logs from file input | User | `parse_args()` + `validate_file()` + `awk` parser |
| REQ-002 | Output top 10 errors | User | `analyze_errors()` + `sort | uniq -c | head -10` |
| REQ-003 | Handle large files efficiently | Assumption | Single-pass `awk`; avoid multi-pass loops |
```

Rules:
- Every major design decision maps to at least one `REQ-*`.
- Keep assumptions explicit and minimal.

### Stage 2: Choose Generation Path

Use this deterministic decision tree:

```text
Need multi-command architecture, unusual control flow, or strict non-template conventions?
├─ Yes -> Custom generation
└─ No
   Need standard CLI skeleton (usage/logging/arg parsing/cleanup)?
   ├─ Yes -> Template-first generation
   └─ No -> Custom generation
```

Template-first is the default for single-purpose CLI utilities.

### Stage 3: Load Only Relevant References

Use progressive disclosure. Read only docs needed for the current request.

| Need | Reference |
|---|---|
| Tool choice (`grep` vs `awk` vs `sed`) | `docs/text-processing-guide.md` |
| Script structure and argument patterns | `docs/script-patterns.md` |
| Strict mode, shell differences, safety | `docs/bash-scripting-guide.md` |
| Naming, organization, and quality baseline | `docs/generation-best-practices.md` |

Citation format (required):
- `[Ref: docs/<file>.md -> <section>]`

### Stage 4: Generate Script

#### Path A: Template-first (default)

1. Generate scaffold:
```bash
bash scripts/generate_script_template.sh standard output-script.sh
```
2. Replace placeholders and add business logic.
3. Keep logging to stderr and data output to stdout unless requirements say otherwise.
4. Add comments only where logic is non-obvious.

#### Path B: Custom generation

Build a script with at least:
- Shebang and strict mode
- `usage()`
- `parse_args()`
- Input validation and dependency checks
- Main workflow function(s)
- Predictable exit codes

### Stage 5: Validate and Iterate

Default validation path:
1. Invoke `bash-script-validator`
2. Apply fixes
3. Re-run validation
4. Repeat until checks pass or blocker is identified

Fallback validation path (when validator skill is unavailable):
```bash
# Deterministic local gate for this skill:
bash scripts/run_ci_checks.sh --skip-shellcheck

# CI gate (shellcheck required):
bash scripts/run_ci_checks.sh --require-shellcheck
```

If any check is skipped, include `Skipped check`, `Reason`, and `Risk` in the output.

### Stage 6: Final Response Contract

Always return:
1. Generated script path
2. Requirements traceability (`REQ-*` -> implementation)
3. Validation results with rerun status
4. Citations in standard format
5. Any assumptions/fallbacks used

## Canonical Example Flows

### Example A: Full Flow (Template-first)

1. Clarify missing data format and output expectations.
2. Capture `REQ-*` table.
3. Choose template-first path.
4. Generate scaffold with `scripts/generate_script_template.sh`.
5. Implement logic and map functions to `REQ-*`.
6. Validate with `bash-script-validator` and rerun until clean.
7. Return final summary with citations.

### Example B: Constrained Environment Flow

Use this when AskUserQuestion, validator skill, or `shellcheck` is unavailable:
1. Ask clarifying questions in chat.
2. Mark unresolved items as assumptions in `Captured Requirements`.
3. Generate from template script or template file copy fallback.
4. Run `bash -n` (and `sh -n` if relevant).
5. If `shellcheck` is missing, report skip with risk and mitigation.

## Done Criteria

The task is complete only when all items are true:
- Trigger matched and scope confirmed
- `Captured Requirements` table exists with `REQ-*` IDs
- Template-first vs custom decision is documented
- Script is generated with deterministic structure
- Validation executed and rerun policy applied
- Any skipped checks include explicit reason and risk
- Final response includes traceability, citations, and assumptions

## Helper Scripts and Assets

- Script generator: `scripts/generate_script_template.sh`
- Deterministic CI gate: `scripts/run_ci_checks.sh`
- Regression test suite: `scripts/test_generator.sh`
- Standard scaffold: `assets/templates/standard-template.sh`
- Example output style: `examples/log-analyzer.sh`

## Reference Docs

- `docs/bash-scripting-guide.md`
- `docs/script-patterns.md`
- `docs/generation-best-practices.md`
- `docs/text-processing-guide.md`

## External References

- [GNU Bash Manual](https://www.gnu.org/software/bash/manual/bash.html)
- [POSIX Shell Specification](https://pubs.opengroup.org/onlinepubs/9699919799/)
- [ShellCheck](https://www.shellcheck.net/)

Attribution

hybridlabor-apihybridlabor-api
View sourceSee grades on GitHubMore from hybridlabor-api →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

ucoz-landing-skill

Create and edit uCoz homepage landing pages via MCP: custom templates, hero sections, lead forms, navigation menus, SEO, and responsive layout. Includes a visual design system (style selection, layout/grid, section recipes, typography/spacing, color tokens, component states, icons, modern CSS/JS, motion, imagery, social proof, copy/voice, accessibility). Uses ucoz-mcp tools for templates, site file uploads, and site modules.

107 votes

Paperclip

Interact with the Paperclip control plane API for task coordination and governance. Use when checking assignments, updating issue status, posting comments, delegating work, managing routines, or calling Paperclip API endpoints.

953191 votes

Pptx

Presentation toolkit (.pptx). Create/edit slides, layouts, content, speaker notes, comments, for programmatic presentation creation and modification.

471861 votes

Daw Music

Digital Audio Workstation usage, music composition, interactive music systems, and game audio implementation for immersive soundscapes.

761 votes

Instantly Rdsthomas Mission Control

Instantly.ai cold email outreach API - manage campaigns, leads, accounts, and analytics. Use for cold email automation, lead management, campaign creation/monitoring, and email account warmup.

761 votes
View all in tools →