batch-script-progress
できること
このツールは、多数の項目(ファイルやデータなど)を処理するスクリプトに、進捗情報を追加するお手伝いをします。何が実行中か、何が完了したか、失敗したものがあるかを表示しますが、スクリプトの主な出力は変えません。
使う場面
- ✓多数のファイルをまとめて処理するスクリプトを作成するとき。
- ✓時間のかかる処理の進捗を把握したいとき。
- ✓大規模な処理のうち、どの項目が失敗したかを知りたいとき。
スキルのリンク
https://github.com/github/awesome-copilot/blob/main/skills/batch-script-progress/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このPythonスクリプトに、フォルダ内のすべてのファイルを処理する際の進捗表示を追加してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このツールはスクリプトの動作を分析し、開始、進捗、個々の失敗、最後の要約に関するメッセージをどこに追加すればよいかを判断します。これらのメッセージは、通常は標準エラー出力(stderr)などの別の経路に送られるため、スクリプトの主な出力を邪魔しません。
技術的な内容(元の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.
…
よくある質問
「処理の契約」とは何ですか?
スクリプトがどのような入力を受け取り、どのような出力を生成し、成功や失敗をどのように報告するかについての取り決めのことです。
通常のプログレスバーを使わないのはなぜですか?
視覚的なプログレスバーは、ユーザーインターフェースのためのものです。このツールは、バックグラウンドやバッチで実行されるスクリプトに、スクリプトの動作自体を変えることなく、わかりやすく構造化された情報を提供することに重点を置いています。
項目の処理に失敗した場合はどうなりますか?
どの項目が、なぜ失敗したか、そしてスクリプトが処理を続けるかどうかを報告できます。これにより、全体の処理を止めることなく、特定の問題を特定しやすくなります。
詳細
作者による元の説明
Design and verify runtime output when creating or modifying Python, PowerShell, or Node.js scripts that process multiple files, records, or API requests. Use for batch scripts, bulk operations, silent long-running loops, progress reporting, per-item failures, final counts, stdout separation, or exit-status consistency. Not for UI progress bars, monitoring infrastructure, or progress updates in the
repo: github/awesome-copilot
人気
- GitHubのスター
- 40k
- ランキング
- #7091
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
acquire-codebase-knowledge
40kエージェントが、既存のコードプロジェクトを理解してドキュメント化できるよう支援します。新しく参加するメンバーのオンボーディングや、アーキテクチャの全体像の把握に役立ちます。
acreadiness-assess
40kエージェントが、プロジェクトのAI対応状況を評価してレポートを生成できるよう支援します。プロジェクトがAIツールをどの程度活用できる状態にあるかを把握するのに役立ちます。
acreadiness-generate-instructions
40kエージェントが、評価結果をもとにAIツール向けの指示文を作成できるよう支援します。AIがコードとどのようにやり取りするかを改善し、特定された不足点を解消するのに役立ちます。
acreadiness-policy
40kエージェントが、AIプロジェクトの評価ポリシーの策定や適用を支援できるようにします。プロジェクトの評価方法を標準化し、コンプライアンスを確保するのに役立ちます。