🎁 Get the FREE AI Skills Starter GuideSubscribe →
BytesAgainBytesAgain
🦀 ClawHub

Quality Verification

by @lanyasheng

输出质量保障与验证。编辑后检查、提交前测试、session 指标测量。不适用于工具重试(用 tool-governance)或 agent 提前停止(用 execution-loop)。参见 tool-governance(错误追踪)。

Versionv2.4.0
When to Use
TriggerAction
- 提交前跑测试 → Test-before-commit gate
- 测量 per-turn 指标 → Hook pair bracket
- 按环境切换 hook 强度 → Hook runtime profiles
💡 Examples

.claude/settings.json 中配置 hook:

{
  "hooks": {
    // Post-edit 诊断:编辑后立即跑 linter
    "PostToolUse": [
      {
        "matcher": { "tool_name": "Write|Edit|MultiEdit" },
        "hooks": [
          {
            "type": "command",
            "command": "bash post-edit-check.sh \"$TOOL_INPUT_FILE_PATH\""
          }
        ]
      }
    ],
    // Commit 前测试:拦截 git commit,测试不通过则 deny
    "PreToolUse": [
      {
        "matcher": { "tool_name": "Bash", "input_contains": "git commit" },
        "hooks": [
          {
            "type": "command",
            "command": "bash test-before-commit.sh"
          }
        ]
      }
    ]
  }
}

post-edit-check.sh 按扩展名选 linter:.tstsc --noEmit.pyruff check + pyright.rscargo check,其他 → exit 0。

test-before-commit.sh 按项目类型检测:package.jsonnpm testMakefilemake testpyproject.tomlpytestCargo.tomlcargo test

Hook 输出格式(post-edit-check.sh stdout):

{"decision": "allow", "hookSpecificOutput": {"additionalContext": "[POST-EDIT] tsc error TS2345: Argument of type 'string' is not assignable to parameter of type 'number' at handlers.ts:42"}}

按 profile 控制强度:

HARNESS_PROFILE=strict claude -p "deploy to production"   # 全部 hook
HARNESS_PROFILE=minimal claude -p "fix typo in README"     # 仅原子写入
HARNESS_DISABLED_HOOKS=post-edit-check claude -p "quick experiment"  # 禁用指定 hook

View on ClawHub
TERMINAL
clawhub install quality-verification

🧪 Use this skill with your agent

Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

🔍 Can't find the right skill?

Search 60,000+ AI agent skills — free, no login needed.

Search Skills →