From a005c77334319d42bb3285fb8d141e11f0873cc9 Mon Sep 17 00:00:00 2001 From: Michael Zhao <44533763+Pistonight@users.noreply.github.com> Date: Sun, 4 Oct 2026 12:19:20 -0700 Subject: [PATCH] docs: improve agent instructions (#213) --- AGENTS.md | 15 ++++++++++++++- CLAUDE.md | 1 - 2 files changed, 14 insertions(+), 2 deletions(-) delete mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md index fe14dfbc..8e9143a8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,7 +28,20 @@ in your commit messages and PR description. - Do not use `goto` for matching unless it is **absolutely** necessary and plausible that the original source code contained `goto`. - The naming convention are different across the game and libraries. For the most - part just be consistent with the code around your changes. + part, just be consistent with the code around your changes. +- If the code matches, but it doesn't look like something that would normally be written + by a developer, it is likely there are still compiler optimizations that should be undone. + Common optimizations include: + - Inlining helper functions + - Look-up table or unsensible if-else chain. Use switch statement instead. + - Duplicated code. The compiler can duplicate code in multiple places in the function to optimize + control flow. + - Complex or unsensible control flow. The compiler can deduplicate code to optimize control flow, + especially duplicated if-conditions. In this case, the re-implementation should re-duplicate + the code. + - Loop unrolling. +- Use functional style cast only for converting an `enum class` to the underlying integer type, narrowing + a number type, or converting between signed and unsigned. Do not use C-style casts. # PR Rules diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 43c994c2..00000000 --- a/CLAUDE.md +++ /dev/null @@ -1 +0,0 @@ -@AGENTS.md