Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

bash-script

/bash-script

Podpowiada konwencje, szablon i wymagane wzorce przy pisaniu lub edycji skryptów Bash z plikiem .sh.

Repozytorium
agent-toolkit ↗
Licencja
MIT
Ostatnia zmiana repozytorium
27.10.2026

Ocena i bezpieczeństwo

90/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść25 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
4
Skrypty
2
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 27.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • 2 skrypty w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.

Skrypty: assets/template-complex.sh, assets/template-simple.sh

Co robi i kiedy

Podpowiada konwencje, szablon i wymagane wzorce przy pisaniu lub edycji skryptów Bash z plikiem .sh.

Oryginalny opis (EN)

Use when writing or editing a Bash script (a `.sh` file or one with a Bash shebang). Covers the template, conventions, and required patterns.

Jak działa

  1. Template
  2. Conventions
  3. Required patterns
  4. References
Sekcje z nagłówków SKILL.md, w oryginale · 47 linii, 369 słów
Podgląd SKILL.md
---
name: bash-script
description: Use when writing or editing a Bash script (a `.sh` file or one with a Bash shebang). Covers the template, conventions, and required patterns.
---

## Template

Two templates cover the two kinds of scripts. Copy the right one exactly and fill in the specific logic.

- **Simple:** Scripts intended to be run directly by a user. These typically take either no arguments or a single positional argument. Start from [`assets/template-simple.sh`](assets/template-simple.sh). It shows the one-argument form; if the script takes no arguments, delete the argument check and keep the top comment.
- **Complex:** Scripts capable of taking multiple arguments via flags. Skill scripts should _always_ be considered complex scripts. Start from [`assets/template-complex.sh`](assets/template-complex.sh). These always support `--help`.

## Conventions

- File: `<name>.sh` with kebab-case (e.g., `extract-pr-number.sh`)
- Make the file executable (`chmod +x`)
- Flag-based arguments using `--flag-name` (kebab-case). Only use positional args for very simple cases.
- Arguments are always required. Never make script arguments optional unless the user _explicitly_ asks for it.
- Full variable names (`directory`, not `dir`)
- Call other commands with their long flags (`--session=main`, not `-s main`), so the call reads without knowing the command
- Exit `0` for success, `1` for errors
- stdout for primary output, stderr for errors/warnings/progress messages
- Run `shellcheck` on the script when you finish editing it, not after every change
- Let a call fail and exit via `set -euo pipefail` instead of wrapping it in `if ! cmd; then`. Only add an explicit check when the failure is actually likely or **needs** a clearer message than the default crash (most don't).

## Required patterns

Always:

- `set -euo pipefail` at the top of every script
- All error messages must start with `Error: ` and go to stderr (`>&2`)
- Always quote variable expansions (`"$variable"`)

Simple scripts:

- A top comment describing what the script does
- No `--help` flag
- If it takes an argument, print a usage message to stderr and exit `1` when the argument is missing

Complex scripts:

- `print_help()` function for help output
- `--help` flag must be the first case in argument parsing
- Always print help to stderr when validation fails or unknown options are provided
- Validate required flags after the parsing loop completes
- Invalid options must print `Error: The option <option> is invalid.`

## References

For colored terminal output, see [`references/colored-echo.md`](references/colored-echo.md).
Pliki w paczce (4)
  • SKILL.md 3 KB
  • assets/template-complex.sh 1 KB
  • assets/template-simple.sh 1 KB
  • references/colored-echo.md 1 KB

Wersje

W bazie nie ma innych skilli o nazwie bash-script.

Migawka bazy z 28.10.2026 · wersja paczki 9a796123ea43 (skrót SHA-256 całej paczki)

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 92write-script-bash
    Prowadzi przez pisanie skryptów w Bash zgodnie z konwencjami tej platformy.
  • 90bun-script
    Pisze skrypt TypeScript dla Bun, stosując szablon, konwencje i wymagane wzorce.
  • 95bash-script-validator
    Waliduje i optymalizuje skrypty bash i shell: sprawdza składnię, niecytowane zmienne, zgodność z POSIX, linie shebang, niebezpieczne podstawienia poleceń i luki bezpieczeństwa.
  • 100bash-script-helper
    Prawdopodobnie wspiera pracę ze skryptami Bash w kategorii DevOps Basics.
  • 100linux-bash-scripting
    Pisze defensywne skrypty Bash dla Linuksa: bezpieczne podstawy, parsowanie argumentów, wzorce produkcyjne i zgodność z ShellCheck, na przykład do automatyzacji, cronów i narzędzi CLI.
  • 90bash-defensive-patterns
    Pokazuje defensywne wzorce pisania skryptów Bash do potoków CI/CD i narzędzi systemowych odpornych na błędy.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.