Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

segment

БесплатноБез исполняемых скриптовНе проверен

Manages CDP child segments using `tdx sg` commands with YAML rule configs. Covers Value/Behavior condition types, all operators (Equal, In, Between…

treasure-dataот treasure-data★ 23 звезды на GitHub15 установок в других каталогах

Об этом скилле

tdx Segment - CDP Child Segment Management

Segment Creation Workflow

Process one segment at a time. For each segment:

  1. Create the YAML file
  2. Validate with tdx sg validate <file>
  3. Count check — run tdx sg sql --path <file> | tdx query - and verify count > 0
    • If count is 0, the rule is too restrictive — revise before proceeding
  4. Preview with preview_segment tool — get user approval before proceeding
  5. Push with tdx sg push -y "<file>" — always specify the file path explicitly

Never batch multiple segments in validate or push operations.

After push succeeds, display the Console link:

https://console.treasuredata.com/app/audiences/<parent_id>/segments/<segment_id>

Editing segments safely — read this first

All segment edits go through the typed tdx sg commands. Never edit a segment with raw tdx api HTTP calls.

  • Never tdx api PUT/PATCH a segment. Raw writes skip validation and can erase a segment's rule. Use the typed command for the change you want: tdx sg move to change folder, tdx sg push to change rules/activations.
  • Never read-modify-write a segment. Do not GET a segment and write the object back — rule fields can come back empty from list/entities reads, so writing it back erases the rule. Always use the dedicated command for the specific change.
  • To change only the folder, use tdx sg move (below). It changes the folder and nothing else.

If a typed command seems not to exist for what you need, ask the user — do not fall back to raw tdx api.

Core Commands

tdx sg use "Customer 360"             # Set parent segment context
tdx sg pull "Customer 360"            # Pull to YAML (creates segments/customer-360/*.yml)
tdx sg validate <file>                # Validate specific file locally
tdx sg push --dry-run "<file>"        # Server-side validation (quote paths with special chars)
tdx sg push -y "<file>"               # Push specific file (-y for non-interactive)

tdx sg list                           # List segments
tdx sg list -r                        # Recursive tree view
tdx sg fields                         # List available fields
tdx sg show "Segment Name"            # Preview segment data
tdx sg sql "Segment Name" | tdx query -  # Pipe segment SQL to query
tdx sg sql --path <file>              # Get SQL from local YAML (requires tdx.json)

tdx sg move <segment...> --folder <folder>  # Safely move segment(s) by ID or name to a folder (preserves rules)

Note: --path requires a project directory created by tdx sg pull. The file must be inside a folder with tdx.json.

Moving segments between folders

To move one or more segments to a different folder, use tdx sg move. It changes only the folder — the segment's rule and activations are left untouched (it re-reads and verifies the rule survived).

tdx sg move 12345 --folder 67890              # by ID
tdx sg move 12345 12346 --folder 67890        # several at once
tdx sg move 12345 --folder 67890 --dry-run    # preview, makes no changes

# By name — needs a parent segment context:
tdx sg use "Customer 360"
tdx sg move "VIP Customers" --folder "Archive"                       # by name
tdx sg move "Marketing/VIP Customers" --folder "Marketing/Archive"   # nested path
  • Segments and the target folder can be given by numeric ID or by name/path (names resolve within the current parent segment context).
  • Find a segment or folder by name with tdx sg list '<pattern>' -r — it searches the whole tree for names matching <pattern> (case-insensitive; a plain string matches as a substring, so 'VIP (US)' matches that name as-is; * and ? are wildcards) and prints each match with its full folder path + id, ready to pass to tdx sg move. On several matches it lists them all — pass the intended path/id, and if more than one matches, ask the user which; never assume the first. If it returns too many matches, narrow the pattern. (tdx sg list -r alone dumps the full tree.) Do not use the ids returned by tdx sg create.
  • If you skip the search and run tdx sg move '<name>' with a name that matches several segments, the move refuses and lists them — pick the intended full path/id (or ask the user); it will not guess.
  • In tdx sg move, name matching is case-insensitive; an ambiguous name errors and lists the matches with their IDs so you can pass the ID instead.
  • Names are relative to the parent segment — do not prefix the parent segment name.
  • A bare name in sg move only resolves a segment at the parent's top level. If the name is nested, sg move won't move the wrong thing: it tells you the segment is nested and prints its full path (or, if the name matches several, lists them all and refuses). Either way, take the full folder path it shows — or find it up front with tdx sg list '<name>' -r — and move by that path (Folder/Sub/Segment Name).
  • Footgun: the same
Полный SKILL.md на GitHub

Установить segment в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

SKILL.meta.ymltest.yml

FAQ

Что делает скилл segment?

Manages CDP child segments using `tdx sg` commands with YAML rule configs. Covers Value/Behavior condition types, all operators (Equal, In, Between, TimeWithinPast, etc.), behavior aggregations with filters, and nested condition group support/caveats. Use when creating audience segments with filtering rules, configuring behavior-based conditions, managing segment hierarchies, or exploring available fields with `tdx sg fields`.

Как установить скилл segment?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл segment запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить segment с