Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)7.6k · #13177

reliable-mutations

Skill này làm gì

Skill này giải thích cách agent nên thực hiện thay đổi cơ sở dữ liệu để chúng thực sự được lưu, bằng một lời gọi lô duy nhất rồi kiểm tra kết quả. Skill dành cho lập trình viên và bất kỳ ai mong đợi nhiều mục được lưu cùng lúc.

Khi nào nên dùng

  • ✓Khi agent phải lưu hoặc cập nhật nhiều mục cùng một lúc.
  • ✓Khi một tác vụ dài thay đổi dữ liệu ứng dụng và phải kết thúc với mọi thứ đã được lưu.
  • ✓Khi agent báo thành công và bạn cần bằng chứng rằng dữ liệu thật sự đã được lưu.

Liên kết skill

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/reliable-mutations/SKILL.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/reliable-mutations/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Cập nhật tất cả các mục này trong một lần, rồi xác nhận chúng thực sự đã được lưu.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Thay vì nhiều lần lưu nhỏ có thể dừng giữa chừng, agent gửi toàn bộ tập hợp trong một action, rồi kiểm tra dữ liệu đã lưu và báo cáo số lượng hoặc ID làm bằng chứng.

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.

Reliable Mutations

Rule

Make a change in one atomic call when the action supports it, then verify the persisted end state and report concrete proof (counts/ids). Never drive a multi-step change by looping many small writes, and never report success from a tool ✓ alone.

Why

Hosted foreground agent runs have a short soft budget so they can hand off cleanly under synchronous serverless walls. Durable background runs get a much longer budget, but they still should not rely on loops of many small writes: continuations can retry the same intent and leave partial state if each item is committed separately. One atomic call commits or fails as a unit; verification turns a hopeful ✓ into a fact.

How

  1. Prefer a single atomic call. If an action accepts the whole set (add many, set all, bulk update), pass the full batch in one call so it commits atomically. Check the action surface for a batch/plural form before reaching for a loop.
  2. Do not loop many small writes under any run budget. A sequence of N per-item writes can still leave partial or no state when a foreground run hands off, a background run continues, or an upstream provider fails. If no batch action exists, that is a gap in the action layer — add or extend an action that accepts the batch (see the actions skill) rather than papering over it with a loop.
  3. Verify the end state after writing. Re-read the data (a list/read action, a count query) and confirm the result matches intent — the right number of rows, the expected ids/fields. Do this before you tell the user it worked, and include the relevant verification expectation in the app's AGENTS.md.
  4. Report proof-of-done, not vibes. State concrete evidence: "saved 12 of 12 panels (ids …)" or "updated 5 rows". Do not infer success from the presence of a tool ✓ on an individual call.
  5. On a time-budget cutoff, fail loud. If the turn is cut before the change is fully committed and verified, say so explicitly and report what did persist (M of N) and what remains. Never round a partial or unverified write up to "done".

Don't

  • Don't loop for each item: write(item) for a large set in a single hosted turn.
  • Don't claim completion because every tool call returned ✓ — a ✓ on an aborted chunk does not mean the row was committed.
  • Don't silently shrink the scope ("I added a few of them") and present it as the finished task.
  • Don't try to "fix" this by asking for a longer run timeout — the budget is correct; restructure the write instead.

Related

  • actions — define or extend a batch/atomic action when only per-item writes exist.
  • storing-data — where app data lives and how reads/writes are scoped.
  • performance — avoid query waterfalls when verifying end state.
  • Design doc: packages/core/docs/design/durable-agent-runs.md — the real ceiling fix (checkpointed and durable runs); this skill is the agent-facing mitigation that reduces how often the ceiling is hit.
Câu hỏi thường gặp

Nếu ứng dụng không có action hàng loạt thì sao?

Skill nói nên thêm một action như vậy thay vì chạy vòng lặp các lần ghi nhỏ.

Vì sao không tin thông báo thành công?

Một thông báo thành công có thể hiện ra ngay cả khi một phần của lần ghi thất bại, nên skill yêu cầu kiểm tra dữ liệu đã lưu.

Điều này có áp dụng cho các tác vụ nền không?

Có. Các lần chạy nền có thể thử lại, nên vẫn ưu tiên một lời gọi tất cả hoặc không có gì.

Chi tiết

Mô tả gốc của tác giả

How the agent must perform writes so they actually persist under the hosted foreground run budget and long-running background handoffs. Use whenever you create, update, delete, or batch-write app data — especially "do this for many items" loops, or any task where the user expects N things to end up saved.

repo: BuilderIO/agent-native

Độ phổ biến

Sao GitHub
7.6k
Vị trí xếp hạng
#13177
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự