本文へ移動
cccskills
無料GitHub で公開日本語紹介

writing-acceptance-tests

GitHub CLIの受け入れテストを追加・変更する際に、リポジトリの共有範囲やAPI利用量、並行実行を考慮したテスト設計と検証を支援します。

原文原文の説明を見る

Use when adding or changing GitHub CLI acceptance tests, txtar scripts, testdata groups, repository fixtures, or acceptance harness behavior.

cli/cliスター 46,747(GitHub 46,747 + cccskills 0)
連携ツールGitHub

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • GitHub CLIの受け入れテストを追加したいとき
  • テスト用リポジトリの方式を選びたいとき
  • ワークフロー実行を安定して検証したいとき
  • API利用量を抑えてテストしたいとき

日本語での紹介

できること

GitHub CLI(gh)を実際のGitHubリソースに対して動かす受け入れテストの追加や変更を支援します。テストごとに、利用者権限が必要かどうかと、共有・分離・リポジトリなしのどのフィクスチャ方式を使うかを決めます。共有リポジトリで他のテストと干渉しない命名や状態管理、作成したリソースの記録と後片付け、APIリクエスト数の抑制も扱います。非同期に登録されるワークフローなどは、固定時間の待機ではなく条件を確認して待ちます。変更したテストは、まず対象を絞って検証する流れです。

こんなときに便利

GitHub CLIの機能や受け入れテスト用スクリプトを変更する開発者向けです。複数テストが同じリポジトリやAPI制限を共有する環境で、競合や不要なリソース作成を避けながら動作を確かめたい場合に役立ちます。

使い方の例

  • 「この機能の受け入れテストに合うフィクスチャ方式を選んで」
  • 「ワークフロー実行のテストを、条件を確認して待つ形に直して」
  • 「変更したテストスクリプトのメタデータを検証して」

注意点

ライブテストはGitHub上のリソースを操作します。実行には受け入れテスト用の認証情報が必要です。検証方法と認証変数はacceptance/README.mdを確認します。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

資料チェック

SKILL.md の記述から、注意が要る操作と導入の前提を AI が確認しました。点数は実際に動かした結果(実行検証)だけで付けています。

安全面送信・削除・コマンド実行などの扱いが明示されているか
B一部不足ライブでリポジトリを作成・削除するが、deferによる後片付けも指示。
導入のしやすさ必要なツールや API キーが少ないか、書かれているか
B一部不足Goテスト、GitHub認証情報、README記載の環境変数が必要。

点数には入れていません。 2026年10月26日 時点で AI(OpenAI Codex)が判定しました。目安なので、入れる前に原文も確認してください。

評価が違うと思ったら、見直しを依頼する

どの項目が、なぜ違うと思うかを書いてください。ログインは不要です。内容を SKILL.md と照らし合わせて評価を作り直し、この欄に反映します。

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

含まれるファイル(1)

  • SKILL.md7.0 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Writing Acceptance Tests

Acceptance tests exercise gh against live GitHub resources. Minimize repository creation and cloning without allowing concurrent scripts to interfere.

Read acceptance/README.md and nearby scripts before editing.

Declare token capability

Every .txtar script must start with exactly one capability declaration:

# requires-user-capability: false

Set the declaration to true only when the script requires a user principal, such as account SSH/GPG keys, personal-account forks, or user membership APIs. Repository and organization operations supported by an installation token should use false.

Choose one repository mode

Every script must contain exactly one declaration:

ModeUse when
fixture-repo shared REPOOne initialized private repository is enough and every operation can coexist with concurrent and accumulated state.
fixture-repo isolated REPOOne initialized private repository is enough, but the test needs clean state, changes repository-global state, or performs multiple coordinated Git ref updates.
fixture-repo noneNo repository is needed, or the test needs multiple repositories, public visibility, special creation options, or repository lifecycle coverage.

Managed fixtures are initialized, have discussions enabled, and are deleted by the harness. Scripts using shared or isolated must not run gh repo create.

With none, create every required repository explicitly and immediately register deferred cleanup. Use defer gh repo delete --yes $ORG/$REPO when the repository should still exist under that name. Use defer cleanup-repo $REPO when testing deletion or renaming; it is scoped to $ORG and treats an already absent repository as success.

Repositories created with an initial commit can remain busy after gh repo create returns. Before renaming one, use wait-for-repository-ready $ORG/$REPO to wait for its default-branch commit. GitHub can retain the repository creation lock after that commit becomes readable, so keep the gh repo rename command inline and allow a 10-second stabilization delay between this readiness check and that command.

Shared fixture contract

Scripts within a group run concurrently. A shared script must remain correct when the repository already contains unrelated resources.

  • Never rename, transfer, archive, delete, or globally reconfigure the repository. Do not toggle features, change its description, or mutate its default branch.
  • Give resources unique, reasonably short names using $RANDOM_STRING, adding $SCRIPT_NAME only when useful. Width-constrained commands such as gh pr status truncate long titles.
  • Make commits unique across concurrent scripts. Unique branch names do not affect commit IDs, so include the script's $RANDOM_STRING in the commit contents or message when scripts could otherwise create the same tree from the same parent.
  • Consolidate related repository-scoped operations, such as merging pull requests, into one isolated script. Unique refs do not prevent concurrent Git pushes and merges in a shared repository from contending.
  • GitHub normalizes some identifiers. Use env2upper for Actions variables and secrets whose generated names are asserted later.
  • Capture the created resource's URL or ID. Filter and paginate list operations; never select the first, latest, or only result.
  • Target the fixture with --repo $ORG/$REPO or GH_REPO=$ORG/$REPO. Clone only when local Git behavior is part of the test.

If any operation violates this contract, use isolated; do not weaken assertions to make sharing appear safe.

API request budgets

Scripts share token-wide API rate limits. Count requests across the whole test process and combine compatible live assertions. Keep coverage for a narrowly limited endpoint in one script so concurrent scripts cannot burst the limit. For Code Search's 10 requests/minute bucket, use at most five HTTP requests in the entire acceptance process, even when they run sequentially. This reserves half the bucket for pagination, retries, and other token activity. Count the requests made by each command, keep representative live coverage, and move remaining variants to unit tests.

Use bounded condition-based waits for asynchronously registered resources. Fixed sleeps are both slower when registration is fast and unreliable when it is slow. Use wait-for-workflow after pushing a new workflow definition, then use wait-for-run before watching or inspecting a triggered workflow run. After gh workflow run, wait-for-run captures the returned run URL when the server provides one and falls back to polling for older servers. On timeout, wait-for-run captures the pushed commit and remote ref, workflow files, recent unfiltered runs, commit check suites, and an Actions API request ID. Use that evidence to distinguish event ingestion, run indexing, filtering, and push/setup failures before changing fixture isolation or timeout budgets. Cancellation tests must use a self-contained workflow with a deliberately long step so the run cannot finish before the cancellation request, plus a short job timeout so a failed cancellation cannot run for the full step. After registration, use wait-for-run-status RUN_ID in_progress before cancellation because the cancellation endpoint can reject a run that is still starting. Do not wait for GitHub to finish cancellation after the command confirms that the request was submitted; that tests Actions' eventual behavior rather than the CLI contract. Do not lengthen registration sleeps to compensate for a short or externally dependent job.

Organization safety

Every live mutation must resolve through $ORG/$REPO, a resource ID or URL captured from something created under $ORG, or fixture cleanup scoped to GH_ACCEPTANCE_ORG. Do not rely on ambient Git remotes or repository context.

Example

env2upper VAR_NAME=TESTSCRIPTS_${RANDOM_STRING}
fixture-repo shared REPO
env GH_REPO=$ORG/$REPO

exec gh variable set $VAR_NAME --body value
exec gh variable get $VAR_NAME
stdout '^value$'

Validate

Run metadata checks without live credentials:

go test -tags=acceptance \
  -run '^(TestSelectAcceptanceTestGroups|TestFilterAcceptanceScripts|TestTokenHasUserCapability|TestAcceptanceScriptsDeclareUserCapabilityRequirement|TestAcceptanceScriptsDeclareFixtureRepository|TestRequiresUserCapabilityForScript|TestValidateFixtureRepositoryDeclaration|TestFixtureRepositoryManager)$' \
  ./acceptance

Run a changed live script with GH_ACCEPTANCE_GROUP and GH_ACCEPTANCE_SCRIPT; see acceptance/README.md for the credential variables. Use -count=1 to bypass the Go test cache. Start with one script. If concurrency is required to reproduce the behavior, pass only the contending scripts as a comma-separated filter and repeat that focused set before widening the run.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

agentic-workflows

無料概要あり

GitHub Agentic Workflowsの設計・作成・更新・デバッグ・アップグレード依頼を見分け、対応する手順書へ案内するスキルです。

  • ワークフローを新規設計・作成したいとき
  • 既存ワークフローを更新したいとき
  • エラーの調査やデバッグをしたいとき
cli/cli4.7万2026年10月25日 更新

cli-exercise

無料概要あり

実際のCLIコマンドをケースや目標に沿って実行・記録し、観察した動作を確認できる動画などの証拠にまとめます。

  • CLIの指定ケースを記録したいとき
  • コマンドの動作を動画で示したいとき
  • 対話型の操作を検証したいとき
cli/cli4.7万2026年10月25日 更新

cli-exercise-evidence

無料概要あり

CLI操作の記録や実行結果を期待値と照合し、動画などの証拠をローカルで作成・確認して、ケースごとの結果と成果物を返します。

  • CLI演習の期待値を検証したいとき
  • 記録から動画証拠を作成したいとき
  • 動画や画面の内容を点検したいとき
cli/cli4.7万2026年10月25日 更新

cli-exercise-exact

無料概要あり

指定されたCLIテストのコマンド、入力、順序、期待条件を保ったまま実行し、観察結果に照らして各ケースを判定するスキルです。

  • 指定どおりのCLIテストを実行したいとき
  • 入力やケースの順序を保って確認したいとき
  • 期待結果を実際の出力と照合したいとき
cli/cli4.7万2026年10月25日 更新

cli-exercise-explore

無料概要あり

指定された目標と許可範囲に沿ってCLIの確認項目を選び、各操作の準備・実行・検証を順に進めて結果を整理するスキルです。

  • CLI操作を目標に沿って確かめたいとき
  • アップロードの完了条件を整理したいとき
  • 操作ごとに準備と検証を行いたいとき
cli/cli4.7万2026年10月25日 更新

cli-exercise-preflight

無料概要あり

cli-exerciseの実行前にGoや録画関連ツールの利用可否を調べ、不足時は導入手順への同意を得て再確認する内部モジュールです。

  • 記録前に必要なツールを確認したいとき
  • 動画やGIFの出力可否を調べたいとき
  • 不足依存関係の導入手順を知りたいとき
cli/cli4.7万2026年10月25日 更新

cli のスキルをすべて見る

このスキルの問題を報告する