用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/T-rav/hydraflow --skill hfcheck-test-counterpart命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | hf.check-test-counterpart |
| description | hf.check-test-counterpart |
#!/bin/bash
# Hook: Nudge when creating new Python source files without a test counterpart.
# Fires on PreToolUse for Write tool.
# Does NOT block (exit 0) - only shows a reminder.
set -euo pipefail
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
# Only check Python source files
if ! echo "$FILE_PATH" | grep -qE '\.py$'; then
exit 0
fi
# Skip test files, configs, __init__, migrations, scripts
if echo "$FILE_PATH" | grep -qE '(test_|_test\.py|conftest\.py|/tests/|__init__\.py|migrations?/|setup\.py|manage\.py|/scripts/)'; then
exit 0
fi
# Only warn for NEW files (not edits to existing files)
if [ -f "$FILE_PATH" ]; then
exit 0
fi
FILENAME=$(basename "$FILE_PATH" .py)
# Look for existing test counterpart in common locations
DIR=$(dirname "$FILE_PATH")
for test_path in \
"${DIR}/tests/test_${FILENAME}.py" \
"${DIR}/test_${FILENAME}.py" \
"${DIR}/../tests/test_${FILENAME}.py"; do
if [ -f "$test_path" ]; then
exit 0 # Test file already exists
fi
done
echo "Reminder: New source file being created without a test counterpart." >&2
echo " Source: $FILE_PATH" >&2
echo " Expected: test_${FILENAME}.py" >&2
echo " Per CLAUDE.md: Every new function/class MUST include tests." >&2