home / skills / bdambrosio / cognitive_workbench / is-positive

is-positive skill

/src/tools_out/is-positive

This skill verifies if a given numeric input is positive, returning true for values greater than zero.

npx playbooks add skill bdambrosio/cognitive_workbench --skill is-positive

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

Files (2)
Skill.md
710 B
---
name: is-positive
description: Check if a number is positive
type: python
schema_hint:
  target: "$variable or Note ID"
  out: "$variable (optional)"
parameters: none
examples:
  - '{"type":"if","condition":{"type":"tool_condition","tool":"is-positive","target":"$score"},"then":[...]}'
---

# Is Positive

Checks if the input value is a positive number (greater than zero).

## Purpose

Simple boolean condition for numeric validation and control flow.

## Input Format

Accepts:
- Integer or float value
- String representation of number

## Output Format

Returns boolean:
- `True` if value > 0
- `False` otherwise

## Examples

Input: 5
Output: True

Input: -3
Output: False

Input: "42"
Output: True

Overview

This skill checks whether a provided value is a positive number (greater than zero). It accepts integers, floats, and numeric strings, and returns a simple boolean result. The goal is fast, reliable numeric validation for decision logic and input filtering.

How this skill works

The skill parses the input and attempts to interpret it as a numeric value. If the value can be converted to a number, it compares the numeric value to zero and returns True when the value is greater than zero, otherwise False. Non-numeric inputs are treated as invalid and result in False (or can be handled explicitly depending on integration).

When to use it

  • Validate user input where only positive numbers are acceptable (quantities, amounts, counts).
  • Gate branching logic that should run only for positive measurements or scores.
  • Filter datasets or streams to include only positive numeric entries.
  • Perform lightweight pre-checks before expensive numeric processing.
  • Sanitize API payloads that expect strictly positive numeric fields.

Best practices

  • Trim whitespace and handle locale-specific formatting before passing strings to the skill.
  • Explicitly handle null, empty, or non-numeric inputs upstream if you need custom error reporting.
  • Use this check as a boolean guard; combine with range checks when you need upper bounds.
  • If working with decimals requiring precision, normalize types (Decimal) before comparison.
  • Log or surface parsing failures when debugging unexpected input formats.

Example use cases

  • Validate form inputs: ensure quantity > 0 before creating an order.
  • Data cleaning: remove non-positive values from an imported CSV column.
  • Access control: allow resource allocation only when requested amount is positive.
  • Analytics: filter event values to compute metrics only on positive contributions.
  • Scripting: skip test steps when a numeric threshold is non-positive.

FAQ

How are numeric strings handled?

Numeric strings are parsed to numbers; valid representations like "42" or "3.14" evaluate normally. Invalid strings return False.

What about zero and negative numbers?

Zero and any negative value return False. The skill strictly checks for values greater than zero.