get-available-resources
Skill này làm gì
Công cụ này kiểm tra các tài nguyên máy tính (như CPU, bộ nhớ và ổ đĩa) có sẵn cho một chương trình cụ thể. Nó tạo bản tóm tắt an toàn và đơn giản về các tài nguyên này để hỗ trợ lập kế hoạch.
Khi nào nên dùng
- ✓Khi bạn cần lên kế hoạch cho một chương trình sử dụng nhiều tài nguyên.
- ✓Trước khi chạy tác vụ có thể tiêu tốn nhiều bộ nhớ hoặc sức xử lý.
- ✓Để hiểu giới hạn tài nguyên của một môi trường máy tính.
Liên kết skill
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/get-available-resources/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
“Kiểm tra tài nguyên khả dụng để lên kế hoạch cho tác vụ của tôi.”
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 môi trường hiện tại của chương trình, kiểm tra giới hạn CPU, bộ nhớ, ổ đĩa và các tài nguyên khác. Nó tạo báo cáo dữ liệu (JSON) cho thấy những gì khả dụng, mà không kiểm tra thử giới hạn.
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.
Get Available Resources
Build a conservative picture of resources available to the current process. Keep host inventory, process affinity, cgroup/container limits, scheduler allocation, and accelerator runtime usability separate.
Safety contract
Follow these rules:
- Run detection when the user requests it or a specific workload needs resource planning. Do not persist a fingerprint for every scientific task.
- Use stdout by default. Persist only when the user chooses an explicit generic local filename.
- Do not run stress tests, benchmarks, large allocations, write probes, device resets, driver installation, or clock/power changes.
- Do not dump the environment. Read only the named Slurm and accelerator variables implemented by the detector.
- Do not report hostnames, absolute paths, cgroup paths, job IDs, device UUIDs, PCI addresses, or raw visibility-variable values.
- Treat a missing observation as unknown. Never convert unknown to unlimited.
- Never infer that a visible host CPU, memory pool, or GPU is usable inside a scheduler allocation or container.
The bundled detector uses only fixed executable/argument tuples, no shell, short timeouts, bounded stdout/stderr, and partial-failure warnings.
Quick start
Run from this skill directory.
Ephemeral stdout snapshot
python scripts/detect_resources.py
The command emits only JSON to stdout. Redirect it only when ordinary shell permissions are acceptable.
Explicit private file
python scripts/detect_resources.py --output resource-snapshot.json
Explicit output is restricted to one .json filename in the current
directory, uses mode 0600 on POSIX, rejects symlinks and path traversal, and
refuses overwrite unless --force is supplied. Forced output also rejects
hard links and non-regular files. Windows privacy additionally depends on the
directory ACL.
Optional psutil enhancement
The standard-library detector works without installation. For broader cross-platform physical-core, affinity, available-memory, swap, and disk coverage:
uv run --no-project --with "psutil==7.2.2" python scripts/detect_resources.py
The import is lazy. Failure to import psutil becomes a warning, not a fatal error.
Skip management-tool probes
python scripts/detect_resources.py --skip-accelerators
Use this when accelerator discovery latency is undesirable. The detector still summarizes the presence and state of allowlisted visibility variables without returning their values.
Required interpretation
CPU
Read these as different facts:
cpu.host.logical: system-visible scheduling units.cpu.host.physical: physical topology, or null; never inferred from logical count.cpu.process.affinity_logical: current affinity-set size when supported.cpu.cgroup_v2.cpuset_logical: effective cgroup cpuset size.cpu.cgroup_v2.quota_cores: finitecpu.maxcapacity, possibly fractional.scheduler.allocation.cpu_per_process: bounded Slurm per-task interpretation when scope is clear.cpu.effective.capacity_cores: minimum positive observed constraint.cpu.effective.worker_ceiling: conservative floor for CPU process workers.
A quota of 1.5 is CPU-time capacity, not 1.5 physical cores. Affinity and cpusets constrain placement; quota constrains bandwidth.
Memory
Keep these separate:
- host total/available memory;
- current cgroup usage, hard
memory.max, and remaining hierarchical capacity; memory.high, which is a pressure/throttle boundary rather than a hard cap;- scheduler memory allocation and its scope; and
- conservative effective hard limit and available estimate.
On Apple silicon, memory.model is unified_cpu_gpu. Do not add integrated GPU
memory to RAM or describe it as separate VRAM.
Accelerators
Each device is a backend candidate:
- NVIDIA GPU → CUDA candidate;
- AMD GPU → ROCm candidate;
- Apple integrated GPU → Metal candidate.
Management-query visibility does not establish:
- scheduler/container permission;
- device-node access;
- driver/runtime compatibility;
- framework package compatibility; or
- operator/data-type support.
Therefore runtime_usable_devices remains null and each device says
runtime_compatibility: not_tested. Visibility/allocation counts constrain
the observed management records, not the number of framework devices. MIG and AMD partition enumeration can differ.
…
Câu hỏi thường gặp
“Tài nguyên” trong ngữ cảnh này là gì?
Đó là các thành phần máy tính mà chương trình dùng để chạy, như sức xử lý (CPU), bộ nhớ (RAM) và dung lượng ổ đĩa.
Tại sao báo cáo được gọi là “an toàn” và “đơn giản”?
Công cụ tránh thu thập thông tin nhạy cảm hoặc quá chi tiết (như tên tệp chính xác hay mã định danh hệ thống) và chỉ tập trung vào giới hạn tài nguyên để tránh làm quá tải hoặc lộ thông tin hệ thống.
Lập kế hoạch tài nguyên nghĩa là gì?
Nghĩa là dùng thông tin về tài nguyên khả dụng để quyết định cách chạy tác vụ hiệu quả, đảm bảo không bị lỗi do thiếu dung lượng hoặc ảnh hưởng đến các chương trình khác.
Chi tiết
Mô tả gốc của tác giả
Detects host inventory and effective CPU, memory, disk, scheduler, container, and accelerator limits when a user asks for resource-aware planning or before a clearly resource-sensitive local workload. Produces a redacted JSON snapshot and conservative planning helpers without stress tests or assuming visible host hardware is usable.
Độ phổ biến
- Sao GitHub
- 51k
- Vị trí xếp hạng
- #3471
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
13c-metabolic-flux
51kƯớc tính thông lượng chuyển hóa bằng dữ liệu theo dõi đồng vị carbon-13. Hữu ích để phân tích chuyển hóa tế bào và các con đường sinh hóa.
adaptyv
51kThiết kế thí nghiệm đặc trưng protein bằng Adaptyv API. Hỗ trợ ước tính chi phí, gửi trình tự và theo dõi kết quả phòng thí nghiệm.
aeon
51kThực hiện các tác vụ học máy trên dữ liệu chuỗi thời gian. Hữu ích để phân loại, dự báo, phát hiện bất thường và tìm mẫu trong dữ liệu tuần tự.
alphagenome
51kTra cứu các tác động di truyền đã được tính trước cho biến thể gen. Cung cấp điểm số và giải thích để hiểu ảnh hưởng của biến thể lên bộ gen.
Skill tương tự
knowledge-capture
394kDạy agent của bạn lưu các quyết định, sở thích và sự kiện quan trọng vào kho Knowledge dưới dạng ghi chú ngắn có ghi nguồn.
knowledge-claim-consolidation
394kGiúp agent của bạn dọn gọn kho Knowledge bằng cách gộp các khẳng định trùng lặp, chuyển chúng đến đúng trang chủ đề và loại bỏ những cái lỗi thời.
knowledge-correct
394kCho phép agent của bạn sửa hoặc rút lại một khẳng định hoặc trang Knowledge cụ thể theo yêu cầu của bạn, và giữ nhật ký những gì đã thay đổi.