微算力 · API 导航与自营网关
API 接入 EN
未登录登录
✨

rust-review

rust-review · v1.9.17
安全 unknown 级 作者 athola 公开目录收录
1.1k 下载 0 安装 5.4k 收藏 4 浏览

简介

rust-review

原始描述

Audits Rust code for unsafe blocks, ownership issues, and Cargo dependency risks

通过你的 Agent 添加

安装目录:rust-review/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/rust-review/
Codex CLI~/.codex/skills/rust-review/
DeepSeek Harness~/.agents/skills/rust-review/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

技能正文


name: rust-review description: Rust code review guidelines for Coglet

Rust review guidelines

This project uses Rust for Coglet (crates/), the prediction server that runs inside Cog containers. It handles HTTP requests, worker process management, and prediction execution.

What linters already catch (skip these)

clippy runs in CI. cargo-deny audits dependencies for license/advisory issues. Don't flag issues these would catch.

What to look for

Error handling

  • Use thiserror for typed errors in library code, anyhow for application errors
  • Don't use .unwrap() or .expect() in non-test code unless the invariant is documented
  • Error context: use .context() or .with_context() from anyhow, not bare ?

Ownership and lifetimes

  • Unnecessary cloning where a borrow would work
  • Lifetime issues that suggest a design problem (not just annotation noise)
  • Arc/Mutex when simpler patterns exist

Async (tokio)

  • Blocking operations inside async contexts (use spawn_blocking)
  • Missing .await on futures (compiler catches some, but not all logical issues)
  • Proper cancellation handling and cleanup
  • Task/JoinHandle leaks

Safety

  • Any unsafe block needs justification and a safety comment
  • FFI boundaries with Python (PyO3) -- check for panics across FFI, GIL handling
  • Memory safety in IPC between parent and worker processes

Architecture

  • crates/coglet/ is the core: HTTP server, worker orchestration, IPC
  • crates/coglet-python/ is PyO3 bindings for Python predictor integration
  • Two-process architecture: parent (HTTP + orchestrator) and worker (Python execution)
  • Don't mix IPC concerns with HTTP handling
  • Snapshot tests use insta -- check if snapshots need updating

Dependencies

  • New dependencies should be justified -- crates/deny.toml audits them
  • Prefer std or existing deps over adding new ones for small tasks

正文来自原始仓库, 版权归作者所有,许可:MIT。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/replicate/cog

标签

没有标签

同类 Skill