home / skills / bdambrosio / cognitive_workbench / test-map-with-args

test-map-with-args skill

/src/saved_plans/test-map-with-args

This skill helps validate map operations with additional argument handling by summarizing test documents using focus and max_length, ensuring correct outputs.

npx playbooks add skill bdambrosio/cognitive_workbench --skill test-map-with-args

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

Files (2)
SKILL.md
324 B
---
name: test-map-with-args
description: Tests map primitive with additional operation arguments
manual_only: true
---

# Test Map with Args

Tests the map primitive applying summarize with focus and max_length arguments.

Creates 2 test documents, maps summarize over them with focus="AI", verifies 2 summaries produced.

Overview

This skill tests the map primitive by applying a summarize operation with additional operation arguments. It creates two short test documents, runs map(summarize) with focus and max_length set, and verifies that two focused summaries are produced. The skill demonstrates how operation arguments are passed through the mapping step and validated.

How this skill works

The test constructs two simple documents and invokes the map primitive using the summarize operation. Operation-specific arguments (focus="AI" and max_length) are supplied so each mapped call receives them. The test then checks that the map returned exactly two summary outputs and that they respect the provided arguments.

When to use it

  • When validating that map correctly forwards operation arguments to each invocation.
  • When adding or changing summarize-related parameters and needing automated regression checks.
  • When building CI tests for primitives that must behave consistently across inputs.
  • When demonstrating how per-call options like focus and max_length affect mapped results.

Best practices

  • Use small, deterministic test documents so failures are easy to inspect.
  • Explicitly assert both count and key properties (e.g., presence of summaries and approximate length).
  • Keep operation arguments explicit and minimal to isolate behavior under test.
  • Seed or mock randomness in models if outputs need exact matching in CI.
  • Run tests in continuous integration to catch regressions when primitives change.

Example use cases

  • Unit test ensuring map(summarize) forwards focus and max_length to each summarize call.
  • Regression test added when modifying the summarize operation signature or defaults.
  • Developer example showing how to write tests for primitives that accept extra args.
  • Quick check to confirm summaries emphasize a particular topic (focus="AI").

FAQ

What does focus="AI" do in this test?

It instructs the summarize operation to emphasize the topic 'AI' when producing each summary, used here to confirm argument forwarding.

Why are there exactly two summaries?

The test creates two source documents and maps the summarize operation over them, so one summary per document is expected.