Files
ss-tools/.kilocode/workflows/speckit.test.md
2026-01-30 11:10:16 +03:00

2.5 KiB

description, handoffs
description handoffs
Run semantic validation and functional tests for a specific feature, module, or file.
label agent prompt send
Fix Implementation speckit.implement Fix the issues found during testing... true

User Input

$ARGUMENTS

Input format: Can be a file path, a directory, or a feature name.

Outline

  1. Context Analysis:

    • Determine the target scope (Backend vs Frontend vs Full Feature).
    • Read semantic_protocol.md to load validation rules.
  2. Phase 1: Semantic Static Analysis (The "Compiler" Check)

    • Command: Use grep or script to verify Protocol compliance before running code.
    • Check:
      • Does the file start with [DEF:...] header?
      • Are @TIER and @PURPOSE defined?
      • Are imports located after the contracts?
      • Do functions marked "Critical" have @PRE/@POST tags?
    • Action: If this phase fails, STOP and report "Semantic Compilation Failed". Do not run runtime tests.
  3. Phase 2: Environment Prep

    • Detect project type:
      • Python: Check if .venv is active.
      • Svelte: Check if node_modules exists.
    • Command: Run linter (e.g., ruff check, eslint) to catch syntax errors immediately.
  4. Phase 3: Test Execution (Runtime)

    • Select the test runner based on the file path:

      • Backend (*.py):
        • Command: pytest <path_to_test_file> -v
        • If no specific test file exists, try to find it by convention: tests/test_<module_name>.py.
      • Frontend (*.svelte, *.ts):
        • Command: npm run test -- <path_to_component>
    • Verification:

      • Analyze output logs.
      • If tests fail, summarize the failure (AssertionError, Timeout, etc.).
  5. Phase 4: Contract Coverage Check (Manual/LLM verify)

    • Review the test cases executed.
    • Question: Do the tests explicitly verify the @POST guarantees defined in the module header?
    • Report: Mark as "Weak Coverage" if contracts exist but aren't tested.

Execution Rules

  • Fail Fast: If semantic headers are missing, don't waste time running pytest.
  • No Silent Failures: Always output the full error log if a command fails.
  • Auto-Correction Hint: If a test fails, suggest the specific speckit.implement command to fix it.

Example Commands

  • Python: pytest backend/tests/test_auth.py
  • Svelte: npm run test:unit -- src/components/Button.svelte
  • Lint: ruff check backend/src/api/