Udaiy’s Blog

Why We Built Agentic Skills for Rust

TL;DR: AI models love to guess; the Rust compiler demands perfection. This mismatch causes AI to get stuck in "Lint Spirals" where it keeps guessing wrong fixes. We solved this by treating the AI not as a chatterbox, but as an engineer that must run cargo check to verify its own work before showing it to you.


1. The Problem: AI Guesses, Rust Checks

The biggest problem with AI coding is verification. In languages like Python or JavaScript, "close enough" code often runs fine. But Rust is different. Its compiler is a strict mentor that refuses to accept code unless it perfectly follows memory safety rules.

When an AI hits a Rust error, it often panics. It tries to "guess" a fix that looks right (like adding .clone() randomly) just to make the error go away. But because it's just guessing unrelated to the actual logic, the compiler rejects it again. This leads to the "Lint Spiral": a frustrating loop where the AI fixes one error only to create another, never actually solving the problem.

2. The Solution: Skills, Not Just Prompts

We stopped trying to fix this with "better prompts" (pasting huge rulebooks into the chat). Instead, we built a Guild Architecture based on Agentic Skills.

What is a Skill?

A Skill is like a specialized employee. It has:

  1. Instructions: How to do the job.
  2. Tools: Scripts it can run (like cargo check).
  3. Docs: Reference manuals it can read.

Instead of one "General Rust AI" that tries to know everything, we split the work:

This prevents Context Pollution. By only loading the rules needed for the current task, the AI stays focused and doesn't get confused by irrelevant information.

3. The "Beast Mode" Loop

We force the AI to think and check its work, just like a human engineer:

Ingest Plan Execute Verify

The most important step is Verify. The AI isn't allowed to just "think" it's right. It must:

  1. Write the code.
  2. Run cargo check.
  3. Read the compiler error.
  4. Fix it immediately.

Only when the code passes the compiler does the AI show it to you. This uses the Rust compiler as a guardrail, ensuring you only get code that actually compiles.

To build better AI for Rust, we stopped treating models like text generators and started treating them like tool users. The Rust compiler is the ultimate judge of truth; our system simply gives the AI the hands to listen to it.

#agents #llm-challenges #rust