Agent skill

oxidizer-workflow

Automated Python-to-Rust migration via iterative convergence loops. Treats the Python codebase as the living specification and produces a fully-tested Rust equivalent with zero-tolerance parity validation. Use when migrating Python modules, libraries, or CLIs to Rust. Activates for: migration, oxidize, python to rust, port to rust, rewrite in rust.

Stars 45
Forks 28

Install this agent skill to your Project

npx add-skill https://github.com/rysweet/amplihack/tree/main/.claude/skills/oxidizer-workflow

SKILL.md

Oxidizer Workflow Skill

Purpose

Orchestrates the oxidizer-workflow recipe to migrate Python codebases to Rust. The workflow is recursive and goal-seeking — it loops until 100% feature parity is achieved, with quality audit and silent degradation checks on every iteration.

When to Use

  • Migrating a Python module, package, or CLI to Rust
  • Porting a Python library to a standalone Rust crate
  • Creating a Rust binary that replaces a Python tool

Core Principles

  1. Tests first — Python test coverage must be complete before any porting begins
  2. Zero tolerance — 100% parity required; partial results are not accepted
  3. Quality gates — Every iteration runs clippy, fmt, and a full test suite
  4. No silent degradation — Every feature, edge case, and error path must be preserved
  5. Iterative convergence — Module-by-module, loop until converged

Required Inputs

Input Example Description
python_package_path src/amplihack/recipes Path to the Python package to migrate
rust_target_path rust/recipe-runner Where to create the Rust project
rust_repo_name amplihack-recipe-runner GitHub repo name for the Rust project
rust_repo_org rysweet GitHub org or user for the repo

Execution

Via Recipe Runner

bash
recipe-runner-rs amplifier-bundle/recipes/oxidizer-workflow.yaml \
  --set python_package_path=src/mypackage \
  --set rust_target_path=rust/mypackage \
  --set rust_repo_name=my-rust-package \
  --set rust_repo_org=myorg

Via Python API

python
from amplihack.recipes import run_recipe_by_name

result = run_recipe_by_name(
    "oxidizer-workflow",
    user_context={
        "python_package_path": "src/mypackage",
        "rust_target_path": "rust/mypackage",
        "rust_repo_name": "my-rust-package",
        "rust_repo_org": "myorg",
    },
)

Workflow Phases

Phase 1: Analysis
  └─ AST analysis, dependency mapping, type inference, public API extraction

Phase 1B: Test Completeness Gate
  └─ Measure coverage → write missing tests → re-verify → BLOCK if < 100%

Phase 2: Scaffolding
  └─ cargo init, add dependencies, create module structure

Phase 3: Test Extraction
  └─ Port Python tests to Rust test modules → quality audit tests

Phase 4-6: Iterative Convergence Loop (× N until 100% parity)
  ├─ Select next module (priority order from Phase 1)
  ├─ Implement module in Rust
  ├─ Compare: feature matrix diff against Python
  ├─ Quality gate: cargo clippy + fmt + test
  ├─ Silent degradation audit: check for lossy conversions
  ├─ Fix any degradation found
  └─ Convergence check: if < 100% parity → loop again

Final: Summary report with parity matrix

Convergence Rules

  • Each iteration processes one module at a time (core-out strategy)
  • Up to 5 unrolled loops in the recipe, plus max_depth: 8 for sub-recipes
  • The recipe terminates when convergence_status == "CONVERGED" or iteration_number > max_iterations (default 30)
  • If max iterations reached without convergence, the final summary reports which modules are still incomplete

Recipe Location

The oxidizer recipe is at:

amplifier-bundle/recipes/oxidizer-workflow.yaml

The recipe is the executable workflow — this skill is the discovery and activation layer. When investigating or customizing the workflow phases, agent prompts, or convergence rules, start with the recipe file above.

Effective Rust Compliance

The oxidizer workflow enforces idiomatic Rust practices aligned with the Effective Rust guide by David Drysdale. Key rules baked into every iteration:

Types (Items 1–6)

  • Use Rust's type system to make invalid states unrepresentable (enum with data)
  • Use Option<T> for optional values — never sentinel values like -1 or null
  • Use Result<T, E> for fallible operations — never panic on expected errors
  • Use the newtype pattern for domain-specific semantics (units, IDs, validated strings)
  • Prefer From/Into conversions over as casts
  • Use thiserror for library error types, anyhow for application error handling

Unsafe (Item 16)

  • Avoid writing unsafe code — use standard library and crate abstractions instead
  • If unsafe is absolutely required (FFI), isolate it in a wrapper module with safety comments
  • Run Miri over any unsafe code
  • Enable the unsafe_op_in_unsafe_fn lint

Parallelism (Item 17)

  • Prefer channels (std::sync::mpsc) over shared state when possible
  • Use Arc<Mutex<T>> for shared state — keep lock scopes small
  • Group related data under a single lock to prevent deadlocks
  • Never invoke closures or return MutexGuard with locks held
  • Include deadlock detection in CI (parking_lot::deadlock, ThreadSanitizer)

Tooling (Items 29, 31, 32)

  • cargo clippy -- -D warnings on every iteration
  • cargo fmt --check on every iteration
  • cargo doc to verify documentation compiles
  • cargo-udeps to detect unused dependencies
  • cargo-deny for license and advisory checks
  • cargo bench with std::hint::black_box for realistic benchmarks

What Success Looks Like

  • Rust project builds cleanly (cargo build)
  • All tests pass (cargo test)
  • Zero clippy warnings (cargo clippy -- -D warnings)
  • Formatted (cargo fmt --check)
  • Feature parity matrix shows 100% coverage
  • No silent degradation detected
  • Zero unsafe blocks (or justified, isolated, and Miri-tested)
  • Idiomatic Rust types — no sentinel values, no stringly-typed APIs

Expand your agent's capabilities with these related and highly-rated skills.

rysweet/amplihack

chemist-analyst

Analyzes events through chemistry lens using molecular structure, reaction mechanisms, thermodynamics, kinetics, and analytical techniques (spectroscopy, chromatography, mass spectrometry). Provides insights on chemical processes, material properties, reaction pathways, synthesis, and analytical methods. Use when: Chemical reactions, material analysis, synthesis planning, process optimization, environmental chemistry. Evaluates: Molecular structure, reaction mechanisms, yield, selectivity, safety, environmental impact.

45 28
Explore
rysweet/amplihack

learning-path-builder

Creates personalized learning paths for technologies, frameworks, or concepts. Use for user-interactive session only for onboarding new technologies, hackathon skill-building, or personal development planning. Not for use in automated development or investigation. Sequences resources (docs, tutorials, exercises) based on current skill level and learning goals. Adapts to learning style: hands-on, theory-first, project-based.

45 28
Explore
rysweet/amplihack

gh-work-report

Generates comprehensive GitHub activity reports across all authenticated accounts. Gathers repos, PRs, features, and themes for configurable time periods (1/5/7/30/90 days). Produces shareable markdown with tables, mermaid charts, and executive summaries. Can create a private repo with GitHub Actions automation and GitHub Pages aggregation site. Use when: "github report", "work report", "activity summary", "what did I work on", "gh-work-report", "show my github activity".

45 28
Explore
rysweet/amplihack

pr-review-assistant

Philosophy-aware PR reviews checking alignment with amplihack principles. Use when reviewing PRs to ensure ruthless simplicity, modular design, and zero-BS implementation. Suggests simplifications, identifies over-engineering, verifies brick module structure. Posts detailed, constructive review comments with specific file:line references.

45 28
Explore
rysweet/amplihack

code-smell-detector

Identifies anti-patterns specific to amplihack philosophy. Use when reviewing code for quality issues or refactoring. Detects: over-abstraction, complex inheritance, large functions (>50 lines), tight coupling, missing __all__ exports. Provides specific fixes and explanations for each smell.

45 28
Explore
rysweet/amplihack

biologist-analyst

Analyzes living systems and biological phenomena through biological lens using evolution, molecular biology, ecology, and systems biology frameworks. Provides insights on mechanisms, adaptations, interactions, and life processes. Use when: Biological systems, health issues, evolutionary questions, ecological problems, biotechnology. Evaluates: Function, structure, heredity, evolution, interactions, molecular mechanisms.

45 28
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results