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