Skip to content

test: add unit tests for scorePrompt and pattern matching#45

Closed
TerminalGravity wants to merge 5 commits intomainfrom
test/prompt-score-and-patterns
Closed

test: add unit tests for scorePrompt and pattern matching#45
TerminalGravity wants to merge 5 commits intomainfrom
test/prompt-score-and-patterns

Conversation

@TerminalGravity
Copy link
Copy Markdown
Collaborator

Adds 19 new unit tests covering two previously untested core modules:

  • prompt-score: 11 tests covering grade calculation, specificity detection (file paths, backtick identifiers), scope bounding, action verb classification, and done-condition recognition
  • patterns: 8 tests for matchPatterns (keyword overlap threshold, case insensitivity, multi-pattern matching) and formatPatternMatches output formatting

Also exports scorePrompt so it can be imported directly for testing.

All 62 tests passing, clean build.

… and contracts

The README references .preflight/ config extensively but there were no
concrete example files to copy. This adds a ready-to-use examples/.preflight/
directory with annotated config.yml, triage.yml, and contracts/api.yml,
plus a README explaining how to use them.
Created examples/USAGE_EXAMPLES.md with 8 real-world scenarios showing
what each tool looks like in practice: preflight_check catching vague
prompts, scope_work creating execution plans, enrich_agent_task for
sub-agents, sharpen_followup resolving ambiguity, session health checks,
semantic history search, weekly scorecards, and prompt grading.

Added link to usage examples in README nav bar.
- Reorder options: npx (zero install) → npm global → clone
- Add -y flag to npx for non-interactive use
- Explain what CLAUDE_PROJECT_DIR enables
- Note that .mcp.json paths must be absolute
- Use 'absolute' in path placeholders to prevent confusion
- Export scorePrompt for testability
- 11 tests for prompt scoring: grades, specificity, scope, actionability, done conditions
- 8 tests for pattern matching: keyword overlap, case insensitivity, formatting
- All 62 tests passing
@TerminalGravity
Copy link
Copy Markdown
Collaborator Author

Superseded by newer PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant