本文へスキップ
Skillpedia
テスト48k · #4018

bats-testing-patterns

できること

このツールは、コマンドラインスクリプト(シェルスクリプト)の自動テストを作成する際に役立ちます。出力、エラー、その他の動作を確認して、スクリプトが期待どおりに動くことを保証します。

使う場面

  • ✓作成したスクリプトのテストを書くとき。
  • ✓さまざまな状況でスクリプトが正しく機能するかを確認したいとき。
  • ✓継続的インテグレーション(CI/CD)の処理の中で、スクリプトの検証を自動化したいとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/bats-testing-patterns/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/bats-testing-patterns/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“バックアップスクリプトがファイルを正しく保存するかを確認するテストは、どのように書けばよいですか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

Batsと呼ばれる仕組みを使ってテストを作成し、実行します。スクリプトが期待どおりのエラーコードを返すか、正しい出力を生成するか、意図した処理を実行するかを確認します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Bats Testing Patterns

Comprehensive guidance for writing comprehensive unit tests for shell scripts using Bats (Bash Automated Testing System), including test patterns, fixtures, and best practices for production-grade shell testing.

Use this skill when

  • Writing unit tests for shell scripts
  • Implementing TDD for scripts
  • Setting up automated testing in CI/CD pipelines
  • Testing edge cases and error conditions
  • Validating behavior across shell environments

Do not use this skill when

  • The project does not use shell scripts
  • You need integration tests beyond shell behavior
  • The goal is only linting or formatting

Instructions

  • Confirm shell dialects and supported environments.
  • Set up a test structure with helpers and fixtures.
  • Write tests for exit codes, output, and side effects.
  • Add setup/teardown and run tests in CI.
  • If detailed examples are required, open resources/implementation-playbook.md.

Resources

  • resources/implementation-playbook.md for detailed patterns and examples.

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.
よくある質問

「シェルスクリプト」とは何ですか?

コンピューターのターミナルで直接実行される小さなプログラムのことで、作業の自動化に使われます。

「CI/CD」とは何ですか?

ソフトウェアの開発と配布のプロセスを自動化する仕組みのことで、テストが自動的に実行されます。

「ユニットテスト」とは何ですか?

関数やスクリプトなど、プログラムの小さな部分を単独で確認し、正しく動作するかを調べるテストのことです。

詳細

作者による元の説明

Master Bash Automated Testing System (Bats) for comprehensive shell script testing. Use when writing tests for shell scripts, CI/CD pipelines, or requiring test-driven development of shell utilities.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#4018
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル