Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Idiomatic Rust patterns for pikru C port. Use when writing or reviewing Rust code ported from C. Don't write C in Rust - the goal is correct behavior, not line-by-line translation.
.claude/skills/bearcove-idiomatic-rust/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 4% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 10% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 209% | 0% |
| case-06 | ✗→✓ | ▲ Improved | -7% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 9% | 0% |
This is a Rust port of C code, but do not write C in Rust. The goal is correct behavior, not line-by-line translation.
If a struct has all the information needed to compute something, make it a method:
rust// BAD: C-style function with boolean flag soup fn text_width(text: &str, charwid: f64, is_mono: bool, font_scale: f64, is_bold: bool) -> f64 // GOOD: The type already knows its properties impl PositionedText { fn width_inches(&self, charwid: f64) -> f64 { // self.mono, self.bold, self.big are all right here } }
Rationale: Boolean flags are:
width(s, w, true, 1.0, false) - which bool is which?)rust// BAD: Bare f64 everywhere, easy to mix up inches and pixels fn convert(value: f64, scale: f64) -> f64 // GOOD: The type system catches mistakes struct Inches(f64); struct Pixels(f64); fn convert(value: Inches, scale: &Scaler) -> Pixels
When you find yourself writing foo_bar(bar, ...), consider bar.foo(...) instead. This:
rust// BAD: What does `true` mean here? render_text(text, true, false) // GOOD: Self-documenting enum TextAnchor { Start, Middle, End } render_text(text, TextAnchor::Start)
When porting C:
The // cref: comments link to C for reference, but the Rust should stand on its own.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-05 | fail→pass | 14,519 | 14,109 | -3% | 1 | 1 | 0% | 2,574 | 2,670 | +4% | 0 | 0 | — |
case-01 | fail→pass | 27,158 | 23,695 | -13% | 1 | 1 | 0% | 3,881 | 4,260 | +10% | 0 | 0 | — |
case-02 | fail→pass | 4,422 | 10,614 | +140% | 1 | 1 | 0% | 791 | 2,442 | +209% | 0 | 0 | — |
case-03 | pass→pass | 17,310 | 14,422 | -17% | 1 | 1 | 0% | 2,549 | 2,713 | +6% | 0 | 0 | — |
case-04 | fail→fail | 14,210 | 11,540 | -19% | 1 | 1 | 0% | 2,543 | 2,745 | +8% | 0 | 0 | — |
case-06 | fail→pass | 15,854 | 14,689 | -7% | 1 | 1 | 0% | 2,963 | 2,749 | -7% | 0 | 0 | — |
case-07 | fail→fail | 20,224 | 24,582 | +22% | 1 | 1 | 0% | 3,653 | 3,473 | -5% | 0 | 0 | — |
case-08 | fail→pass | 30,877 | 17,929 | -42% | 1 | 1 | 0% | 2,570 | 2,793 | +9% | 0 | 0 | — |
case-09 | fail→fail | 18,580 | 17,593 | -5% | 1 | 1 | 0% | 2,750 | 2,582 | -6% | 0 | 0 | — |
case-10 | fail→fail | 13,990 | 12,512 | -11% | 1 | 1 | 0% | 2,039 | 2,427 | +19% | 0 | 0 | — |
case-11 | fail→pass | 22,863 | 31,346 | +37% | 1 | 1 | 0% | 3,416 | 5,391 | +58% | 0 | 0 | — |
case-12 | fail→pass | 19,402 | 26,448 | +36% | 1 | 1 | 0% | 3,684 | 5,822 | +58% | 0 | 0 | — |
case-13 | fail→fail | 15,545 | 10,705 | -31% | 1 | 1 | 0% | 2,866 | 2,129 | -26% | 0 | 0 | — |
case-14 | fail→fail | 14,198 | 14,200 | +0% | 1 | 1 | 0% | 2,669 | 3,050 | +14% | 0 | 0 | — |
case-15 | fail→pass | 20,796 | 13,807 | -34% | 1 | 1 | 0% | 3,178 | 2,970 | -7% | 0 | 0 | — |
case-16 | fail→pass | 21,126 | 32,783 | +55% | 1 | 1 | 0% | 3,295 | 7,235 | +120% | 0 | 0 | — |
case-17 | fail→pass | 18,726 | 42,071 | +125% | 1 | 1 | 0% | 2,921 | 7,243 | +148% | 0 | 0 | — |
case-18 | fail→pass | 22,356 | 16,932 | -24% | 1 | 1 | 0% | 3,643 | 2,890 | -21% | 0 | 0 | — |
case-19 | fail→fail | 19,659 | 25,895 | +32% | 1 | 1 | 0% | 3,118 | 4,460 | +43% | 0 | 0 | — |
case-20 | fail→pass | 16,161 | 11,360 | -30% | 1 | 1 | 0% | 2,895 | 2,521 | -13% | 0 | 0 | — |
case-21 | fail→pass | 16,678 | 17,869 | +7% | 1 | 1 | 0% | 2,416 | 3,184 | +32% | 0 | 0 | — |
case-22 | pass→pass | 15,679 | 14,111 | -10% | 1 | 1 | 0% | 2,920 | 3,009 | +3% | 0 | 0 | — |
case-23 | fail→fail | 20,532 | 14,804 | -28% | 1 | 1 | 0% | 2,928 | 3,071 | +5% | 0 | 0 | — |
case-24 | pass→pass | 18,279 | 10,812 | -41% | 1 | 1 | 0% | 3,045 | 2,413 | -21% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +54 percentage points is the difference between those two pass rates over the 24 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.