- Home
- Skills
- Bdambrosio
- Cognitive Workbench
- Test Json Sql Sort
test-json-sql-sort_skill
- Python
9
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill bdambrosio/cognitive_workbench --skill test-json-sql-sort- plan.json1.7 KB
- SKILL.md354 B
Overview
This skill validates the sort primitive (ORDER BY) by running a focused test that creates its own data and asserts correct descending ordering. It is self-contained and requires no external fixtures. The test confirms that a collection of papers is ordered by year from newest to oldest.
How this skill works
The skill generates an internal $papers collection with four entries dated 2020, 2021, 2023, and 2022. It applies the sort operation to order the collection by the year field in descending order. The test compares the resulting $sorted collection to the expected sequence 2023, 2022, 2021, 2020 and fails if any position differs.
When to use it
- When verifying that ORDER BY or equivalent sort primitives return correct descending results.
- During unit testing of query engines, JSON-to-SQL mappers, or ORM sort implementations.
- When adding or refactoring sort-related code paths and needing a quick regression check.
- To validate ordering behavior in environments that generate or transform SQL/JSON queries.
Best practices
- Keep the test self-contained: create all input data inside the test to avoid external dependencies.
- Use a small, deterministic dataset with clear expected order to make failures obvious.
- Make the expected ordering explicit and check sequence positions, not just set equality.
- Run the test in isolation as part of CI to catch regressions in sorting logic early.
Example use cases
- A developer modifies query translation logic and runs this test to ensure ORDER BY semantics remain intact.
- A QA engineer adds this test to a suite to guard against regressions introduced by performance optimizations.
- A library author uses the test to demonstrate correct descending sort behavior in documentation or examples.
FAQ
No. The test is self-contained and creates the $papers collection internally.
What exact order is expected?
The expected $sorted order is years: 2023, 2022, 2021, 2020.