SOLID 批处理
硬性限制
- 保持
.bat文件简短(最好少于 80 行) - 将实际逻辑委托给 PowerShell 或 Python
实践
- 在文件开头使用
setlocal - 使用
cd /d "%~dp0"实现可移植的相对路径 - 在关键调用后检查
errorlevel - 当存在提示或环境变量时,不要硬编码机密信息或私有局域网默认值
- 在启动未经身份验证的网络工具时,输出安全提示
检查清单
- 启动器仅负责编排
- 失败时以非零代码退出
- 路径相对于
%~dp0
SOLID 批处理 (.bat/.cmd) 守护规则:围绕 PowerShell/Python 的薄封装,使用 setlocal、显式 errorlevel 检查,不包含机密信息。适用于编辑 Windows 启动器或便携式软件包入口点时使用。
此技能为在 Windows 环境下编写和维护 .bat/.cmd 启动器脚本提供了明确的 SOLID 原则。它强调批处理文件应保持简短(少于 80 行),并将复杂的逻辑委托给 PowerShell 或 Python,从而降低脚本的复杂性和错误风险。该技能强制实施一系列安全实践,例如使用 `setlocal` 隔离环境变量、使用 `cd /d "%~dp0"` 实现便携式相对路径、在关键调用后检查 `errorlevel`,以及禁止硬编码机密信息或私有局域网默认值。它还要求当启动网络工具且未进行身份验证时,应输出安全提示。该技能适用于 Claude Code 等 AI 代理平台,并且其检查清单确保每个启动器仅作为编排器运行,失败时以非零代码退出,且所有路径均相对于 `%~dp0`。
npx skills add https://github.com/Nutz95/CursorCodingSkills/tree/HEAD/skills/solid-batchInstalled? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →
.bat 文件简短(最好少于 80 行)setlocalcd /d "%~dp0" 实现可移植的相对路径errorlevel%~dp0This repo contains 3 individual skills — each has its own dedicated page.
>- SOLID C++ / ESP32 firmware guardrails: file/class size, no nested classes, strict DI at composition roots, no UNIT_TEST / test ifdefs in production headers (and avoid them in .cpp), no hardcoded secrets, one type per public header, public API /// comments, dual-core radio pinning (PRO_CPU 0 / APP_CPU 1), FreeRTOS-safe patterns. Use when editing ESP-IDF, Arduino-ESP32, PlatformIO firmware, or ESP-NOW / BLE / Wi-Fi tasks.
>- SOLID CUDA 13 / GPU pipeline guardrails for Python+CUDA apps (e.g. NVDEC): concrete typing at boundaries, small modules, explicit device/resource lifetimes, no silent Any leakage. Use when editing CUDA 13, PyNvCodec, GPU decode/inference code.
>- SOLID Docker/Compose guardrails: small Dockerfiles, non-root when practical, no secrets in images, pinned base tags, clear multi-stage builds. Use when editing Dockerfile or compose files.
Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.
Control Eight Sleep pods (status, temperature, alarms, schedules).
BluOS CLI (blu) for discovery, playback, grouping, and volume.
Create, search, and manage Bear notes via grizzly CLI.
Capture frames or clips from RTSP/ONVIF cameras.
Search GIF providers with CLI/TUI, download results, and extract stills/sheets.