openai-codex-rust-patterns
БесплатноБез исполняемых скриптовНе проверенOpenAI Codex Rust coding patterns distilled from the codex-rs workspace. Use this skill whenever writing, reviewing, or refactoring Rust code — especially for…
от pproenca★ 231 звезда на GitHubОб этом скилле
OpenAI Codex Rust Best Practices
Distilled from openai/codex codex-rs/ — a 119-crate, 2,008-file Rust workspace that ships the Codex CLI coding agent. Contains 63 rules across 11 categories, each citing the exact file in codex-rs where the pattern lives, so you can write Rust the way its top contributors (Michael Bolin, jif-oai, Ahmed Ibrahim, Eric Traut, Pavel Krymets) actually ship it. Citations were refreshed against main at commit 8a94430 (2026-05-25).
When to Apply
Reference these guidelines when:
- Writing or reviewing async Rust code that spawns tokio tasks, owns cancellation tokens, or manages long-lived background workers.
- Designing error enums,
Resultflows, retry loops, or layer boundaries in a library or service. - Building a CLI tool that spawns subprocesses, enforces sandboxing, or runs LLM-generated code safely.
- Architecting a Cargo workspace with more than ~5 crates, deciding what to split out, and how to manage shared dependencies.
- Adding tests to a Rust codebase where existing tests are inline
mod tests { ... }blocks and scaling is becoming painful. - Implementing a JSON-RPC or custom wire protocol with serde — especially one that must evolve without breaking clients.
- Reading API keys or other secrets into memory, or hardening a binary that handles credentials against core dumps, debugger attach, and
LD_PRELOAD. - Enforcing a network egress allowlist that must survive DNS rebinding, or loading untrusted plugins/extensions.
- Wiring OpenTelemetry traces, logs, or metrics into a service that has privacy constraints around PII.
- Building a Ratatui-based TUI that streams LLM output, handles paste bursts, or manages raw-mode terminal state.
- Any time you find yourself reaching for
.unwrap(),.lock().unwrap(),anyhow::Result<()>, or#[cfg(feature = "test")]— this skill explains what codex does instead.
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Defensive Coding & Panic Discipline | CRITICAL | defensive- |
| 2 | Error Handling & Result Discipline | CRITICAL | errors- |
| 3 | Async, Concurrency & Cancellation | HIGH | async- |
| 4 | Sandboxing & Process Isolation | HIGH | sandbox- |
| 5 | Secrets & Process Hardening | HIGH | secrets- |
| 6 | Type Design & Invariants | HIGH | types- |
| 7 | Testing Architecture | MEDIUM-HIGH | testing- |
| 8 | Protocol & Serde Design | MEDIUM-HIGH | proto- |
| 9 | Workspace & Crate Organization | MEDIUM | workspace- |
| 10 | Observability & Tracing | MEDIUM | otel- |
| 11 | TUI (Ratatui) Rendering | MEDIUM | tui- |
Quick Reference
1. Defensive Coding & Panic Discipline (CRITICAL)
defensive-deny-unwrap-workspace-wide— Deny unwrap and expect at the workspace level, opt in locally.defensive-debug-assert-with-early-return— Use debug_assert(false) with a safe fallback on unreachable branches.defensive-recover-poisoned-lock— Recover a poisoned lock with into_inner instead of unwrapping it.defensive-banned-interpreter-prefixes— Avoid learning allowlist rules for general-purpose interpreters.defensive-head-tail-output-buffer— Cap subprocess output with a head-and-tail ring buffer.defensive-io-drain-timeout-grandchildren— Time out the I/O drain task separately from the child process.defensive-refuse-to-run-unsandboxed— Refuse to run when the sandbox cannot enforce the requested policy.defensive-canonicalize-approval-cache-key— Canonicalize shell wrappers before hashing approval keys.defensive-fault-isolate-plugin-load— Isolate plugin load failures and sanitize manifest text before the model sees it.
2. Error Handling & Result Discipline (CRITICAL)
errors-exhaustive-retryable-match— Classify retryable errors with an exhaustive match on every variant.errors-transient-permanent-type-split— Encode transient vs permanent outcomes as two enum variants.errors-boundary-error-translator— Translate errors at the layer boundary in a single function.errors-carry-retry-delay-in-variant— Carry the server-requested retry delay inside the error variant.errors-struct-display-payload— Pu
Установить openai-codex-rust-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл openai-codex-rust-patterns?
OpenAI Codex Rust coding patterns distilled from the codex-rs workspace. Use this skill whenever writing, reviewing, or refactoring Rust code — especially for async agents, CLI tools, sandboxing, secret handling, Ratatui TUIs, JSON-RPC protocols, tokio-based services, or any codebase that needs defensive panic discipline. Trigger even when the user does not explicitly mention Codex, because the patterns generalize to any production Rust workspace. Covers async cancellation, error enum design, process sandboxing, DNS-rebinding defense, credential hardening (zeroize/mlock/ctor), Cargo workspace architecture, wiremock-based fakes, insta snapshot testing, OpenTelemetry tracing, and Ratatui rendering.
Как установить скилл openai-codex-rust-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл openai-codex-rust-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic