Loading...
Loading...
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, 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, Cargo workspace architecture, wiremock-based fakes, insta snapshot testing, OpenTelemetry tracing, and Ratatui rendering.
npx skill4agent add pproenca/dot-skills openai-codex-rust-patternsopenai/codexcodex-rs/Resultmod tests { ... }.unwrap()anyhow::Result<()>#[cfg(feature = "test")]| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Defensive Coding & Panic Discipline | CRITICAL | |
| 2 | Error Handling & Result Discipline | CRITICAL | |
| 3 | Async, Concurrency & Cancellation | HIGH | |
| 4 | Sandboxing & Process Isolation | HIGH | |
| 5 | Type Design & Invariants | HIGH | |
| 6 | Testing Architecture | MEDIUM-HIGH | |
| 7 | Protocol & Serde Design | MEDIUM-HIGH | |
| 8 | Workspace & Crate Organization | MEDIUM | |
| 9 | Observability & Tracing | MEDIUM | |
| 10 | TUI (Ratatui) Rendering | MEDIUM | |
defensive-deny-unwrap-workspace-widedefensive-debug-assert-with-early-returndefensive-banned-interpreter-prefixesdefensive-head-tail-output-bufferdefensive-io-drain-timeout-grandchildrendefensive-canonicalize-approval-cache-keydefensive-refuse-to-run-unsandboxederrors-exhaustive-retryable-matcherrors-transient-permanent-type-spliterrors-carry-retry-delay-in-varianterrors-boundary-error-translatorerrors-struct-display-payloaderrors-tool-call-respond-vs-fatalerrors-io-error-with-context-structasync-abort-on-drop-handleasync-graceful-then-forceful-cancelasync-biased-select-for-cancellationasync-bounded-vs-unbounded-channel-splitasync-child-cancellation-tokensasync-shared-boxfuture-joinhandlesandbox-shared-policy-data-modelsandbox-staged-restrictions-re-execsandbox-argv0-multiplex-binarysandbox-dev-null-first-missing-mountsandbox-three-layer-network-isolationsandbox-env-clear-pre-exectypes-thread-local-raii-serdetypes-dyn-safe-adapter-traittypes-try-from-newtype-validationtypes-full-reference-hierarchytypes-non-exhaustive-public-enumstypes-unknown-variant-forward-compattesting-path-attribute-sibling-teststesting-wiremock-sse-fakestesting-atomic-bool-test-opt-intesting-config-closure-buildertesting-insta-snapshot-tui-renderingtesting-paused-runtime-advanceproto-internally-tagged-rpc-dispatchproto-double-option-tri-stateproto-rename-alias-wire-migrationproto-experimental-runtime-gateproto-sse-idle-timeout-terminatorproto-internal-vs-wire-error-splitworkspace-ban-per-crate-featuresworkspace-single-source-dependenciesworkspace-layered-transport-api-coreworkspace-test-support-as-member-cratesworkspace-utils-microcrate-fanoutworkspace-lint-config-packageotel-log-only-vs-trace-safe-targetsotel-field-empty-then-recordotel-layered-subscribers-env-filterotel-w3c-traceparent-propagationotel-instrument-at-trace-leveltui-two-gear-hysteresis-chunkingtui-schedule-frame-coalescertui-drop-guard-panic-hook-chaintui-paste-burst-state-machinetui-event-broker-pause-resumecodex-rs/| File | Description |
|---|---|
| AGENTS.md | Auto-built TOC document compiling every rule |
| README.md | Skill repository docs — contribution, structure, commands |
| references/_sections.md | Category definitions and ordering |
| gotchas.md | Failure points discovered while applying these rules |
| metadata.json | Version, discipline, references to codex-rs |