[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6D27M3P3C930S8K2EYZ8T3V":3,"skill-same:01M6D27M3P3C930S8K2EYZ8T3V":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":49,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M6D27M3P3C930S8K2EYZ8T3V","systems",null,"Systems programming: reading a low-level codebase, ownership and lifetimes made explicit, invariants written down, errors that fail loudly, concurrency and memory decisions, portability, unsafe code with its proof, measuring before optimising, and the checks (warnings, sanitizers, fuzzing, Miri) that make it done. The principles and which skill holds each. Read before any low-level, performance-critical or unsafe work.","enowdev\u002Fenowxcli","enowdev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F179420349?v=4","01M6D1MVX2KC0X3Z9NESE7P22K","Enow Dev.","01M6D1MW1FMZGBDKWAJY4GQX81",67,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fsystems\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[5,29,30,31,32,33,34,35,36,37,38],"memory","performance","fuzzing","code","concurrency","programming","work","decisions","read","done","2026-11-10 10:12:30",false,"---\nname: systems\ndescription: \"Systems programming: reading a low-level codebase, ownership and lifetimes made explicit, invariants written down, errors that fail loudly, concurrency and memory decisions, portability, unsafe code with its proof, measuring before optimising, and the checks (warnings, sanitizers, fuzzing, Miri) that make it done. The principles and which skill holds each. Read before any low-level, performance-critical or unsafe work.\"\n---\n\n# Systems programming\n\nThe default version compiles and passes the happy-path test: `unwrap` on\nevery `Result`, an `unsafe` block with no word on why it is sound, one\nmutex around all the state, a fresh `Vec` per iteration of the hot loop,\n`len as u32` truncating in silence, a parser that trusts the length field\nit just read, \"optimised\" code nobody measured, and a hard-coded `\u002Ftmp`\npath. It breaks on the first hostile input, the first contended lock, the\nfirst other platform. This skill is the discipline around the code: what\nto read first, the principles, what makes a change done, and which\n`systems-*` skill holds the detail.\n\n## 1. Read the project before changing it\n\n- **Toolchain**: `rust-toolchain.toml` (pinned channel, components,\n  targets), `edition` and `rust-version` in `Cargo.toml`; for C and C++,\n  `CMakePresets.json`, toolchain files, the standard set by\n  `target_compile_features` or `CMAKE_CXX_STANDARD`, and the compilers CI\n  uses. Work within them: no nightly feature in a stable crate, no C++23\n  library call in a C++17 codebase.\n- **Targets and features**: `[features]`, `cfg(...)` gates,\n  `.cargo\u002Fconfig.toml` (linker, `rustflags`, runners), CMake options. The\n  change builds with every feature set CI builds.\n- **Where the danger lives**, before you edit near it:\n\n  ```sh\n  rg -n 'unsafe (fn|impl|extern|\\{)|extern \"C\"' --type rust\n  rg -n 'reinterpret_cast|memcpy|malloc|free\\(|\\bnew |delete ' --type c --type cpp\n  rg -n 'enum \\w*Error|thiserror|anyhow' --type rust\n  ```\n\n- **Conventions**: the existing error type or return-code scheme, the\n  logging macro, the allocator, the test framework. Reuse them; a second\n  error type or a second channel crate is a review comment waiting.\n- **Baseline**: build and test once before the change and keep the\n  output. \"No new warnings\" and \"no new failures\" are measured against it.\n- **CI**: the workflow files say what passing means (`-D warnings`,\n  `-Werror`, sanitizer and Miri jobs, the target matrix). Run the same\n  commands locally.\n\n## 2. Principles\n\n- **Invalid states unrepresentable.** An enum instead of two booleans that\n  can contradict; `NonZeroU32`, `Port(u16)`, a validated `Utf8Name`\n  instead of a raw integer or string every caller re-checks; private\n  fields and a constructor that validates.\n- **Invariants written where they are relied on.** A comment on the type\n  or field (\"`len \u003C= cap`; `buf[..len]` is initialised\"), a\n  `debug_assert!` or `assert()` at the point that depends on it, and a\n  test for the edge. An invariant only the author knew is the next\n  editor's bug.\n- **Errors fail loudly.** Input and environment errors return with context\n  (which file, which offset, what was expected). A broken invariant is a\n  bug: panic or abort with a message. Never swallow: no\n  `unwrap_or_default()` on corrupt data, no ignored return code, no empty\n  `catch (...)`.\n- **Bounded resources.** Every queue, buffer, cache, recursion and retry\n  has a stated limit: a channel of 1024, frames of at most 16 MiB, depth\n  64, an LRU of 10 000 entries, three retries with backoff. Unbounded is\n  an outage under load.\n- **No undefined behaviour.** UB is not \"works on my machine\": the\n  compiler may assume it never happens, and the next version will act on\n  that. Overflow is checked or explicitly wrapping; narrowing casts are\n  checked.\n- **Portability by abstraction.** Platform code in one module\n  (`sys\u002Funix.rs`, `sys\u002Fwindows.rs`, `platform_posix.c`) behind one\n  interface; no `#[cfg]` or `#ifdef` threaded through logic; paths built\n  with the path API; sizes from `\u003Cstdint.h>` types, not `long`. CI tests\n  every target you claim; a 32-bit target (`i686-unknown-linux-gnu`)\n  catches pointer-size assumptions, a big-endian one under QEMU\n  (`cross test --target s390x-unknown-linux-gnu`) catches byte-order bugs.\n- **Determinism in tests.** Seeded randomness, an injected clock, no\n  `sleep` as synchronisation, output sorted before comparison (hash map\n  order is random in Rust and differs between C++ standard libraries).\n\nWhich failure gets which treatment:\n\n| Situation | Rust | C++ | C |\n|---|---|---|---|\n| Bad input, missing file, network or user error | `Result` with context | `std::expected` or an exception, per project policy | a status code, details through an out-parameter or `errno` |\n| A broken invariant (a bug) | `assert!` or `unreachable!` with a message | `assert`, and `std::abort()` where going on would corrupt data | `assert`, `abort()` |\n| State too damaged to go on | `std::process::abort()` | `std::terminate()` | `abort()` |\n\n- `assert!` stays in release builds: keep it where continuing would\n  corrupt memory or data; `debug_assert!` for checks too costly to ship.\n- Library code never exits the process or prints; it returns the error\n  and the binary decides what to tell the user.\n\n## 3. Ownership and lifetimes, explicit\n\nFor every resource (memory, file, socket, lock, thread, mapping) you can\nsay who owns it, who borrows it, and when it ends.\n\n| Language | Owner | Borrower | Shared |\n|---|---|---|---|\n| Rust | `T`, `Box\u003CT>`, `Vec\u003CT>` | `&T`, `&mut T`, `&[T]`, `&str` | `Arc\u003CT>`, `Rc\u003CT>` |\n| C++ | a value, `std::unique_ptr\u003CT>` | `T&`, `const T&`, `std::span`, `std::string_view` | `std::shared_ptr\u003CT>` |\n| C | a documented `foo_create`\u002F`foo_destroy` pair | a pointer documented as borrowed for the call | a count with `_ref`\u002F`_unref` |\n\n- Release on every path by a destructor (`Drop`, RAII) rather than by\n  hand; in C, one cleanup label per function.\n- Views never outlive the owner: no `string_view` of a temporary, no\n  slice kept across a `Vec` that grows, no pointer to a stack buffer\n  returned.\n- Shared ownership is a decision, not a way to quiet the borrow checker:\n  `Arc\u003CMutex\u003CT>>` everywhere usually means nobody decided who owns the\n  state.\n\n## 4. Integers do not overflow in silence\n\n- Rust panics on overflow in debug builds and wraps in release (unless\n  `overflow-checks = true` in the profile). Say what you mean:\n  `checked_add` for sizes and offsets from input, `saturating_sub` for\n  counters that floor at zero, `wrapping_add` for hashes and sequence\n  numbers.\n- Narrowing with `u32::try_from(len)?`, never `as`; clippy's\n  `cast_possible_truncation` and `cast_sign_loss` (pedantic) find the rest.\n- C and C++: signed overflow is undefined, unsigned wraps. Use\n  `__builtin_add_overflow` and `__builtin_mul_overflow` (GCC, Clang) or C23\n  `ckd_add` and `ckd_mul` from `\u003Cstdckdint.h>`.\n- `count * size` and `offset + len` are the classic heap overflow: checked,\n  then compared against what is actually there.\n\n## 5. Unsafe code carries its proof\n\nUnsafe Rust, raw pointers in C++ and all of C are where the compiler\ntrusts you. Each use gets:\n\n1. **The smallest scope**: one operation per `unsafe` block, inside a\n   function whose safe signature makes misuse impossible.\n2. **A proof**: a `\u002F\u002F SAFETY:` comment naming each requirement of the\n   operation (non-null, aligned, initialised, in bounds, no aliasing\n   `&mut`, alive long enough) and why it holds here. An `unsafe fn`\n   documents its callers' obligations under `# Safety`.\n3. **A debug check**: `debug_assert!` of the precondition.\n4. **A tool run**: Miri for Rust, ASan and UBSan for C and C++, on tests\n   that reach the code.\n\n```rust\n\u002F\u002F\u002F Bytes `start..end` of the buffer, without a bounds check.\n\u002F\u002F\u002F\n\u002F\u002F\u002F # Safety\n\u002F\u002F\u002F `start \u003C= end \u003C= self.len()`.\npub unsafe fn slice_unchecked(&self, start: usize, end: usize) -> &[u8] {\n    debug_assert!(start \u003C= end && end \u003C= self.len());\n    \u002F\u002F SAFETY: the caller guarantees the range is in bounds, and `self.ptr`\n    \u002F\u002F points to `self.len` initialised bytes (invariant of `Buffer`).\n    unsafe { std::slice::from_raw_parts(self.ptr.add(start), end - start) }\n}\n```\n\nEnforce it with `unsafe_op_in_unsafe_fn` (warns by default in edition\n2024) and clippy's `undocumented_unsafe_blocks` and `missing_safety_doc`.\nIf the proof cannot be written, the code is not sound: use the safe\nversion (usually a few percent slower, and fine) or restructure.\n\n## 6. Concurrency and memory are decisions\n\nWrite them down before the code, in the module doc or the change\ndescription:\n\n- Which threads or tasks exist, what each owns, how they talk (a channel,\n  or shared state behind which lock), what happens when a consumer is\n  slower than its producer (block, drop, reject), and how everything stops\n  (`systems-concurrency`).\n- Where the data lives, how long, who frees it, and the expected peak\n  (`systems-memory`). A buffer sized from input is capped.\n\n## 7. Measure before optimising\n\n1. Fix the workload: real input at sizes that matter, a release build\n   with symbols (`debug = \"line-tables-only\"`, or `-O2 -g`).\n2. Baseline: `hyperfine --warmup 3 'old\u002Fapp input' 'new\u002Fapp input'` for a\n   command; criterion or Google Benchmark for a function; peak RSS from\n   `\u002Fusr\u002Fbin\u002Ftime -v` (Linux) or `\u002Fusr\u002Fbin\u002Ftime -l` (macOS).\n3. Profile to find the hot path: `perf record --call-graph dwarf` then\n   `perf report`, `samply record` (Linux and macOS), Instruments,\n   `cargo flamegraph`.\n4. Change one thing where the profile points; measure again with the same\n   command, enough runs to see the noise.\n5. Keep it only if the gain is real on the real workload. Under about 5%\n   off the bottleneck, keep the simpler code. Record the trade-off in the\n   commit or a comment: what got faster, for which input, at what cost.\n\nDetail in `performance-profiling` and `performance-benchmarks`.\n\n## 8. Done means\n\n| Check | Rust | C and C++ |\n|---|---|---|\n| Builds on every supported target, no new warnings | `RUSTFLAGS=\"-D warnings\" cargo build --all-targets --locked` | `-Wall -Wextra -Wpedantic -Werror` (MSVC `\u002FW4 \u002FWX`) |\n| Lint | `cargo clippy --all-targets --all-features -- -D warnings` | `clang-tidy -p build` on touched files |\n| Format | `cargo fmt --all --check` | `clang-format --dry-run --Werror` |\n| Tests, one for the edge case handled | `cargo test` or `cargo nextest run` | `ctest --test-dir build --output-on-failure` |\n| Unsafe or pointer code changed | `cargo +nightly miri test` | ASan and UBSan build of the tests |\n| Threads changed | loom model, TSan, stress loop | TSan build, stress loop |\n| Parser or decoder changed | `cargo +nightly fuzz run \u003Ctarget>` for minutes | libFuzzer or AFL++ run |\n| Performance claim | before and after numbers, same benchmark | same |\n\nThe edge-case test fails without the change and passes with it.\n\n## 9. Which skill holds what\n\n| Job | Skill |\n|---|---|\n| Principles, done, this map | `systems` |\n| Rust idioms, errors, traits, unsafe, tokio, tooling, MSRV, cross builds | `systems-rust` |\n| C and C++: RAII, UB, CMake, warnings, sanitizers, fuzzing, ABI | `systems-c-cpp` |\n| Threads, locks, atomics, async cancellation, backpressure, loom, TSan | `systems-concurrency` |\n| Allocation, arenas, leaks, layout, cache locality, mmap, RSS, GC knobs | `systems-memory` |\n| Calling across languages: C ABI, bindgen, cbindgen, cxx, PyO3, napi-rs, wasm | `systems-ffi` |\n| Binary formats, versioning, untrusted input, checksums, compression | `systems-formats` |\n| Files, fsync, processes, signals, stdio, paths, time, sockets, CLIs | `systems-os` |\n| Finding where the time goes | `performance-profiling` |\n| Benchmarks that can be trusted | `performance-benchmarks` |\n\n## Check it\n\n- Run the section 8 table with `bash` and read the output, not only the\n  exit code: count warnings before and after\n  (`cargo build 2>&1 | grep -c '^warning'`).\n- `git diff | grep -nE 'unwrap\\(\\)|expect\\(|as (u|i)(8|16|32)|unsafe|todo!|dbg!|printf\\('`:\n  every hit left is justified by a comment or an invariant proven nearby.\n- Every limit you added has a test at the limit and one past it.\n- Say plainly what could not be run (no nightly for Miri, no Linux for\n  TSan or perf, no Windows machine) and what that leaves unverified.\n\n## Avoid\n\n`unwrap` on anything input or the environment can cause; `unsafe` without\na `SAFETY` proof; a lock held across I\u002FO or an `.await`; queues, buffers,\ncaches or recursion without a limit; `as` casts that truncate; lengths\nfrom input used before they are checked against what remains; optimising\nwithout a profile, or claiming a speed-up without numbers; platform paths,\nseparators and integer sizes hard-coded; warnings left for later; calling\na change done because it compiled.\n","# Systems programming\n\nThe default version compiles and passes the happy-path test: `unwrap` on\nevery `Result`, an `unsafe` block with no word on why it is sound, one\nmutex around all the state, a fresh `Vec` per iteration of the hot loop,\n`len as u32` truncating in silence, a parser that trusts the length field\nit just read, \"optimised\" code nobody measured, and a hard-coded `\u002Ftmp`\npath. It breaks on the first hostile input, the first contended lock, the\nfirst other platform. This skill is the discipline around the code: what\nto read first, the principles, what makes a change done, and which\n`systems-*` skill holds the detail.\n\n## 1. Read the project before changing it\n\n- **Toolchain**: `rust-toolchain.toml` (pinned channel, components,\n  targets), `edition` and `rust-version` in `Cargo.toml`; for C and C++,\n  `CMakePresets.json`, toolchain files, the standard set by\n  `target_compile_features` or `CMAKE_CXX_STANDARD`, and the compilers CI\n  uses. Work within them: no nightly feature in a stable crate, no C++23\n  library call in a C++17 codebase.\n- **Targets and features**: `[features]`, `cfg(...)` gates,\n  `.cargo\u002Fconfig.toml` (linker, `rustflags`, runners), CMake options. The\n  change builds with every feature set CI builds.\n- **Where the danger lives**, before you edit near it:\n\n  ```sh\n  rg -n 'unsafe (fn|impl|extern|\\{)|extern \"C\"' --type rust\n  rg -n 'reinterpret_cast|memcpy|malloc|free\\(|\\bnew |delete ' --type c --type cpp\n  rg -n 'enum \\w*Error|thiserror|anyhow' --type rust\n  ```\n\n- **Conventions**: the existing error type or return-code scheme, the\n  logging macro, the allocator, the test framework. Reuse them; a second\n  error type or a second channel crate is a review comment waiting.\n- **Baseline**: build and test once before the change and keep the\n  output. \"No new warnings\" and \"no new failures\" are measured against it.\n- **CI**: the workflow files say what passing means (`-D warnings`,\n  `-Werror`, sanitizer and Miri jobs, the target matrix). Run the same\n  commands locally.\n\n## 2. Principles\n\n- **Invalid states unrepresentable.** An enum instead of two booleans that\n  can contradict; `NonZeroU32`, `Port(u16)`, a validated `Utf8Name`\n  instead of a raw integer or string every caller re-checks; private\n  fields and a constructor that validates.\n- **Invariants written where they are relied on.** A comment on the type\n  or field (\"`len \u003C= cap`; `buf[..len]` is initialised\"), a\n  `debug_assert!` or `assert()` at the point that depends on it, and a\n  test for the edge. An invariant only the author knew is the next\n  editor's bug.\n- **Errors fail loudly.** Input and environment errors return with context\n  (which file, which offset, what was expected). A broken invariant is a\n  bug: panic or abort with a message. Never swallow: no\n  `unwrap_or_default()` on corrupt data, no ignored return code, no empty\n  `catch (...)`.\n- **Bounded resources.** Every queue, buffer, cache, recursion and retry\n  has a stated limit: a channel of 1024, frames of at most 16 MiB, depth\n  64, an LRU of 10 000 entries, three retries with backoff. Unbounded is\n  an outage under load.\n- **No undefined behaviour.** UB is not \"works on my machine\": the\n  compiler may assume it never happens, and the next version will act on\n  that. Overflow is checked or explicitly wrapping; narrowing casts are\n  checked.\n- **Portability by abstraction.** Platform code in one module\n  (`sys\u002Funix.rs`, `sys\u002Fwindows.rs`, `platform_posix.c`) behind one\n  interface; no `#[cfg]` or `#ifdef` threaded through logic; paths built\n  with the path API; sizes from `\u003Cstdint.h>` types, not `long`. CI tests\n  every target you claim; a 32-bit target (`i686-unknown-linux-gnu`)\n  catches pointer-size assumptions, a big-endian one under QEMU\n  (`cross test --target s390x-unknown-linux-gnu`) catches byte-order bugs.\n- **Determinism in tests.** Seeded randomness, an injected clock, no\n  `sleep` as synchronisation, output sorted before comparison (hash map\n  order is random in Rust and differs between C++ standard libraries).\n\nWhich failure gets which treatment:\n\n| Situation | Rust | C++ | C |\n|---|---|---|---|\n| Bad input, missing file, network or user error | `Result` with context | `std::expected` or an exception, per project policy | a status code, details through an out-parameter or `errno` |\n| A broken invariant (a bug) | `assert!` or `unreachable!` with a message | `assert`, and `std::abort()` where going on would corrupt data | `assert`, `abort()` |\n| State too damaged to go on | `std::process::abort()` | `std::terminate()` | `abort()` |\n\n- `assert!` stays in release builds: keep it where continuing would\n  corrupt memory or data; `debug_assert!` for checks too costly to ship.\n- Library code never exits the process or prints; it returns the error\n  and the binary decides what to tell the user.\n\n## 3. Ownership and lifetimes, explicit\n\nFor every resource (memory, file, socket, lock, thread, mapping) you can\nsay who owns it, who borrows it, and when it ends.\n\n| Language | Owner | Borrower | Shared |\n|---|---|---|---|\n| Rust | `T`, `Box\u003CT>`, `Vec\u003CT>` | `&T`, `&mut T`, `&[T]`, `&str` | `Arc\u003CT>`, `Rc\u003CT>` |\n| C++ | a value, `std::unique_ptr\u003CT>` | `T&`, `const T&`, `std::span`, `std::string_view` | `std::shared_ptr\u003CT>` |\n| C | a documented `foo_create`\u002F`foo_destroy` pair | a pointer documented as borrowed for the call | a count with `_ref`\u002F`_unref` |\n\n- Release on every path by a destructor (`Drop`, RAII) rather than by\n  hand; in C, one cleanup label per function.\n- Views never outlive the owner: no `string_view` of a temporary, no\n  slice kept across a `Vec` that grows, no pointer to a stack buffer\n  returned.\n- Shared ownership is a decision, not a way to quiet the borrow checker:\n  `Arc\u003CMutex\u003CT>>` everywhere usually means nobody decided who owns the\n  state.\n\n## 4. Integers do not overflow in silence\n\n- Rust panics on overflow in debug builds and wraps in release (unless\n  `overflow-checks = true` in the profile). Say what you mean:\n  `checked_add` for sizes and offsets from input, `saturating_sub` for\n  counters that floor at zero, `wrapping_add` for hashes and sequence\n  numbers.\n- Narrowing with `u32::try_from(len)?`, never `as`; clippy's\n  `cast_possible_truncation` and `cast_sign_loss` (pedantic) find the rest.\n- C and C++: signed overflow is undefined, unsigned wraps. Use\n  `__builtin_add_overflow` and `__builtin_mul_overflow` (GCC, Clang) or C23\n  `ckd_add` and `ckd_mul` from `\u003Cstdckdint.h>`.\n- `count * size` and `offset + len` are the classic heap overflow: checked,\n  then compared against what is actually there.\n\n## 5. Unsafe code carries its proof\n\nUnsafe Rust, raw pointers in C++ and all of C are where the compiler\ntrusts you. Each use gets:\n\n1. **The smallest scope**: one operation per `unsafe` block, inside a\n   function whose safe signature makes misuse impossible.\n2. **A proof**: a `\u002F\u002F SAFETY:` comment naming each requirement of the\n   operation (non-null, aligned, initialised, in bounds, no aliasing\n   `&mut`, alive long enough) and why it holds here. An `unsafe fn`\n   documents its callers' obligations under `# Safety`.\n3. **A debug check**: `debug_assert!` of the precondition.\n4. **A tool run**: Miri for Rust, ASan and UBSan for C and C++, on tests\n   that reach the code.\n\n```rust\n\u002F\u002F\u002F Bytes `start..end` of the buffer, without a bounds check.\n\u002F\u002F\u002F\n\u002F\u002F\u002F # Safety\n\u002F\u002F\u002F `start \u003C= end \u003C= self.len()`.\npub unsafe fn slice_unchecked(&self, start: usize, end: usize) -> &[u8] {\n    debug_assert!(start \u003C= end && end \u003C= self.len());\n    \u002F\u002F SAFETY: the caller guarantees the range is in bounds, and `self.ptr`\n    \u002F\u002F points to `self.len` initialised bytes (invariant of `Buffer`).\n    unsafe { std::slice::from_raw_parts(self.ptr.add(start), end - start) }\n}\n```\n\nEnforce it with `unsafe_op_in_unsafe_fn` (warns by default in edition\n2024) and clippy's `undocumented_unsafe_blocks` and `missing_safety_doc`.\nIf the proof cannot be written, the code is not sound: use the safe\nversion (usually a few percent slower, and fine) or restructure.\n\n## 6. Concurrency and memory are decisions\n\nWrite them down before the code, in the module doc or the change\ndescription:\n\n- Which threads or tasks exist, what each owns, how they talk (a channel,\n  or shared state behind which lock), what happens when a consumer is\n  slower than its producer (block, drop, reject), and how everything stops\n  (`systems-concurrency`).\n- Where the data lives, how long, who frees it, and the expected peak\n  (`systems-memory`). A buffer sized from input is capped.\n\n## 7. Measure before optimising\n\n1. Fix the workload: real input at sizes that matter, a release build\n   with symbols (`debug = \"line-tables-only\"`, or `-O2 -g`).\n2. Baseline: `hyperfine --warmup 3 'old\u002Fapp input' 'new\u002Fapp input'` for a\n   command; criterion or Google Benchmark for a function; peak RSS from\n   `\u002Fusr\u002Fbin\u002Ftime -v` (Linux) or `\u002Fusr\u002Fbin\u002Ftime -l` (macOS).\n3. Profile to find the hot path: `perf record --call-graph dwarf` then\n   `perf report`, `samply record` (Linux and macOS), Instruments,\n   `cargo flamegraph`.\n4. Change one thing where the profile points; measure again with the same\n   command, enough runs to see the noise.\n5. Keep it only if the gain is real on the real workload. Under about 5%\n   off the bottleneck, keep the simpler code. Record the trade-off in the\n   commit or a comment: what got faster, for which input, at what cost.\n\nDetail in `performance-profiling` and `performance-benchmarks`.\n\n## 8. Done means\n\n| Check | Rust | C and C++ |\n|---|---|---|\n| Builds on every supported target, no new warnings | `RUSTFLAGS=\"-D warnings\" cargo build --all-targets --locked` | `-Wall -Wextra -Wpedantic -Werror` (MSVC `\u002FW4 \u002FWX`) |\n| Lint | `cargo clippy --all-targets --all-features -- -D warnings` | `clang-tidy -p build` on touched files |\n| Format | `cargo fmt --all --check` | `clang-format --dry-run --Werror` |\n| Tests, one for the edge case handled | `cargo test` or `cargo nextest run` | `ctest --test-dir build --output-on-failure` |\n| Unsafe or pointer code changed | `cargo +nightly miri test` | ASan and UBSan build of the tests |\n| Threads changed | loom model, TSan, stress loop | TSan build, stress loop |\n| Parser or decoder changed | `cargo +nightly fuzz run \u003Ctarget>` for minutes | libFuzzer or AFL++ run |\n| Performance claim | before and after numbers, same benchmark | same |\n\nThe edge-case test fails without the change and passes with it.\n\n## 9. Which skill holds what\n\n| Job | Skill |\n|---|---|\n| Principles, done, this map | `systems` |\n| Rust idioms, errors, traits, unsafe, tokio, tooling, MSRV, cross builds | `systems-rust` |\n| C and C++: RAII, UB, CMake, warnings, sanitizers, fuzzing, ABI | `systems-c-cpp` |\n| Threads, locks, atomics, async cancellation, backpressure, loom, TSan | `systems-concurrency` |\n| Allocation, arenas, leaks, layout, cache locality, mmap, RSS, GC knobs | `systems-memory` |\n| Calling across languages: C ABI, bindgen, cbindgen, cxx, PyO3, napi-rs, wasm | `systems-ffi` |\n| Binary formats, versioning, untrusted input, checksums, compression | `systems-formats` |\n| Files, fsync, processes, signals, stdio, paths, time, sockets, CLIs | `systems-os` |\n| Finding where the time goes | `performance-profiling` |\n| Benchmarks that can be trusted | `performance-benchmarks` |\n\n## Check it\n\n- Run the section 8 table with `bash` and read the output, not only the\n  exit code: count warnings before and after\n  (`cargo build 2>&1 | grep -c '^warning'`).\n- `git diff | grep -nE 'unwrap\\(\\)|expect\\(|as (u|i)(8|16|32)|unsafe|todo!|dbg!|printf\\('`:\n  every hit left is justified by a comment or an invariant proven nearby.\n- Every limit you added has a test at the limit and one past it.\n- Say plainly what could not be run (no nightly for Miri, no Linux for\n  TSan or perf, no Windows machine) and what that leaves unverified.\n\n## Avoid\n\n`unwrap` on anything input or the environment can cause; `unsafe` without\na `SAFETY` proof; a lock held across I\u002FO or an `.await`; queues, buffers,\ncaches or recursion without a limit; `as` casts that truncate; lengths\nfrom input used before they are checked against what remains; optimising\nwithout a profile, or claiming a speed-up without numbers; platform paths,\nseparators and integer sizes hard-coded; warnings left for later; calling\na change done because it compiled.\n",{"name":5,"description":7},"main","38293fe1b096e6bf3646c7344c38786ed688f464","crates\u002Fenowx-core\u002Fskills\u002Fsystems",21,"https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli","https:\u002F\u002Fenowx.ai","https:\u002F\u002Fgithub.com\u002Fenowdev","Pretending to be a Developer","2026-10-06 02:05:35",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add enowdev\u002Fenowxcli --skill systems",{"tool":59,"command":60},"bunx","bunx skills add enowdev\u002Fenowxcli --skill systems",{"tool":62,"command":63},"pnpm","pnpm dlx skills add enowdev\u002Fenowxcli --skill systems","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fsystems\u002FSKILL.md",true,[],[68,80,103,119,143,165],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":75,"publishedAt":39},"01M6D2HQYSQD9N7MTNDT4A7CBM","demo-skill","Project-scope demo skill for tests.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fworkspace\u002F.agents\u002Fskills\u002Fdemo-skill\u002FSKILL.md",[74],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[76,77,78,79,37],"demo skill","demo","tests","project",{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":92,"publishedAt":39},"01M6D2HM0GCPM0TM2HPG9HHR2R","writing","Writing words people read: the specific thing instead of claims, words to drop, sentences, interface copy (buttons, labels, errors, empty states, confirmations), page copy, notifications and emails, alt text and link text, numbers and dates, words that translate well, documentation and voice. Read before writing a page's copy, an interface's text or a document.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fwriting\u002FSKILL.md",[86,89],{"categoryNo":87,"categoryName":88,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":90,"categoryName":91,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000036","内容创作者",[82,93,94,95,96,97,37,98,99,100,101,102],"text","emails","empty","drop","document","page","voice","notifications","documentation","translate",{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":112,"publishedAt":39},"01M6D2HG07YS49NM196Q0R3AZ8","ui","Designing or restyling an interface: direction, layout, type, colour, icons, components, states, responsive behaviour. Read before building a page, a screen or a set of components.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui\u002FSKILL.md",[109],{"categoryNo":110,"categoryName":111,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000032","设计师",[105,113,114,115,116,98,117,37,118],"icons","components","SET","responsive","layout","before building",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":129,"publishedAt":39},"01M6D2HB59HZHWG1RYZDV4SJ91","ui-themes","Light and dark themes, and colour that holds in both: tokens with a value per theme, and what each kind of content needs to stay visible (icons, SVG drawings and line art, logos, photos, screenshots, charts, code, maps, borders, shadows, focus, form controls), switching without a flash, and checking both. Read before building a second theme or a theme toggle, and before any drawing, logo or chart on a page that has two themes.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-themes\u002FSKILL.md",[125,128],{"categoryNo":126,"categoryName":127,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},[105,130,131,132,133,134,135,136,137,37,118,138,98,32,139,140,113,141,142],"ui themes","switching","photos","tokens","drawing","focus","maps","Art","flash","Charts","content","screenshots","logo",{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":152,"publishedAt":39},"01M6D2H5R5KRAE524C8QX0T7Q0","ui-structure","Structure before styling: the blueprint written before any interface code (the screen's job, the regions its kind of page needs, their order and why, the layout skeleton in numbers, the components and their states), the anatomy and order of a homepage, a dashboard, a list, a detail page, settings, a form, sign-in, pricing, docs, an article and a checkout, and how to turn the blueprint into code (tokens, layout primitives, components, sections, page). Read first, before building or rebuilding any page or screen.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-structure\u002FSKILL.md",[149,150,151],{"categoryNo":87,"categoryName":88,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},{"categoryNo":90,"categoryName":91,"taxonomyType":26,"taxonomyTypeDesc":27},[153,105,154,114,155,156,32,157,158,159,117,133,160,161,162,37,118,98,163,164],"structure","ui structure","pricing","dashboard","Blueprint","article","anatomy","styling","primitives","list","why","how",{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":169,"categories":170,"keywords":178,"publishedAt":39},"01M6D2H0ZZBJG77MBGPZHA6MWD","ui-stack-vue","Building interfaces in Vue 3 and Nuxt: project layout, script setup with typed defineProps, defineEmits and defineModel, attribute fallthrough, slots and scoped slots, template refs, ref, reactive and computed, watch versus watchEffect, composables and VueUse, provide and inject, Pinia, keyed v-for, transitions, Nuxt 4 (app directory, pages, layouts, useFetch and useAsyncData keys, $fetch in handlers, server routes, runtime config, useSeoMeta, NuxtImg, middleware), VeeValidate forms, Reka UI and Nuxt UI, testing, vue-tsc, and the traps. Read when the project uses Vue or Nuxt.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-stack-vue\u002FSKILL.md",[171,174,177],{"categoryNo":172,"categoryName":173,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":175,"categoryName":176,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",{"categoryNo":110,"categoryName":111,"taxonomyType":26,"taxonomyTypeDesc":27},[105,179,180,181,182,183,184,185,117,79,186,187,37,188,189,190,191,192,193,194],"vue","stack","ui stack vue","forms","pages","watch","runtime","transitions","fetch","pinia","nuxt","template","server","config","directory","testing"]