bash-scripting – skill Agent & Tự động hóa cho agent AI
Quy trình viết Bash script để tạo shell script sẵn sàng production, với các mẫu phòng thủ, xử lý lỗi và kiểm thử.
Cài skill bash-scripting bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/bash-scripting-1c8c7.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /bash-scripting – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/bash-scripting-1c8c7.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $bash-scripting – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/bash-scripting-1c8c7.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /bash-scripting – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/bash-scripting-1c8c7.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /bash-scripting – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Bash Scripting Workflow
Overview
Specialized workflow for creating robust, production-ready bash scripts with defensive programming patterns, comprehensive error handling, and automated testing.
When to Use This Workflow
Use this workflow when:
- Creating automation scripts
- Writing system administration tools
- Building deployment scripts
- Developing backup solutions
- Creating CI/CD scripts
Scope and execution
Choose the phases that match the user’s task; this document is an index, not an instruction to run every listed skill. Read a selected skill before using it. Respect repository and user constraints. Cloud calls, host configuration, publishing, destructive operations and spending require the applicable authorization; a workflow checklist does not grant it.
The template is a starting point, not a completed script: it does not implement argument parsing or rollback. Validate paths, quote expansions, test in a disposable directory, and make retries bounded and safe for the specific command. Never log credentials or imply strict mode catches every failure.
Workflow Phases
Phase 1: Script Design
Skills to Invoke
bash-pro- Professional scriptingbash-defensive-patterns- Defensive patterns
Actions
1. Define script purpose
2. Identify inputs/outputs
3. Plan error handling
4. Design logging strategy
5. Document requirements
Copy-Paste Prompts
Use @bash-pro to design production-ready bash scriptPhase 2: Script Structure
Skills to Invoke
bash-pro- Script structurebash-defensive-patterns- Safety patterns
Actions
1. Add shebang and strict mode
2. Create usage function
3. Implement argument parsing
4. Set up logging
5. Add cleanup handlers
Copy-Paste Prompts
Use @bash-defensive-patterns to implement strict mode and error handlingPhase 3: Core Implementation
Skills to Invoke
bash-linux- Linux commandslinux-shell-scripting- Shell scripting
Actions
1. Implement main functions
2. Add input validation
3. Create helper functions
4. Handle edge cases
5. Add progress indicators
Copy-Paste Prompts
Use @bash-linux to implement system commandsPhase 4: Error Handling
Skills to Invoke
bash-defensive-patterns- Error handlingerror-handling-patterns- Error patterns
Actions
1. Add trap handlers
2. Implement retry logic
3. Create error messages
4. Set up exit codes
5. Add rollback capability
Copy-Paste Prompts
Use @bash-defensive-patterns to add comprehensive error handlingPhase 5: Logging
Skills to Invoke
bash-pro- Logging patterns
Actions
1. Create logging function
2. Add log levels
3. Implement timestamps
4. Configure log rotation
5. Add debug mode
Copy-Paste Prompts
Use @bash-pro to implement structured loggingPhase 6: Testing
Skills to Invoke
bats-testing-patterns- Bats testingshellcheck-configuration- ShellCheck
Actions
1. Write Bats tests
2. Run ShellCheck
3. Test edge cases
4. Verify error handling
5. Test with different inputs
Copy-Paste Prompts
Use @bats-testing-patterns to write script testsUse @shellcheck-configuration to lint bash scriptPhase 7: Documentation
Skills to Invoke
documentation-templates- Documentation
Actions
1. Add script header
2. Document functions
3. Create usage examples
4. List dependencies
5. Add troubleshooting section
Copy-Paste Prompts
Use @documentation-templates to document bash scriptScript Template
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_NAME=$(basename -- "$0")
readonly SCRIPT_NAME
SCRIPT_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
readonly SCRIPT_DIR
log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"; }
error() { log "ERROR: $*" >&2; exit 1; }
usage() { cat <<EOF
Usage: $SCRIPT_NAME [OPTIONS]
Options:
-h, --help Show help
-v, --verbose Verbose output
EOF
}
main() {
log "Script started"
# Implementation
log "Script completed"
}
main "$@"Quality Gates
- [ ] ShellCheck passes
- [ ] Bats tests pass
- [ ] Error handling works
- [ ] Logging functional
- [ ] Documentation complete
Related Workflow Bundles
os-scripting- OS scriptinglinux-troubleshooting- Linux troubleshootingcloud-devops- DevOps automation
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Skill liên quan
- eval – Đánh giá và xếp hạng kết quả của agent theo chỉ số hoặc LLM judge cho một phiên…
- execute – /c-level-agents:execute [decision] — Tạo kế hoạch thực thi 90 ngày với các mốc hằng…
- bdi-mental-states – Dùng khi người dùng yêu cầu “mô hình hóa trạng thái tinh thần của agent”, “triển khai…
- extract – Biến một mẫu hoặc giải pháp gỡ lỗi đã được kiểm chứng thành một skill độc lập tái sử…
- bifrost-gateway – Chạy và cấu hình Bifrost, AI gateway mã nguồn mở: một API tương thích OpenAI cho hơn 20…
- bilig-workpaper – Dùng WorkPaper JSON có công thức và công cụ MCP cho các tác vụ bảng tính của agent…
- billing-automation – Làm chủ hệ thống thanh toán tự động, bao gồm thanh toán định kỳ, tạo hóa đơn, quản lý…
- fable-goal – Chuyển một mô tả lan man về kết quả mong muốn thành một prompt /goal hoàn chỉnh, tự…