‹ 首页

component

@darkroomengineering · 收录于 昨天 · 上游提交 昨天

Create UI component / widget / reusable piece. Triggers "create component", "new component", "add component", or naming a component (Button, Header, Card).

适合你,如果你经常需要创建新的UI组件或修改现有组件。

/ 通过 npx 安装 校验哈希
npx oh-my-skill add darkroomengineering/cc-settings/component
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- darkroomengineering/cc-settings/component
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify darkroomengineering/cc-settings/component
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
40GitHub stars
~888上下文体积 · 单文件
索引托管

怎么用

商店整理自技能原文 · 版本 fa04efc · 表述以原文为准
它做什么

装好后,当你说出创建组件的指令时,Claude会先检测项目类型(Next.js或React Router),然后自动生成符合Darkroom约定的React组件文件,包括组件代码、CSS模块和正确的导入路径。

什么时候触发

当你提到“创建组件”、“新组件”、“添加组件”,或者直接说出组件名称(如Button、Header)时触发。也可以使用参数指定组件名和--client标志(仅Next.js)强制创建客户端组件。

装好后可以这样说
Claude检测堆栈并生成文件
同上
强制创建客户端组件(仅Next.js)
技能原文 SKILL.md作者撰写 · MIT · fa04efc

Create Darkroom Component

Create a React component following Darkroom conventions. Detect the stack first — satus (Next.js) and novus (React Router) have different conventions for client/server boundaries, image/link wrappers, and path aliases.

Step 1 — Detect stack

Read package.json:

  • dependencies.next present → Next.js / satus conventions
  • dependencies["react-router"] or devDependencies["@react-router/dev"] → React Router / novus conventions
  • Neither → ask user, or assume satus if unclear
Step 2 — Resolve target paths

| Stack | Component path | CSS module path | Image wrapper | Link wrapper | Path alias | |---|---|---|---|---|---| | satus (Next.js) | components/<name>/index.tsx | components/<name>/<name>.module.css | import { Image } from '@/components/image' | import { Link } from '@/components/link' | @/ | | novus (React Router) | components/<name>/index.tsx | components/<name>/<name>.module.css | Native <img> (or project's wrapper if it exists) | import { Link } from 'react-router' | ~/ |

Step 3 — Emit template
satus / Next.js
// components/<name>/index.tsx
// 'use client' — only add if component needs:
// - useState, useEffect, or other hooks
// - Event handlers (onClick, onChange, etc.)
// - Browser APIs (window, document, etc.)

import s from './<name>.module.css'

interface <Name>Props {
  children?: React.ReactNode
  className?: string
}

export function <Name>({ children, className }: <Name>Props) {
  return (
    <div className={`${s.<name>} ${className ?? ''}`}>
      {children}
    </div>
  )
}
novus / React Router
// components/<name>/index.tsx
// React Router components are isomorphic — no directive needed.
// They run on server during SSR and on client after hydration.

import s from './<name>.module.css'

interface <Name>Props {
  children?: React.ReactNode
  className?: string
}

export function <Name>({ children, className }: <Name>Props) {
  return (
    <div className={`${s.<name>} ${className ?? ''}`}>
      {children}
    </div>
  )
}
CSS module (both stacks)
.<name> {
  /* Component styles */
}
Before you start

If this component wraps or uses an external library (Radix, Framer Motion, GSAP, etc.):

  1. Fetch docs first — use Context7 MCP (mcp__context7__resolve-library-idget-library-docs) for the current API.
  2. Check version — run bun info <package> before installing.

Never implement against external library APIs from memory.

Conventions (both stacks)
  1. CSS Module as s — always import as s for consistency.
  2. Props interface — define explicitly, include className for composition.
  3. Named export — use export function, not export default.
  4. No memoization — React Compiler handles it.
Conventions (satus only)
  1. Server Component by default — only add 'use client' if needed.
  2. Image wrapperimport { Image } from '@/components/image'.
  3. Link wrapperimport { Link } from '@/components/link'.
Conventions (novus only)
  1. Components are isomorphic — no 'use client' directive.
  2. Path alias is ~/, not @/.
  3. Linkimport { Link } from 'react-router' (declarative routing).
  4. Images — native <img> with explicit width/height/fetchPriority. No project-level wrapper unless the project added one.
Arguments
  • $ARGUMENTS — Component name (e.g., "Button", "Header")
  • --client flag (Next.js only) — Force client component
Example
User: "create a Button component"
→ detect stack → satus → creates components/button/index.tsx + button.module.css with @/-aliased imports

User: "create a Button component" (in novus repo)
→ detect stack → novus → creates same files but with ~/-aliased imports and no 'use client' directive
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。