Skip to main content
prompt GP ChatGPT

Shell Scripting taste — ChatGPT prompt: what it does and setup

Prompt setting strict Bash engineering standards with confidence ratings. It guides AI to write defensive shell scripts with proper traps and error handling.

Open on GitHub

What Shell Scripting taste does

This prompt instructs the assistant to follow DevOps-focused bash scripting habits. Each guideline includes a confidence score. Scripts must start with #!/usr/bin/env bash and set -euo pipefail. Functions encapsulate logic with local variables and conclude with a main "$@" entry point.

The standards ban parsing ls output, require while IFS= read -r line for file reads, and mandate arrays instead of concatenated command strings. Temporary files require cleanup via mktemp and trap '...' EXIT. Destructive operations must provide a --dry-run flag.

Once a script exceeds 100 lines or demands real data structures, the rule prescribes moving to Python or Go. Scripts target Bash 4+ by default, format with shfmt, and enforce zero ShellCheck warnings in CI.

What it helps with

  • enforce strict error handling via set -euo pipefail and exit traps
  • prevent unsafe word splitting by quoting all variable expansions
  • parse command options using getopts and support --dry-run
  • clean up temporary scratch files automatically with mktemp and trap

Example prompts for the agent

  • Refactor my deployment script according to the Shell Scripting taste rules.
  • Write a Bash backup utility adhering to Shell Scripting taste conventions.
  • Audit this shell script for ShellCheck compliance and missing quotes.

How to install Shell Scripting taste

How to use

Paste the text at the start of a chat or into project instructions

Questions about Shell Scripting taste

How to install Shell Scripting taste in ChatGPT?

Paste the prompt rules directly into your Custom Instructions or at the start of a conversation. In Claude Code, reference .claude/commands/prompts.csv.md.

What does Shell Scripting taste do?

It forces the model to generate maintainable Bash scripts with set -euo pipefail, ShellCheck compliance, local function scoping, and exit traps.

When does this guideline advise switching away from Bash?

It advises migrating to Python or Go once a script grows beyond roughly 100 lines or requires complex data structures.

Source text

prompts.csv · CC0-1.0
# Shell scripting taste of a DevOps engineer
- Start every script with #!/usr/bin/env bash and set -euo pipefail. Confidence: 0.90
- Switch to Python or Go once a script passes about 100 lines or needs real data structures. Confidence: 0.85
- Run ShellCheck in CI and fix warnings instead of silencing them. Confidence: 0.95
- Format scripts with shfmt so diffs stay small. Confidence: 0.75
- Quote every variable expansion ("$var") unless word splitting is intended and commented. Confidence: 0.95
- Use [[ ]] for tests and $(...) for command substitution, never backticks. Confidence: 0.90
- Declare variables inside functions with local. Confidence: 0.85
- Put the logic in functions and call a main "$@" at the bottom of the file. Confidence: 0.80
- Clean up temporary files with mktemp and trap '...' EXIT. Confidence: 0.90
- Write errors and logs to stderr and keep stdout for data other tools can pipe. Confidence: 0.85
- Exit with a non-zero status and a clear message when something fails. Confidence: 0.90
- Provide a usage function and handle -h and --help. Confidence: 0.80
- Parse options with getopts or a simple case loop, not ad hoc positional checks. Confidence: 0.75
- Check required commands up front with command -v and fail early when one is missing. Confidence: 0.85
- Read configuration from environment variables with defaults, such as ${PORT:-8080}. Confidence: 0.80
- Never parse ls output; use globs or find -print0 with xargs -0. Confidence: 0.90
- Read files line by line with while IFS= read -r line. Confidence: 0.85
- Use arrays for argument lists instead of building command strings. Confidence: 0.85
- Avoid eval, and never pass untrusted input to it. Confidence: 0.95
- Make scripts idempotent so running them twice is safe. Confidence: 0.85
- Add a --dry-run flag to anything that deletes or changes remote state. Confidence: 0.80
- Stick to POSIX sh only when the script must run in minimal containers; otherwise target bash 4+. Confidence: 0.70

© f · CC0-1.0 · f/prompts.chat

Similar prompts

All prompts for DevOps and infrastructure →

From the same set143

The whole set →
Universal LLM Operating Guidelines A rule set for LLM-assisted coding: understand the task first, then touch the code. Cuts invented APIs and stray edits. GP ChatGPT ★ 174,676repo stars Web Accessibility taste Sets frontend accessibility standards for interface development. It guides accessible markup, keyboard navigation, and focus handling. GP ChatGPT ★ 174,676repo stars Redis Caching taste A prompt that hands your AI assistant a working set of Redis caching rules: cache-aside reads, TTL with jitter, delete-on-write invalidation. Useful when you design a cache and want the sharp edges covered. GP ChatGPT ★ 174,676repo stars GraphQL API taste A prompt that steers an agent to shape a GraphQL schema from client use cases rather than database tables. Useful when the API exists but the types no longer match what the frontend needs. GP ChatGPT ★ 174,676repo stars Web Performance taste This prompt gives frontend work a performance checklist, from real-user Core Web Vitals to JavaScript budgets and image loading. GP ChatGPT ★ 174,676repo stars Web Security taste A curated set of web security conventions with confidence scores. Helps full-stack developers verify session cookies, auth flows, and injection defenses. GP ChatGPT ★ 174,676repo stars Error Handling taste A prompt that gives an AI assistant the error-handling taste of a TypeScript backend engineer: validate input, split expected errors from bugs, log once, answer with problem+json. GP ChatGPT ★ 174,676repo stars Kubernetes taste A prompt that hands your AI assistant a platform team's Kubernetes rules: GitOps, probes, resources, pod security. Useful when you ask a model to write or review manifests. GP ChatGPT ★ 174,676repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor