Skip to main content

add-private-feature-flag

Use when adding a new private (developer experiments) feature flag to Ghost, including the backend registration and settings UI toggle.

跳到安装

来源信息

仓库
TryGhost/Ghost
最近来源活动
2026年9月16日 12:45
检测到的 SKILL.md 语言
英语
星标
55,321
分支
11,966

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
add-private-feature-flag
description
Use when adding a new private (developer experiments) feature flag to Ghost, including the backend registration and settings UI toggle.
# Add Private Feature Flag ## Overview Adds a new private feature flag to Ghost. Private flags appear in Labs settings under the "Private features" tab, visible only when developer experiments are enabled. Read and follow the canonical [feature flag guide](../../../docs/practices/feature-flags.md) before adding a flag. The guide covers when a Labs flag is appropriate, safe gating across server and Admin, testing, and the cleanup lifecycle. For Admin 7 milestone flags, also use the [Admin 7 feature flags skill](../admin7-feature-flags/SKILL.md) for naming and shared presentation guidance. ## Steps 1. **Add the flag to `ghost/core/core/shared/labs.js`** - Add the flag name (camelCase string) to the `PRIVATE_FEATURES` array. 2. **Add a UI toggle in `apps/admin/src/settings/advanced/labs/private-features.tsx`** - Add a new entry to the `features` array with `title`, `description`, and `flag` (must match the string in `labs.js`). 3. **Run tests and update the config API snapshot** - Unit: `cd ghost/core && pnpm test:single test/unit/shared/labs.test.js` - Update snapshots: `cd ghost/core && pnpm test:single test/e2e-api/admin/config.test.js -u && pnpm test:single test/e2e-api/admin/settings.test.js -u` - Review both snapshot diffs to confirm only your new flag was added. ## Notes - No database migration is needed. Labs flags are stored in a single JSON `labs` setting. - The flag name must be identical in `labs.js`, `private-features.tsx`, and the snapshots. - Flags are camelCase strings (e.g. `welcomeEmailDesignCustomization`). - For public beta flags (visible to all users), add to `PUBLIC_BETA_FEATURES` in `labs.js` instead and add the toggle to `apps/admin/src/settings/advanced/labs/beta-features.tsx`.
在 GitHub 查看