用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/NethermindEth/pluto --skill porting命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | porting |
| description | Guides Go→Rust porting for Pluto. Invoke when asked to port, implement parity for, or translate a Go component. |
Before writing any code:
charon-guide for codebase location, version, and structure. Verify once per session if needed.charon/<path>:<line> (v1.7.1)Architecture context: See charon-guide skill for workflow components, design patterns, and package structure.
For each file in scope:
Do not guess. If behavior is unclear, ask.
For DKG, sync, reshare, FetchDefinition, or peer-indexed broadcast code, still use Charon v1.7.1 as the porting baseline, but load .claude/skills/pluto-review/references/trail-of-bits-charon-v2-audit.md and apply those fixes where v1.7.1 behavior is known vulnerable.
List Go imports and map each to its Rust equivalent:
| Go import | Rust crate/module | Status |
|---|---|---|
encoding/json | serde_json | available |
crypto/sha256 | sha2 | available |
some/go/pkg | ??? | missing — needs decision |
Flag anything without a clear mapping before continuing.
List every function/type to port, in the same order as the Go source:
| Item | Go file:line | Complexity | Notes |
|---|---|---|---|
FooCmd | cmd/foo.go:12 | Low | CLI entrypoint |
parseBar | cmd/foo.go:45 | Medium | custom encoding |
BazType | pkg/baz/baz.go:8 | High | shared with DKG |
Complexity: Low = straightforward translation / Medium = non-trivial logic or encoding / High = protocol-level, crypto, or shared invariants.
For each item in the inventory:
### `parse_bar` (charon/cmd/foo.go:45)
Behavior:
- Accepts hex-encoded 32-byte key, returns decoded [u8; 32]
- Returns error "invalid key: <hex>" on bad input (match string exactly)
Rust target: `pluto/crates/core/src/foo.rs`
Edge cases:
- Empty string → error, not panic
- Odd-length hex → error from hex::decode, wrap in ModuleError
Invariants:
- Output length always 32 bytes
- Error string must match Go for CLI parity
Do not begin implementing until this plan is approved.
Follow rust-style skill conventions and AGENTS.md golden rules:
Examples where different implementation is acceptable:
defer → Rust RAII (Drop trait)sync.WaitGroup → Rust tokio::task::JoinSetcontext.Context → Rust CancellationToken + structured concurrencyDashMap or channels#[from] deriveKeep Go file open alongside. After each function, verify behavior matches before moving on.
Do not write Go-cross-reference comments in the Rust source:
// Mirrors X / // Mirror of Go's X// Equivalent to Go's X// Ports charon/<path> (vX.Y.Z)// Placeholder for go.eth2v1.Foo// foo — router.go:108 cross-refs on routes/fields/methods// router.go:NN line-number anchors anywhereReasons:
Doc comments should describe what the Rust item does and any non-obvious why (constraint, invariant, edge case). If you need to record the Go origin for your own bookkeeping while porting, do it in the plan or PR description, never the source.
For each ported item:
#[test_case] for parameterized cases#[tokio::test] for asyncMinimum bar: every error path exercised, every Go test translated.
Before marking work done, verify functional equivalence with Go implementation:
Use pluto-review skill for structured parity review format. Any deviations must be documented with justification.
| Go | Rust |
|---|---|
string | String / &str |
[]byte | Vec<u8> / &[u8] |
int64 / uint64 | i64 / u64 |
map[K]V | HashMap<K, V> |
[]T | Vec<T> |
*T (nullable) | Option<T> |
error | Result<T, E> |
go func() | tokio::spawn() |
chan T | tokio::sync::mpsc |