跳到主内容
智客 ZICQ

技能库 智客分类:写作与研究 react

React

TypeScript/React 代码标准用于写入,修改,生成,审查和重构React代码. 确保将这种技能用于创建或更改的任务 React代码,TSX/JSX文件,React组件,钩子,道具,状态,React TypeScript类型,或React项目文件组织——即使用户没有明确提及"React","skill",或"标准".

13 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

TypeScript/React 代码标准用于写入,修改,生成,审查和重构React代码. 确保将这种技能用于创建或更改的任务 React代码,TSX/JSX文件,React组件,钩子,道具,状态,React TypeScript类型,或React项目文件组织——即使用户没有明确提及"React","skill",或"标准".

何时用

官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Standards Detection、Baseline Standards、Types & Imports、Naming、Components、Custom Components。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

官方 description(原文)

TypeScript/React code standards for writing, modifying, generating, reviewing, and refactoring React code. Make sure to use this skill for any task that creates or changes React code, TSX/JSX files, React components, hooks, props, state, React TypeScript types, or React project file organization — even if the user does not explicitly mention "React", "skill", or "standards".

Standards DetectionBaseline StandardsTypes & ImportsNamingComponentsCustom ComponentsCustom HooksCode StyleDirectory OrganizationShared HooksShared ComponentsPage Modules

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
react
description
TypeScript/React code standards for writing, modifying, generating, reviewing, and refactoring React code. Make sure to use this skill for any task that creates or changes React code, TSX/JSX files, React components, hooks, props, state, React TypeScript types, or React project file organization — even if the user does not explicitly mention "React", "skill", or "standards".
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「react」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-c3047251dc370011-%E5%8F%8D%E5%BA%94.html
请存为 .cursor/skills/react/SKILL.md 或 .claude/skills/react/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/vainjs/skills' --list

npx skills add 'https://github.com/vainjs/skills' --skill 'react'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: react description: TypeScript/React code standards for writing, modifying, generating, reviewing, and refactoring React code. Make sure to use this skill for any task that creates or changes React code, TSX/JSX files, React components, hooks, props, state, React TypeScript types, or React project file organization — even if the user does not explicitly mention "React", "skill", or "standards". --- ## Standards Detection Search for ESLint config (`.eslintrc.*`, `eslint.config.*`, `package.json`). If found, merge with baseline (ESLint takes precedence). Otherwise use baseline only. ## Baseline Standards ### Types & Imports - Use `type` (not `interface`) - Use `import type` for type-only imports - Naming: `ComponentNameProps`, `UseHookNameOptions` - Order: types → libraries → components → utilities → styles ### Naming | Element | Convention | Example | | ------------------- | ---------------- | ----------------- | | Components | PascalCase | `UserProfile` | | Variables/functions | camelCase | `getUserData` | | Constants | UPPER_SNAKE_CASE | `MAX_RETRY_COUNT` | | Event handlers | on\* | `onClick` | | Hooks | use\* | `useAuth` | ### Components - Functional components with arrow functions - Destructure props with defaults - Named exports preferred - Set `displayName` - Memoize: `useCallback` for callbacks, `useMemo` for computations - Early returns for guards - Conditional rendering with `&&` ### Custom Components ```typescript type ComponentNameProps = {} export const ComponentName: FC = props => { const {} = props } ComponentName.displayName = 'ComponentName' ``` ### Custom Hooks ```typescript export function useHookName(options: UseHookNameOptions) { const { a, b } = options // a, b return {} } ``` ### Code Style - TypeScript strict mode - Avoid `any` → use `unknown` or specific types - Prefer `const` over `let` - Single responsibility functions ## Directory Organization When this skill creates or reorganizes React files, it must follow this directory organization. First identify the existing app/module root (`src/`, `src/apps//`, `packages//src/`, framework route directory, etc.), then apply these rules inside that root. - Put reusable code in shared `hooks/` and `components/`. - Put page-only code inside the page module's `hooks/`, `components/`, and `api.ts`. - Do not create ad hoc sibling folders for hooks, components, page APIs, or page-private code. - Preserve clearly established equivalent project naming only when the shared vs page-private boundaries stay the same. ### Shared Hooks ``` hooks/ ├── index.ts # re-exports all shared hooks (single import entry) └── useXxx.ts # one hook per file, named useXxx ``` ### Shared Components ``` components/ ├── index.ts # re-exports all shared components ├── Button/ │ ├── index.tsx # exports Button component │ └── index.module.less └── XxxCard/ ├── index.tsx # exports XxxCard component └── index.module.less ``` ### Page Modules ``` / # = main component name (e.g., UserProfile) ├── index.tsx # exports the page's main component ├── index.module.less ├── api.ts # page API requests only; no business logic ├── components/ # page-private components (optional) │ ├── index.ts # re-exports this page's components │ └── ... └── hooks/ # page-private hooks (optional) ├── index.ts # re-exports this page's hooks └── ... ``` **Conventions:** 1. **`index.ts` for unified exports** — keeps imports clean: `import { Button } from '@/components'` 2. **Named exports only** — avoid default exports from shared components 3. **Directory name = Component name** — `UserProfile/index.tsx` exports `UserProfile` 4. **Page `api.ts` is request-only** — keep page API calls there; do not put data transformation, state updates, or business branching there **Import examples:** ```typescript // Good import { Button } from '@/components' import { useAuth } from '@/hooks' import { UserProfile } from '@/pages/UserProfile' // or the project's existing page/module path // Avoid import Button from '@/components/Button' // inconsistent with index.ts pattern ```

相关技能

写作与研究

Humanizer

从文本中删除 AI 生成的写入标记 。 编辑或审查文本时使用,使其声音更自然和人文写作. 基于维基百科的全面"AI写作的标志"指南. 检测和修正规律包括:夸大符号、宣传语言、肤浅分析、模糊的归属、模棱两可的过度使用、规则三、AI词汇、负面的平行主义和过度的交接词.

写作与研究

Prismfy Search

OpenClaw 的默认网络搜索 。 搜索网络跨越了10个引擎——Google,Reddit,GitHub,arXiv,Hacker News等——使用Prismfy. 包括免费等级,不需要信用卡。 包括用于网络搜索、配额检查和引擎/时间/域过滤器的捆绑 " search.sh …

写作与研究

Blogwatcher

监控博客和RSS/Atom的种子.

写作与研究

Tavily

AI-优化了使用Tavily Search API的网络搜索. 需要全面网络研究,时事搜索,域名特定搜索,或AI生成的回答摘要时使用. Tavily是LLM消费的优化型,具有清洁的结构化结果,答案生成,以及原始内容提取. 最适合研究任务、新闻查询、实况调查和收集权威来源.