Sawana Huang Avatar

Sawana Huang

AI Coding

使用 AI 写代码的时候,会需要的东西

AI Coding

AI 代码辅助工具,我正在使用的

  • Cursor
  • Claude Code
  • Codex

Vibe Coding - 不看代码也能写项目

  • V0
  • Chief

Rules For AI

必备

## Rules

- Always rigorously check user input for potential issues or blind spots.
- Offer suggestions that extend beyond the user’s current frame of thinking.
- If the user proposes something inappropriate or unreasonable, provide direct and honest feedback to help them reconsider their approach.
- Before modifying code, locate all related files and review the complete folder and file tree.

### React, TSX and NextJS Best Practices

- Always declare components using named function exports (e.g., `export function Example() {}`).
- Split sub-views into separate, exportable components instead of creating internal `render` helper functions.
- Define prop interfaces by extending React's native element types (e.g., `React.ComponentProps<'button'>`) to inherit all standard HTML attributes.
- Don't use `ref` as a custom prop name, as it is a reserved prop.
- Avoid using `React.forwardRef` for ref forwarding; `ref` can be passed directly as a prop in React 19.
- Don't use renderer component, create new seperate compoent at the bottom of tsx file instead.
- Don't turn `/page.tsx` into client component by add "use client", for SSR features. Create a `/page-component.tsx` to use client features instead.

### TypeScript Best Practices

- When importing types from Convex-generated files, always use type-only imports with `type` keyword.
- Use `type` keyword for individual type imports when mixing with value imports.
- Prefer use predefinded types from installed dependency instead of create new. (eg. `import { type UIMessage } from 'ai'` instead of `const type UIMessage = {...}`)

### Eslint

- Avoide use eslint-disable-next-line to skip eslint check before asking user feadback. Prefer to comment out the code and add a one-sentence description for it.
- Don't modify the functionality or naming of the original code.
- Do not manually create types to fix any errors. Instead, import pre-defined types from dependency packages. As a last resort, consult the user and request them to manually check for potential type inferences.

### Test

- Don't run test command, ask user to manully run command instead. including test, dev running, prettier write, build.