home / skills / bdambrosio / cognitive_workbench / is-empty
This skill checks if text is null, empty, or whitespace, enabling conditional logic and data validation.
npx playbooks add skill bdambrosio/cognitive_workbench --skill is-emptyReview the files below or copy the command above to add this skill to your agents.
---
name: is-empty
description: Check if text is null, empty, or only whitespace
type: python
schema_hint:
target: "$variable or Note ID"
out: "$variable (optional)"
parameters: none
examples:
- '{"type":"if","condition":{"type":"tool_condition","tool":"is-empty","target":"$text"},"then":[...]}'
---
# Is Empty
Check whether text contains meaningful content or is effectively empty.
## Purpose
- Validate note content exists
- Enable conditional logic in plans
- Filter out empty results
- Guard against null/missing data
## Input Format
Accepts:
- Plain text string
- Note content
## Parameters
None.
## Output Format
Returns boolean:
- `True` if text is null, empty string, or only whitespace
- `False` if text contains any non-whitespace content
## Usage Examples
**Basic validation:**
```json
{"type":"is-empty","target":"$result","out":"$is_empty"}
```
**Used in conditional:**
```json
{"type":"is-empty","target":"$search_results","out":"$no_results"}
```
## Guidelines
- Treats null, empty string, whitespace-only as empty
- Newlines, tabs, spaces count as whitespace
- Any visible character makes content non-empty
## Examples
**Empty cases:**
```
null → true
"" → true
" " → true
"\n\t \n" → true
```
**Non-empty cases:**
```
"Hello" → false
" x " → false
"0" → false
```
This skill checks whether a piece of text is null, empty, or contains only whitespace. It provides a simple boolean result that tells you if content is effectively absent. Use it to validate input, filter results, or drive conditional logic in workflows.
The skill accepts a plain text string or note content and inspects it for meaningful characters. It returns True when the input is null, an empty string, or contains only whitespace (spaces, tabs, newlines). It returns False when any visible character appears in the text.
Does the skill treat newlines and tabs as empty?
Yes. Newlines, tabs, and spaces are all considered whitespace and count as empty when no visible characters are present.
Is the check sensitive to characters like zero or punctuation?
No. Any visible character, including digits like '0' or punctuation, makes the content non-empty.