windows-shell-reliability – skill Khác cho agent AI
Thực thi lệnh đáng tin cậy trên Windows: đường dẫn, mã hóa ký tự và các lỗi thường gặp với binary.
Cài skill windows-shell-reliability bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/windows-shell-reliability-94f12.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /windows-shell-reliability – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/windows-shell-reliability-94f12.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $windows-shell-reliability – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/windows-shell-reliability-94f12.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /windows-shell-reliability – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/windows-shell-reliability-94f12.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /windows-shell-reliability – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Windows Shell Reliability Patterns
> Best practices for running commands on Windows via PowerShell and CMD.
When to Use
Use this skill when developing or debugging scripts and automation that run on Windows systems, especially when involving file paths, character encoding, or standard CLI tools.
---
1. Encoding & Redirection
CRITICAL: Redirection Differences Across PowerShell Versions
Older Windows PowerShell releases can rewrite native-command output in ways that break
later processing. PowerShell 7.4+ preserves the byte stream when redirecting stdout,
so only apply the UTF-8 conversion workaround when you are dealing with older shell
behavior or a log file that is already unreadable.
| Problem | Symptom | Solution |
|---------|---------|----------|
| dotnet > log.txt | view_file fails in older Windows PowerShell | Get-Content log.txt | Set-Content -Encoding utf8 log_utf8.txt |
| npm run > log.txt | Need a UTF-8 text log with errors included | npm run ... 2>&1 | Out-File -Encoding UTF8 log.txt |
Rule: Prefer native redirection as-is on PowerShell 7.4+, and use explicit UTF-8
conversion only when older Windows PowerShell redirection produces an unreadable log.
---
2. Handling Paths & Spaces
CRITICAL: Quoting
Windows paths often contain spaces.
| ❌ Wrong | ✅ Correct |
|----------|-----------|
| dotnet build src/my project/file.fsproj | dotnet build "src/my project/file.fsproj" |
| & C:\Path With Spaces\bin.exe | & "C:\Path With Spaces\bin.exe" |
Rule: Always quote absolute and relative paths that may contain spaces.
The Call Operator (&)
In PowerShell, if an executable path starts with a quote, you MUST use the & operator.
Pattern:
& "C:\Program Files\dotnet\dotnet.exe" build ...---
3. Common Binary & Cmdlet Pitfalls
| Action | ❌ CMD Style | ✅ PowerShell Choice |
|--------|-------------|---------------------|
| Delete | del /f /q file | Remove-Item -Force file |
| Copy | copy a b | Copy-Item a b |
| Move | move a b | Move-Item a b |
| Make Dir | mkdir folder | New-Item -ItemType Directory -Path folder |
Tip: Using CLI aliases like ls, cat, and cp in PowerShell is usually fine, but using full cmdlets in scripts is more robust.
---
4. Dotnet CLI Reliability
Build Speed & Consistency
| Context | Command | Why |
|---------|---------|-----|
| Fast Iteration | dotnet build --no-restore | Skips redundant nuget restore. |
| Clean Build | dotnet build --no-incremental | Disables incremental compilation; use a separate clean step when stale outputs are suspected. |
| Background | Start-Process dotnet -ArgumentList 'run' -RedirectStandardOutput output.txt -RedirectStandardError error.txt | Launches the app without blocking the shell and keeps logs. |
---
5. Environment Variables
| Shell | Syntax |
|-------|--------|
| PowerShell | $env:VARIABLE_NAME |
| CMD | %VARIABLE_NAME% |
---
6. Long Paths
Windows has a 260-character path limit by default.
Fix: If you hit long path errors, use the extended path prefix:
\\?\C:\Very\Long\Path\...
---
7. Troubleshooting Shell Errors
| Error | Likely Cause | Fix |
|-------|-------------|-----|
| The term 'xxx' is not recognized | Path not in $env:PATH | Use absolute path or fix PATH. |
| Access to the path is denied | File in use or permissions | Inspect ownership and locks; stop only an authorized process and avoid elevation as a default fix. |
| Encoding mismatch | Older shell redirection rewrote the output | Re-export the file as UTF-8 or capture with 2>&1 | Out-File -Encoding UTF8. |
---
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Skill liên quan
- workorai – Skill sàn nhân sự WorkorAI: ứng viên tìm việc và quản lý đơn ứng tuyển; nhà tuyển dụng…
- xml-sitemap-visualizer – XML Sitemap Visualizer. Dùng khi làm việc với XML sitemap hoặc sitemap index.
- yann-lecun – Nhân vật hư cấu lấy cảm hứng từ các chủ đề công khai gắn với Yann LeCun, dùng cho đối…
- yann-lecun-debate – Sub-skill về các cuộc tranh luận và quan điểm của Yann LeCun. Bao gồm phê bình kỹ thuật…
- yann-lecun-filosofia – Sub-skill triết học và sư phạm của Yann LeCun.
- yann-lecun-tecnico – Sub-skill kỹ thuật của Yann LeCun. Bao gồm CNN, LeNet, backpropagation, JEPA (I-JEPA…
- zhongcao-cover-maker – Cài đặt và sử dụng gói chính thức Xiaohongshu Cover Maker, ghim theo digest, cho công…
- zhongcao-note-copywriter – Cài đặt và sử dụng gói chính thức Xiaohongshu Copywriter, ghim theo digest, cho công…