Agent skill
validate-segment
Validates CDP segment YAML configurations against the TD CDP API specification. Use when reviewing segment rules for correctness, checking operator types and values, or troubleshooting segment configuration errors before pushing to Treasure Data.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/validate-segment
SKILL.md
Segment YAML Validation
tdx sg validate # Validate all YAML files locally
tdx sg validate path/to/segment.yml # Validate specific file
tdx sg push --dry-run # Preview changes before push
Required Structure
name: string
kind: batch # batch | realtime | funnel_stage
rule:
type: And # And | Or
conditions:
- type: Value
attribute: field_name
operator:
type: OperatorType
value: ...
Operators Quick Reference
| Type | Value | Notes |
|---|---|---|
Equal, NotEqual |
single value | |
Greater, GreaterEqual, Less, LessEqual |
number | |
In, NotIn |
array | ["US", "CA"] |
Contain, StartWith, EndWith |
array | ["@gmail.com"] |
Regexp |
string | regex pattern |
IsNull |
(none) | |
TimeWithinPast, TimeWithinNext |
number + unit | value: 30, unit: day |
include, exclude |
segment name | reuse existing segment |
Time Units (Singular Form Only)
year | quarter | month | week | day | hour | minute | second
Common mistake: days → day, months → month
Behavior Aggregation Structure
# Behavior condition with aggregation
- type: Value
attribute: field_name # Or "" for pure count
operator:
type: GreaterEqual
value: 1
aggregation:
type: Count # Count | Sum | Avg | Min | Max
source: behavior_name # Behavior from parent segment
Required fields: aggregation.type and source must both be present
Related Skills
- segment - Full segment management
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?