[{"data":1,"prerenderedAt":843},["ShallowReactive",2],{"content-query-4zbz1yR34q":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"lastUpdated":10,"body":11,"_type":188,"_id":838,"_source":839,"_file":840,"_stem":841,"_extension":842},"\u002Fmethodology\u002Fproject-rules","methodology",false,"","项目规则配置","为项目设置专属规则，团队成员共享统一的编码规范","2026-04-23",{"type":12,"children":13,"toc":825},"root",[14,23,29,43,148,152,157,171,183,404,416,426,566,578,667,670,675,738,741,746,819],{"type":15,"tag":16,"props":17,"children":19},"element","h1",{"id":18},"项目规则配置project-rules",[20],{"type":21,"value":22},"text","项目规则配置（Project Rules）",{"type":15,"tag":24,"props":25,"children":27},"h2",{"id":26},"为什么需要项目规则",[28],{"type":21,"value":26},{"type":15,"tag":30,"props":31,"children":32},"p",{},[33,35,41],{"type":21,"value":34},"项目规则存储在项目仓库中，",{"type":15,"tag":36,"props":37,"children":38},"strong",{},[39],{"type":21,"value":40},"随代码版本管理",{"type":21,"value":42},"，确保团队所有成员使用统一的 AI 编程规范。",{"type":15,"tag":44,"props":45,"children":46},"table",{},[47,71],{"type":15,"tag":48,"props":49,"children":50},"thead",{},[51],{"type":15,"tag":52,"props":53,"children":54},"tr",{},[55,61,66],{"type":15,"tag":56,"props":57,"children":58},"th",{},[59],{"type":21,"value":60},"问题",{"type":15,"tag":56,"props":62,"children":63},{},[64],{"type":21,"value":65},"没有项目规则",{"type":15,"tag":56,"props":67,"children":68},{},[69],{"type":21,"value":70},"有项目规则",{"type":15,"tag":72,"props":73,"children":74},"tbody",{},[75,94,112,130],{"type":15,"tag":52,"props":76,"children":77},{},[78,84,89],{"type":15,"tag":79,"props":80,"children":81},"td",{},[82],{"type":21,"value":83},"代码风格",{"type":15,"tag":79,"props":85,"children":86},{},[87],{"type":21,"value":88},"每人各自为政",{"type":15,"tag":79,"props":90,"children":91},{},[92],{"type":21,"value":93},"全队统一规范",{"type":15,"tag":52,"props":95,"children":96},{},[97,102,107],{"type":15,"tag":79,"props":98,"children":99},{},[100],{"type":21,"value":101},"技术栈选择",{"type":15,"tag":79,"props":103,"children":104},{},[105],{"type":21,"value":106},"AI 可能推荐过时库",{"type":15,"tag":79,"props":108,"children":109},{},[110],{"type":21,"value":111},"锁定团队技术栈",{"type":15,"tag":52,"props":113,"children":114},{},[115,120,125],{"type":15,"tag":79,"props":116,"children":117},{},[118],{"type":21,"value":119},"命名规范",{"type":15,"tag":79,"props":121,"children":122},{},[123],{"type":21,"value":124},"混乱不一致",{"type":15,"tag":79,"props":126,"children":127},{},[128],{"type":21,"value":129},"强制统一命名",{"type":15,"tag":52,"props":131,"children":132},{},[133,138,143],{"type":15,"tag":79,"props":134,"children":135},{},[136],{"type":21,"value":137},"安全要求",{"type":15,"tag":79,"props":139,"children":140},{},[141],{"type":21,"value":142},"可能遗漏",{"type":15,"tag":79,"props":144,"children":145},{},[146],{"type":21,"value":147},"内置安全检查清单",{"type":15,"tag":149,"props":150,"children":151},"hr",{},[],{"type":15,"tag":24,"props":153,"children":155},{"id":154},"主流工具的配置方式",[156],{"type":21,"value":154},{"type":15,"tag":158,"props":159,"children":161},"h3",{"id":160},"cursor-cursorrules",[162,164],{"type":21,"value":163},"Cursor — ",{"type":15,"tag":165,"props":166,"children":168},"code",{"className":167},[],[169],{"type":21,"value":170},".cursorrules",{"type":15,"tag":30,"props":172,"children":173},{},[174,176,181],{"type":21,"value":175},"在项目根目录创建 ",{"type":15,"tag":165,"props":177,"children":179},{"className":178},[],[180],{"type":21,"value":170},{"type":21,"value":182}," 文件：",{"type":15,"tag":184,"props":185,"children":189},"pre",{"className":186,"code":187,"language":188,"meta":7,"style":7},"language-markdown shiki shiki-themes github-dark","# 项目规则\n\n## 技术栈\n- 前端：Vue 3 + TypeScript + Vite\n- 后端：Node.js + Express\n- 数据库：PostgreSQL\n- 样式：Tailwind CSS\n\n## 代码规范\n- 使用 Composition API，不使用 Options API\n- 所有函数必须有 TypeScript 类型注释\n- 组件文件使用 PascalCase 命名\n- 工具函数使用 camelCase 命名\n\n## 禁止事项\n- 禁止使用 any 类型\n- 禁止使用 var 声明变量\n- 禁止在组件中直接操作 DOM\n","markdown",[190],{"type":15,"tag":165,"props":191,"children":192},{"__ignoreMap":7},[193,205,215,224,240,253,266,279,287,296,309,322,335,348,356,365,378,391],{"type":15,"tag":194,"props":195,"children":198},"span",{"class":196,"line":197},"line",1,[199],{"type":15,"tag":194,"props":200,"children":202},{"style":201},"--shiki-default:#79B8FF;--shiki-default-font-weight:bold",[203],{"type":21,"value":204},"# 项目规则\n",{"type":15,"tag":194,"props":206,"children":208},{"class":196,"line":207},2,[209],{"type":15,"tag":194,"props":210,"children":212},{"emptyLinePlaceholder":211},true,[213],{"type":21,"value":214},"\n",{"type":15,"tag":194,"props":216,"children":218},{"class":196,"line":217},3,[219],{"type":15,"tag":194,"props":220,"children":221},{"style":201},[222],{"type":21,"value":223},"## 技术栈\n",{"type":15,"tag":194,"props":225,"children":227},{"class":196,"line":226},4,[228,234],{"type":15,"tag":194,"props":229,"children":231},{"style":230},"--shiki-default:#FFAB70",[232],{"type":21,"value":233},"-",{"type":15,"tag":194,"props":235,"children":237},{"style":236},"--shiki-default:#E1E4E8",[238],{"type":21,"value":239}," 前端：Vue 3 + TypeScript + Vite\n",{"type":15,"tag":194,"props":241,"children":243},{"class":196,"line":242},5,[244,248],{"type":15,"tag":194,"props":245,"children":246},{"style":230},[247],{"type":21,"value":233},{"type":15,"tag":194,"props":249,"children":250},{"style":236},[251],{"type":21,"value":252}," 后端：Node.js + Express\n",{"type":15,"tag":194,"props":254,"children":256},{"class":196,"line":255},6,[257,261],{"type":15,"tag":194,"props":258,"children":259},{"style":230},[260],{"type":21,"value":233},{"type":15,"tag":194,"props":262,"children":263},{"style":236},[264],{"type":21,"value":265}," 数据库：PostgreSQL\n",{"type":15,"tag":194,"props":267,"children":269},{"class":196,"line":268},7,[270,274],{"type":15,"tag":194,"props":271,"children":272},{"style":230},[273],{"type":21,"value":233},{"type":15,"tag":194,"props":275,"children":276},{"style":236},[277],{"type":21,"value":278}," 样式：Tailwind CSS\n",{"type":15,"tag":194,"props":280,"children":282},{"class":196,"line":281},8,[283],{"type":15,"tag":194,"props":284,"children":285},{"emptyLinePlaceholder":211},[286],{"type":21,"value":214},{"type":15,"tag":194,"props":288,"children":290},{"class":196,"line":289},9,[291],{"type":15,"tag":194,"props":292,"children":293},{"style":201},[294],{"type":21,"value":295},"## 代码规范\n",{"type":15,"tag":194,"props":297,"children":299},{"class":196,"line":298},10,[300,304],{"type":15,"tag":194,"props":301,"children":302},{"style":230},[303],{"type":21,"value":233},{"type":15,"tag":194,"props":305,"children":306},{"style":236},[307],{"type":21,"value":308}," 使用 Composition API，不使用 Options API\n",{"type":15,"tag":194,"props":310,"children":312},{"class":196,"line":311},11,[313,317],{"type":15,"tag":194,"props":314,"children":315},{"style":230},[316],{"type":21,"value":233},{"type":15,"tag":194,"props":318,"children":319},{"style":236},[320],{"type":21,"value":321}," 所有函数必须有 TypeScript 类型注释\n",{"type":15,"tag":194,"props":323,"children":325},{"class":196,"line":324},12,[326,330],{"type":15,"tag":194,"props":327,"children":328},{"style":230},[329],{"type":21,"value":233},{"type":15,"tag":194,"props":331,"children":332},{"style":236},[333],{"type":21,"value":334}," 组件文件使用 PascalCase 命名\n",{"type":15,"tag":194,"props":336,"children":338},{"class":196,"line":337},13,[339,343],{"type":15,"tag":194,"props":340,"children":341},{"style":230},[342],{"type":21,"value":233},{"type":15,"tag":194,"props":344,"children":345},{"style":236},[346],{"type":21,"value":347}," 工具函数使用 camelCase 命名\n",{"type":15,"tag":194,"props":349,"children":351},{"class":196,"line":350},14,[352],{"type":15,"tag":194,"props":353,"children":354},{"emptyLinePlaceholder":211},[355],{"type":21,"value":214},{"type":15,"tag":194,"props":357,"children":359},{"class":196,"line":358},15,[360],{"type":15,"tag":194,"props":361,"children":362},{"style":201},[363],{"type":21,"value":364},"## 禁止事项\n",{"type":15,"tag":194,"props":366,"children":368},{"class":196,"line":367},16,[369,373],{"type":15,"tag":194,"props":370,"children":371},{"style":230},[372],{"type":21,"value":233},{"type":15,"tag":194,"props":374,"children":375},{"style":236},[376],{"type":21,"value":377}," 禁止使用 any 类型\n",{"type":15,"tag":194,"props":379,"children":381},{"class":196,"line":380},17,[382,386],{"type":15,"tag":194,"props":383,"children":384},{"style":230},[385],{"type":21,"value":233},{"type":15,"tag":194,"props":387,"children":388},{"style":236},[389],{"type":21,"value":390}," 禁止使用 var 声明变量\n",{"type":15,"tag":194,"props":392,"children":394},{"class":196,"line":393},18,[395,399],{"type":15,"tag":194,"props":396,"children":397},{"style":230},[398],{"type":21,"value":233},{"type":15,"tag":194,"props":400,"children":401},{"style":236},[402],{"type":21,"value":403}," 禁止在组件中直接操作 DOM\n",{"type":15,"tag":158,"props":405,"children":407},{"id":406},"claude-code-claudemd",[408,410],{"type":21,"value":409},"Claude Code — ",{"type":15,"tag":165,"props":411,"children":413},{"className":412},[],[414],{"type":21,"value":415},"CLAUDE.md",{"type":15,"tag":30,"props":417,"children":418},{},[419,420,425],{"type":21,"value":175},{"type":15,"tag":165,"props":421,"children":423},{"className":422},[],[424],{"type":21,"value":415},{"type":21,"value":182},{"type":15,"tag":184,"props":427,"children":429},{"className":186,"code":428,"language":188,"meta":7,"style":7},"# Claude 项目指令\n\n## 架构说明\n这是一个 Vue 3 + Node.js 的全栈项目。\n\n## 命令\n- npm run dev — 启动开发服务器\n- npm run test — 运行测试\n- npm run lint — 代码检查\n\n## 代码风格\n- 使用 TypeScript 严格模式\n- 优先使用 async\u002Fawait 而非 .then()\n- 错误处理使用 try-catch，不要吞掉错误\n",[430],{"type":15,"tag":165,"props":431,"children":432},{"__ignoreMap":7},[433,441,448,456,464,471,479,491,503,515,522,530,542,554],{"type":15,"tag":194,"props":434,"children":435},{"class":196,"line":197},[436],{"type":15,"tag":194,"props":437,"children":438},{"style":201},[439],{"type":21,"value":440},"# Claude 项目指令\n",{"type":15,"tag":194,"props":442,"children":443},{"class":196,"line":207},[444],{"type":15,"tag":194,"props":445,"children":446},{"emptyLinePlaceholder":211},[447],{"type":21,"value":214},{"type":15,"tag":194,"props":449,"children":450},{"class":196,"line":217},[451],{"type":15,"tag":194,"props":452,"children":453},{"style":201},[454],{"type":21,"value":455},"## 架构说明\n",{"type":15,"tag":194,"props":457,"children":458},{"class":196,"line":226},[459],{"type":15,"tag":194,"props":460,"children":461},{"style":236},[462],{"type":21,"value":463},"这是一个 Vue 3 + Node.js 的全栈项目。\n",{"type":15,"tag":194,"props":465,"children":466},{"class":196,"line":242},[467],{"type":15,"tag":194,"props":468,"children":469},{"emptyLinePlaceholder":211},[470],{"type":21,"value":214},{"type":15,"tag":194,"props":472,"children":473},{"class":196,"line":255},[474],{"type":15,"tag":194,"props":475,"children":476},{"style":201},[477],{"type":21,"value":478},"## 命令\n",{"type":15,"tag":194,"props":480,"children":481},{"class":196,"line":268},[482,486],{"type":15,"tag":194,"props":483,"children":484},{"style":230},[485],{"type":21,"value":233},{"type":15,"tag":194,"props":487,"children":488},{"style":236},[489],{"type":21,"value":490}," npm run dev — 启动开发服务器\n",{"type":15,"tag":194,"props":492,"children":493},{"class":196,"line":281},[494,498],{"type":15,"tag":194,"props":495,"children":496},{"style":230},[497],{"type":21,"value":233},{"type":15,"tag":194,"props":499,"children":500},{"style":236},[501],{"type":21,"value":502}," npm run test — 运行测试\n",{"type":15,"tag":194,"props":504,"children":505},{"class":196,"line":289},[506,510],{"type":15,"tag":194,"props":507,"children":508},{"style":230},[509],{"type":21,"value":233},{"type":15,"tag":194,"props":511,"children":512},{"style":236},[513],{"type":21,"value":514}," npm run lint — 代码检查\n",{"type":15,"tag":194,"props":516,"children":517},{"class":196,"line":298},[518],{"type":15,"tag":194,"props":519,"children":520},{"emptyLinePlaceholder":211},[521],{"type":21,"value":214},{"type":15,"tag":194,"props":523,"children":524},{"class":196,"line":311},[525],{"type":15,"tag":194,"props":526,"children":527},{"style":201},[528],{"type":21,"value":529},"## 代码风格\n",{"type":15,"tag":194,"props":531,"children":532},{"class":196,"line":324},[533,537],{"type":15,"tag":194,"props":534,"children":535},{"style":230},[536],{"type":21,"value":233},{"type":15,"tag":194,"props":538,"children":539},{"style":236},[540],{"type":21,"value":541}," 使用 TypeScript 严格模式\n",{"type":15,"tag":194,"props":543,"children":544},{"class":196,"line":337},[545,549],{"type":15,"tag":194,"props":546,"children":547},{"style":230},[548],{"type":21,"value":233},{"type":15,"tag":194,"props":550,"children":551},{"style":236},[552],{"type":21,"value":553}," 优先使用 async\u002Fawait 而非 .then()\n",{"type":15,"tag":194,"props":555,"children":556},{"class":196,"line":350},[557,561],{"type":15,"tag":194,"props":558,"children":559},{"style":230},[560],{"type":21,"value":233},{"type":15,"tag":194,"props":562,"children":563},{"style":236},[564],{"type":21,"value":565}," 错误处理使用 try-catch，不要吞掉错误\n",{"type":15,"tag":158,"props":567,"children":569},{"id":568},"github-copilot-githubcopilot-instructionsmd",[570,572],{"type":21,"value":571},"GitHub Copilot — ",{"type":15,"tag":165,"props":573,"children":575},{"className":574},[],[576],{"type":21,"value":577},".github\u002Fcopilot-instructions.md",{"type":15,"tag":184,"props":579,"children":581},{"className":186,"code":580,"language":188,"meta":7,"style":7},"# Copilot 指令\n\n## 项目上下文\n这是一个企业级 SaaS 项目，需要关注安全性和可维护性。\n\n## 编码要求\n- 所有 API 接口必须有输入验证\n- 数据库查询必须使用参数化查询\n- 敏感数据必须加密存储\n",[582],{"type":15,"tag":165,"props":583,"children":584},{"__ignoreMap":7},[585,593,600,608,616,623,631,643,655],{"type":15,"tag":194,"props":586,"children":587},{"class":196,"line":197},[588],{"type":15,"tag":194,"props":589,"children":590},{"style":201},[591],{"type":21,"value":592},"# Copilot 指令\n",{"type":15,"tag":194,"props":594,"children":595},{"class":196,"line":207},[596],{"type":15,"tag":194,"props":597,"children":598},{"emptyLinePlaceholder":211},[599],{"type":21,"value":214},{"type":15,"tag":194,"props":601,"children":602},{"class":196,"line":217},[603],{"type":15,"tag":194,"props":604,"children":605},{"style":201},[606],{"type":21,"value":607},"## 项目上下文\n",{"type":15,"tag":194,"props":609,"children":610},{"class":196,"line":226},[611],{"type":15,"tag":194,"props":612,"children":613},{"style":236},[614],{"type":21,"value":615},"这是一个企业级 SaaS 项目，需要关注安全性和可维护性。\n",{"type":15,"tag":194,"props":617,"children":618},{"class":196,"line":242},[619],{"type":15,"tag":194,"props":620,"children":621},{"emptyLinePlaceholder":211},[622],{"type":21,"value":214},{"type":15,"tag":194,"props":624,"children":625},{"class":196,"line":255},[626],{"type":15,"tag":194,"props":627,"children":628},{"style":201},[629],{"type":21,"value":630},"## 编码要求\n",{"type":15,"tag":194,"props":632,"children":633},{"class":196,"line":268},[634,638],{"type":15,"tag":194,"props":635,"children":636},{"style":230},[637],{"type":21,"value":233},{"type":15,"tag":194,"props":639,"children":640},{"style":236},[641],{"type":21,"value":642}," 所有 API 接口必须有输入验证\n",{"type":15,"tag":194,"props":644,"children":645},{"class":196,"line":281},[646,650],{"type":15,"tag":194,"props":647,"children":648},{"style":230},[649],{"type":21,"value":233},{"type":15,"tag":194,"props":651,"children":652},{"style":236},[653],{"type":21,"value":654}," 数据库查询必须使用参数化查询\n",{"type":15,"tag":194,"props":656,"children":657},{"class":196,"line":289},[658,662],{"type":15,"tag":194,"props":659,"children":660},{"style":230},[661],{"type":21,"value":233},{"type":15,"tag":194,"props":663,"children":664},{"style":236},[665],{"type":21,"value":666}," 敏感数据必须加密存储\n",{"type":15,"tag":149,"props":668,"children":669},{},[],{"type":15,"tag":24,"props":671,"children":673},{"id":672},"最佳实践",[674],{"type":21,"value":672},{"type":15,"tag":676,"props":677,"children":678},"ol",{},[679,690,708,718,728],{"type":15,"tag":680,"props":681,"children":682},"li",{},[683,688],{"type":15,"tag":36,"props":684,"children":685},{},[686],{"type":21,"value":687},"保持简洁",{"type":21,"value":689},"：规则文件不超过 100 行，过长会降低 AI 的遵循率",{"type":15,"tag":680,"props":691,"children":692},{},[693,698,700,706],{"type":15,"tag":36,"props":694,"children":695},{},[696],{"type":21,"value":697},"具体明确",{"type":21,"value":699},"：写\"使用 ",{"type":15,"tag":165,"props":701,"children":703},{"className":702},[],[704],{"type":21,"value":705},"const",{"type":21,"value":707}," 声明不变量\"而非\"注意变量声明\"",{"type":15,"tag":680,"props":709,"children":710},{},[711,716],{"type":15,"tag":36,"props":712,"children":713},{},[714],{"type":21,"value":715},"版本管理",{"type":21,"value":717},"：规则文件纳入 Git，PR 审查时一并审查规则变更",{"type":15,"tag":680,"props":719,"children":720},{},[721,726],{"type":15,"tag":36,"props":722,"children":723},{},[724],{"type":21,"value":725},"定期更新",{"type":21,"value":727},"：技术栈升级时同步更新规则文件",{"type":15,"tag":680,"props":729,"children":730},{},[731,736],{"type":15,"tag":36,"props":732,"children":733},{},[734],{"type":21,"value":735},"团队共识",{"type":21,"value":737},"：规则应该是团队讨论后的共识，而非个人偏好",{"type":15,"tag":149,"props":739,"children":740},{},[],{"type":15,"tag":24,"props":742,"children":744},{"id":743},"常见问题",[745],{"type":21,"value":743},{"type":15,"tag":44,"props":747,"children":748},{},[749,764],{"type":15,"tag":48,"props":750,"children":751},{},[752],{"type":15,"tag":52,"props":753,"children":754},{},[755,759],{"type":15,"tag":56,"props":756,"children":757},{},[758],{"type":21,"value":60},{"type":15,"tag":56,"props":760,"children":761},{},[762],{"type":21,"value":763},"解决方案",{"type":15,"tag":72,"props":765,"children":766},{},[767,780,793,806],{"type":15,"tag":52,"props":768,"children":769},{},[770,775],{"type":15,"tag":79,"props":771,"children":772},{},[773],{"type":21,"value":774},"AI 不遵守项目规则",{"type":15,"tag":79,"props":776,"children":777},{},[778],{"type":21,"value":779},"检查文件是否在正确位置、格式是否正确",{"type":15,"tag":52,"props":781,"children":782},{},[783,788],{"type":15,"tag":79,"props":784,"children":785},{},[786],{"type":21,"value":787},"规则文件太长 AI 忽略部分规则",{"type":15,"tag":79,"props":789,"children":790},{},[791],{"type":21,"value":792},"精简到 100 行以内，分优先级",{"type":15,"tag":52,"props":794,"children":795},{},[796,801],{"type":15,"tag":79,"props":797,"children":798},{},[799],{"type":21,"value":800},"团队成员规则文件不一致",{"type":15,"tag":79,"props":802,"children":803},{},[804],{"type":21,"value":805},"用 Git 管理，PR 审查时检查",{"type":15,"tag":52,"props":807,"children":808},{},[809,814],{"type":15,"tag":79,"props":810,"children":811},{},[812],{"type":21,"value":813},"不知道该写什么规则",{"type":15,"tag":79,"props":815,"children":816},{},[817],{"type":21,"value":818},"从技术栈和禁止事项开始，逐步补充",{"type":15,"tag":820,"props":821,"children":822},"style",{},[823],{"type":21,"value":824},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":217,"depth":217,"links":826},[827,828,836,837],{"id":26,"depth":207,"text":26},{"id":154,"depth":207,"text":154,"children":829},[830,832,834],{"id":160,"depth":217,"text":831},"Cursor — .cursorrules",{"id":406,"depth":217,"text":833},"Claude Code — CLAUDE.md",{"id":568,"depth":217,"text":835},"GitHub Copilot — .github\u002Fcopilot-instructions.md",{"id":672,"depth":207,"text":672},{"id":743,"depth":207,"text":743},"content:methodology:project-rules.md","content","methodology\u002Fproject-rules.md","methodology\u002Fproject-rules","md",1777287374700]