Token导航 LogoToken导航TokenDH.com
前端设计操作浏览器github未标认证来源可访问clear审计通过

javascript-reactJavaScript React 测试

Agent Skill

用于辅助 Java 项目开发、面向对象设计、Spring 生态、Maven 或 Gradle 依赖和后端工程实践。它适合让 Agent 分析类结构、设计接口、整理服务分层、生成测试或检查常见代码坏味道。使用时需要结合项目已有架构、包结构和依赖版本,不应只按通用教程改代码;涉及数据库、事务、并发或框架配置时,应先确认运行环境和回归测试范围。

总安装

198

周安装

8

GitHub Stars

公开资料未说明

下载量

62
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/jaredlander/freshbooks-speed --skill javascript-react

简介

深度集成 React 框架,支持组件设计与状态管理优化。

  • 适用于现代前端单页应用开发与维护。javascript-react 属于前端设计类 Skill,可作为该场景下的辅助能力补充。
  • 使用时应关注 Hooks 用法与渲染性能优化。
  • 涉及 SSR 或微前端时需特别处理生命周期。
  • 安装方式:从特定仓库获取,注意核对 React 版本兼容性。

SKILL.md

Expert JavaScript & React Development

Write modern, performant, type-safe JavaScript and React code following current best practices.

Core Principles

  1. Prefer composition over inheritance - Use hooks, HOCs, and render props strategically
  2. Minimize re-renders - Memoize appropriately, lift state only when necessary
  3. Type everything - Use TypeScript for any non-trivial code
  4. Fail fast - Validate inputs, use error boundaries, handle edge cases

JavaScript Patterns

Modern Syntax Defaults

// Prefer const, use let only when reassignment needed
const config = { timeout: 5000 };
let count = 0;

// Destructuring with defaults
const { name, age = 18, ...rest } = user;
const [first, second, ...remaining] = items;

// Optional chaining and nullish coalescing
const value = obj?.deeply?.nested?.value ?? 'default';

// Template literals for complex strings
const query = `SELECT * FROM ${table} WHERE id = ${id}`;

Async Patterns

// Prefer async/await over raw promises
async function fetchData(url) {
  try {
    const response = await fetch(url);
    if (!response.ok) throw new Error(`HTTP ${response.status}`);
    return await response.json();
  } catch (error) {
    console.error('Fetch failed:', error);
    throw error;
  }
}

// Parallel execution
const [users, posts] = await Promise.all([fetchUsers(), fetchPosts()]);

// Sequential with error handling
const results = await Promise.allSettled([task1(), task2(), task3()]);
const successes = results.filter(r => r.status === 'fulfilled').map(r => r.value);

Advanced patterns reference

See references/modern-javascript.md for:

  • Closures and module patterns
  • Proxy and Reflect
  • Generators and async iterators
  • WeakMap/WeakSet for memory management
  • Custom iterables

React Patterns

Component Structure

// Functional components with TypeScript
interface ButtonProps {
  variant?: 'primary' | 'secondary' | 'danger';
  size?: 'sm' | 'md' | 'lg';
  disabled?: boolean;
  onClick?: () => void;
  children: React.ReactNode;
}

export function Button({
  variant = 'primary',
  size = 'md',
  disabled = false,
  onClick,
  children,
}: ButtonProps) {
  return (
    <button
      className={cn(styles.button, styles[variant], styles[size])}
      disabled={disabled}
      onClick={onClick}
    >
      {children}
    </button>
  );
}

Hooks Best Practices

// Custom hooks extract reusable logic
function useDebounce<T>(value: T, delay: number): T {
  const [debouncedValue, setDebouncedValue] = useState(value);

  useEffect(() => {
    const timer = setTimeout(() => setDebouncedValue(value), delay);
    return () => clearTimeout(timer);
  }, [value, delay]);

  return debouncedValue;
}

// useMemo for expensive computations
const sortedItems = useMemo(
  () => items.slice().sort((a, b) => a.name.localeCompare(b.name)),
  [items]
);

// useCallback for stable function references
const handleSubmit = useCallback(
  async (data: FormData) => {
    await submitForm(data);
    onSuccess();
  },
  [onSuccess]
);

State Management Decision Tree

  1. Local UI stateuseState
  2. Complex local state with actionsuseReducer
  3. Shared state within subtree → Context + useReducer
  4. Global app state → Zustand, Jotai, or Redux Toolkit
  5. Server state (fetching/caching) → TanStack Query or SWR

Advanced React patterns reference

See references/react-patterns.md for:

  • Compound components
  • Render props and HOCs
  • Controlled vs uncontrolled patterns
  • Error boundaries
  • Suspense and lazy loading
  • Server components (React 19+)

TypeScript Patterns

Type Utilities

// Discriminated unions for exhaustive checking
type Result<T> = { ok: true; value: T } | { ok: false; error: Error };

// Generic constraints
function getProperty<T, K extends keyof T>(obj: T, key: K): T[K] {
  return obj[key];
}

// Conditional types
type Awaited<T> = T extends Promise<infer U> ? U : T;

// Template literal types
type EventName = `on${Capitalize<string>}`;

Strict Configuration

{
  "compilerOptions": {
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "noImplicitReturns": true,
    "exactOptionalPropertyTypes": true
  }
}

Performance Optimization

See references/performance.md for comprehensive optimization strategies.

Quick Reference

ProblemSolution
Unnecessary re-rendersReact.memo, useMemo, useCallback
Large bundle sizeCode splitting, React.lazy, tree shaking
Slow listsVirtualization (@tanstack/react-virtual)
Layout thrashinguseLayoutEffect, batch DOM reads
Memory leaksCleanup in useEffect, AbortController

Critical Anti-patterns

// ❌ Creating objects/arrays in render
<Component style={{ color: 'red' }} items={[1, 2, 3]} />

// ✅ Stable references
const style = useMemo(() => ({ color: 'red' }), []);
const items = useMemo(() => [1, 2, 3], []);

// ❌ Index as key with dynamic lists
{items.map((item, i) => <Item key={i} {...item} />)}

// ✅ Stable unique keys
{items.map(item => <Item key={item.id} {...item} />)}

Testing

See references/testing.md for testing strategies.

Testing Stack

  • Unit tests: Vitest (fast, ESM-native)
  • Component tests: React Testing Library
  • E2E tests: Playwright
  • Type tests: tsd or expect-type

Testing Principles

  1. Test behavior, not implementation
  2. Prefer integration tests over unit tests
  3. Mock at network boundary (MSW), not internal modules
  4. Use realistic data with factories

Project Structure

src/
├── components/       # Reusable UI components
│   └── Button/
│       ├── Button.tsx
│       ├── Button.test.tsx
│       └── index.ts
├── features/         # Feature-specific code
│   └── auth/
│       ├── components/
│       ├── hooks/
│       ├── api.ts
│       └── types.ts
├── hooks/           # Shared custom hooks
├── lib/             # Utilities and helpers
├── types/           # Shared TypeScript types
└── App.tsx

Tooling Recommendations

CategoryToolNotes
BuildViteFast dev, good defaults
LintingESLint + typescript-eslintUse flat config
FormattingPrettierOr Biome for speed
Package managerpnpmFast, disk efficient
Runtime validationZodInfer TS types from schemas

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

Claude Code

28.75%
按下载量换算18

windsurf

20.02%
按下载量换算12

trae

17.72%
按下载量换算11

OpenCode

12.87%
按下载量换算8

Codex

7.08%
按下载量换算4

Antigravity

2.82%
按下载量换算2

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills