Systematic diagnosis of rustc error codes and Clippy lints; updates ERROR_PATTERNS.md.
<description>Systematic diagnosis of rustc error codes and Clippy lints; updates ERROR_PATTERNS.md.</description>
<when_to_use>
cargo check, cargo test, or cargo clippy produces errors.rust-compile-loop — use this to diagnose, compile-loop to iterate fixes.
</when_to_use><critical_rules>
<rule id="1" level="ALWAYS">Read the FULL error message — the compiler suggests the fix.</rule>
<rule id="2" level="ALWAYS">Classify each error into exactly ONE category before fixing.</rule>
<rule id="3" level="ALWAYS">Add new patterns to ERROR_PATTERNS.md with root cause, fix, snippet, and test.</rule>
<rule id="4" level="NEVER">Suppress clippy with #[allow] without a documented justification comment.</rule>
</critical_rules>
// Fix: finish using the immutable borrow before mutating let first = data[0]; // copy the value (no borrow kept) data.push(42); // now safe </code_example>
</section> <section name="fix-patterns"> <content> ### Library errors - `thiserror` with `#[error("...")]` + `#[from]` for auto-conversion. - `#[source]` to preserve error chains. - `Box` large payloads: `ParseError(Box<serde_json::Error>)`.anyhow with .context("why it failed")..context() at module boundaries, NOT on every call.#[allow(clippy::...)] with justification.<common_mistakes>
<mistake id="1">
<wrong>Trying to fix error by type before reading the message</wrong>
<right>Read the FULL error message — the compiler suggests the fix</right>
</mistake>
<mistake id="2">
<wrong>Ignoring rustc --explain Exxxx</wrong>
<right>Run it — it gives examples and detailed explanations</right>
</mistake>
<mistake id="3">
<wrong>Suppressing clippy with #[allow] without a comment</wrong>
<right>ALWAYS add // Reason: ... next to #[allow]</right>
</mistake>
</common_mistakes>
<verification_checkpoints>
<checkpoint id="1" command="cat ERROR_PATTERNS.md">New entry has: root cause, canonical fix, minimal snippet, minimal test</checkpoint>
<checkpoint id="2" command="./scripts/verify.sh --fast">Exits 0 after applying the fix</checkpoint>
<checkpoint id="3" command="cargo test">New minimal test in ERROR_PATTERNS.md compiles and passes</checkpoint>
<checkpoint id="4" command="grep -rn '#\[allow' src/">Every #[allow] has an inline comment explaining why</checkpoint>
</verification_checkpoints>
npx skills add GravityZenAI/rust-error-triage下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer