team-ownership — скилл для Claude Code: передача владения записями CRM
Разбирает, кому принадлежат контакты, сделки и тикеты в HubSpot, и переносит владение при уходе сотрудника.
npx skills add HubSpot/agent-cli-skills --skill team-ownership -a claude-codeЧто делает team-ownership
Скилл работает с полем hubspot_owner_id на объектах contacts, companies, deals и tickets. Владельцы — это пользователи CRM, их список отдаёт hubspot owners list. Отдельного объекта команд нет, поэтому срез по команде строится на клиенте: записи группируются по hubspot_owner_id и сшиваются со списком владельцев ради читаемых адресов.
Перед началом нужно прочитать bulk-operations/SKILL.md: оттуда берутся конвейер JSONL, пагинация, схема dry-run/digest/confirm и восстановление через hubspot history. ID владельцев не хардкодят — они привязаны к конкретному порталу, поэтому сначала почту превращают в ID, а результат кэшируют.
Массовая передача идёт по цепочке «поиск → обновление»: строки поиска пересобираются в {id, properties:{hubspot_owner_id}} и уходят в objects update. Эта операция необратима, поэтому сначала прогоняют dry-run и смотрят дайджест, а затем повторяют с --digest и --confirm. Для одного сотрудника цикл проходит по всем четырём типам объектов. Ошиблись с переносом — hubspot history --since 1h покажет затронутые ID.
Какие задачи решает
- перенести записи уходящего менеджера на коллегу
- найти все сделки и тикеты конкретного владельца
- посчитать, сколько записей закреплено за каждым сотрудником
- выбрать сделки без владельца и назначить ответственного
- назначить владельца одной записи без выгрузки в JSONL
Примеры запросов агенту
- покажи все сделки, которые принадлежат [email protected]
- передай контакты и тикеты уходящего сотрудника на [email protected], сначала dry-run
- сгруппируй открытые сделки по владельцу и выведи почту с количеством
Как установить team-ownership
1Через Skills CLI (Vercel)
npx skills add HubSpot/agent-cli-skills --skill team-ownership -a claude-code2Вручную: положить файлы
~/.claude/skills/team-ownership/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/team-ownership/
1Через Skills CLI (Vercel)
npx skills add HubSpot/agent-cli-skills --skill team-ownership -a codex2Вручную: положить файлы
.agents/skills/team-ownership/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add HubSpot/agent-cli-skills --skill team-ownership -a cursor2Вручную: положить файлы
.cursor/skills/team-ownership/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install HubSpot/agent-cli-skills team-ownership2Вручную: положить файлы
.github/skills/team-ownership/SKILL.md1Через Skills CLI (Vercel)
npx skills add HubSpot/agent-cli-skills --skill team-ownership -a gemini-cli2Командой платформы
gemini skills install https://github.com/HubSpot/agent-cli-skills --path team-ownershipВручную: положить файлы
.devin/skills/team-ownership/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add HubSpot/agent-cli-skills --skill team-ownership -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Из того же набора11
Похожие
Рядом в теме «Автоматизация и no-code: n8n, Zapier, Make»
Все скиллы по теме «Автоматизация и no-code: n8n, Zapier, Make» →Вопросы о team-ownership
Как установить team-ownership в Claude?
Выполните npx skills add HubSpot/agent-cli-skills --skill team-ownership -a claude-code, скилл появится в ~/.claude/skills/team-ownership/SKILL.md.
Что делает team-ownership?
Назначает и переназначает владельцев записей CRM, показывает, кому что принадлежит, и помогает раздать записи при смене сотрудника. Работает поверх скилла bulk-operations.
Чем team-ownership отличается от bulk-operations?
bulk-operations даёт общий механизм массовых правок: JSONL, пагинацию, dry-run/digest/confirm и восстановление. team-ownership добавляет к нему логику владения записями и сценарий передачи дел.
Исходный текст
SKILL.md · Apache-2.0
--- name: team-ownership description: Assign and reassign CRM record ownership, audit who-owns-what across object types, and handle rep transitions. Built on `bulk-operations`. triggers: - "assign owner" - "reassign records" - "ownership audit" - "rep leaving" - "transfer records" - "change owner" - "find records owned by" - "redistribute accounts" --- Prereq: read `bulk-operations/SKILL.md` first. JSONL piping, pagination, dry-run/digest/confirm, and `hubspot history` recovery live there. Reshape patterns live in `bulk-operations/resources/json-patterns.md`. `hubspot_owner_id` is a string field on `contacts`, `companies`, `deals`, and `tickets`. Owners are CRM users — `hubspot owners list` returns them; there is no `teams` object, so team-level views are client-side groupings by `hubspot_owner_id`. ## 1. Resolve email → owner ID Never hardcode IDs — they are portal-specific. Resolve, then cache: ```bash FROM_ID=$(hubspot owners list | jq -r 'select(.email=="[email protected]") | .id') TO_ID=$(hubspot owners list | jq -r 'select(.email=="[email protected]") | .id') ``` ## 2. Find records for an owner Same filter across all four object types. Add object-specific `--properties` for context. Unowned records use the `!property` form. ```bash hubspot objects search --type contacts --filter "hubspot_owner_id=$FROM_ID" --properties email,firstname,lifecyclestage hubspot objects search --type companies --filter "hubspot_owner_id=$FROM_ID" --properties name,domain hubspot objects search --type deals --filter "hubspot_owner_id=$FROM_ID" --properties dealname,dealstage,amount hubspot objects search --type tickets --filter "hubspot_owner_id=$FROM_ID" --properties subject,hs_pipeline_stage # Records with no owner at all hubspot objects search --type deals --filter "!hubspot_owner_id" --properties dealname,amount ``` >100 hits — page with the `--after` loop from `bulk-operations`. Counting only: pipe to `wc -l`. ## 3. Bulk reassign — search → update Reshape each search row into `{id, properties:{hubspot_owner_id}}` and pipe to `objects update`. `objects update` is irreversible, so dry-run first: the dry-run emits a digest + `apply_command_hint` at every size (confirm = the record ID for one record, the row count for a batch). Then re-run with `--digest`/`--confirm` (see `bulk-operations/SKILL.md` § "Safe destructive workflow"). ```bash # Dry-run hubspot objects search --type contacts --filter "hubspot_owner_id=$FROM_ID" \ | jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}' \ | hubspot objects update --type contacts --dry-run \ | tee /tmp/reassign.preview.jsonl # Execute — lift the digest + confirm from the preview line (required at every size) digest=$(jq -r 'select(.digest != null) | .digest' /tmp/reassign.preview.jsonl) confirm=$(jq -r 'select(.digest != null) | .target.id' /tmp/reassign.preview.jsonl) # single: record ID; batch: row count hubspot objects search --type contacts --filter "hubspot_owner_id=$FROM_ID" \ | jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}' \ | hubspot objects update --type contacts --digest "$digest" --confirm "$confirm" ``` Single-record assignment — no stdin, no jq. Still irreversible, so dry-run first (confirm = the record ID): ```bash hubspot objects update --type contacts 12345 --property hubspot_owner_id=$TO_ID --dry-run hubspot objects update --type contacts 12345 --property hubspot_owner_id=$TO_ID --digest <hash> --confirm 12345 ``` ## 4. Rep-leaves workflow Loop over the four object types the rep touches: ```bash FROM_ID=$(hubspot owners list | jq -r 'select(.email=="[email protected]") | .id') TO_ID=$(hubspot owners list | jq -r 'select(.email=="[email protected]") | .id') for type in contacts companies deals tickets; do echo "── $type ──" hubspot objects search --type "$type" --filter "hubspot_owner_id=$FROM_ID" \ | jq -c --arg to "$TO_ID" '{id, properties:{hubspot_owner_id:$to}}' \ | hubspot objects update --type "$type" --dry-run done ``` Review each digest line, then re-run per type with the `--digest`/`--confirm` lifted from that type's preview line (required at every size; confirm = the row count for a batch, the record ID for a single). Mis-reassigned? `hubspot history --since 1h` lists the affected IDs. ## 5. Team-level views (client-side grouping) Group records by `hubspot_owner_id`, join to `owners list` for human-readable emails: ```bash hubspot objects search --type deals --filter "dealstage!=closedwon AND dealstage!=closedlost" \ --properties hubspot_owner_id --format json \ | jq '.data | group_by(.properties.hubspot_owner_id) | map({owner_id: .[0].properties.hubspot_owner_id, count: length})' \ > /tmp/by-owner.json hubspot owners list \ | jq --slurpfile by /tmp/by-owner.json -r \ '. as $o | $by[0][] | select(.owner_id==$o.id) | "\($o.email)\t\(.count)"' ```
© HubSpot · Apache-2.0 · HubSpot/agent-cli-skills