AGENT SKILL
rust-migration-slice
Carry one TypeScript (or Python/JS) subsystem through the full Rust migration sequence — contract capture, Rust implementation, parity verification, consumer switch, legacy deletion, ledger update, commit. Use for any "port X to Rust" / "continue the migration" request.
- License 许可
- MIT
- 最近更新
- 2026-11-09
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- rust-migration-slice
- description
- Carry one TypeScript (or Python/JS) subsystem through the full Rust migration sequence — contract capture, Rust implementation, parity verification, consumer switch, legacy deletion, ledger update, commit. Use for any "port X to Rust" / "continue the migration" request.
03 SKILL.md 正文
Migrate one slice to Rust
Read first (once per session): docs/rust-migration/HANDOFF.md, docs/rust-migration/README.md, AGENTS.md. Executable sources beat prose. Run /migration-status if no slice was named.
Hard rules
- Never mark ledger/capability rows verified without evidence; never delete ledger rows; never relax xtask gates.
- Reuse mature engines (
pi-edit,pi-shell,pi-walker,pi-vcs,pi-ast,harvest-runtimejail/bounded IO/atomic writes). Do not write a weaker second implementation. - Model/provider policy stays in KDL; prompts stay static
.md(useinclude_str!). Generated files are regenerated, never hand-edited. - No JS-runtime fallback for retired features — fail with an actionable migration message.
- Tests:
cargo xtask test -p <crate>(never barecargo test). Tests assert observable contracts; no source-grep tests.
Sequence
- Scope: pick a slice with a closed set of files. List them and their consumers (
grep -rnimports/callsites incl. workers inpackages/coding-agent/src/cli.ts, build scripts, BazelBUILD.bazel, CI workflows). - Contract capture: document inputs/outputs, error mapping, limits, persisted formats, cancellation. Build an oracle: run the current implementation over representative + malformed inputs and save outputs (scratchpad) for byte comparison. Port meaningful existing TS tests as Rust tests.
- Implement in an ordinary Rust crate (existing
crates/harvest-*or new one added to rootCargo.tomlworkspace,Cargo.lock, BazelBUILD.bazel/MODULE.bazel, and Rust CI package lists). Explicit bounds before allocation/decoding. If TS still calls it, keep a thin N-API adapter (see/napi-extract). - Verify:
cargo xtask test -p <crate>,cargo clippy -p <crate> --all-targets -- -D warnings,cargo fmt -p <crate> -- --check(only changed files inpi-natives— runrustfmton them, not the crate). Compare oracle byte-for-byte. If natives changed:bun run build:native, then focusedbun test <path>for TS consumers,bun --cwd=packages/coding-agent run check. - Switch consumers (callers, generators, packaging, docs). Delete superseded TS/TSX/declarations only when every consumer moved. Remove orphaned deps/config.
- Ledger: update the slice's
source-ledger.jsonentries (contract, consumers, rust_destination, verification states, legacy_removal) andcapabilities.jsonhonestly; add a section todocs/rust-migration/README.mdwith real counts. Runcargo xtask migrationandcargo xtask capabilitiesto confirm the gates accept it. - Commit one verified slice (conventional subject, e.g.
refactor(media): move sixel encode/decode into harvest-media), only if the user authorized commits. Report what is still TS/unverified.
04 同仓库更多 Skills
greet
A greeting skill for testing
★ 3
valid-skill
A valid skill for testing purposes.
★ 3
unknown-field
A skill with an unknown frontmatter field.
★ 3
no-frontmatter
暂无简介
★ 3
child-skill
A nested skill in a subdirectory.
★ 3
different-name
A skill with a name that doesn't match the directory.
★ 3