Comprehensive toolkit for generating best practice bash scripts following current standards and conventions...
Generate production-ready Bash scripts with clear requirements capture, deterministic generation flow, and validation-first iteration.
Use this skill when the user asks to:
grep, awk, or sedDo not use this skill for validating an existing script only. Use devops-skills:bash-script-validator for validation-only requests.
Follow stages in order. Do not skip a stage; use the documented fallback when blocked.
bashsh| 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 | devops-skills: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.
Collect only what is needed to generate the script correctly:
Then create a Captured Requirements table with stable IDs.
## 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:
REQ-*.Use this deterministic decision tree:
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.
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>]bash scripts/generate_script_template.sh standard output-script.sh
Build a script with at least:
usage()parse_args()Default validation path:
devops-skills:bash-script-validatorFallback validation path (when validator skill is unavailable):
# 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.
Always return:
REQ-* -> implementation)REQ-* table.scripts/generate_script_template.sh.REQ-*.devops-skills:bash-script-validator and rerun until clean.Use this when AskUserQuestion, validator skill, or shellcheck is unavailable:
Captured Requirements.bash -n (and sh -n if relevant).shellcheck is missing, report skip with risk and mitigation.The task is complete only when all items are true:
Captured Requirements table exists with REQ-* IDsscripts/generate_script_template.shscripts/run_ci_checks.shscripts/test_generator.shassets/templates/standard-template.shexamples/log-analyzer.shdocs/bash-scripting-guide.mddocs/script-patterns.mddocs/generation-best-practices.mddocs/text-processing-guide.md