Add carmack.rust.md agent-specific language prompt

Rust-specific readability guidance for the carmack agent including:
- let...else example for shallow control flow
- Async: don't block the runtime (tokio::fs, spawn_blocking, Send)
- Visibility: prefer pub(crate), private fields with accessors
- Generics: impl Trait over explicit params, avoid complex where clauses
- Improved iterator guidance: if you need a comment, use a loop
- UTF-8 string slicing warnings
- Ownership/lifetime pragmatism
- Anti-patterns: no macros/typestate/proc-macros unless already in repo

Also adds Rust detection to LANGUAGE_PROMPTS (empty base prompt,
agent-specific prompts handle the guidance).
This commit is contained in:
Dhanji R. Prasanna
2026-01-15 07:13:56 +05:30
parent 6d1aa62ba7
commit 65807eea99
2 changed files with 74 additions and 0 deletions

View File

@@ -11,6 +11,11 @@ use std::path::Path;
/// The key should match common file extensions or language identifiers.
static LANGUAGE_PROMPTS: &[(&str, &[&str], &str)] = &[
// (language_name, file_extensions, prompt_content)
(
"rust",
&[".rs"],
"", // No base Rust prompt; agent-specific prompts handle this
),
(
"racket",
&[".rkt", ".rktl", ".rktd", ".scrbl"],
@@ -23,6 +28,7 @@ static LANGUAGE_PROMPTS: &[(&str, &[&str], &str)] = &[
static AGENT_LANGUAGE_PROMPTS: &[(&str, &str, &str)] = &[
// (agent_name, language_name, prompt_content)
("carmack", "racket", include_str!("../../../prompts/langs/carmack.racket.md")),
("carmack", "rust", include_str!("../../../prompts/langs/carmack.rust.md")),
];
/// Detect languages present in the workspace by scanning for file extensions.