validate-segment

Validate segment YAML configurations against the TD CDP API specification.

21|24|Updated Oct 21, 2025
One-click install
npx skills add https://github.com/treasure-data/td-skills --skill validate-segment
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: validate-segment
Source: https://github.com/treasure-data/td-skills/tree/main/tdx-skills/validate-segment
Command: npx skills add https://github.com/treasure-data/td-skills --skill validate-segment

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Validates segment YAML against the TD CDP API specification, ensuring operators, time units, and behavior aggregations are correct.

Core Features & Use Cases

  • Operator validation (Equal, In, Contain, TimeWithinPast, etc.)
  • Time unit singularization checks
  • Behavior aggregation structure validation

Quick Start

Use tdx sg validate to check all segments or validate a specific file: tdx sg validate path/to/segment.yml.

Frequently Asked Questions about validate-segment

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate segment YAML before pushing to Treasure Data?

Validate segment YAML using `tdx sg validate` to check all segments or specify a file path. The tool verifies operators, time units, and behavior aggregation structure against the TD CDP API specification, catching configuration errors before deployment.

What operators does segment validation support?

Segment validation supports Equal, NotEqual, Greater, GreaterEqual, Less, LessEqual, In, NotIn, Contain, StartWith, EndWith, Regexp, IsNull, TimeWithinPast, TimeWithinNext, include, and exclude operators for defining segment rules.

What YAML structure is required for segments?

Segments require name, kind, and rule fields. Rules must include type and conditions. Behavior aggregations need aggregation.type and source properties. Validation enforces this structure and uses singular time units (year, quarter, month, week, day, hour, minute, second).

Can I validate segment configurations without deploying them?

Yes. Run `tdx sg validate` to pre-validate segment YAML against the TD CDP API specification. This identifies operator type errors, invalid time units, and aggregation structure issues before pushing changes to production.

Why does segment validation fail with my time units?

Segment validation requires singular time units (day, not days; hour, not hours). Check your TimeWithinPast and TimeWithinNext conditions use correct singular forms. Plural units will cause validation errors.

What happens if behavior aggregation is missing or malformed?

Segment validation checks that behavior aggregations include both aggregation.type and source fields. Omitting either field or providing incorrect structure will fail validation and prevent segment deployment.