Rust 工程最佳实践
原名:rust-best-practices
按可读性、错误处理、所有权和测试原则审查 Rust 代码。
中文 Skills 技能说明
适合编写或评审 Rust 服务与插件;建议必须结合当前工具链和真实代码,先运行格式、检查和测试,再说明仍未覆盖的风险。技能以本地 GraphQL 代码和配置为主;Apollo GraphOS、Studio 或其他托管服务需使用用户自己的账户,网络、区域、费用和数据位置由用户确认。执行前读取真实项目、当前版本和官方资料,输出目标、依据、影响、验证结果与回退方式;没有证据时明确说明未知,不编造数据、配置或成功状态。 创建、修改、部署、发布、提交审核、迁移、删除、发送或产生费用的操作,必须先展示目标和差异并获得有权限人员确认。 代码、schema、日志、令牌、客户、订单、支付、音视频和企业资料按敏感内容处理,只读取任务所需范围,上传或外发前完成授权、脱敏和最小化。
上游能力依据
上游原始适用说明:Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook. Use this skill when: (1) writing new Rust code or functions, (2) reviewing or refactoring existing Rust code, (3) deciding between borrowing vs cloning or ownership patterns, (4) implementing error handling with Result types, (5) optimizing Rust code for performance, (6) writing tests or documentation for Rust projects.
上游 SKILL.md 主要章节(保留原文标题):
- Best Practices Reference
- Quick Reference
- Borrowing & Ownership
- Error Handling
- Performance
- Linting
- Testing
- Generics & Dispatch
- Type State Pattern
- Documentation
使用边界
先读取项目约定、依赖版本和现有测试,再提出最小改动。写文件、运行脚本、提交代码或发布前应检查差异并保留回退路径。
作者、翻译与许可证
- 原作者
- Apollo GraphQL, Inc. 与 apollographql/skills contributors
- 中文翻译
- CEOFans翻译
- 许可证
- MIT
- 上游来源
- https://github.com/apollographql/skills/tree/c288eb80629dd2309eed81f23d693f66a452d043/skills/rust-best-practices
适用范围
平台:linux、macos、windows;标签:软件开发、Rust 工程最佳实践
安全提示
基础静态扫描不等于绝对安全。技能可能调用命令、浏览器、云服务或本地文件,请在最小权限环境中使用,高风险操作必须人工确认。
如发现侵权、许可证或安全问题,可在本页前台提交投诉,管理员复核后可立即下架。