К основному содержанию
скилл CX Codex

copying-flags-across-projects — скилл для Claude Code

Переносит feature flag из одного проекта PostHog в другие проекты той же организации. Подходит для перехода со staging на production и синхронизации настроек.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add PostHog/skills --skill copying-flags-across-projects -a claude-code
Открыть на GitHub

Что делает copying-flags-across-projects

Скилл находит исходный feature flag по ключу или имени, проверяет проекты назначения и показывает зависимости перед копированием. Он переносит группы фильтров, варианты, процент раскатки и ссылки на cohorts. Cohort автоматически создаётся или переиспользуется в целевом проекте.

По умолчанию копия выключена, расписание изменений не переносится, а зависимые флаги остаются в исходном проекте. Эти параметры можно изменить отдельным подтверждением; расписание и зависимости копируются только после согласия. За один вызов можно передать до 50 проектов назначения, а результат приходит отдельно для каждого.

Для работы нужен API-ключ с явным scope feature_flag:write или feature_flag:* и ключ уровня организации либо без ограничения по организации. Team-scoped ключ не подойдёт, а на исходном проекте нужен как минимум редакторский доступ. Это критично проверить до запуска копирования.

Какие задачи решает

  • перенести feature flag из staging в production
  • скопировать один флаг в несколько проектов
  • синхронизировать фильтры и cohorts между проектами
  • сохранить зашифрованный payload remote configuration
  • проверить зависимости перед переносом флага

Примеры запросов агенту

  • Скопируй feature flag checkout-redesign из проекта staging в production и оставь копию выключенной.
  • Проверь зависимости флага new-pricing, затем перенеси его в проекты 101 и 102 без расписания.
  • Перенеси этот флаг как есть, включи его в целевых проектах и сохрани scheduled rollout.

Как установить copying-flags-across-projects

1Через Skills CLI (Vercel)

npx skills add PostHog/skills --skill copying-flags-across-projects -a claude-code

2Вручную: положить файлы

~/.claude/skills/copying-flags-across-projects/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/copying-flags-across-projects/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о copying-flags-across-projects

Как установить copying-flags-across-projects в Claude Code?

Выполните npx skills add PostHog/skills --skill copying-flags-across-projects -a claude-code, затем используйте файл ~/.claude/skills/copying-flags-across-projects/SKILL.md.

Что делает copying-flags-across-projects?

Скилл копирует один feature flag из проекта PostHog в один или несколько проектов той же организации. Он проверяет зависимости, переносит cohorts и сообщает результат отдельно для каждого проекта.

Какие доступы нужны для копирования флага?

API-ключ должен иметь явный scope feature_flag:write или feature_flag:* и быть уровня организации либо без ограничения по организации. Нужен редакторский доступ к исходному проекту; team-scoped ключ не работает.

Исходный текст

SKILL.md · MIT
---
name: copying-flags-across-projects
description: 'Copy a feature flag from one PostHog project to one or more target projects in the same organization. Use when the user wants to duplicate a flag, promote a flag from staging to production, sync flags across projects, or replicate a flag configuration in a different workspace. Covers cohort remapping, scheduled-change handling, encrypted payloads, and the safe defaults (disabled in target, no scheduled changes).'
---

# Copying feature flags across projects

This skill guides you through duplicating a feature flag from a source project into one or more target projects within the same PostHog organization.

## When to use this skill

- The user asks to "copy a flag to another project", "duplicate this flag", or "sync a flag between projects"
- The user wants to promote a flag from a staging project to a production project (or vice versa)
- The user wants to replicate a flag configuration in a different workspace and keep cohort dependencies intact
- The user is working around the absence of true environments by using projects-as-environments

## What this skill does not cover

- **Cross-organization copy** is not supported. The endpoint requires source and target projects to belong to the same org.
- **Bulk copying every flag in a project**. The tool copies one flag at a time. For batch copies, loop through flag keys; each call is independent.
- **Cleaning up old or stale flags** — see the `cleaning-up-stale-feature-flags` skill instead.

## Workflow

### 1. Resolve the source flag

You need the flag's **key** and the **source project's id**.

- If the user gave a flag key and a project id, use them directly.
- If the user gave a flag name (e.g. "the new pricing flag"), call `posthog:feature-flag-get-all` in the source project to find the matching flag and read its `key`.
- If the user only gave a flag and not a project, ask which project it lives in. Don't assume the active MCP project — copying out of the wrong source is a common foot-gun.

### 2. Resolve target project ids

Targets must be in the same organization as the source. Call `posthog:projects-get` to list available projects and confirm membership before issuing the copy.

For a multi-target copy, the tool accepts up to 50 target project ids in a single call. Successes and failures are reported per target, so a partial failure does not block the rest.

### 3. Preview the source flag and its dependencies

Call `posthog:feature-flag-get-definition` on the source flag. Then always call `posthog:feature-flags-copy-dependencies-check` with `feature_flag_key`, `from_project`, and `target_project_ids`, rather than trying to detect dependencies first — it copies nothing, and returns an empty result with no warnings when the flag has none, so running it on every copy is cheap and never skips a real dependency.

A false `can_copy_dependencies` does not always mean the copy is blocked. It is also false when there is nothing to copy. Report a problem only when `warnings` is non-empty.

Present a concise summary to the user before copying:

- Flag key, name, and active state in the source
- Filter groups (rollout %, property filters, variant splits)
- Any cohort references in `filters.groups[].properties[]` — these will be remapped server-side, but the user should know whether the target project already has matching cohorts
- Whether the flag has encrypted payloads (`has_encrypted_payloads`) or is remote configuration (`is_remote_configuration`)
- Whether scheduled changes exist (the user can opt to copy them in step 4)
- The dependency check's `copied_dependency_keys` (dependencies a copy would create in a target), `reused_dependency_keys` (dependencies a target already satisfies), and any `warnings`

### 4. Confirm copy options

One confirmation covers all three options. Default to the safest combination and ask the user to override only if they explicitly want different behavior:

- **`disable_copied_flag: true`** — the copied flag lands disabled in the target. Recommended by default; turning a flag on in a new project should be a deliberate, observed action.
- **`copy_schedule: false`** — scheduled changes do not come along. Recommended by default; schedules are usually project-specific.
- **`copy_dependencies: false`** — dependency flags do not come along. Set it to `true` only when the user approves copying the keys step 3's check reported.

If the user says "promote it as-is" or "turn it on in prod", switch `disable_copied_flag` to `false`. If they say "include the rollout schedule" or "with the scheduled rollout", switch `copy_schedule` to `true`.

### 5. Execute the copy

Call `posthog:feature-flags-copy-flags-create` with:

- `feature_flag_key`: the source flag's key
- `from_project`: the source project id
- `target_project_ids`: the resolved list of target project ids
- `disable_copied_flag`: from step 4 (default `true`)
- `copy_schedule`: from step 4 (default `false`)
- `copy_dependencies`: from step 4 (default `false`). Omitting it silently skips dependency copying, even when the user approved it.

### 6. Report per-target outcome

The response includes a `success` array (one entry per copied flag) and a `failed` array (per-target errors). Surface both:

- For each success: target project id, the new flag's id, and its `active` state in the target.
- For each failure: target project id and the error message. Common causes are missing editor access on the target team, or the flag already existing as a non-overridable resource in the target.

If any targets failed, ask the user whether to retry the failed ones, skip them, or fix the underlying issue (e.g. grant access, then retry).

## Important notes

- **Cohorts are remapped automatically.** When the source flag references a cohort, the endpoint creates or reuses an equivalent cohort in each target project and rewrites the flag's filters to point at the target-project cohort id. You don't need to handle this — but tell the user it's happening so they understand the new cohorts that may appear in the target.
- **Encrypted payloads are preserved.** Remote-configuration flags with encrypted payloads keep their encryption when copied; the payload is re-encrypted under the target project's key.
- **Scheduled changes copy with cohort remap too.** If `copy_schedule: true`, any scheduled cohort references are remapped just like the live filter conditions.
- **Auth requirements.** The user's API key must include explicit `feature_flag:write` (or `feature_flag:*`) scope. A `*`-only key will be rejected — this endpoint is gated by an INTERNAL viewset and `*` consent does not satisfy it. Team-scoped keys cannot reach this endpoint either; an org-scoped or unscoped key is required.
- **Editor access on the source.** The user must have at least editor-level access on the source flag's team. The endpoint enforces this via PostHog's access control before copying.
- **Per-target access on targets.** Targets the user can't see are silently dropped from the result; targets they can see but lack edit rights on appear in the `failed` array with a permission error.
- **No undo.** A copy creates a new flag in the target (or overwrites an existing flag with the same key). Always confirm with the user before issuing the copy, especially when the target is a production project.

## Example interaction

> **User:** Copy the `new-checkout` flag from project 12345 to project 67890.
>
> **Agent:** Looking at the source flag in project 12345.
>
> _(calls `posthog:feature-flag-get-definition`)_
>
> The `new-checkout` flag is currently a boolean at 25% rollout in project 12345, with no cohort filters and no scheduled changes. I'll copy it as **disabled** in project 67890 with no scheduled changes — this is the safer default. Confirm?
>
> **User:** Yes, but enable it in the target.
>
> **Agent:** Got it — enabling in the target.
>
> _(calls `posthog:feature-flags-copy-flags-create` with `disable_copied_flag: false`, `copy_schedule: false`)_
>
> Done. Created flag id 99887 in project 67890 (`active: true`). No failed targets.

## Available tools

- `posthog:feature-flags-copy-flags-create` — performs the copy. Required fields: `feature_flag_key`, `from_project`, `target_project_ids`. Optional: `disable_copied_flag`, `copy_schedule`, `copy_dependencies`.
- `posthog:feature-flags-copy-dependencies-check` — previews what a copy would do to the flag's transitive flag dependencies. Copies nothing. Call it before every copy; it returns an empty result when the flag has no dependencies.
- `posthog:feature-flag-get-all` — find a flag by key/name in a given project when the user only gave a friendly name.
- `posthog:feature-flag-get-definition` — fetch the full source flag (filters, variants, cohort references, encryption flags) so you can preview before copying.
- `posthog:projects-get` — list projects in the active organization, used to resolve and validate target project ids.

© PostHog · MIT · PostHog/skills

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

Каталог скиллов SKILL.md →
tracking-brand-sentiment-across-platforms apidojo Собирает посты о бренде в Twitter, Reddit и TikTok, считает тональность по каждой площадке и выдаёт общий балл здоровья бренда от 0 до 100. CX Codex +1 767установок migrating-dbt-project-across-platforms dbt-labs Скилл помогает перенести dbt-проект между хранилищами данных с помощью dbt Fusion. Он находит различия в SQL-диалектах и сверяет логику через unit-тесты. CX Codex +1 526установок aiconfig-projects launchdarkly Скилл отключён и переименован в projects. Нужен только тем, у кого в документации или промптах осталась старая ссылка. CX Codex +1 2 800установок redesign-existing-projects nexu-io Аудитирует существующий интерфейс и точечно перерабатывает сайт или приложение, сохраняя рабочую логику. Нужен, когда UI выглядит шаблонно или теряет визуальную иерархию. CX Codex +1 1 900установок projects launchdarkly Пошагово настраивает проекты LaunchDarkly в кодовой базе: проверяет стек и создаёт проект через MCP или API. CX Codex +1 1 800установок mcloud-projects medusajs Позволяет агенту находить, проверять и удалять облачные проекты Medusa через CLI. Пригодится при автоматизации деплоя и переключении окружений. CX Codex +1 1 300установок

Из того же набора48

suggesting-data-imports Подсказывает, каких данных не хватает в PostHog, и ведёт к подключению источника в дата-вейрхаусе. Пригодится, когда запрос падает из-за отсутствующей таблицы. CX Codex +1 372установок inbox-exploration Скилл для работы с PostHog Inbox: показывает отчёты, помогает разобрать их и превратить в задачу или PR. CX Codex +1 370установок tuning-incremental-sync-config Настраивает параметры синхронизации таблиц в data warehouse PostHog: переключает режимы, меняет инкрементальные поля, первичные ключи и расписание. CX Codex +1 370установок triaging-visual-review-runs Разбирает прогоны Visual Review в PostHog, отсеивает флакающие скриншоты Playwright и Storybook и снимает блокировку с пуллреквестов. CX Codex +1 368установок exploring-apm-traces Скилл разбирает распределённые трейсы OpenTelemetry в PostHog: находит медленные спаны, ошибки и узкие места по trace_id. CX Codex +1 358установок authoring-log-alerts Помогает настроить алерты по логам в проекте PostHog: выбирает сервисы, считает базовую линию и подбирает порог, чтобы алерт срабатывал 0–3 раза в неделю. CX Codex +1 356установок working-with-skills Учит агента правильно работать с PostHog-скиллами через MCP-инструменты skill-*: что читать, что писать и в каком порядке. Пригодится, когда скиллов много и они большие. CX Codex +1 353установок formatting-insight-axes Подбирает правильную единицу оси Y при создании инсайта в PostHog: секунды, миллисекунды, проценты, валюта. Избавляет от формул ради пересчёта единиц. CX Codex +1 353установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой