install
source · Clone the upstream repo
git clone https://github.com/aRustyDev/agents
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/aRustyDev/agents "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.claude/plans/merge-convert-skills/skills/codebase-implement-from-ir" ~/.claude/skills/arustydev-agents-implement-from-ir && rm -rf "$T"
manifest:
.claude/plans/merge-convert-skills/skills/codebase-implement-from-ir/SKILL.mdsource content
Implement from IR
Generate idiomatic code in a target language from an Intermediate Representation (IR).
Usage
/codebase-implement-from-ir <ir-path> --target <language> [--style <mode>] [--gaps <handling>]
Parameters
| Parameter | Description | Default |
|---|---|---|
| Path to IR file (JSON/YAML) | Required |
| Target language | Required |
| Generation style (minimal, idiomatic, verbose) | idiomatic |
| Gap handling (warn, error, annotate, ignore) | warn |
Process
1. IR Validation
Validate the input IR:
- Schema compliance
- Required fields present
- Internal consistency (referenced types exist)
2. Gap Resolution
Review detected gaps and apply mitigations:
| Gap Severity | Default Action |
|---|---|
| Critical | Halt, require human decision |
| High | Warn, suggest alternatives |
| Medium | Auto-convert with TODO comment |
| Low | Auto-convert silently |
| Info | Log for reference |
3. Pattern Translation
Map IR patterns to target idioms:
Type Mappings
| Source | Python | Rust | TypeScript | Go | Scala |
|---|---|---|---|---|---|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
Pattern Mappings
| Pattern | Source IR | Target Transformation |
|---|---|---|
| Pattern Match | | switch/if-else chain (if needed) |
| ADT | | sealed class/enum |
| Type Class | | trait/interface + instances |
| Async | | async/await, Future, goroutine |
| Error Handling | | Result, Either, (T, error) |
4. Code Generation
Generate syntactically correct code:
- Proper indentation and formatting
- Valid identifier names
- Correct import statements
- Appropriate module structure
5. Idiom Application
Apply target-language conventions:
- Naming conventions (snake_case, camelCase, PascalCase)
- Documentation style (docstrings, JSDoc, rustdoc)
- Error handling idioms
- Common patterns (builder, factory, etc.)
6. Formatting
Format code with target's standard tools:
- Python:
,blackruff - Rust:
rustfmt - TypeScript:
prettier - Go:
gofmt - Scala:
scalafmt
Output
Generated Code Structure
output/ ├── src/ │ ├── models.{ext} # Type definitions │ ├── services.{ext} # Functions and methods │ └── utils.{ext} # Helper functions ├── tests/ │ └── test_models.{ext} # Generated test stubs ├── Cargo.toml # (Rust) Package manifest ├── pyproject.toml # (Python) Package manifest └── GAPS.md # Gap resolution notes
Gap Resolution Report
# Gap Resolution Report ## Critical Gaps (Require Human Decision) ### 1. Higher-Kinded Types (SC-001) - **Source**: `Functor[F[_]]` in `types.scala` - **Target**: TypeScript - **Issue**: TypeScript cannot express HKT - **Options**: 1. Monomorphize to specific types (List, Option, etc.) 2. Use type-level programming with conditional types 3. Simplify to concrete implementation ## High Severity Gaps (Auto-Converted with Warning) ### 1. Ownership Transfer (RS-001) - **Source**: `fn take(self)` in `entity.rs` - **Target**: Python - **Resolution**: Converted to normal method, added runtime validation
Semantic Preservation Levels
Target these levels in order of priority:
1. Semantically Equivalent
Same observable behavior in all cases:
- Pure functions map directly
- Immutable data structures preserve semantics
- Error handling maintains all cases
2. Idiomatically Correct
Follows target conventions even if slightly different:
- Use target-native collections
- Apply target naming conventions
- Use target error handling patterns
3. Optimized
Efficient for target platform:
- Use target-specific optimizations
- Leverage platform features
- Minimize overhead from conversion
Examples
Synthesize Rust from Python IR
/codebase-implement-from-ir analysis.ir.json --target rust
Synthesize with verbose style
/codebase-implement-from-ir analysis.ir.json --target python --style verbose
Strict gap handling
/codebase-implement-from-ir analysis.ir.json --target go --gaps error
Reference
Target-Specific Guides
Related Skills
- codebase-analysis - Extract IR from source
- idiomatic-rust - Rust-specific idioms
- idiomatic-python - Python-specific idioms