From 77e71fb4891b4132a4de76daec185c3feb1d0748 Mon Sep 17 00:00:00 2001 From: xudan Date: Fri, 25 Jul 2025 23:24:19 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=96=87=E6=A1=A3=EF=BC=8C=E5=A2=9E=E5=8A=A0AI=E8=BE=85?= =?UTF-8?q?=E5=8A=A9=E5=BC=80=E5=8F=91=E6=8C=87=E5=8D=97=E5=92=8C=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E6=8C=87=E4=BB=A4=EF=BC=8C=E6=98=8E=E7=A1=AE=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E9=A3=8E=E6=A0=BC=E3=80=81=E7=BB=84=E4=BB=B6=E6=9E=B6?= =?UTF-8?q?=E6=9E=84=E3=80=81=E7=8A=B6=E6=80=81=E7=AE=A1=E7=90=86=E3=80=81?= =?UTF-8?q?API=E4=BA=A4=E4=BA=92=E5=8F=8A=E6=B5=8B=E8=AF=95=E8=A6=81?= =?UTF-8?q?=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/settings.local.json | 7 ++----- gemini.md | 40 +++++++++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 37eeadd..8adffc3 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -10,9 +10,6 @@ "Bash(npx react-native start --reset-cache)", "Bash(npm run lint)" ], - "deny": [ - "WebSearch" - ], - "defaultMode": "bypassPermissions" + "deny": ["WebSearch"] } -} \ No newline at end of file +} diff --git a/gemini.md b/gemini.md index 7194fd9..5d2053e 100644 --- a/gemini.md +++ b/gemini.md @@ -2,15 +2,33 @@ This is a React Native application built with TypeScript. -## Project Structure +## General Instructions -- `src/`: Contains the main source code for the application. - - `components/`: Reusable React components. - - `context/`: React context for state management. - - `hooks/`: Custom React hooks. - - `navigation/`: Navigation logic using React Navigation. - - `screens/`: Application screens. - - `services/`: Services for API calls and other business logic. - - `types/`: TypeScript type definitions. -- `android/`: Android specific code. -- `ios/`: iOS specific code. +- Always use Chinese to answer. +- Check for potential errors in the user's prompt and try to fix them. +- If the proposed changes are significant or alter the core logic, ask the user for confirmation before proceeding. Otherwise, you can make the changes directly. + +## AI-Assisted Development Guidelines + +### 1. Code Style & Conventions +- **Adherence:** Strictly follow the existing code style, formatting (Prettier), and linting rules (ESLint) of the project. +- **Consistency:** When adding new features, first analyze the surrounding code to ensure new code matches the existing patterns in terms of naming, structure, and architecture. + +### 2. Component-Based Architecture +- **Modularity:** Prioritize creating modular, reusable, and single-purpose components. Place all reusable components in the `src/components/` directory. +- **Props:** Define explicit TypeScript interfaces for all component props in the `src/types/` directory or co-located with the component file. + +### 3. State Management +- **React Context:** For global or shared state, utilize the existing React Context API structure located in `src/context/`. +- **Local State:** For component-specific state that doesn't need to be shared, use the `useState` and `useReducer` hooks. + +### 4. API & Data Fetching +- **Service Layer:** All interactions with external APIs must be encapsulated within the service layer (`src/services/`). Do not make direct API calls (e.g., using `fetch` or `axios`) from within UI components. +- **Type Safety:** Define clear TypeScript types for all API request payloads and responses in the `src/types/` directory. + +### 5. Navigation +- **Centralized Logic:** All screen navigation logic should be managed within the `src/navigation/` directory, using the established React Navigation setup. + +### 6. Testing +- **Unit Tests:** When creating new components or services, please also create corresponding unit tests in the `__tests__` directory. +- **Existing Tests:** When modifying existing code, ensure all related tests are updated and continue to pass. \ No newline at end of file