About freeze-tests
freeze-tests is a skill that blocks writes and edits to matching test files while code is being refactored. It is intended to help preserve test-defined behavior and can be deactivated when test changes are needed.
Key features
- 01Blocks writes to matching test files
- 02Blocks edits to matching test files
- 03Supports activation and deactivation
- 04Allows tests to run while frozen
Use cases
- 01Refactoring without changing test definitions
- 02Optimizing performance while preserving behavior
- 03Updating dependencies while keeping tests unchanged
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ proffesor-for-testing/ agentic-qe --skill freeze-testsAfter installing, type/freeze-testsin Claude Code to confirm it loaded.
Bundled filesscripts/block-test-edits.sh
Details
From the project READMEFreeze Tests Mode
When activated, blocks all modifications to test files. Use during refactoring to ensure behavior (as captured by tests) is preserved.
What It Does
Blocks Write and Edit operations on any file matching test patterns:
**/*.test.{ts,js,tsx,jsx}**/*.spec.{ts,js,tsx,jsx}**/__tests__/****/tests/**
Activation
/freeze-tests
Deactivate with /freeze-tests off.
Hook Configuration
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit",
"hook": ".claude/skills/freeze-tests/scripts/block-test-edits.sh",
"condition": "file matches **/*.test.* OR **/*.spec.* OR **/__tests__/** OR **/tests/**"
}
]
}
}
Enforcement Logic
#!/bin/bash
# block-test-edits.sh
FILE="$1"
if echo "$FILE" | grep -qP '\.(test|spec)\.(ts|js|tsx|jsx)$|__tests__|/tests/'; then
echo "BLOCKED: Test files are frozen during refactoring."
echo "If tests need updating, deactivate with: /freeze-tests off"
exit 1
fi
When to Use
- Refactoring: Changing code structure without changing behavior
- Performance optimization: Making code faster without changing logic
- Dependency updates: Upgrading libraries while preserving behavior
Gotchas
- Frozen tests can't be fixed if they break during refactoring — that's the point (the refactoring broke behavior)
- If a refactoring requires test changes, it's not a pure refactoring — deactivate and treat as a feature change
- This doesn't prevent running tests — only modifying test files
Comments
Markdown supported