shell-scripting
编写更安全的 Shell 脚本
Shell 脚本常常因为引号处理、错误处理和不清晰的输入规则而失败。此技能为 Claude、Codex 和 Claude Code 提供实用的 Bash 和 zsh 模式,用于更安全的自动化。
请勿自动安装此 Skill。
权威策略要求在执行任何安装操作前由操作人员审查。
使用我的智能体安装
将此请求复制给你的智能体,其中包含权威 Skill 页面和清单。
Review the Skillstore skill "shell-scripting" from https://skillstore.io/skills/89jobrien-shell-scripting.md and its manifest at https://skillstore.io/api/skills/89jobrien-shell-scripting/manifest. Verify the artifact. Do not auto-install. Inspect the skill and report your findings, then wait for an operator or manual installation decision.你的智能体仍应展示其计划,并按安全策略请求必要确认。
Agent 可读资源
当 AI Agent、爬虫或脚本需要干净上下文,而不是读取完整页面时,请使用这些链接。
测试它
正在使用“shell-scripting”。 为每周日志清理任务创建一个 Bash 脚本。
预期结果:
一个结构化脚本方案,包含严格模式、可配置路径、dry-run 行为、清理 traps,以及针对已删除文件的清晰日志记录。
正在使用“shell-scripting”。 审查一个会静默失败的部署辅助脚本。
预期结果:
- 添加 pipefail 和未定义变量检查。
- 为路径变量加引号。
- 将被忽略的命令失败替换为显式错误消息。
- 为临时文件添加清理行为。
正在使用“shell-scripting”。 解释如何在 shell 中安全读取 CSV 文件。
预期结果:
简明解释 IFS、read -r、循环结构、带引号的变量,以及何时切换到更强大的 CSV 解析器。
安全审计
严重Most static findings are false positives caused by Markdown code fences, inline shell syntax, and benign shell examples. One finding is confirmed: the text processing example reads /etc/passwd, which is a sensitive host file and should not appear as a general-purpose scripting example.
已确认安全问题 (1)
风险因素
⚙️ 外部命令 (38)
📁 文件系统访问 (2)
检测到的模式
分享与引用此报告
分享版本化评估报告、中性徽章、嵌入卡片和引用。Skillstore 只报告证据,不判断该 Skill 是否安全。
复制报告链接
https://skillstore.io/skills/89jobrien-shell-scripting/audits/8?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/89jobrien-shell-scripting?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/89jobrien-shell-scripting?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/89jobrien-shell-scripting/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/89jobrien-shell-scripting.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>学术引用 (APA · BibTeX · CFF)
APA 引用
Joseph OBrien. (2026). shell-scripting security audit report (audit version 8) [Author version 1.0.1]. Skillstore. https://skillstore.io/skills/89jobrien-shell-scripting/audits/8BibTeX 引用
@techreport{joseph-obrien-89jobrien-shell-scripting-2026,
author = {Joseph OBrien},
title = {shell-scripting security audit report (audit version 8)},
institution = {Skillstore},
year = {2026},
number = {8},
url = {https://skillstore.io/skills/89jobrien-shell-scripting/audits/8},
note = {Author version 1.0.1}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "shell-scripting security audit report (audit version 8)"
version: "1.0.1"
type: report
authors:
- name: "Joseph OBrien"
date-released: "2026-07-09"
url: "https://skillstore.io/skills/89jobrien-shell-scripting/audits/8"
identifiers:
- type: other
value: "skillstore:89jobrien-shell-scripting:audit:8"
description: "Skillstore immutable audit report identifier"
比较变体
2 个可安装变体每位作者的技能都保持为独立的可安装项。推荐变体按 Skillstore 证据排序。
为什么此变体排名第一
codingkaiser-shell-scripting
2026-09-09
89jobrien-shell-scripting
2026-09-09
Skillstore 评分
评分依据 证据置信度: 中你能构建什么
创建可靠的自动化脚本
使用模板和严格模式指南,为重复性的本地任务或 CI 任务构建脚本。
调试 shell 命令失败
应用错误处理和日志记录模式,找出脚本失败的位置及原因。
构建小型命令行工具
使用参数解析、帮助输出和退出码指南,创建简单的团队工具。
试试这些提示
使用 shell-scripting skill 为我的任务起草一个 Bash 脚本模板。包含严格模式、用法帮助、参数解析、日志记录和 dry-run 支持。
使用 shell-scripting skill 审查这个 shell 脚本。重点关注引号处理、严格模式、清理 traps、退出处理和不安全的输入假设。
使用 shell-scripting skill 设计一个处理这些文件的 Bash 工作流。展示安全循环、输入处理、输出重定向和清晰的失败行为。
使用 shell-scripting skill 规划一个生产就绪的 Bash CLI 辅助工具。包含子命令、验证边界、日志记录、清理、测试思路和 ShellCheck 注意事项。
最佳实践
- 在生成依赖平台行为的命令之前,先询问目标 shell 和操作系统。
- 对于会修改文件、部署或系统状态的脚本,使用 dry-run 模式。
- 在真实数据上使用生成的脚本之前,先运行 ShellCheck 和一个小型测试用例。
避免
- 不要在未经审查和 dry run 的情况下,将生成的破坏性命令粘贴到生产 shell 中。
- 不要对用户可控输入使用 eval 或未加引号的变量。
- 不要把简短的 shell 示例当作经过完整安全审查的生产脚本。
常见问题
此技能涵盖哪些 shell?
它能编写完整脚本吗?
它会执行 shell 命令吗?
它适合生产自动化吗?
它会教授文本处理工具吗?
发布前应修复什么?
开发者详情
许可证
MIT
作者版本
v1.0.1
Skillstore 修订
r1
引用
7db9b9f06e0ab79c575b58bc48c4d8dc9849f424
维护新鲜度
2026/7/18
使用量
12 次下载 · 267 次浏览
文件结构
📄 SKILL.md