add-logging
Skill này làm gì
Skill này thêm các dòng log hữu ích vào code trước khi triển khai, để vấn đề có thể được hiểu sau này. Dành cho lập trình viên muốn tránh phải gỡ lỗi trong bóng tối.
Khi nào nên dùng
- ✓Khi bạn đang viết hoặc rà soát một tính năng hoặc bản sửa và muốn có log tốt ngay từ đầu.
- ✓Khi một lỗi khó chẩn đoán vì log không ghi lại gì.
- ✓Khi bạn muốn cải thiện log trên một luồng code sắp thay đổi.
Liên kết skill
https://github.com/ParadevAI/Paradev/blob/main/plugins/sazabi/skills/add-logging/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 log vào thay đổi thanh toán tôi đang làm để sau này chúng ta biết vì sao một khoản thanh toán chuyển sang tuyến dự phòng.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent làm theo cách ghi log mà dự án đã dùng, rồi thêm một dòng cho mỗi lỗi và mỗi quyết định làm thay đổi hành vi. Nó ghi ID thay vì toàn bộ dữ liệu và giữ bí mật ngoài log.
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.
Log what you will need to ask about
Every investigation in Sazabi is limited by what the code logged. The cheapest time to add the right lines is while the change is fresh. The job is a small number of structured lines that answer "what happened to this request, and why".
0. How the tools work
The Sazabi MCP server lists only two tools, search and execute. Browse
Sazabi's operations with search and namespace: "sazabi" (an empty query
without a namespace lists connected connectors, not Sazabi operations). Before
calling one, repeat search with namespace: "sazabi", the hit's full name as
the query, and includeInputSchema: true to load its arguments. Then run it
with execute as { name, arguments }, the name copied from the hit (for
example sazabi/logs.ask).
1. Match what is already there
Read how this repository logs: which logger, which field names, how request and
trace IDs are attached. Ask sazabi/logs.ask for a sample of this service's
recent lines to see the real shape. New lines must look like their neighbors;
an investigation that has to join two naming schemes is slower.
2. Pick the lines
On the changed path, log:
- Failures with the error, the input that caused it (IDs, not payloads), and what the code did next (retry, fallback, give up).
- Decisions that change behavior: a feature flag, a fallback, a skipped step, a limit hit.
- Boundaries: calls to other services or queues, with target, outcome and duration.
Skip lines that restate the obvious ("entering function").
3. Shape each line
- A stable event name (
checkout.payment_declined), so a question can count it. - Structured fields, not values glued into the message string.
- IDs that join the story: request or trace ID, user or tenant ID, order ID.
- The right level: ERROR for failures someone must act on, WARN for degraded but handled, INFO for decisions, DEBUG for detail that is off in production.
- Never secrets, tokens, passwords or full personal data. Redact or omit.
4. Check it
Run the path locally or in tests and read the lines it emits. After deploy, ask Sazabi for the new event name to confirm the lines arrive with their fields.
Anti-patterns
- Logging payloads. They leak data and cost money; log IDs and sizes.
- ERROR for expected outcomes. A declined card is INFO; an ERROR should mean a broken system.
- Many lines per request in a hot loop. Log the summary, not every iteration.
Câu hỏi thường gặp
Log có chứa dữ liệu khách hàng không?
Không. Skill ghi ID thay vì toàn bộ payload và giữ bí mật ra khỏi các dòng log.
Nó có theo kiểu log hiện có của dự án không?
Có. Nó đọc cách code đang ghi log để các dòng mới khớp với những dòng xung quanh.
Vì sao thêm log trước khi triển khai?
Việc điều tra bị giới hạn bởi những gì đã được ghi log, và thêm đúng dòng là rẻ nhất khi thay đổi còn mới.
Chi tiết
Mô tả gốc của tác giả
Before shipping a change, add structured log lines to the code path it touches so the next investigation has evidence — one line per decision and failure, with stable event names and the IDs needed to join requests, at the right level and without secrets. Use when writing or reviewing a feature or fix, when a bug was hard to diagnose because the logs were silent, or when the user asks to improve logging or observability in code.
repo: ParadevAI/Paradev
Độ phổ biến
- Sao GitHub
- 16k
- Vị trí xếp hạng
- #10841
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
decide
16kHướng dẫn bạn từng quyết định về thiết kế hoặc code, mỗi lần một việc, có lựa chọn rõ ràng và khuyến nghị. Ghi lại mọi câu trả lời và đưa ra bản tóm tắt cuối.
mobile-demo-film
16kBiến video quay màn hình điện thoại thành video demo gọn gàng, có thẻ tiêu đề, khung điện thoại và thẻ kết thúc. Hợp với demo tính năng và clip ra mắt.
redesign
16kXem xét một thành phần giao diện và đề xuất cách sửa cụ thể về khoảng cách, độ tương phản, thứ bậc và bố cục. Cũng có thể áp dụng thay đổi.
superset-settings
16kCho phép agent xem và thay đổi cài đặt ứng dụng desktop Paradev, như giao diện, phông chữ và thông báo, từ dòng lệnh.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.