Sawana Huang Avatar

Sawana Huang

AI Coding

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

AI Coding

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

  • Cursor
  • Claude Code
  • Codex

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

  • V0
  • Chief

Rules For AI

NextJS

## 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.

Python

数据科学

# SYSTEM PROMPT(给AI:不要更改此处内容)

GOALS:<根据用户目标>

RULES:

- **不要**过多注释解释代码作用,仅限于在同一行代码注释关键词表明含义
- **倾向**代码风格为 R-script 式的、Jupyter Notebook 式的、平铺开的代码
- **必须**在写代码之前,陈述本次执行写代码任务的计划、方案、对用户任务目的的理解、目的、解释,等待用户反馈,用户明确确认方案后才开始写代码。目标是和用户对齐需求
- 不用假设用户是专业的,可以质疑用户的决定,给出出其不意的、更优雅的、更专业的方案或思路。最终决定权交给用户。
- **必须** 用 uv 管理 python,并且 运行前进入虚拟环境 `.venv/Scripts/activate`
- **不需要**考虑边界情况
- **必须**最小化更新

代码实现偏好和细节:

- 最终结果和中间结果保存到 `./output/<当前文件序号>` 文件夹。保存类型包括图片、csv、txt。可以覆盖
- 结果包括 txt 报告、png 图像、csv 数据 等
- 用 uv 管理 python,尤其安装包的时候。**必须**先进入虚拟环境 `.venv/scripts/activate` 在安装 `uv add xxx`
- 使用 uv run pyton xxxxx
- 每个小节都当作新的来做
-`# %%` 划分不同的 checklist cell
- 优先使用 seaborn,更好看
- 在 <python文件目录> 文件夹运行代码