copying-flags-across-projects
Skill này làm gì
Skill này sao chép một feature flag vào một hoặc nhiều dự án trong cùng tổ chức. Nó dành cho các nhóm thử nghiệm trong dự án staging và muốn chuyển một flag sang production.
Khi nào nên dùng
- ✓Khi bạn muốn chuyển một flag từ dự án staging sang dự án production.
- ✓Khi bạn muốn cùng một flag ở một không gian làm việc khác, với các cohort được giữ nguyên.
- ✓Khi bạn cần một bản sao của flag trong dự án thứ hai để xem nó hoạt động thế nào ở đó.
Liên kết skill
https://github.com/PostHog/posthog/blob/master/products/feature_flags/skills/copying-flags-across-projects/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Sao chép feature flag giá mới từ dự án staging sang production, nhưng giữ nó tắt ở đó.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill tìm khóa flag và dự án nguồn, rồi sao chép flag sang dự án đích. Bản sao ở dự án đích mặc định bị tắt và không mang theo các thay đổi đã lên lịch.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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-flagsskill 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-allin the source project to find the matching flag and read itskey. - 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 anywarnings
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 totrueonly 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 keyfrom_project: the source project idtarget_project_ids: the resolved list of target project idsdisable_copied_flag: from step 4 (defaulttrue)copy_schedule: from step 4 (defaultfalse)- `
Câu hỏi thường gặp
Tôi có thể sao chép flag sang tổ chức khác không?
Không. Dự án nguồn và dự án đích phải thuộc cùng một tổ chức.
Flag đã sao chép có được bật ở dự án đích không?
Không. Bản sao mặc định bị tắt ở dự án đích.
Tôi có thể sao chép tất cả flag cùng lúc không?
Không. Skill sao chép từng flag một, nên sao chép nhiều flag cần một lần sao chép cho mỗi flag.
Chi tiết
Mô tả gốc của tác giả
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).
repo: PostHog/posthog
Độ phổ biến
- Sao GitHub
- 41k
- Vị trí xếp hạng
- #6884
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
depot-ci
41kGiúp agent của bạn thiết lập và chạy quy trình Depot CI, một lựa chọn thay thế GitHub Actions, gồm chuyển các quy trình hiện có và đọc nhật ký chạy.
depot-container-builds
41kGiúp agent của bạn build image Docker trên các builder từ xa của Depot, gồm image đa nền tảng, đẩy lên registry và sửa lỗi build.
depot-github-runners
41kGiúp agent của bạn chuyển các job GitHub Actions sang runner do Depot quản lý, chọn kích thước và nhãn runner, và xử lý lỗi thiết lập runner.
editing-agents-md
41kGiúp agent của bạn quyết định một quy tắc nên nằm trong file AGENTS.md hay CLAUDE.md, và viết sao cho quy tắc được tuân thủ mà file không bị phình to.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.