Skip to content
comet-scaffold logo

Comet 脚手架命令规范

comet-scaffold

React Native 脚手架 comet CLI 命令规范与项目配置。当用户提到"comet"、"脚手架"、"scaffold"、"初始化项目"、"创建应用"、"项目结构"、"comet.yaml"时使用此 skill。

SKILL.md

Full skill instructions

Comet 脚手架命令规范

基于 React Native 通用脚手架设计方案的 CLI 命令与配置约定。

核心配置文件

comet.yaml

脚手架的单一配置源,记录所有工程约定:

name: my_app
org: com.example

package_manager: pnpm

build_tool: expo_prebuild # expo_prebuild | bare
architecture: new # new | old
integration: greenfield # greenfield | brownfield

state_management: zustand
server_state: tanstack_query
router: react_navigation

styling_engine: nativewind # nativewind | unistyles | restyle | stylesheet
forms: rhf_zod # rhf_zod | none
permissions: unified # unified | none
deep_linking: true
app_scheme: myapp
universal_links:
  - example.com

envs:
  - name: development
    android_flavor: dev
    ios_scheme: MyApp-Dev
    env_file: .env.development
  - name: staging
    android_flavor: stg
    ios_scheme: MyApp-Stg
    env_file: .env.staging
  - name: production
    android_flavor: prod
    ios_scheme: MyApp
    env_file: .env.production

modules:
  network: true
  storage: true
  i18n: true
  sentry: true
  svg: true
  e2e: false

CLI 命令

创建应用

comet create app <app_name> \
  --org com.example \
  --package-manager pnpm \
  --build-tool expo_prebuild \
  --architecture new \
  --integration greenfield \
  --state-management zustand \
  --router react_navigation \
  --enable-network \
  --enable-storage \
  --with-i18n \
  [--with-sentry] \
  [--with-ci]

行为:

  • Expo Prebuild(默认):基于 npx create-expo-app@latest 初始化
  • Bare RN(可选):基于 npx @react-native-community/​cli init 初始化
  • 生成标准目录结构(src/​app、src/​core、src/​features)
  • 初始化多环境配置
  • 若指定 --with-ci,生成 .github/​workflows/​ci.yml

创建 Feature

comet create feature <feature_name> \
  [--route Counter] \
  [--no-domain] \
  [--no-data]

生成结构:

src/​features/<feature_name>/
  presentation/
    screens/<FeatureName>Screen.tsx
    components/<FeatureName>View.tsx
    stores/​use<FeatureName>Store.ts
  domain/
    entities/<featureName>.ts
    repositories/<featureName>Repository.ts
  data/
    datasources/<FeatureName>RemoteDataSource.ts
    repositories/<FeatureName>RepositoryImpl.ts

选项:

  • --route:自动在 Root Navigator 注册路由
  • --no-domain:不生成 domain 层
  • --no-data:不生成 data 层

创建 Service

comet create service <service_name>

在 src/​core/ 下生成服务骨架,如 analytics、crash_reporting 等。

辅助命令

命令说明
comet lint运行 ESLint + TypeScript 检查
comet format运行 Prettier
comet test运行 Jest(可选 Detox)
comet doctor检查项目是否符合脚手架约定
comet upgrade-core统一升级核心依赖版本

项目目录结构

顶层目录

project_root/
  app.json or app.config.ts   # Expo 配置
  android/                    # 原生 Android(Prebuild 生成)
  ios/                        # 原生 iOS(Prebuild 生成)
  src/                        # 源代码
  assets/                     # 静态资源
  __tests__/                  # 测试文件
  .vscode/ or .idea/          # IDE 配置
  babel.config.js
  metro.config.js
  tsconfig.json
  package.json
  comet.yaml                  # 脚手架配置
  README.md

src 目录结构

src/
  app/
    App.tsx                   # 根组件:Provider、NavigationContainer
    bootstrap.ts              # 应用引导初始化
    di.ts                     # 可选:跨 feature 核心依赖收口
    navigation/
      routes.ts               # 路由常量/类型(ParamList)
      RootNavigator.tsx       # Root Navigator

  core/                       # 无业务基础设施
    config/
      env.ts                  # 环境抽象
      appConfig.ts            # 配置汇总
    error/
      appError.ts             # 错误模型
      errorMapper.ts          # 错误映射
      errorReporter.ts        # 错误上报
    forms/
      formTypes.ts            # 表单类型
      zodSchemas.ts           # Zod Schema
    network/
      httpClient.ts           # axios/​fetch 封装
      interceptors/
        authInterceptor.ts
        loggingInterceptor.ts
    permissions/
      permissions.ts          # 权限类型
      usePermission.ts        # 权限 Hook
    storage/
      keyValueStorage.ts      # KV 存储抽象
      secureStorage.ts        # 安全存储
    theme/
      tokens.ts               # 设计 token
      theme.ts                # 主题对象
    styling/
      styling.ts              # 样式引擎适配
    i18n/
      i18n.ts                 # i18next 初始化
    utils/
      logger.ts
      result.ts               # Result 类型
    components/
      AppScaffold.tsx
      LoadingIndicator.tsx
      ErrorView.tsx
      PrimaryButton.tsx

  features/                   # Feature-first 业务模块
    counter/                  # 示例 feature
      presentation/
        screens/
          CounterScreen.tsx
        components/
          CounterView.tsx
        stores/
          useCounterStore.ts
      domain/
        entities/
          counter.ts
        repositories/
          counterRepository.ts
      data/
        datasources/
          counterLocalDataSource.ts
        repositories/
          counterRepositoryImpl.ts

技术选型(默认)

类别技术
构建工具Expo(Prebuild / CNG)
底层架构New Architecture
语言TypeScript(strict)
包管理pnpm
导航React Navigation 7
状态管理Zustand + TanStack Query
样式NativeWind
表单React Hook Form + Zod
网络axios
存储AsyncStorage / MMKV
国际化i18next
监控Sentry
测试Jest + @testing-library/​react-native

临时初始化(comet 未落地前)

Expo(推荐)

npx create-expo-app@latest MyApp
cd MyApp
npx expo start

# 需要原生工程时
npx expo prebuild --clean

Bare React Native

npx @react-native-community/​cli@latest init MyApp
cd MyApp
npx react-native run-android
# 或
npx react-native run-ios

环境切换

原生构建维度

  • iOS:Scheme/​Configuration(Debug/​Staging/​Release)
  • Android:productFlavors(dev/​staging/​prod)+ buildTypes

JS 侧读取

  • Expo:app.config.ts + EAS 环境变量
  • Bare RN:react-native-config + .env.*

运行脚本示例

{
  "scripts": {
    "ios:dev": "expo start --ios",
    "ios:stg": "expo start --ios --variant staging",
    "android:dev": "expo start --android",
    "android:stg": "expo start --android --variant staging"
  }
}

依赖版本参考(2025-12)

以模板 package.json + lockfile 为准,以下仅供参考:

包版本
react19.2.3
react-native0.83.0
@react-navigation/​native7.1.25
zustand5.0.9
@tanstack/​react-query5.90.12
axios1.13.2
i18next25.7.2
@sentry/​react-native7.7.0

定期运行 npx expo doctor 和 pnpm outdated 检查兼容性。

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View