CostPrediction/.cursorrules
2024-11-08 23:43:57 +08:00

83 lines
1.7 KiB
Plaintext

# 开发流程
First ensure basic functionality works
Implement core functionality using the simplest direct approach
Ensure data flow is working correctly
Verify results are accurate
Then gradually add additional features
Add error handling
Add data validation
Add format conversion
Add logging
Improve user experience
Avoid premature optimization
Don't do complex data validation at the start
Don't worry about performance optimization early
Don't over-engineer
This development flow:
Quickly validates if core functionality works
Identifies and fixes fundamental issues early
Avoids wasting time on unnecessary optimizations
Makes code easier to maintain and debug
These principles should guide all code responses, focusing on getting the basics working first before adding complexity.
# 代码修改最佳实践
1. 修改前的准备
- 检查相关文件和依赖关系
- 确保命名一致性
- 添加必要的日志记录
- 准备回滚方案
2. 修改过程中
- 遵循统一的代码风格
- 添加适当的错误处理
- 保持代码的可读性
- 避免重复代码
3. 修改后的验证
- 验证主要功能
- 测试边界条件
- 检查错误处理
- 验证性能影响
4. 文档更新
- 更新相关文档
- 添加注释说明
- 记录重要修改
- 更新调试信息
5. 代码审查要点
- 检查命名规范
- 验证错误处理
- 确认日志完整性
- 评估代码质量
6. 调试建议
- 添加详细日志
- 使用断点调试
- 验证数据流
- 检查状态变化
7. 性能考虑
- 避免过早优化
- 关注关键路径
- 合理使用缓存
- 优化数据库查询
8. 安全性检查
- 验证输入数据
- 处理异常情况
- 保护敏感信息
- 添加访问控制
These practices help maintain code quality and reduce potential issues.