daily-coding
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDaily Coding Checklist
日常编码检查清单
A minimal coding quality assurance checklist ensuring every code modification follows best practices.
一份轻量的编码质量保障检查清单,确保每一次代码修改都遵循最佳实践。
Core Checklist
核心检查清单
Before Starting
开始编码前
- Read before modify - Must read target file with Read tool before making changes
- Understand context - Confirm understanding of existing code logic and design intent
- 修改前先阅读 - 进行修改前必须使用 Read 工具读取目标文件
- 理解上下文 - 确认已理解现有代码逻辑和设计意图
During Coding
编码过程中
- Minimal changes - Only change what's necessary, no over-engineering, no unrelated features
- Type safety - Add type hints for Python, avoid in TypeScript
any - Security check - Avoid command injection, XSS, SQL injection vulnerabilities
- 最小改动 - 仅修改必要内容,不做过度设计,不添加无关功能
- 类型安全 - Python 代码添加类型提示,TypeScript 中避免使用
any - 安全检查 - 避免命令注入、XSS、SQL 注入漏洞
After Completion
编码完成后
- Verify execution - Ensure code runs correctly with no syntax errors
- Clean up - Remove print/console.log debug statements and temporary files
- Brief summary - Inform user what was changed and the scope of impact
- 验证执行 - 确保代码可正常运行,无语法错误
- 清理内容 - 移除 print/console.log 调试语句和临时文件
- 简要总结 - 告知用户修改内容以及影响范围
Quick Reference
快速参考
Common Mistakes to Avoid
需要避免的常见错误
python
undefinedpython
undefined❌ Don't
❌ Don't
def process(data=[]): # Mutable default argument
pass
def process(data=[]): # Mutable default argument
pass
✅ Should
✅ Should
def process(data: list | None = None):
data = data or []
```pythondef process(data: list | None = None):
data = data or []
```python❌ Don't
❌ Don't
except: # Bare except
pass
except: # Bare except
pass
✅ Should
✅ Should
except ValueError as e:
logger.error(f"Processing failed: {e}")
raise
undefinedexcept ValueError as e:
logger.error(f"Processing failed: {e}")
raise
undefinedSecurity Check Points
安全检查要点
- User input must be validated/escaped
- Use pathlib for file paths, avoid path traversal
- Never hardcode sensitive info (API keys, passwords)
- 用户输入必须经过校验/转义
- 文件路径使用 pathlib 处理,避免路径穿越
- 绝对不要硬编码敏感信息(API 密钥、密码)