Rust Best Practices
farm-fe/farm
Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.
Modern C++ (17/20/23) idioms: RAII, smart pointers, value semantics, Rule of Zero/Five, concepts, and std::expected error handling.
$ npx skills add irahardianto/awesome-agv --skill cpp-idioms -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install irahardianto/awesome-agv cpp-idioms --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/irahardianto/awesome-agv.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/cpp-idioms .claude/skills/cpp-idioms && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "cpp-idioms" agent skill from https://github.com/irahardianto/awesome-agv/tree/main/.agents/skills/cpp-idioms into .claude/skills/cpp-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cpp-idioms", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/irahardianto/awesome-agv/tree/main/.agents/skills/cpp-idiomsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add irahardianto/awesome-agv --skill cpp-idioms -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install irahardianto/awesome-agv cpp-idioms --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/irahardianto/awesome-agv.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/cpp-idioms .agents/skills/cpp-idioms && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "cpp-idioms" agent skill from https://github.com/irahardianto/awesome-agv/tree/main/.agents/skills/cpp-idioms into .agents/skills/cpp-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cpp-idioms", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add irahardianto/awesome-agv --skill cpp-idioms -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install irahardianto/awesome-agv cpp-idioms --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/irahardianto/awesome-agv.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/cpp-idioms .cursor/skills/cpp-idioms && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "cpp-idioms" agent skill from https://github.com/irahardianto/awesome-agv/tree/main/.agents/skills/cpp-idioms into .cursor/skills/cpp-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cpp-idioms", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/irahardianto/awesome-agv.git --path .agents/skills/cpp-idioms--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add irahardianto/awesome-agv --skill cpp-idioms -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install irahardianto/awesome-agv cpp-idioms --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/irahardianto/awesome-agv.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/cpp-idioms .gemini/skills/cpp-idioms && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "cpp-idioms" agent skill from https://github.com/irahardianto/awesome-agv/tree/main/.agents/skills/cpp-idioms into .gemini/skills/cpp-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cpp-idioms", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install irahardianto/awesome-agv cpp-idiomsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add irahardianto/awesome-agv --skill cpp-idioms -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/irahardianto/awesome-agv.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/cpp-idioms .github/skills/cpp-idioms && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "cpp-idioms" agent skill from https://github.com/irahardianto/awesome-agv/tree/main/.agents/skills/cpp-idioms into .github/skills/cpp-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cpp-idioms", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add irahardianto/awesome-agv --skill cpp-idioms -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install irahardianto/awesome-agv cpp-idioms --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/irahardianto/awesome-agv.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/cpp-idioms .opencode/skills/cpp-idioms && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "cpp-idioms" agent skill from https://github.com/irahardianto/awesome-agv/tree/main/.agents/skills/cpp-idioms into .opencode/skills/cpp-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cpp-idioms", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
cpp-idiomsModern C++ (17/20/23) idioms: RAII, smart pointers, value semantics, Rule of Zero/Five, concepts, and std::expected error handling.
Cpp Idioms is an agent skill from irahardianto/awesome-agv. Modern C++ (17/20/23) idioms: RAII, smart pointers, value semantics, Rule of Zero/Five, concepts, and std::expected error handling. Use when writing, refactoring, or reviewing C++ code, CMake targets, or native modules.
Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development, covering Error handling and Refactoring. It works with C++. The repository describes itself as: Comprehensive sets of standards and practices designed to elevate the capabilities of AI coding agents. The licence is MIT.
5 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 9e997ba. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are cpp).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Cpp Idioms loads about 2.1k tokens when it runs. Until then it costs about 58 tokens; SKILL.md has 327 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from irahardianto/awesome-agv at commit 9e997ba, republished under its MIT licence (© irahardianto). 327 words, ~2,086 tokens.
.claude/skills/cpp-idioms/SKILL.md (or your agent's skills folder).Modern C++ (17/20/23) rewards RAII, value semantics, and zero-cost abstractions. Lean into the type system and smart pointers. Idiomatic C++ = safe, deterministic, performant.
Scope: C++ coding idioms. Test naming: .agents/rules/testing-strategy.md.
RAII — resources tied to object lifetime. No manual new/delete.
std::unique_ptr for exclusive ownership, std::shared_ptr only when sharing is necessary.
Move semantics — prefer moving over copying for expensive types.
Rule of Five/Zero:
// ✅ Rule of Zero — let compiler-generated defaults work
class TaskService {
std::unique_ptr<TaskStorage> storage_;
std::shared_ptr<Logger> logger_;
public:
// No destructor, copy/move constructors needed — smart pointers handle it
explicit TaskService(std::unique_ptr<TaskStorage> storage, std::shared_ptr<Logger> logger)
: storage_(std::move(storage)), logger_(std::move(logger)) {}
};
// ✅ Rule of Five — when managing raw resources (rare)
class Buffer {
char* data_;
size_t size_;
public:
~Buffer(); // Destructor
Buffer(const Buffer&); // Copy constructor
Buffer& operator=(const Buffer&); // Copy assignment
Buffer(Buffer&&) noexcept; // Move constructor
Buffer& operator=(Buffer&&) noexcept; // Move assignment
};Pass by value and move for sink parameters:
// ✅ Sink parameter — takes ownership
void addTask(Task task) {
tasks_.push_back(std::move(task));
}
// ✅ Read-only — const reference
void printTask(const Task& task);
// ❌ Never pass smart pointers unless transferring ownership
void processTask(std::shared_ptr<Task> task); // Unnecessary ref-count bump
// ✅ If function doesn't need ownership
void processTask(const Task& task);For universal error handling principles, see
.agents/rules/error-handling-principles.md. Below: language-specific patterns only.
std::expected (C++23) or Result types for expected failures:
// ✅ C++23 std::expected
std::expected<Task, TaskError> getTask(std::string_view id) {
auto it = tasks_.find(id);
if (it == tasks_.end()) {
return std::unexpected(TaskError::NotFound);
}
return it->second;
}
// Caller handles both paths
auto result = getTask("123");
if (!result) {
handleError(result.error());
return;
}
processTask(*result);Exceptions for exceptional conditions only. Never for control flow.
noexcept on move constructors and destructors.
Domain error types:
enum class TaskError {
NotFound,
ValidationFailed,
StorageUnavailable,
};
// ✅ For exception-based paths
class TaskNotFoundException : public std::runtime_error {
std::string task_id_;
public:
explicit TaskNotFoundException(std::string id)
: std::runtime_error("Task not found: " + id), task_id_(std::move(id)) {}
const std::string& task_id() const noexcept { return task_id_; }
};std::string_view for read-only string parameters (no allocation):
// ✅ Zero-copy string parameter
void log(std::string_view message, std::string_view context);
// ❌ Unnecessary copy
void log(const std::string& message);constexpr for compile-time evaluation:
constexpr int maxRetries = 3;
constexpr auto timeout = std::chrono::seconds(30);
constexpr int factorial(int n) {
return n <= 1 ? 1 : n * factorial(n - 1);
}Structured bindings: auto [id, title] = getTask();
std::optional for nullable values:
// ✅ Explicit nullability
std::optional<Task> findById(std::string_view id);
// Caller checks explicitly
if (auto task = findById("123"); task.has_value()) {
process(*task);
}std::variant for type-safe unions (sum types):
using TaskResult = std::variant<Task, TaskError>;
TaskResult result = getTask(id);
std::visit(overloaded{
[](const Task& task) { process(task); },
[](TaskError err) { handleError(err); },
}, result);Concepts (C++20) for constrained templates:
template<typename T>
concept Storable = requires(T t) {
{ t.id() } -> std::convertible_to<std::string_view>;
{ t.serialize() } -> std::same_as<std::vector<char>>;
};
template<Storable T>
void save(const T& entity);Ranges (C++20) for functional-style pipelines:
auto active_titles = tasks
| std::views::filter([](const Task& t) { return t.is_active(); })
| std::views::transform(&Task::title)
| std::views::take(10);// ✅ Interface (abstract class with pure virtuals)
class TaskStorage {
public:
virtual ~TaskStorage() = default;
virtual std::expected<Task, TaskError> getById(std::string_view id) = 0;
virtual void save(const Task& task) = 0;
};
// ✅ Production implementation
class PostgresTaskStorage : public TaskStorage {
// ...
};
// ✅ Test implementation
class MockTaskStorage : public TaskStorage {
// MOCK_METHOD from Google Mock, or hand-rolled
};
// ✅ Constructor injection
class TaskService {
std::unique_ptr<TaskStorage> storage_;
public:
explicit TaskService(std::unique_ptr<TaskStorage> storage)
: storage_(std::move(storage)) {}
};_ suffix for private members: storage_, logger_.constexpr).new/delete — use std::make_unique / std::make_sharedusing namespace std; in headers — pollutes global namespace... without re-throwing — swallows all errors including crashesconst_cast to remove constness — design flaw, fix the interfacereinterpret_cast without safety justification — undefined behavior risk(int)x — use static_cast<int>(x) for type safetystd::shared_ptr when std::unique_ptr suffices — unnecessary overheadconst auto&:// ❌ Copies every Task
for (auto task : tasks) { process(task); }
// ✅ Reference — no copy
for (const auto& task : tasks) { process(task); }Google Test or Catch2. Google Mock for interface mocking.
// Google Test + Google Mock
TEST(TaskServiceTest, ReturnsNotFoundForMissingTask) {
auto storage = std::make_unique<MockTaskStorage>();
EXPECT_CALL(*storage, getById("999"))
.WillOnce(Return(std::unexpected(TaskError::NotFound)));
TaskService service(std::move(storage));
auto result = service.getTask("999");
EXPECT_FALSE(result.has_value());
EXPECT_EQ(result.error(), TaskError::NotFound);
}| Tool | Purpose | Command |
|---|---|---|
clang-format | Formatting | clang-format -i src/**/*.cpp |
clang-tidy | Static analysis | clang-tidy src/*.cpp -- |
cppcheck | Bug detection | cppcheck --enable=all src/ |
| AddressSanitizer | Memory errors | -fsanitize=address |
| ThreadSanitizer | Race conditions | -fsanitize=thread |
| UBSanitizer | Undefined behavior | -fsanitize=undefined |
© irahardianto, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/cpp-idioms of irahardianto/awesome-agv.
Open the folder on GitHubat commit 9e997ba
Cpp Idioms next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Cpp Idioms this skillirahardianto/awesome-agv | 157 | — | ~2.1k | Automated safety check: Pass | MIT | |
| Rust Best Practicesfarm-fe/farm | 5.6k | 3 repos | ~1.1k | Automated safety check: Pass | MIT | |
| SeekDB Code Reviewoceanbase/seekdb | 3.1k | — | ~2.1k | Automated safety check: Pass | Apache-2.0 | |
| Better Result Adoptnikivdev/ts | 820 | — | ~1.4k | Automated safety check: Pass | MIT | |
| Embedded Cpp14 MisraBlueAndi/Pixelix | 443 | — | ~2k | Automated safety check: Pass | MIT | |
| Ss Cpp ModernSerial-Studio/Serial-Studio | 7.2k | — | ~1.6k | Automated safety check: Pass | Custom licence |
farm-fe/farm
Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.
oceanbase/seekdb
Reviews seekdb pull requests and diffs for real defects in correctness, resources, concurrency, security and tests, reporting only Blocker or Major findings.
nikivdev/ts
Migrate codebase from try/catch or Promise-based error handling to better-result.
BlueAndi/Pixelix
A skill your agent uses when writing, reviewing, or refactoring C/C++ firmware code in this repository (src/, lib/, test/) — creating or editing .h/.hpp/.cpp files, applying MISRA-oriented and…
Serial-Studio/Serial-Studio
Modern C++20 authoring guidance for Serial Studio (Qt 6.11, C++20): concepts, ranges, move/RAII, std smart pointers, constexpr, lock-free SPSC atomics.
Yikai-Liao/symusic
Writes, optimizes, and debugs C++ applications using modern C++20/23 features, template metaprogramming, and high-performance systems techniques.
irahardianto/awesome-agv
Commits to one bold aesthetic direction, sets up a CSS token system for it, then builds the interface in Vue or plain HTML using those tokens.
irahardianto/awesome-agv
Profile-driven performance optimization protocol. An agent skill from irahardianto/awesome-agv.
irahardianto/awesome-agv
Coding conventions for Angular 19 and later: standalone components, signals, OnPush change detection, lazy routes and where RxJS still belongs.
irahardianto/awesome-agv
Rules for designing CI/CD pipelines in layers: universal lint, test and scan stages, container builds with SBOM attestation, and GitOps for orchestrated deployments.
irahardianto/awesome-agv
Hono lightweight web framework patterns: type-safe route handlers, middleware composition, Zod validation, and RPC clients for Cloudflare Workers, Node, or Bun.
irahardianto/awesome-agv
Mobile E2E testing patterns — Flutter integrationtest, Patrol, Maestro, golden testing, device matrix, and test data management.
Works with
Categories
Modern C++ (17/20/23) idioms: RAII, smart pointers, value semantics, Rule of Zero/Five, concepts, and std::expected error handling. Cpp Idioms is an agent skill from irahardianto/awesome-agv. Modern C++ (17/20/23) idioms: RAII, smart pointers, value semantics, Rule of Zero/Five, concepts, and std::expected error handling.
Cpp Idioms fits situations like: reviewing C++ code; tasks that involve Error handling; tasks that involve Refactoring.
Run `npx skills add irahardianto/awesome-agv --skill cpp-idioms -a claude-code`. Or copy the skill folder (.agents/skills/cpp-idioms in irahardianto/awesome-agv) into .claude/skills/cpp-idioms in your project. Claude Code loads it when a task matches its description.
Run `npx skills add irahardianto/awesome-agv --skill cpp-idioms -a codex`. Or copy the skill folder (.agents/skills/cpp-idioms in irahardianto/awesome-agv) into .agents/skills/cpp-idioms in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add irahardianto/awesome-agv --skill cpp-idioms -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cpp-idioms, .gemini/skills/cpp-idioms, .github/skills/cpp-idioms and .opencode/skills/cpp-idioms in your project.
SKILL.md names no scripts, command-line tools or credentials: Cpp Idioms is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Cpp Idioms is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.1k tokens (SKILL.md is roughly 8.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Cpp Idioms: Rust Best Practices (farm-fe/farm, 5.6k stars), SeekDB Code Review (oceanbase/seekdb, 3.1k stars), Better Result Adopt (nikivdev/ts, 820 stars) and Embedded Cpp14 Misra (BlueAndi/Pixelix, 443 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
irahardianto (a GitHub user) maintains it in irahardianto/awesome-agv, which has 157 GitHub stars. The repository holds 34 skills in this directory. The repository was last updated on October 5, 2026.
Source: irahardianto/awesome-agv on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.