IS IT WORKING? - Task Verification Protocol
Workflow Reference: See Master Workflow for how this command fits into the verification stage of the agentic workflow.
You're in the middle of a task. Before claiming completion, execute this verification protocol.
IMMEDIATE ACTION REQUIRED
First, understand your project's test structure:
- Check for existing test directories: tests/, test/, spec/, tests/
- Identify test categories: unit/, integration/, e2e/, functional/, regression/
- Note the testing framework: pytest, jest, mocha, go test, etc.
- Find naming conventions: test_.py,.test.js, _test.go,.spec.ts
Your task type:
- FIX: Resolving a bug → Execute FIX_VERIFICATION
- FEATURE: Adding functionality → Execute FEATURE_VERIFICATION
- REFACTOR: Restructuring code → Execute REFACTOR_VERIFICATION
- OTHER: Any other task → Execute GENERAL_VERIFICATION
FIX_VERIFICATION
REPRODUCE THE BUG NOW
Find or create the appropriate test file:
- If fixing src/module/component.py → Create/update tests/unit/test_component.py
- If fixing a integration issue → Create/update tests/integration/test_[issue_description].py
- Add a test method that REPRODUCES the bug:
Run this test NOW and confirm it fails:
Save the failure output for reference.
APPLY YOUR FIX
Make your code changes to fix the bug. The test you just wrote should guide your fix.
VERIFY THE FIX WORKS
Run the SAME test - it must pass now:
The regression test must now pass
pytest tests/unit/test_component.py::test_task_completed_should_print_progress -xvs
Run all related tests to ensure you didn't break anything
pytest tests/unit/test_component.py -xvs
If this was an integration issue, run integration tests
pytest tests/integration/ -xvs -k "relevant_keyword"
Show actual output demonstrating the test passes.
CHECK FOR REGRESSIONS
Run the full test suite relevant to your changes:
Run unit tests for the module you changed
pytest tests/unit/test_[affected_module].py -xvs
Run integration tests if you changed interfaces
pytest tests/integration/ -xvs
Run the full suite if changes are significant
pytest tests/ -xvs
Or use the project's test command
make test npm test go test ./...
Document any failures and fix them.
COMMIT YOUR FIX WITH THE TEST
Your commit should include:
- The fix itself
- The regression test that prevents this bug from recurring
- Added print statement to task_completed()
- Added regression test to prevent silent execution
- Fixes #123"
STATUS CHECK: Is your regression test committed and passing? If not, continue working.
FEATURE_VERIFICATION
DEFINE TEST REQUIREMENTS
Based on your feature, determine where tests belong:
- Unit tests: tests/unit/test_[new_module].py for new functions/classes
- Integration tests: tests/integration/test_[feature_name].py for component interactions
- E2E tests: tests/e2e/test_[user_workflow].py for user-facing features
Write the test signatures FIRST (they will fail):
def test_export_to_json_creates_valid_file() -> None: """Test that export creates a valid JSON file""" pass # TODO: implement
def test_export_handles_special_characters() -> None: """Test that special characters are properly escaped""" pass # TODO: implement
def test_export_raises_on_invalid_input() -> None: """Test that appropriate errors are raised""" pass # TODO: implement
IMPLEMENT FEATURE WITH TESTS
For each test you defined:
- Implement the test fully
- Run it - confirm it fails
- Implement the feature code to make it pass
- Confirm the test passes
Once all unit tests pass, run them together
pytest tests/unit/test_json_exporter.py -xvs
Don't move forward until all tests pass.
ADD INTEGRATION TESTS
Create tests/integration/test_[feature]_integration.py:
# Execute
result = export_workflow(data, format='json')
# Verify
assert result.success
assert valid_json(result.output)
assert all_data_preserved(data, result.output)
Run integration tests: pytest tests/integration/test_*_integration.py -xvs
ADD E2E TEST IF APPLICABLE
For user-facing features, add tests/e2e/test_[feature]_workflow.py:
- Test the complete user journey
- Include error scenarios
- Test edge cases
COMMIT FEATURE WITH ALL TESTS
- Implemented JsonExporter class with validation
- Added comprehensive unit tests
- Added integration tests for full workflow
- Added E2E tests for user scenarios
- Closes #456"
STATUS CHECK: Are all your tests committed and passing in the proper test directories? If not, continue working.
REFACTOR_VERIFICATION
ENSURE EXISTING TESTS PASS
Before refactoring, verify the current state:
Run tests for the code you're about to refactor
pytest tests/unit/test_[module_to_refactor].py -xvs > /tmp/baseline_tests.txt pytest tests/integration/ -xvs -k [module] >> /tmp/baseline_tests.txt
Ensure all pass before starting
If tests are missing for the code you're refactoring, ADD THEM FIRST.
PERFORM REFACTOR
Make your refactoring changes. After each significant change, run the tests: pytest tests/unit/test_[refactored_module].py -xvs
Tests should continue passing throughout the refactor.
VERIFY BEHAVIOR UNCHANGED
Compare test results
diff /tmp/baseline_tests.txt /tmp/after_tests.txt
Run performance tests if applicable
pytest tests/performance/ -xvs
All tests should pass with similar or better performance.
COMMIT REFACTOR
- [What was changed]
- [Why it's better]
- All existing tests still pass
- No functional changes"
STATUS CHECK: Do all existing tests still pass after refactoring? If not, continue working.
GENERAL_VERIFICATION
CRITICAL REMINDERS
Where Tests Belong
- Unit tests: tests/unit/test_[module_name].py - test individual functions/classes
- Integration tests: tests/integration/test_[feature]_integration.py - test component interactions
- E2E tests: tests/e2e/test_[workflow].py - test complete user workflows
- Regression tests: Add to existing test files as new test methods
- Performance tests: tests/performance/test_[module]_perf.py if applicable
NEVER create random test files in the project root. ALWAYS follow the project's existing test structure.
Tests Are Permanent
- Every bug fix MUST include a regression test
- Every feature MUST include unit and integration tests
- Tests are part of the deliverable, not verification artifacts
- Tests prevent future breaks and document behavior
- Tests must be committed with the code changes
Temporary Artifacts Only Use /tmp/ or .verification/ (gitignored) ONLY for:
- Output captures for comparison
- Log files for debugging
- Temporary state files
Never commit temporary verification artifacts.
YOUR IMMEDIATE NEXT STEP
Then execute:
Find relevant existing tests
find tests -name "[relevant_module]" -type f
Run existing tests to establish baseline
pytest tests/[relevant_path] -xvs
Create or update test file in proper location
Write the test that validates your change
Run it and show it fails (for fixes) or passes (for features)
This command ensures you CREATE PERMANENT TESTS, not temporary verification files. Keep working until tests are committed.