Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)139k · #705

guard

Skill này làm gì

Skill này bật đồng thời hai kiểm tra an toàn: cảnh báo cho các lệnh rủi ro và giới hạn thư mục nơi file có thể được thay đổi. Skill dành cho những ai muốn có lưới an toàn chắc chắn khi agent làm việc.

Khi nào nên dùng

  • ✓Khi bạn muốn bảo vệ tối đa trong lúc agent làm việc trên dự án của bạn.
  • ✓Khi bạn muốn cả cảnh báo lệnh phá hủy và giới hạn thư mục cùng lúc.
  • ✓Khi bạn giao một tác vụ cho agent trên một dự án quan trọng, không thể chấp nhận sai sót.

Liên kết skill

https://github.com/garrytan/gstack/blob/main/guard/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/garrytan/gstack/blob/main/guard/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

“Bật chế độ an toàn đầy đủ và giữ mọi thay đổi file trong thư mục src. Cảnh báo tôi trước bất kỳ việc gì có tính phá hủy.”

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

Cách hoạt động

Bạn chọn một thư mục, và skill kết hợp các cảnh báo lệnh với giới hạn thư mục. Việc sửa bên ngoài thư mục bị chặn, và lệnh rủi ro sẽ kích hoạt cảnh báo.

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.

<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly --> <!-- Regenerate: bun run gen:skill-docs -->

/guard — Full Safety Mode

Activates both destructive command warnings and directory-scoped edit restrictions. This is the combination of /careful + /freeze in a single command.

Dependency note: This skill references hook scripts from the sibling /careful and /freeze skill directories. Both must be installed (they are installed together by the gstack setup script).

GSTACK_STATE_ROOT=$(~/.claude/skills/gstack/bin/gstack-paths --get GSTACK_STATE_ROOT); : "${GSTACK_STATE_ROOT:?gstack-paths failed; reinstall with ./setup or /gstack-upgrade}"
mkdir -p "$GSTACK_STATE_ROOT"/analytics
echo '{"skill":"guard","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","repo":"'$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")'"}'  >> "$GSTACK_STATE_ROOT"/analytics/skill-usage.jsonl 2>/dev/null || true

Setup

Ask the user which directory to restrict edits to. Use AskUserQuestion:

  • Question: "Guard mode: which directory should edits be restricted to? Destructive command warnings are always on. Files outside the chosen path will be blocked from editing."
  • Text input (not multiple choice) — the user types a path.

Once the user provides a directory path:

Set the user-selected boundary with the shared writer, which resolves a physical absolute path and serializes replacement with investigation cleanup:

bash "$HOME/.claude/skills/gstack/freeze/bin/freeze-state.sh" set "<user-provided-path>"

On helper failure, do not claim the boundary is active. Preserve the state and report recovery; never bypass the shared writer with a direct write or deletion.

Tell the user:

  • "Guard mode active. Two protections are now running:"
  • "1. Destructive command guard — rm -rf, DROP TABLE, force-push, etc. warn before executing (overridable); catastrophic shapes (recursive delete of / or ~, force-push to the default branch) are hard-denied"
  • "2. Edit boundary — file edits restricted to <path>/. Edits outside this directory are blocked."
  • "To remove the persistent edit boundary, run /unfreeze. Ending the session stops its hooks but does not delete that boundary."

What's protected

See /careful for the full list of destructive command patterns and safe exceptions. See /freeze for how edit boundary enforcement works.

Câu hỏi thường gặp

Chế độ an toàn đầy đủ bao gồm những gì?

Cảnh báo cho lệnh phá hủy cộng với việc chặn sửa file bên ngoài thư mục bạn chọn.

Các cảnh báo có luôn bật không?

Có. Mô tả cho biết cảnh báo lệnh phá hủy luôn bật trong chế độ này.

Nó có cần skill khác được cài không?

Có. Nó dùng các script hook từ hai skill anh em được cài cùng.

Chi tiết

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

Full safety mode: destructive command warnings + directory-scoped edits. (gstack)

repo: garrytan/gstack

Độ phổ biến

Sao GitHub
139k
Vị trí xếp hạng
#705
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ự