一括処理やAPIリクエストを実行するPython、PowerShell、またはNode.jsスクリプトにおいて、実行中の出力が適切に観測できるか設計・検証します。
- GitHubスター
- 41,038
- ファイル
- 6
- 最終コミット
- 2026年11月11日
- ライセンス
- MIT
- 許可されたツール
- —
batch-script-progress skillは何をしますか
batch-script-progressはAgent Skillsです。 一括処理やAPIリクエストを実行するPython、PowerShell、またはNode.jsスクリプトにおいて、実行中の出力が適切に観測できるか設計・検証します。.
skillのSKILL.mdから生成された要約。
batch-script-progress skill について
一括処理用のPython、PowerShell、またはNode.jsスクリプトを構築している開発者は、このSKILLを使用して、実行中の出力が適切に観測できるか設計・検証できます。このスキルは、スクリプトの基盤となる処理ロジックや終了ステータスを変更することなく、進捗報告、アイテムの失敗、および最終的なサマリーのための構造化された規約を作成することに焦点を当てています。これは、サイレントな実行によってモニタリングが困難になる、長時間実行されるループ、APIリクエストのバッチ処理、またはファイル処理タスクにおいて特に有用です。
エージェントが、開始通知、定期的な進捗更新、およびターミナルでのサマリーを含めるためにスクリプトを修正する必要がある場合に、このスキルをロードする必要があります。このスキルは、主要なstdoutの結果ストリームを汚染しないよう、進捗データがstderrなどの別のチャネルに送信されることを保証します。これは、異なるランタイム向けの特定の実装パターンに依存しており、プロセスが実行されている間に出力が表示されることを証明するための、言語横断的な検証機能を含んでいます。なお、これはUIのプログレスバーやモニタリングインフラストラクチャを目的としたものではなく、信頼性の高い、マシン読み取り可能または人間が読み取り可能な診断ストリームを確立するためのものです。
エージェントができること
- 1一括APIスクリプトに進捗を追加する多数のAPIリクエストを実行するNode.jsスクリプトを修正し、処理済み、成功、および失敗の件数をstderr経由で報告するようにします。
- 2終了ステータスの整合性を確保するPythonのバッチスクリプトを更新し、元の終了コードの規約を維持したまま、結果のサマリーを含めるようにします。
- 3安全なエラー報告を実装する生の例外や機密データをダンプすることなく、個々のアイテムに対するサニタイズされた失敗理由を出力するようにスクリプトを設定します。
skill の SKILL.md から作成されています。すべてのユースケースは、その引用と照合されています。
batch-script-progress skillのインストール方法
各コマンドはskillフォルダをクライアントのskillsディレクトリにコピーします。読み込むには、クライアントを再起動するか新しいセッションを開始してください。Claude Codeにbatch-script-progress skillをインストールする
~/.claude/skills/batch-script-progress/SKILL.md
$ npx degit github/awesome-copilot/skills/batch-script-progress ~/.claude/skills/batch-script-progressClaude Code (project)にbatch-script-progress skillをインストールする
.claude/skills/batch-script-progress/SKILL.md
$ npx degit github/awesome-copilot/skills/batch-script-progress .claude/skills/batch-script-progressCodexにbatch-script-progress skillをインストールする
~/.agents/skills/batch-script-progress/SKILL.md
$ npx degit github/awesome-copilot/skills/batch-script-progress ~/.agents/skills/batch-script-progressGemini CLIにbatch-script-progress skillをインストールする
~/.gemini/skills/batch-script-progress/SKILL.md
$ npx degit github/awesome-copilot/skills/batch-script-progress ~/.gemini/skills/batch-script-progressClaude.aiにbatch-script-progress skillをインストールする
npx degit github/awesome-copilot/skills/batch-script-progress batch-script-progress && zip -r batch-script-progress.zip batch-script-progress # claude.ai → Customize → Skills → + → Create skill → Upload a skill → batch-script-progress.zip
自動チェック
実行日 2026年11月13日詳細レポート →自動チェックに合格しました。これはセキュリティ監査ではありません。エージェントに実行させる前にスクリプトを読んでください。 チェックの仕組み
- ソースリポジトリがリンクされており、アクセス可能github/awesome-copilot/skills/batch-script-progress is public and reachablegithub.com/github/awesome-copilot/tree/HEAD/skills/batch-scr ↗合格
- オープンソースライセンス (OSI)MITspdx.org/licenses/MIT.html ↗合格
- 過去1年以内にコミットまたはリリースありLast commit 2026-11-11github.com/github/awesome-copilot/commits ↗合格
- スクリプトにダウンロード実行や認証情報の窃取がない3 scripts read; no download-and-run, remote eval, base64 execution or credential upload合格
- SKILL.md に隠れた指示がないNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/github/awesome-copilot/blob/HEAD/skills/batch-scr ↗合格
- 事前許可ツールが限定されているNo pre-approved tools; the agent asks before using onegithub.com/github/awesome-copilot/blob/HEAD/skills/batch-scr ↗合格
SKILL.md
GitHubで表示Batch Script Progress
Make generated batch scripts observable while they run, without changing their processing contract. Design start, periodic progress, per-item failure, and final-summary output together with result streams and exit status. A progress-bar library alone does not establish this contract.
1. Fix the existing contract
Read the script, callers, and nearby tests before editing. Identify:
- Input unit, known or unknown total, and whether enumeration is lazy.
- Existing stdout format and consumers, runtime version, and interactive versus redirected execution.
- Continue-on-error or fail-fast policy, retry rules, skip rules, transaction boundaries, and cancellation behavior.
- Existing exit codes and what callers treat as success.
Preserve these decisions. Do not add retries, parallelism, dependencies, or a new failure policy just to add progress output. If partial failures currently return zero, report the partial outcome honestly while keeping that exit contract. If the contract is missing or contradictory, ask for the decision that changes behavior; do not silently make it.
2. Define the output contract before implementation
Choose a small, stable vocabulary and fields, reusing the repository logger where suitable:
- Start: operation name, total or explicit unknown, and initial counters. Emit before expensive enumeration; discovery itself may need progress.
- Progress: processed, succeeded, failed, skipped, total or unknown, and elapsed time. Add a sanitized current-item identifier only when useful.
- Item failure: safe identifier, failure category or sanitized reason, and whether processing will continue. Emit when observed, independently of the normal progress interval.
- Summary: completed, partial, failed, or cancelled; final counters; elapsed time; known unprocessed count if available; and the exit status required by the existing contract.
Define processed = succeeded + failed + skipped for items that reached a terminal outcome. Keep in-flight and not-started items separate. Count each item once; retry attempts are not additional processed items. Do not label an item successful before its required commit, write, or acknowledgement. If a transaction rolls back, report rolled-back work rather than claiming durable success.
For an unknown total, report counts without a fabricated percentage, ETA, or remaining count. Do not materialize a stream just to count it. For zero items, emit start and summary with zero counts; never divide by zero.
3. Choose output streams and cadence
Reserve stdout for the established machine-readable result, pipeline objects, or protocol. Put progress and diagnostics on a separate channel; stderr is the portable default for standalone CLI scripts. Stderr output alone does not imply failure: callers must use the agreed exit code and result contract. Verify callers that treat any stderr as failure before changing their output. If stdout is reserved and stderr is incompatible, use an existing compatible logger or sink only when the caller already supports it. Do not move progress to stdout or another stream with changed semantics. If no compatible channel exists, stop and ask whether the output contract may change, or report that progress cannot be added safely.
Use a bounded cadence, such as every configured number of items or elapsed interval, rather than unconditionally logging every item. Emit start, failures, and summary regardless of that cadence. Preserve required per-item audit records separately. Avoid unbounded in-memory failure lists and repeated stack traces. Redact credentials, query parameters, personal data, and sensitive paths before formatting; do not dump raw exceptions or whole input records by default.
Use monotonic time for intervals and duration. Ensure output is flushed or drained so notifications arrive before exit. Use plain newline-delimited records under redirection; enable terminal rewriting or colors only for an appropriate TTY. Keep log-field meanings consistent across languages, not necessarily their exact formatting or libraries.
A time check at the end of a loop cannot emit while one item is blocking. For a long item, use existing progress callbacks, stage notifications, or a safely integrated heartbeat where the runtime permits it. A Node.js timer cannot run through synchronous event-loop blocking; a PowerShell progress display is not a durable log. If mid-item progress cannot be added without changing execution semantics, emit the current stage before it starts and disclose the notification gap. Do not promise a periodic heartbeat that the implementation cannot deliver.
4. Implement the smallest compatible change
Read language notes and safe examples for the selected runtime. The examples are executable output-contract probes, not production processors; adapt their emitter and accounting to the existing code rather than copying their failure policy.
Keep reporting separate from processing decisions. In concurrent code, serialize reporting through the coordinator and count completed outcomes, not submissions. On handled failure or cancellation, attempt one final summary and preserve the original outcome; a summary-write error must not replace the original processing exception. Do not swallow cancellation as an ordinary item failure. For host-managed cancellation, including PowerShell host stops, preserve the existing host behavior; do not convert stop exceptions into item failures or promise a final summary after host termination. Use finally for applicable cleanup, but verify the actual cancellation path in the supported host when graceful cancellation is part of the contract.
Do not force successful termination to deliver buffered output. In Node.js prefer setting process.exitCode and draining writes over an immediate process.exit(). Respect existing host/library semantics in PowerShell: a reusable function should not exit its caller. Forced termination, process crashes, and broken output pipes can prevent final reporting; do not claim otherwise.
5. Verify before reporting completion
Read verification cases, then run focused tests for the changed script with harmless fixtures. Capture stdout and stderr separately and check the real exit status. Verify start/progress ordering, monotonic counters, sanitized failures, exactly one summary on supported paths, and unchanged result contents and processing policy.
Prove liveness by reading the child process output while it is still running, not by examining output collected after exit. Check both terminal and redirected behavior when both are supported. A controlled pause after a progress event is a useful deterministic probe: receive the event, confirm the child has not exited, then release it. Keep such gates in harmless test fixtures or the test harness; do not add stdin waits, sleeps, or cancellation hooks to normal production processing solely to make a test pass. Prefer an existing callback or injectable processing boundary. If no safe deterministic seam exists, test the real path only with harmless inputs or report liveness as unverified. A watchdog may fail the test; it must not manufacture a successful result.
The bundled cross-language verifier runs the Python, PowerShell, and Node.js probes with normal, partial-failure, preserved partial-failure exit-zero, empty, unknown-total, fail-fast, simulated-cancellation, and live-output cases. It checks the probes only; it does not prove that an arbitrary generated script or automatic skill selection works.
Run it from this skill folder with Node.js 20 or later:
node tests/verify-examples.mjs
It also requires Python 3.9 or later and PowerShell 5.1 or later. See the language notes for executable overrides. Missing runtimes are failures, not silently skipped coverage.
Deliverables
Return the changed script, its output/exit contract, and focused verification results. Distinguish executed tests from inspection and unexecuted cases. Do not call the script verified merely because it prints a progress bar or the skill metadata passes validation.
Gotchas
- Counting before logging can make discovery silently consume an entire stream.
- Writing status with PowerShell
Write-Outputadds strings to the success pipeline. - Measuring only buffered output after exit cannot prove progress visibility.
- A final message saying
completedhides partial failure unless the outcome and counters explain it. finallyis not a guarantee of reporting after forced termination.
このスキルのファイル
6batch-script-progress skillに関する質問
Claude Codeにbatch-script-progress skillをインストールするには
npx degit github/awesome-copilot/skills/batch-script-progress ~/.claude/skills/batch-script-progressを実行してください。Claude Codeは~/.claude/skills(すべてのプロジェクト)または.claude/skills(単一プロジェクト)からskillsを読み込み、説明がタスクに一致する場合にskillを使用します。
batch-script-progress skillはどのクライアントで使用できますか
Agent Skills形式を読み込むすべてのクライアントで使用できます: Claude Code、Codex、Gemini CLI、claude.ai(ZIPとしてアップロード)。skill内のスクリプトは、クライアントがコード実行を許可した場合にのみ実行されます。
合計件数が不明な場合、進捗はどのように報告すべきですか?
捏造したパーセンテージ、ETA(到着予定時刻)、または残り件数を使用せずに、件数のみを報告してください。件数を数えるためだけにストリームを実体化させないでください。
CLIスクリプトにおいて、進捗や診断情報はどこに送信すべきですか?
進捗と診断情報は別のチャネルに配置する必要があります。スタンドアロンのスクリプトでは、マシン読み取り可能な結果用にstdoutを確保し、stderrをポータブルなデフォルトとして使用してください。
実行中に進捗が実際に表示されることをどのように確認すればよいですか?
プロセス終了後に収集された出力を確認するのではなく、プロセスが実行されている間に子プロセスの出力を読み取ることで、生存性(liveness)を証明する必要があります。