batch-script-progress
Skill này làm gì
Công cụ này giúp thêm thông tin tiến độ vào các script xử lý nhiều mục (như tệp hoặc dữ liệu). Nó cho thấy điều gì đang xảy ra, những gì đã xong và nếu có gì thất bại, mà không thay đổi kết quả chính của script.
Khi nào nên dùng
- ✓Khi viết script xử lý nhiều tệp theo lô.
- ✓Khi bạn cần biết tiến độ của các thao tác chạy lâu.
- ✓Để hiểu mục nào bị lỗi trong một thao tác lớn.
Liên kết skill
https://github.com/github/awesome-copilot/blob/main/skills/batch-script-progress/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Thêm báo cáo tiến độ vào script Python này, script xử lý tất cả tệp trong một thư mục.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ phân tích script để hiểu cách nó hoạt động và chỗ thêm thông báo về lúc bắt đầu, tiến độ, từng lỗi riêng lẻ và tổng kết cuối. Các thông báo này được gửi đến một kênh riêng (thường là stderr) để không ảnh hưởng đến kết quả chính của script.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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.
…
Câu hỏi thường gặp
“Processing contract” là gì?
Đó là thỏa thuận về cách script nên hoạt động, gồm những gì nó nhận làm đầu vào, những gì nó tạo ra làm đầu ra và cách nó báo cáo thành công hay thất bại.
Vì sao không dùng thanh tiến trình thông thường?
Thanh tiến trình trực quan dành cho giao diện người dùng. Công cụ này tập trung cung cấp thông tin rõ ràng, có cấu trúc cho các script chạy nền hoặc theo lô, mà không thay đổi điều script thực sự làm.
Điều gì xảy ra nếu một mục bị lỗi?
Công cụ có thể báo mục nào bị lỗi, vì sao và script có tiếp tục hay không. Điều này giúp xác định vấn đề cụ thể mà không dừng toàn bộ thao tác.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 40k
- Vị trí xếp hạng
- #7091
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
acquire-codebase-knowledge
40kGiúp agent của bạn hiểu và ghi tài liệu cho một dự án mã nguồn có sẵn. Hữu ích khi đón thành viên mới hoặc nắm tổng quan về kiến trúc.
acreadiness-assess
40kGiúp agent của bạn đánh giá mức độ sẵn sàng cho AI của dự án và tạo báo cáo. Hữu ích để biết dự án đã sẵn sàng dùng công cụ AI đến đâu.
acreadiness-generate-instructions
40kGiúp agent của bạn tạo hướng dẫn cho công cụ AI dựa trên kết quả đánh giá. Hữu ích để cải thiện cách AI làm việc với mã và khắc phục các khoảng trống.
acreadiness-policy
40kGiúp agent của bạn xác định hoặc áp dụng chính sách đánh giá dự án bằng AI. Hữu ích để chuẩn hóa cách đánh giá dự án và đảm bảo tuân thủ.
Skill tương tự
knowledge-automation
394kGiúp agent của bạn thiết lập tác vụ định kỳ đưa nội dung mới vào kho Knowledge theo lịch, rồi kiểm tra tác vụ có chạy không.
knowledge-source-ingest
394kGiúp agent của bạn cập nhật Knowledge vault với các mục mới từ kênh chat, nguồn tin hoặc hộp thư, mà không thêm lại những gì đã có.
benchmark
280kGiúp agent của bạn đo tốc độ và hiệu suất của code, hữu ích để đảm bảo mọi thứ nhanh và tìm ra những chỗ chậm.