# Autofix Rust Dep

> Fixes Rust 'can't find crate' errors by adding dependencies to Cargo.toml or rustlibs.

- Skill: `hyz0906/autofix-rust-dep` (Agent Skill)
- Install (CLI): `npx skillmds@latest add hyz0906/autofix-rust-dep`
- Raw SKILL.md: https://api.skillmd.com/api/skills/hyz0906/autofix-rust-dep/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: hyz0906 (https://skillmd.com/u/hyz0906)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/hyz0906/autofix-rust-dep

---


# Rust Dependency Skill

Fixes Rust compilation errors related to missing crates.

## Detection Patterns
- `can't find crate for 'X'`
- `unresolved import 'X'`
- `could not find 'X' in 'Y'`

## Strategy

1. **Identify Crate**: Extract the missing crate name.
2. **Add to Build**: Update Cargo.toml or Android.bp rustlibs.

## Instructions

### Step 1: Parse Error
From: `can't find crate for 'serde'`
Crate: `serde`

### Step 2: Add Dependency

**Cargo.toml:**
```toml
[dependencies]
serde = "1.0"
```

**Android.bp (AOSP):**
```json
rust_library {
    rustlibs: [
        "libserde",
    ],
}
```

### Common Rust Crates
| Crate | Android.bp name |
|-------|-----------------|
| `serde` | `libserde` |
| `log` | `liblog_rust` |
| `libc` | `liblibc` |

