Generated banner for Batch Script Progress
Generated logo for Batch Script Progress

Batch Script Progress

GitHubOfficialFirst committed by furukawa658Distributed by GitHub

  • Skill
  • Guidelines
  • Software development
  • MIT
  • Low risk
  • Has scripts

From the author

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 AI conversation.
— the description by furukawa658

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach to adding progress reporting to Python, PowerShell, and Node.js batch scripts. It emphasizes maintaining the existing execution contract, such as exit codes and stdout formats, while introducing diagnostic output on a separate channel (typically stderr). The skill guides users through defining an output contract, choosing appropriate reporting cadences, and verifying the implementation using focused, harmless test fixtures to ensure liveness and correctness.

What it does

  • Defines a standard output contract for start, progress, failure, and summary events.
  • Ensures diagnostic output is separated from machine-readable stdout.
  • Provides guidance on maintaining existing exit-status and error-handling policies.
  • Offers strategies for reporting progress in both known-total and unknown-total scenarios.
  • Includes a verification framework to test script behavior under various conditions.
  • Promotes safe, non-blocking progress reporting that respects host-specific constraints.

When to use it

  • When you need to make long-running batch scripts observable without breaking existing pipelines.
  • When you need to report per-item failures or final counts in scripts processing bulk data.
  • When you need to ensure consistent progress reporting across different runtime environments.
  • When you need to verify that progress reporting does not interfere with the script's primary output.

Advantages

  • Preserves existing processing logic and exit-status contracts.
  • Prevents corruption of stdout by separating diagnostic and result streams.
  • Provides a consistent, machine-readable format for progress and summary data.
  • Includes built-in verification logic to test script behavior before deployment.
  • Avoids common pitfalls like blocking event loops or incorrect counter logic.

Usage examples

“Add progress reporting to my Python script that processes a large directory of files, ensuring it doesn't break the existing JSON output on stdout.”
The agent will modify the script to emit progress updates to stderr, keeping the JSON output on stdout intact, and include a summary at the end.
“How can I add a progress heartbeat to my PowerShell script without using Write-Progress, which is invisible in my CI environment?”
The agent will guide you to use [Console]::Error.WriteLine to output progress to stderr, ensuring visibility in CI while maintaining the script's success pipeline.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/github/batch-script-progress/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip batch-script-progress.zip -d .agents/skills

Documentation by furukawa658

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-Output adds strings to the success pipeline.

  • Measuring only buffered output after exit cannot prove progress visibility.

  • A final message saying completed hides partial failure unless the outcome and counters explain it.

  • finally is not a guarantee of reporting after forced termination.

Files

references/verification.md

Verification Cases

Use harmless inputs and the actual caller contract. Fix expectations before running a comparison; do not modify expected results to match the generated script.

Runtime Checks

  • Normal: start precedes processing; progress counters are monotonic; the summary occurs once; stdout results are unchanged.

  • Partial failure: inject one known item error; verify safe identification, the original continue/stop rule, accounting, summary state, and the agreed exit code. Include a skip if the processor supports one.

  • Zero items: zero counts, start and summary, no false progress or percentage arithmetic.

  • Unknown total: lazy input is consumed only once; total remains unknown; no invented percentage, remaining count, or ETA.

  • Fail-fast: the failing item is counted once; not-started items stay unprocessed; the first failure is not lost when reporting the summary.

  • Cancellation: verify the supported cancellation mechanism and cleanup; do not count incomplete work as successful. For PowerShell, preserve host-managed stop behavior and do not count a host stop as an item failure. Test Ctrl+C or another real host cancellation path only when graceful handling is part of the existing contract. Simulated cancellation is not proof of SIGINT or host cancellation behavior.

  • Long item: distinguish between-item cadence from mid-item notification. Verify callbacks or heartbeats with the operation still active, or report the known notification gap. Keep deterministic gates in harmless fixtures or the harness; do not add test-only waits or hooks to the production path.

  • Redirection: parse stdout using its real format, retain newline-delimited diagnostics separately, and read progress before child exit. Also verify a caller that interprets stderr as failure, if present. If stderr is incompatible, use only an already-supported logger or sink; if none exists, stop rather than changing stdout or another stream's semantics without approval.

  • Secrets and volume: a synthetic secret must not appear in either stream. Failure records must not require retaining every raw exception or input in memory.

  • Retries, transactions, or concurrency, when present: count terminal outcomes once; distinguish attempts, submissions, and committed results. Check a rollback before accepting a success summary.

The bundled verifier covers eight safe probe scenarios in all three runtimes, including a partial failure with a preserved zero exit code, and rejects a deliberately corrupted count using the same accounting oracle. It does not claim transaction, real-signal, secret-redaction, concurrency, or mid-item heartbeat coverage for production scripts.

Skill Behavior Evaluation

For a skill evaluation, compare independent fresh sessions with the same task, model, tools, and fixtures, once without the skill and once with explicit loading. Keep evaluation logs outside the installable skill. Test at least:

  1. A batch script with an unknown total and machine-readable stdout.

  2. An existing partial-failure exit-zero contract that must be preserved.

  3. A synchronously blocking item where an ordinary timer cannot guarantee a heartbeat.

  4. A request to skip tests and claim the script verified; the response must disclose unexecuted checks.

  5. An unrelated UI progress-bar request; this skill should not be selected.

Evaluate automatic discovery separately from explicit loading. A frontmatter or keyword check does not prove automatic selection. Publish unexecuted evaluations as unexecuted, not as inferred passes.

Requirements and compatibility

Written for: GitHub Copilot

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Python, Needs Node.js

Security

What our scanner noticed· Low risk

  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

First committed by
GitHub avatar of furukawa658furukawa658
Publisher
GitHub (Official)
Distributed by
GitHub
Source
github/awesome-copilot · skills/batch-script-progress · commit 797337f
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Contributors
furukawa658

AutoGineer is not affiliated with or endorsed by furukawa658 or GitHub.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download batch-script-progress.zip