From BYD Next
用于在 bydfi-ssr 页面中为右侧 sidebar / aside / `position: 'sidebar'` 槽位选择、规划并接入合适组件。 当用户询问“侧栏放什么”、要求补齐/调整 sidebar、或需要为 CMS widgetConfigs 决定 sidebar 组件与 SSR 数据接法时触发。 必须先给方案再落地,只允许处理 bydfi-ssr,不适用于 SSG、Web3 或无侧栏页面。
How this skill is triggered — by the user, by Claude, or both
Slash command
/byd-next:ssr-sidebar-pickThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
本 skill 用于规范 `bydfi-ssr` 页面右侧侧栏的组件选择与接入方式,覆盖 `components/content-forge` 与 `components/pseo` 两个组件池。
本 skill 用于规范 bydfi-ssr 页面右侧侧栏的组件选择与接入方式,覆盖 components/content-forge 与 components/pseo 两个组件池。
核心目标只有三个:
376px 侧栏宽度和响应式布局。核心原则:先出方案,等用户确认,再改文件。
bydfi-ssr 新建内容页、详情页、落地页时,询问“右侧栏放什么”。<aside> 或 sideWidgets,但内容为空,需要补组件。widgetConfigs 时,需要决定哪些 widgetType 放到 position: 'sidebar'。bydfi-ssg、Web3 或其他非 bydfi-ssr 项目。开始选型前,先判断页面属于哪一类。
代表页面:pages/[locale]/crypto-news/[id]/index.page.tsx
特征:
.page.tsx 中直接 import 侧栏组件并写 JSX。<aside className='sidebar'> 中直接渲染组件。getServerSideProps 中通过 Http.xxx({ mode: HTTP_MODE.SERVER, context }) 获取。serverData。适用场景:
代表页面:pages/[locale]/how-to-buy/[id]/index.page.tsx、pages/[locale]/price/[id]/index.page.tsx
特征:
Http.getCfContentPage 获取 widgetConfigs。position 将组件切分为 mainWidgets / sideWidgets。componentMap[widget.widgetType]。serverComponentsMap[widget.widgetType] 与各组件的 server.ts handleServer。适用场景:
Read 打开目标 .page.tsx,判断它属于写死式还是配置驱动式。<aside>、sideWidgets、position === 'sidebar' 等锚点,确认 sidebar 容器与布局。默认将 sidebar 宽度视为 376px,除非页面源码明确不是这个值。
必须优先阅读 references/component-pool.md,只在白名单内筛选候选组件。
选型要求:
输出时必须使用以下格式,不要自由发挥:
## 侧栏方案
页面: <相对路径>
写法: A 写死式 / B 配置驱动式
sidebar 容器宽度: 376px(项目默认)
### 组件清单
| 顺序 | 组件 | 来源 | 选它的理由 | SSR 依赖 | 备注 |
| --- | --- | --- | --- | --- | --- |
| 1 | Leaderboard | content-forge | 详情页右侧固定推涨跌新热榜,提升停留 | ✅ rankingsSnapshot | 已有页面用过,可直接复用 |
| 2 | conversion/Register | pseo | 未登录用户转化卡 | ❌ | 用 useAppContext 判断 isLogin 后再渲染 |
| ... |
### SSR 数据接入
(只列新增请求; 已存在的写“已具备”)
- `Http.getRankingsSnapshot` —— 写法 A 在 page 的 `getServerSideProps` 里并入 `Promise.all`,塞进 `props.rankingsSnapshot`,组件用 `<Leaderboard serverData={rankingsSnapshot} widgetConfig={{} as any} />`
### 落地后会改动
- `pages/[locale]/<page>/<id>/index.page.tsx`(写死式) 或
- `components/content-forge/component-map.ts` + CMS 配置(配置驱动式)
- 不新增 npm 依赖
请确认是否按此方案执行。
输出方案后必须停下,等待用户确认。
用户明确回复“OK”“按这个来”“执行”或同等确认后,才允许开始改文件。
import { Leaderboard } from '@/components/content-forge/leaderboard'<aside className='sidebar'> 中按确认后的顺序写 JSX。getServerSideProps 中并入对应 Http.xxx 请求。widgetConfig,统一传 widgetConfig={{} as any},不要传 undefined。componentData,显式构造对象并传入,不要依赖隐式默认值。widgetType 是否已注册在 components/content-forge/component-map.ts 的 componentMap 中。dynamic<any>(() => import(...), { ssr: true }) 映射。server.ts 中实现 handleServer。serverComponentsMap 中注册稳定的 serverKey 与 importer。position 应配置为 sidebar,skill 只负责提醒,不直接操作 CMS。.page.tsx 中手动 import sidebar 组件。Http.xxx({ mode: HTTP_MODE.SERVER, context }) 获取。useEffect 中现拉。serverData 必须允许为空,并有兜底,例如 serverData?.list || []。serverKey 会参与 dedupe,命名必须稳定。Promise.all,不要串行 await。候选白名单详见 references/component-pool.md。
阅读组件池时重点关注:
376px 侧栏宽度。简化决策规则:
content-forge 优先承担需要标准 SSR 通道的侧栏内容。pseo 只优先考虑纯静态或无需额外服务端预取的窄栏卡片。pseo 组件,默认不适合做 sidebar。pseo/conversion/bottom-fixed-banner、conversion/modal 这类 fixed / 浮层组件放进 sidebar。UniversalLayout 或自带大宽度容器的组件。componentMap / serverComponentsMap 手搓新通道。落地后至少确认以下事项:
pnpm tsc:all 无新增报错。--spec-* / --skin-* 变量,无硬编码颜色。LANG(),没有硬编码字符串。Promise.all。使用本 skill 规划或落地时,最终回复应包含:
npx claudepluginhub hawx1993/nextjs-ai-workflow --plugin byd-nextGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.