Token导航 LogoToken导航

Agent Skill · 研究检索

dx-expert(DX 专家)

dx-expert 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

dx-expert 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 66,424。

总安装 264周安装 11GitHub Stars 公开资料未说明下载 88核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/agustinoberg/dx-expert-skill --skill dx-expert

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

dx-expert 专注 React Native Expo 开发体验优化,强制执行单一职责和组件组合模式。适用于多组件编写、跨关注点逻辑和状态渲染混合场景的代码审查与重构。优先使用 Expo APIs 和 Router 原生特性,避免第三方替代方案引入复杂度。

使用前需确认项目技术栈为 React Native + Expo,否则可能导致规则不适用。dx-expert 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/dx-expert

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/agustinoberg/dx-expert-skill --skill dx-expert;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

dx-expert 怎么安装?

在终端执行 npx skills add https://github.com/agustinoberg/dx-expert-skill --skill dx-expert。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

dx-expert 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

dx-expert 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

dx-expert 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

dx-expert 用的人多吗?

公开数据是累计安装 264 次,近一周安装 11 次,下载 88 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

dx-expert 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
dx-expert

DX 专家 · 本页

264—需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

/dx-expert - Developer Experience Expert

Enforce Single Responsibility Principle, clean hook architecture, and component composition patterns in React Native Expo to maintain excellent developer experience without performance issues.

Target platform: React Native with Expo. Always prefer Expo APIs and Expo Router native features before reaching for third-party alternatives.

When to Apply

Apply these principles automatically when:

  • Creating or modifying more than one component
  • Writing logic that spans multiple concerns
  • Reviewing code that mixes state logic with rendering
  • Refactoring existing code for clarity

Core Principles

1. Single Responsibility Principle (SRP)

Separate state logic from rendering logic. Components render. Hooks manage state.

// BAD - Mixed concerns
export const AppointmentCard = ({ appointmentId }: Props) => {
  const [appointment, setAppointment] = useState<Appointment | null>(null);
  const [isExpanded, setIsExpanded] = useState(false);
  const [barber, setBarber] = useState<Barber | null>(null);

  useEffect(() => {
    fetchAppointment(appointmentId).then(setAppointment);
  }, [appointmentId]);

  useEffect(() => {
    if (appointment?.barberId) {
      fetchBarber(appointment.barberId).then(setBarber);
    }
  }, [appointment?.barberId]);

  const handleToggle = () => setIsExpanded(prev => !prev);

  return (
    <View>
      <Text>{appointment?.clientName}</Text>
      {isExpanded && <Text>{barber?.name}</Text>}
      <Pressable onPress={handleToggle}>
        <Text>Toggle</Text>
      </Pressable>
    </View>
  );
};

// GOOD - Separated concerns
export const AppointmentCard = ({ appointmentId }: AppointmentCardProps) => {
  const { appointment, barber, isExpanded, handleToggle } = useAppointmentCard({ appointmentId });

  return (
    <View>
      <Text>{appointment?.clientName}</Text>
      {isExpanded && <Text>{barber?.name}</Text>}
      <Pressable onPress={handleToggle}>
        <Text>Toggle</Text>
      </Pressable>
    </View>
  );
};
AppointmentCard.displayName = 'AppointmentCard';

2. Hook Architecture

2a. One Hook Per File

Every hook lives in its own file. Group related hooks in folders.

hooks/
├── useAppointmentCard/
│   ├── index.ts
│   ├── useAppointmentCard.ts
│   ├── useExpandToggle.ts        # Small, focused sub-hook
│   └── types.ts
2b. Small and Focused

Each hook does one thing only. If a hook grows beyond ~50-80 lines, split it.

// BAD - Hook doing too many things
const useAppointmentForm = ({ appointmentId }: Args) => {
  // 200+ lines of fetching, validation, submission, formatting...
};

// GOOD - Composed small hooks
const useAppointmentForm = ({ appointmentId }: UseAppointmentFormArgs) => {
  const { appointment } = useAppointmentQuery({ appointmentId });
  const { form, handleSubmit } = useAppointmentFormState({ appointment });
  const { timeSlots } = useAvailableSlots({ barberId: appointment?.barberId });

  return { appointment, form, handleSubmit, timeSlots };
};
2c. Single Object Argument

Hooks always receive a single object as argument. Never loose parameters.

// BAD - Loose parameters
const useClientSearch = (query: string, filters: Filters, page: number) => { ... };

// GOOD - Single object argument
interface UseClientSearchArgs {
  query: string;
  filters: Filters;
  page: number;
}

const useClientSearch = ({ query, filters, page }: UseClientSearchArgs) => { ... };

Even with a single parameter, use an object for consistency and extensibility:

// BAD
const useBarberDetails = (barberId: string) => { ... };

// GOOD
const useBarberDetails = ({ barberId }: UseBarberDetailsArgs) => { ... };

3. useEffect Rules

Avoid useEffect whenever possible. It is one of the main sources of memory leaks.

When NOT to use useEffect:
  • Deriving state from props or other state (use useMemo or compute inline)
  • Responding to user events (use event handlers)
  • Transforming data for rendering (compute during render)
  • Syncing with external stores (use useSyncExternalStore)
// BAD - Derived state in useEffect
const [fullName, setFullName] = useState('');
useEffect(() => {
  setFullName(`${firstName} ${lastName}`);
}, [firstName, lastName]);

// GOOD - Compute inline or with useMemo
const fullName = `${firstName} ${lastName}`;
When useEffect IS acceptable:
  • Syncing with external systems (subscriptions, native modules)
  • Cleanup on unmount (event listeners, timers)
  • Cases where no alternative exists
If using useEffect:
  1. Keep the dependency array fully controlled and explicit
  2. Keep the effect body small and focused (< 10 lines)
  3. Always include cleanup when needed
  4. Never ignore exhaustive-deps warnings
// Acceptable - External system sync
useEffect(() => {
  const subscription = eventEmitter.addListener('event', handler);
  return () => subscription.remove();
}, [handler]);

4. Memoization Strategy

useCallback: Almost Never

With React Compiler, useCallback loses its purpose. Do not use it.

// BAD - Unnecessary with React Compiler
const handlePress = useCallback(() => {
  onSelect(item.id);
}, [onSelect, item.id]);

// GOOD - Just define the function
const handlePress = () => {
  onSelect(item.id);
};
useMemo: Only for Computed Constants

Use useMemo for expensive computations or derived constants. Do not memoize components or hooks. Do not memoize everything.

// Valid - Expensive computation
const sortedItems = useMemo(
  () => items.slice().sort((a, b) => a.name.localeCompare(b.name)),
  [items],
);

// Valid - Derived constant
const availableSlots = useMemo(
  () => slots.filter(slot => slot.isAvailable),
  [slots],
);

// BAD - Memoizing a component
const MemoizedCard = useMemo(() => <Card data={data} />, [data]);

// BAD - Memoizing trivial operations
const label = useMemo(() => `${firstName} ${lastName}`, [firstName, lastName]);

5. Component Rules

5a. Small and Focused

Each component has semantic meaning and a clear, single purpose.

// BAD - Component doing too much
const AppointmentScreen = () => {
  // 300 lines: header, filters, list, empty state, modals, FAB...
};

// GOOD - Composed small components
const AppointmentScreen = () => {
  return (
    <View style={styles.container}>
      <AppointmentHeader />
      <AppointmentFilters />
      <AppointmentList />
      <CreateAppointmentFAB />
    </View>
  );
};
AppointmentScreen.displayName = 'AppointmentScreen';
5b. No Excessive Conditionals

Avoid nested ternaries and complex conditional rendering. Extract to components or use early returns.

// BAD - Nested ternaries
return (
  <View>
    {isLoading ? (
      <Spinner />
    ) : error ? (
      <ErrorView error={error} />
    ) : data?.length ? (
      data.map(item => (
        item.type === 'premium' ? (
          <PremiumCard key={item.id} data={item} />
        ) : (
          <StandardCard key={item.id} data={item} />
        )
      ))
    ) : (
      <EmptyState />
    )}
  </View>
);

// GOOD - Clear, readable conditions
if (isLoading) return <Spinner />;
if (error) return <ErrorView error={error} />;
if (!data?.length) return <EmptyState />;

return (
  <View>
    {data.map(item => (
      <AppointmentCard key={item.id} data={item} />
    ))}
  </View>
);
5c. Compound Component Pattern — Composition Is All You Need

This is the preferred way to build components and screens. Instead of monolithic components with growing lists of boolean props, use the compound component pattern (Component.Root, Component.Header, Component.Content, etc.) to create declarative, composable APIs that share state through context.

The Golden Rule

If you have a boolean prop that determines which component tree gets rendered, you need composition instead.

// BAD - Boolean props that control rendering
<Composer isThread={true} isEditing={false} isForwarding={false} isDM={false} />

// GOOD - Distinct component trees that compose shared internals
<ThreadComposer />   // Renders only what threads need
<EditComposer />     // Renders only what editing needs
<ForwardComposer />  // Renders only what forwarding needs

Don't render or don't — there are no booleans. Want drag-and-drop? Render <DropZone />. Don't want it? Don't render it. No enableDropZone={false}.

The Pattern

A compound component has:

  1. A Provider that holds the context and defines the shared interface (state + actions)
  2. Sub-components that consume the context and render specific parts
  3. A namespace export that groups everything under Component.Root, Component.Header, etc.

State management: Always use React Context for sharing state within compound components. External state (React Query, global stores) feeds into the provider from outside, but the delivery mechanism between provider and sub-components is always Context.

The key insight: the provider defines the interface, but each consumer decides the implementation. Different screens can use different state management (useState, React Query, global sync) as long as they conform to the same context interface.

File Organization

Flexible based on size:

Small compound component — everything in one file:

ServicePicker/
├── index.ts
├── ServicePicker.tsx     # Context, provider, and sub-components all here
├── styles.ts
└── types.ts

Large compound component — split across files in a folder:

AppointmentComposer/
├── index.ts
├── context.ts                          # Context + useContext hook
├── types.ts                            # Shared types
├── AppointmentComposer.Frame.tsx
├── AppointmentComposer.ClientPicker.tsx
├── AppointmentComposer.DatePicker.tsx
├── AppointmentComposer.SubmitButton.tsx
├── CommonActions.tsx                   # Co-located shared composition
└── styles.ts

Shared compositions like CommonActions are co-located within the compound component folder.

Full Example: Appointment Composer

Imagine an appointment component used in multiple places: creating, editing, and rescheduling. Each has subtle differences in UI and state.

// -- Context Interface --

interface AppointmentComposerContextValue {
  state: {
    clientId: string | null;
    barberId: string | null;
    serviceIds: string[];
    date: Date | null;
    notes: string;
  };
  actions: {
    updateClient: (clientId: string) => void;
    updateBarber: (barberId: string) => void;
    updateServices: (serviceIds: string[]) => void;
    updateDate: (date: Date) => void;
    updateNotes: (notes: string) => void;
    submit: () => void;
  };
  meta: {
    isSubmitting: boolean;
    canSubmit: boolean;
  };
}

const AppointmentComposerContext = createContext<AppointmentComposerContextValue | null>(null);

const useAppointmentComposer = () => {
  const context = useContext(AppointmentComposerContext);
  if (!context) {
    throw new Error('Must be used within AppointmentComposer.Provider');
  }
  return context;
};

// -- Sub-components (agnostic to state implementation) --

const Frame = ({ children }: { children: ReactNode }) => (
  <View style={styles.frame}>{children}</View>
);
Frame.displayName = 'AppointmentComposer.Frame';

const ClientPicker = () => {
  const { state, actions } = useAppointmentComposer();
  return (
    <ClientSelector
      selectedId={state.clientId}
      onSelect={actions.updateClient}
    />
  );
};
ClientPicker.displayName = 'AppointmentComposer.ClientPicker';

const BarberPicker = () => {
  const { state, actions } = useAppointmentComposer();
  return (
    <BarberSelector
      selectedId={state.barberId}
      onSelect={actions.updateBarber}
    />
  );
};
BarberPicker.displayName = 'AppointmentComposer.BarberPicker';

const ServicePicker = () => {
  const { state, actions } = useAppointmentComposer();
  return (
    <ServiceMultiSelect
      selectedIds={state.serviceIds}
      onChange={actions.updateServices}
    />
  );
};
ServicePicker.displayName = 'AppointmentComposer.ServicePicker';

const DatePicker = () => {
  const { state, actions } = useAppointmentComposer();
  return <CalendarPicker selected={state.date} onSelect={actions.updateDate} />;
};
DatePicker.displayName = 'AppointmentComposer.DatePicker';

const Notes = () => {
  const { state, actions } = useAppointmentComposer();
  return (
    <TextInput
      value={state.notes}
      onChangeText={actions.updateNotes}
      placeholder="Notes..."
    />
  );
};
Notes.displayName = 'AppointmentComposer.Notes';

const SubmitButton = () => {
  const { actions, meta } = useAppointmentComposer();
  return (
    <Button
      onPress={actions.submit}
      disabled={!meta.canSubmit}
      loading={meta.isSubmitting}
    />
  );
};
SubmitButton.displayName = 'AppointmentComposer.SubmitButton';

// -- Namespace Export --

export const AppointmentComposer = {
  Context: AppointmentComposerContext,
  useContext: useAppointmentComposer,
  Frame,
  ClientPicker,
  BarberPicker,
  ServicePicker,
  DatePicker,
  Notes,
  SubmitButton,
};
Different Implementations, Same Components

Creating an appointment — state is local, submit creates:

const CreateAppointmentProvider = ({ children }: { children: ReactNode }) => {
  const [state, setState] = useState(INITIAL_STATE);
  const { mutate: createAppointment, isPending } = useCreateAppointmentMutation();

  const actions = {
    updateClient: (clientId: string) => setState(prev => ({ ...prev, clientId })),
    updateBarber: (barberId: string) => setState(prev => ({ ...prev, barberId })),
    // ...other updates
    submit: () => createAppointment(state),
  };

  const meta = { isSubmitting: isPending, canSubmit: !!state.clientId && !!state.date };

  return (
    <AppointmentComposer.Context.Provider value={{ state, actions, meta }}>
      {children}
    </AppointmentComposer.Context.Provider>
  );
};

// Usage — all sub-components, full form:
const CreateAppointmentScreen = () => (
  <CreateAppointmentProvider>
    <AppointmentComposer.Frame>
      <AppointmentComposer.ClientPicker />
      <AppointmentComposer.BarberPicker />
      <AppointmentComposer.ServicePicker />
      <AppointmentComposer.DatePicker />
      <AppointmentComposer.Notes />
      <AppointmentComposer.SubmitButton />
    </AppointmentComposer.Frame>
  </CreateAppointmentProvider>
);
CreateAppointmentScreen.displayName = 'CreateAppointmentScreen';

Editing an appointment — state is pre-filled, submit updates, no client picker:

const EditAppointmentProvider = ({ appointmentId, children }: EditProviderProps) => {
  const { data: appointment } = useAppointmentQuery({ appointmentId });
  const [state, setState] = useState(() => mapAppointmentToState(appointment));
  const { mutate: updateAppointment, isPending } = useUpdateAppointmentMutation();

  const actions = {
    // ...same interface, different implementation
    submit: () => updateAppointment({ appointmentId, ...state }),
  };

  return (
    <AppointmentComposer.Context.Provider value={{ state, actions, meta }}>
      {children}
    </AppointmentComposer.Context.Provider>
  );
};

// Usage — NO ClientPicker, NO boolean. We just don't render it.
const EditAppointmentScreen = () => (
  <EditAppointmentProvider appointmentId={id}>
    <AppointmentComposer.Frame>
      <AppointmentComposer.BarberPicker />
      <AppointmentComposer.ServicePicker />
      <AppointmentComposer.DatePicker />
      <AppointmentComposer.Notes />
      <AppointmentComposer.SubmitButton />
    </AppointmentComposer.Frame>
  </EditAppointmentProvider>
);
EditAppointmentScreen.displayName = 'EditAppointmentScreen';

Rescheduling — only date picker, submit button is OUTSIDE the frame (in a modal footer):

// Lift the provider above the frame so external components can access state.
const RescheduleModal = () => (
  <RescheduleProvider appointmentId={id}>
    <ModalContent>
      <AppointmentComposer.Frame>
        <AppointmentComposer.DatePicker />
      </AppointmentComposer.Frame>
    </ModalContent>
    <ModalFooter>
      {/* This button is OUTSIDE the frame but INSIDE the provider.
          It can access state and actions from context. */}
      <AppointmentComposer.SubmitButton />
    </ModalFooter>
  </RescheduleProvider>
);
RescheduleModal.displayName = 'RescheduleModal';
Lifting State — The Most Powerful Technique

If a component outside your main frame needs access to the composer's state, lift the provider higher in the tree. The provider doesn't have to wrap only the visual component — it wraps anything that needs access.

// BAD - Trying to pass state back up
const Modal = () => {
  const [formState, setFormState] = useState(null);
  return (
    <View>
      <Composer onFormStateChange={setFormState} />
      <Button onPress={() => submit(formState)}>Save</Button>  {/* Stale, fragile */}
    </View>
  );
};

// GOOD - Lift the provider
const Modal = () => (
  <ComposerProvider>
    <Composer />
    <SaveButton />  {/* Uses context directly, always in sync */}
  </ComposerProvider>
);
Reusable Monoliths From Compound Components

When many implementations share the same actions, create a convenience wrapper that composes the sub-components — but always allow escaping to individual pieces:

// Convenience: shared default for most cases
const CommonActions = () => (
  <>
    <AppointmentComposer.ServicePicker />
    <AppointmentComposer.DatePicker />
    <AppointmentComposer.Notes />
  </>
);

// Most screens use CommonActions
const CreateScreen = () => (
  <CreateProvider>
    <AppointmentComposer.Frame>
      <AppointmentComposer.ClientPicker />
      <CommonActions />
      <AppointmentComposer.SubmitButton />
    </AppointmentComposer.Frame>
  </CreateProvider>
);

// But you can always escape to individual components
const EditScreen = () => (
  <EditProvider appointmentId={id}>
    <AppointmentComposer.Frame>
      {/* No ClientPicker, no CommonActions — just what we need */}
      <AppointmentComposer.DatePicker />
      <AppointmentComposer.Notes />
      <AppointmentComposer.SubmitButton />
    </AppointmentComposer.Frame>
  </EditProvider>
);
Why This Is the Best Approach
ProblemCompound Components Solve It
Boolean prop explosion (isEditing, isThread, isForwarding)Each variant is its own component tree — no booleans
Prop drillingState is shared via context, not passed through layers
Massive componentsEach sub-component is small and focused
Rigid layoutsConsumer controls order and composition
State management couplingProvider defines interface; implementation is swapped at the root
Components outside the frame needing stateLift the provider higher in the tree
TestingSub-components can be tested in isolation with a mock provider
When to Use
  • Screens: Always. Every screen should be a Provider + composed sub-components.
  • Complex components: Cards with header/body/footer, modals, composers, forms with sections.
  • Anything with shared state: If 2+ sibling components need the same data, use this pattern.
  • Components with variants: If the same concept has different implementations (create vs edit vs reschedule), use different providers with the same sub-components.
When NOT to Use
  • Simple, self-contained components with no shared state (a Badge, a Divider)
  • Components with 1-2 props that don't drill anywhere
Anti-Patterns
// BAD - Boolean props controlling what renders
<Composer isEditing={true} hideClientPicker={true} showCancelButton={true} />

// BAD - God component with everything inline
const AppointmentScreen = () => {
  // 300 lines of mixed state + rendering + conditions
};

// BAD - Passing state back up to parent
<Composer onFormStateChange={setFormState} />

// BAD - Array of actions with conditions
const actions = [
  { id: 'emoji', show: !isEditing },
  { id: 'attach', show: !isEditing && !isForwarding },
  // ...nightmare
];
5d. No renderSomething Functions

Never create render functions inside components. Extract to proper components.

// BAD - render functions
const ClientList = () => {
  const renderHeader = () => <View><Text>Clients</Text></View>;
  const renderItem = (item: Client) => <View><Text>{item.name}</Text></View>;
  const renderEmpty = () => <View><Text>No clients</Text></View>;

  return (
    <View>
      {renderHeader()}
      <FlatList
        data={clients}
        renderItem={({ item }) => renderItem(item)}
        ListEmptyComponent={renderEmpty()}
      />
    </View>
  );
};

// GOOD - Proper components
const ClientListHeader = () => (
  <View><Text>Clients</Text></View>
);
ClientListHeader.displayName = 'ClientListHeader';

const ClientListItem = ({ client }: ClientListItemProps) => (
  <View><Text>{client.name}</Text></View>
);
ClientListItem.displayName = 'ClientListItem';

const ClientListEmpty = () => (
  <View><Text>No clients</Text></View>
);
ClientListEmpty.displayName = 'ClientListEmpty';

const ClientList = () => (
  <FlatList
    data={clients}
    renderItem={({ item }) => <ClientListItem client={item} />}
    ListHeaderComponent={ClientListHeader}
    ListEmptyComponent={ClientListEmpty}
  />
);
ClientList.displayName = 'ClientList';
5e. Use Native APIs

Prefer React Native built-in components: FlatList, SectionList, ScrollView, Pressable. Avoid reinventing what the platform provides.


6. Suggest Better Libraries When Obvious

If something is clearly being reinvented when a well-known library already solves it, suggest it:

"This could be much better using [library]. It would save you all these problems."

Only suggest when it's obviously a bad practice — don't over-suggest. Use common sense.


7. User Experience Must Be Pixel-Perfect

DX and UX go hand in hand. Every solution must consider how the user actually experiences it. This is non-negotiable.

Keyboard Handling

The keyboard must never cover the input the user is typing in. Ever. This is the #1 UX offense in mobile apps.

Solutions (use whichever fits):

  • KeyboardAvoidingView (built-in React Native) for simple screens
  • react-native-keyboard-controller for smooth native-driven animations
  • ScrollView with keyboardShouldPersistTaps="handled" for scrollable forms
  • Proper contentContainerStyle padding to account for keyboard height
// BAD - Input hidden behind keyboard
const FormScreen = () => (
  <View style={styles.container}>
    <TextInput placeholder="Name" />
    <TextInput placeholder="Email" />
    <TextInput placeholder="Notes" />  {/* Covered by keyboard */}
  </View>
);

// GOOD - Keyboard never covers active input
const FormScreen = () => (
  <KeyboardAvoidingView behavior="padding" style={styles.container}>
    <ScrollView keyboardShouldPersistTaps="handled">
      <TextInput placeholder="Name" />
      <TextInput placeholder="Email" />
      <TextInput placeholder="Notes" />
    </ScrollView>
  </KeyboardAvoidingView>
);
General UX Principles

Always consider:

  • Loading states: Never show a blank screen. Use skeletons, spinners, or placeholders.
  • Error states: Every failure must be communicated clearly. No silent failures.
  • Empty states: Lists with no data must show a meaningful empty state, not just nothing.
  • Touch targets: Interactive elements must be large enough to tap comfortably (minimum 44x44pt).
  • Feedback: Every user action must have visible feedback (press states, animations, haptics).
  • Scroll behavior: Long content must scroll. Never clip or hide content without a way to reach it.
  • Safe areas: Respect device notches, home indicators, and status bars. Use safe area insets.
  • Dismissibility: Modals, bottom sheets, and overlays must always be dismissible (gesture or button).

These are not nice-to-haves. They are requirements. If a solution works technically but the UX is broken, it's not done.


8. Expo Router First

Always prefer Expo Router native features before reaching for manual solutions or third-party navigation libraries.

Use Expo Router For:
  • Navigation: File-based routing is the default. Use app/ directory conventions. Don't manually configure stack navigators when a file in the right folder does the same thing.
  • Layouts: Use _layout.tsx files for shared layouts (tabs, stacks, drawers). Don't build layout wrappers manually.
  • Modals: Use modal presentation in route config. Don't build custom modal navigation.
  • Deep linking: Expo Router handles it automatically via file structure. Don't configure linking manually.
  • Route params: Use useLocalSearchParams and useGlobalSearchParams. Don't pass data through context or state when it belongs in the URL.
  • Navigation hooks: Use useRouter, useSegments, usePathname from expo-router.
  • Protected routes: Use redirect logic in layouts, not manual navigation guards.
  • Screen options: Configure via <Stack.Screen options={...} /> in layouts, not imperatively.
// BAD - Manual navigation when Expo Router handles it
import { useNavigation } from '@react-navigation/native';

const navigation = useNavigation();
navigation.navigate('ClientDetail', { clientId: '123' });

// GOOD - Expo Router
import { useRouter } from 'expo-router';

const router = useRouter();
router.push({ pathname: '/clients/[clientId]', params: { clientId: '123' } });
// BAD - Manual modal management
const [showModal, setShowModal] = useState(false);

return (
  <>
    <Button onPress={() => setShowModal(true)} />
    {showModal && <CustomModal onClose={() => setShowModal(false)} />}
  </>
);

// GOOD - Expo Router modal route (when it fits)
// app/clients/[clientId]/edit.tsx with presentation: 'modal' in _layout.tsx
router.push(`/clients/${clientId}/edit`);
When Expo Router Is Not Enough

If Expo Router doesn't cover a specific need (e.g., complex nested navigators, custom transition animations), then use React Navigation APIs directly. But always check Expo Router first.


9. Basic Performance Awareness

Don't overthink performance — the React Compiler handles most re-render issues. But be aware of these basics:

  • FlatList: Always use keyExtractor. Never render heavy components without getItemLayout for known-height items. Prefer FlashList for large lists.
  • Images: Always provide explicit width and height. Use cached image libraries when loading remote images.
  • Inline objects/arrays in JSX: Avoid creating new objects/arrays on every render as props (e.g., style={{flex: 1}}). Move them to stylesheets or constants.
  • Large context values: If a context value changes frequently and has many consumers, consider splitting into separate contexts (one for state, one for actions) to reduce unnecessary re-renders.

Decision Checklist

When writing or reviewing code, verify:

  • SRP: Is state logic in hooks and rendering in components?
  • Hook size: Is each hook under ~80 lines and focused on one thing?
  • Hook args: Does every hook receive a single object argument?
  • One hook per file: Is each hook in its own file?
  • No useEffect: Can this be solved without useEffect?
  • No useCallback: Is useCallback removed (React Compiler handles it)?
  • useMemo: Only used for computed constants, not components or trivial ops?
  • Component size: Is each component small with semantic meaning?
  • No nested ternaries: Are conditionals flat and readable?
  • Compound components: Are screens and complex components using the Component.Root / Component.X pattern?
  • No prop drilling: Is state shared via context inside compound components, not drilled through props?
  • No renderX functions: Are all render functions extracted to components?
  • Native APIs: Are platform components used where applicable?
  • Library suggestions: Is there a hand-rolled solution that a library already solves better?
  • Keyboard: Does the keyboard never cover the active input?
  • Loading/Error/Empty: Are all three states handled for every data-driven screen?
  • Touch targets: Are interactive elements at least 44x44pt?
  • Safe areas: Are notches, home indicators, and status bars respected?
  • Dismissibility: Can every overlay/modal/sheet be dismissed?
  • Expo Router: Is Expo Router used for navigation, modals, params, and layouts before manual alternatives?

平台分布

Codex

34.09%
按下载量换算30

Claude

33.23%
按下载量换算29

Cursor

20.57%
按下载量换算18

Gemini CLI

9.56%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

继续浏览同类 Skills