Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计异常

bash-script-validatorbash 脚本验证器

Agent Skill

bash-script-validator 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

3,408

周安装

142

GitHub Stars

197

下载量

1,136
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:bash-script-validator(bash 脚本验证器)
来源仓库:https://github.com/akin-ozer/cc-devops-skills
仓库路径:skills/bash-script-validator
安装命令:
npx skills add https://github.com/akin-ozer/cc-devops-skills --skill bash-script-validator
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/akin-ozer/cc-devops-skills --skill bash-script-validator

简介

用于 Bash 脚本的语法检查与自定义规则验证,支持 ShellCheck 集成。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中提升脚本质量与 CI 门禁。
  • 通过 npx skills add https://github.com/akin-ozer/cc-devops-skills --skill bash-script-validator 安装。
  • 使用前请确认系统是否具备 shellcheck 二进制文件,受限环境可能跳过部分检查。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Bash Script Validator

Overview

This skill validates Bash and POSIX shell scripts with layered checks:

  1. Syntax validation (bash -n or sh -n)
  2. ShellCheck static analysis (system binary or wrapper fallback)
  3. Custom security, portability, and optimization checks

Use the default flow below, then branch to fallbacks only when the environment is constrained.

Trigger Guidance

Use this skill when the request includes script quality, linting, syntax checking, or shell portability work.

Trigger Phrases

  • "Validate this bash script"
  • "Lint this .sh file"
  • "Find security issues in this shell script"
  • "Why does this script fail ShellCheck?"
  • "Make this script POSIX compliant"
  • "Review this shell script before CI"

Non-Trigger Examples

  • General Linux command questions with no script file
  • Kubernetes, Terraform, or pipeline validation tasks that do not involve shell scripts
  • Pure prose editing tasks

Deterministic Execution Model

Run commands from this skill directory:

cd devops-skills-plugin/skills/bash-script-validator

Step 1: Preflight

  1. Confirm target path exists and is readable.
  2. Confirm bash is available.
  3. Determine whether fixes can be applied directly (write access) or only suggested (read-only).

Step 2: Run Baseline Validation (Default Path)

bash scripts/validate.sh <script-path>

For deterministic stage behavior, set the ShellCheck provider explicitly:

# Modes: auto (default), system, wrapper, disabled
VALIDATOR_SHELLCHECK_MODE=system bash scripts/validate.sh <script-path>

Record:

  • Detected shell type
  • Exit code (0 clean, 1 warnings, 2 errors)
  • All reported issue lines and ShellCheck codes (SC####) when present

Step 3: Load Only Needed References

Progressive disclosure by issue type:

  • ShellCheck code explanations: docs/shellcheck-reference.md
  • General fix patterns and security mistakes: docs/common-mistakes.md
  • Bash-only behavior: docs/bash-reference.md
  • POSIX portability or bashism fixes: docs/shell-reference.md
  • Text-processing optimization issues: docs/grep-reference.md, docs/awk-reference.md, docs/sed-reference.md, docs/regex-reference.md (only when directly relevant)

Step 4: Provide or Apply Fixes

For each issue, include:

  1. Exact location from validator output (line number and snippet)
  2. Root cause
  3. Corrected code
  4. Why the change is safer or more portable
  5. Subsection-level citation (format below)

If the request includes patching files and write access is available, apply fixes in small batches grouped by issue type.

Step 5: Rerun Policy (Mandatory After Changes)

After each batch of edits, rerun the validator:

bash scripts/validate.sh <script-path>

Rerun loop rules:

  1. Continue until no new errors are introduced.
  2. If warnings remain by design, document why they are intentionally accepted.
  3. If constraints prevent full resolution, report unresolved items with a clear next action.
  4. Always report the latest rerun exit code and remaining issue count.

Fallback Behavior

Use these branches only when the default flow cannot run as-is.

ConstraintFallback actionReporting requirement
shellcheck missing, wrapper availableLet scripts/validate.sh use scripts/shellcheck_wrapper.sh --cache automaticallyState that wrapper mode was used
shellcheck and wrapper unavailableRun syntax + custom checks only (validator does this)Explicitly call out reduced coverage and missing ShellCheck analysis
Python unavailable for wrapperSkip wrapper path, keep syntax + custom checksState why ShellCheck could not run
Target file is read-onlyProvide precise patch suggestions without editingMark response as "advisory only"
Target file missing or unreadableStop and request a valid file pathDo not fabricate results
Binary/non-text inputStop validationReport unsupported input type

Citation Guidance for Fixes

Use subsection-level citations for every non-trivial fix.

Required citation format:

Reference: docs/<file>.md -> <Section> -> <Subsection>

Examples:

  • Reference: docs/common-mistakes.md -> 1. Unquoted Variables -> Solution
  • Reference: docs/shellcheck-reference.md -> SC2164: Use || exit After cd
  • Reference: docs/shell-reference.md -> POSIX Best Practices -> 5. Avoid Bashisms

Citation rules:

  1. Cite the most specific section that justifies the fix.
  2. For ShellCheck findings, include both the SC#### code and the matching section.
  3. If no exact subsection exists, cite the closest section and state that the fix is inferred from that guidance.

Response Template

Use this structure for deterministic output:

  • Validation Results
  • Command: bash scripts/validate.sh <script-path>
  • Detected shell: <shell>
  • Exit code: <code>
  • Summary: <errors> errors, <warnings> warnings, <info> info
  • Issue: <short label> (Line <n>)
  • Problem: <problematic snippet>
  • Fix: <corrected snippet>
  • Why: <short explanation>
  • Reference: docs/<file>.md -> <Section> -> <Subsection>
  • Rerun command: bash scripts/validate.sh <script-path>
  • Exit code after fixes: <code>
  • Remaining issues: <count or none>

Example Flows

Fully Automated Environment

# 1) Baseline validation
bash scripts/validate.sh examples/bad-bash.sh

# 2) Apply fixes to target script
# 3) Rerun validation
bash scripts/validate.sh examples/bad-bash.sh

Expected behavior: full syntax + ShellCheck + custom-check coverage, with iterative reruns until stable.

Deterministic CI Gate

# Requires a system shellcheck binary.
bash scripts/run_ci_checks.sh

This runner enforces VALIDATOR_REQUIRE_SHELLCHECK=1 and VALIDATOR_SHELLCHECK_MODE=system so CI fails if the ShellCheck stage is skipped or unavailable.

Constrained Environment (No ShellCheck Runtime)

# shellcheck unavailable and wrapper cannot run
bash scripts/validate.sh examples/bad-shell.sh

Expected behavior: syntax + custom checks still run. Report reduced coverage and list what must be revalidated once ShellCheck is available.

Validator Script Details

Scripts

  • scripts/validate.sh: primary validator entrypoint
  • scripts/shellcheck_wrapper.sh: optional ShellCheck fallback using a cached Python virtual environment

Detection and Ordering

Validation order in scripts/validate.sh:

  1. File checks (exists/readable/text)
  2. Shebang-based shell detection
  3. Syntax check
  4. ShellCheck (or fallback/skip behavior)
  5. Custom checks
  6. Summary with exit code

Exit Codes

  • 0: no issues found
  • 1: warnings found
  • 2: errors found

References

Load only what is needed:

  • docs/bash-reference.md
  • docs/shell-reference.md
  • docs/shellcheck-reference.md
  • docs/common-mistakes.md
  • docs/grep-reference.md
  • docs/awk-reference.md
  • docs/sed-reference.md
  • docs/regex-reference.md

Done Criteria

This skill update is complete when all are true:

  1. Trigger guidance is explicit (positive and non-trigger examples).
  2. Default workflow is deterministic and ordered.
  3. Fallback behavior is explicit for missing tooling and constrained environments.
  4. Fix explanations include subsection-level citations.
  5. Post-fix rerun policy is mandatory and reported with exit codes.
  6. Documentation supports both fully automated and constrained execution paths.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.39%
按下载量换算413

Claude

30.78%
按下载量换算350

Cursor

20.11%
按下载量换算228

Gemini CLI

10.39%
按下载量换算118

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/akin-ozer/cc-devops-skills --skill bash-script-validator 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills