Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计通过

feature-flags-nextjsfeature flags Next.js 开发

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

1,247

周安装

53

GitHub Stars

31

下载量

437
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:feature-flags-nextjs(feature flags Next.js 开发)
来源仓库:https://github.com/posthog/skills
仓库路径:skills/feature-flags-nextjs
安装命令:
npx skills add https://github.com/posthog/skills --skill feature-flags-nextjs
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/posthog/skills --skill feature-flags-nextjs

简介

为 Next.js 应用提供完整的功能标志集成解决方案。

  • 支持服务端和客户端渲染场景下的功能控制。feature-flags-nextjs 属于开发类 Skill,可作为该场景下的辅助能力补充。
  • 包含 React 特定模式和 Next.js 优化的最佳实践指导。
  • 适用于需要全栈功能控制和渐进式发布的场景。
  • 通过 GitHub 安装,支持 Vercel 平台和主流前端框架。

SKILL.md

PostHog feature flags for Next.js

This skill helps you add PostHog feature flags to Next.js applications.

Reference files

  • references/react.md - React feature flags installation - docs
  • references/next-js.md - Next.js - docs
  • references/adding-feature-flag-code.md - Adding feature flag code - docs
  • references/best-practices.md - Feature flag best practices - docs

Consult the documentation for API details and framework-specific patterns.

Key principles

  • Environment variables: Always use environment variables for PostHog keys. Never hardcode them.
  • Minimal changes: Add feature flag code alongside existing logic. Don't replace or restructure existing code.
  • Boolean flags first: Default to boolean flag checks unless the user specifically asks for multivariate flags.
  • Server-side when possible: Prefer server-side flag evaluation to avoid UI flicker.

PostHog MCP tools

Check if a PostHog MCP server is connected. If available, look for tools related to feature flag management (creating, listing, updating, deleting flags). Use these tools to manage flags directly in PostHog rather than requiring the user to do it manually in the dashboard.

Framework guidelines

  • For Next.js 15.3+, initialize PostHog in instrumentation-client.ts for the simplest setup
  • The PostHog React hooks (useFeatureFlagEnabled, useFeatureFlagPayload) work WITHOUT PostHogProvider if posthog-js is already initialized (e.g., via instrumentation-client.ts)
  • In client components, import and use hooks directly - the React context defaults to the posthog-js singleton
  • Do NOT wrap components in PostHogProvider just for feature flags - it's unnecessary if posthog-js is initialized globally
  • Server Components and Route Handlers cannot use React hooks - use posthog-node SDK instead
  • Create a server-side PostHog client with posthog-node, call getAllFlags() or getFeatureFlag(), then await posthog.shutdown()
  • Pass flag values from server to client components as props to avoid hydration mismatches
  • For flags that affect initial render, evaluate server-side and pass as props to prevent UI flicker
  • Client-side hooks may return undefined initially while flags load - handle this loading state
  • For feature flags, use useFeatureFlagEnabled() or useFeatureFlagPayload() hooks - they handle loading states and external sync automatically
  • Add analytics capture in event handlers where user actions occur, NOT in useEffect reacting to state changes
  • Do NOT use useEffect for data transformation - calculate derived values during render instead
  • Do NOT use useEffect to respond to user events - put that logic in the event handler itself
  • Do NOT use useEffect to chain state updates - calculate all related updates together in the event handler
  • Do NOT use useEffect to notify parent components - call the parent callback alongside setState in the event handler
  • To reset component state when a prop changes, pass the prop as the component's key instead of using useEffect
  • useEffect is ONLY for synchronizing with external systems (non-React widgets, browser APIs, network subscriptions)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.38%
按下载量换算155

Claude

30.11%
按下载量换算132

Cursor

16.89%
按下载量换算74

Gemini CLI

8.66%
按下载量换算38

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills