一键导入
quality-gate
Generate or update the quality gate Stop hook. Use when: /harn:quality-gate, 'set up type checking', 'add quality gate', 'stop hook'
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate or update the quality gate Stop hook. Use when: /harn:quality-gate, 'set up type checking', 'add quality gate', 'stop hook'
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Scaffold a complete harness for the current project — AGENTS.md, hooks, guardrails. Use when starting a new project or hardening an existing one. Triggers: /harn:init, 'set up harness', 'scaffold guardrails', 'create AGENTS.md'
Build or rebuild AGENTS.md with progressive disclosure. Use when: /harn:agents-md, 'create AGENTS.md', 'update agent instructions', 'too many instructions'
Audit project harness against the CAR framework. Use when: /harn:analyze, 'audit harness', 'check CAR', 'harness health', 'how good is my harness'
Scaffold resume artifacts (LEARNED.md, CHECKPOINT.json) for long-running sessions. Triggers: /harn:checkpoint, 'resume artifacts', 'checkpoint', 'session recovery', 'LEARNED.md'
Generate context monitoring and backpressure hooks. Triggers: /harn:context, 'context monitoring', 'backpressure', 'context budget', 'attention budget', 'context rot'
Generate or update security guardrail hooks. Use when: /harn:guard, 'update security rules', 'block dangerous commands', 'add guardrail'
基于 SOC 职业分类
| name | quality-gate |
| description | Generate or update the quality gate Stop hook. Use when: /harn:quality-gate, 'set up type checking', 'add quality gate', 'stop hook' |
Generate or update scripts/harness/quality_gate.sh for the current project.
npx tsc --noEmitcargo checkgo vet ./...mypy or pyrightnpx eslint ..claude/settings.jsonstop_hook_active payload to prevent infinite loopsThe generated scripts/harness/quality_gate.sh must include the following robustness patterns:
# Harn quality gate — blocks agent completion if code is broken
# Why: https://harn.app/kb/safety.html — "Quality checks in the loop"
# Pattern: https://harn.app/kb/evals.html — "Infrastructure noise moves benchmarks"
command -v jq &>/dev/null || { echo "Harn: jq not found, quality gate skipped" >&2; exit 0; }
LOG_FILE="${TMPDIR:-/tmp}/harn_gate_${PPID}_$$.log"
Each checker must be guarded with command -v before invocation:
if [ -f "tsconfig.json" ]; then
command -v npx &>/dev/null || {
echo "QUALITY GATE BLOCKED: TypeScript detected but 'npx' not found." >&2
echo "Install Node.js or remove tsconfig.json." >&2
exit 2
}
npx tsc --noEmit > "$LOG_FILE" 2>&1 || {
echo "QUALITY GATE BLOCKED: TypeScript errors found:" >&2
cat "$LOG_FILE" >&2
exit 2
}
fi
if [ -f "Cargo.toml" ]; then
command -v cargo &>/dev/null || {
echo "QUALITY GATE BLOCKED: Rust detected but 'cargo' not found." >&2
echo "Install Rust toolchain or remove Cargo.toml." >&2
exit 2
}
cargo check > "$LOG_FILE" 2>&1 || {
echo "QUALITY GATE BLOCKED: Cargo check errors found:" >&2
cat "$LOG_FILE" >&2
exit 2
}
fi
if [ -f "go.mod" ]; then
command -v go &>/dev/null || {
echo "QUALITY GATE BLOCKED: Go detected but 'go' not found." >&2
echo "Install Go or remove go.mod." >&2
exit 2
}
go vet ./... > "$LOG_FILE" 2>&1 || {
echo "QUALITY GATE BLOCKED: Go vet errors found:" >&2
cat "$LOG_FILE" >&2
exit 2
}
fi
if [ -f "mypy.ini" ] || [ -f "setup.cfg" ] || [ -f "pyproject.toml" ]; then
command -v mypy &>/dev/null || {
echo "QUALITY GATE BLOCKED: Python type checking configured but 'mypy' not found." >&2
echo "Install mypy or remove type checking config." >&2
exit 2
}
mypy . > "$LOG_FILE" 2>&1 || {
echo "QUALITY GATE BLOCKED: mypy errors found:" >&2
cat "$LOG_FILE" >&2
exit 2
}
fi
"Harn: Quality gate passed." (minimal output)