Claude Code Plugins

Community-maintained marketplace

Feedback

validate-segment

@treasure-data/td-skills
2
0

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 Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name validate-segment
description 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.

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: daysday, monthsmonth

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