home / skills / bdambrosio / cognitive_workbench / test-json-sql-filter

test-json-sql-filter skill

/src/saved_plans/test-json-sql-filter

This skill analyzes internal test data, applies a where citations > 100 filter, and returns the high-cited items.

npx playbooks add skill bdambrosio/cognitive_workbench --skill test-json-sql-filter

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
414 B
---
name: test-json-sql-filter
description: Tests filter-structured primitive (WHERE clause)
manual_only: true
---

# Test Filter-Structured Primitive

**Self-contained:** Creates test data internally

**Input:** Creates $papers collection (citations: 100, 250, 50, 180)

**Operation:** Filter where citations > 100

**Expected Output:** $high_cited collection with 2 items (Transformers: 250, Scaling Laws: 180)

Overview

This skill validates a structured filter primitive by running an end-to-end test that creates sample data and applies a WHERE-style condition. It focuses on filtering primitive fields (numeric comparisons) and confirming the resulting collection matches the expected subset. The test is self-contained and deterministic, making it ideal for CI checks of filtering logic.

How this skill works

The skill generates an internal collection named $papers with citation counts [100, 250, 50, 180] and associated titles. It applies a filter operation equivalent to WHERE citations > 100 and produces a $high_cited collection. The test then asserts that $high_cited contains exactly the two expected items (Transformers: 250, Scaling Laws: 180).

When to use it

  • Validate numeric comparison behavior of filter primitives
  • Automated tests in CI to catch regressions in WHERE logic
  • Verify end-to-end behavior of a query layer without external dependencies
  • Demonstrate expected filter semantics for reviewers or maintainers
  • Quick sanity checks after refactoring filtering code

Best practices

  • Keep test data minimal and self-contained to avoid external flakiness
  • Use clear, deterministic expectations (exact item counts and values)
  • Test boundary conditions (equal, greater-than, less-than) in companion tests
  • Name collections and assertions to clearly indicate intent (e.g., $high_cited)
  • Run the test as part of a pipeline to catch regressions early

Example use cases

  • CI job that runs unit-level verification of filtering primitives
  • Documentation example showing how WHERE > numeric comparisons behave
  • Regression test after optimizing query execution or changing comparison operators
  • Teaching example for engineers learning how structured filters are evaluated
  • Pre-merge check to ensure no change breaks simple numeric filters

FAQ

What does this test assert exactly?

It asserts that filtering $papers for citations > 100 yields a $high_cited collection with exactly two items: Transformers (250) and Scaling Laws (180).

Does the skill depend on external data or services?

No. The test is self-contained and creates its own $papers collection so it can run deterministically in any environment.