handle-unused-code
Handle unused code warnings by investigating purpose via journals, then choose the right fix: suppress, wire-up, or remove.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Handle unused code warnings by investigating purpose via journals, then choose the right fix: suppress, wire-up, or remove.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
| name | handle-unused-code |
| description | Handle unused code warnings by investigating purpose via journals, then choose the right fix: suppress, wire-up, or remove. |
Use this skill when the compiler or clippy reports unused-code warnings
(dead_code, unused_imports, unused_variables, etc.).
docs/journal/) and docs/todo.md for the item's
purpose and planned activation milestone.For each unused item:
docs/journal/ for dated notes mentioning the symbol, its file,
or the feature it belongs to.docs/todo.md for the planned milestone.git log --all -S "<symbol>") for the commit that introduced
it, and read the commit message for intent.The code exists because a feature was planned but the implementation was never finished. The code describes the INTENT.
Signs:
[ ] in docs/todo.mdAction: Suppress the warning with #[allow(...)] and a comment linking the
planned milestone. Do NOT delete — the code serves as documentation and will
be activated when the feature is completed.
The code was used once but later replaced, refactored out, or the caller was removed. It serves no current or planned purpose.
Signs:
Action: Delete. Do not rename with underscore, do not #[allow].
Remove the item and any now-unused imports it pulls in.
A group of related constants, enum variants, or config keys that form a palette or register. Most are used; a few are not yet wired.
Signs:
Action: Treat each unused item individually. If it belongs to Bucket A
(unimplemented capability), suppress with an item-level #[allow] and a
comment. If it belongs to Bucket B (genuinely dead), delete it. Never
use #![allow(dead_code)] at module level — it hides genuinely dead
code alongside reserved items.
/// Reserved for consolidation index output.
/// Will be activated when Phase 2 merge is completed (docs/todo.md).
#[allow(dead_code)]
const INDEX_FILE: &str = "MEMORY.md";
The comment must:
Delete everything: the item, its imports (if now unused), related helper functions, and tests. One commit per logical group.
Treat each unused item in the palette individually using the Bucket A or Bucket B rules. The palette as a whole is NOT a reason to blanket-suppress all items. Each item must stand on its own.
// If the item is reserved for future use:
/// Reserved hook level — will be activated with plugin system (docs/todo.md).
#[allow(dead_code)]
pub const POST_TOOL_USE: HookLevel = HookLevel::new("post_tool_use");
// If the item is genuinely dead (no plans, no references):
// Just delete it.
#[cfg(feature = "tokio")] with no declared tokio feature: declare the
feature in Cargo.toml ([features] tokio = []). Do NOT remove the cfg
gate if it guards planned async work.#[serde(default)] but never read): the field is
for deserialization compatibility. Keep it with #[allow(dead_code)].unused_imports with conditional compilation: use #[cfg(feature = "...")] on the import, or inlay the import inside the feature-gated
function.compiler warning → identify unused item
→ search docs/journal/ for purpose
→ search todo.md for milestone
→ classify as A, B, or C
→ apply the bucket's action
→ cargo check to verify warning is gone
→ if bucket A or C: run cargo fmt, commit with
"chore: suppress unused <item> (reserved for <feature>)"
→ if bucket B: run cargo fmt, commit with
"chore: remove dead code <item>"
# The compiler says:
warning: constant `INDEX_FILE` is never used
rg INDEX_FILE docs/journal/ → found in 2025-03-15-consolidation.mdrg INDEX_FILE docs/todo.md → - [ ] Phase 2 consolidation merge#[allow(dead_code)] with comment // Reserved for consolidation Phase 2 (docs/todo.md)Use when you need to understand the RARA codebase structure — what each file does, where subsystems live, and how they connect. The index maps every source file to its role.
Use when preparing, validating, tagging, or troubleshooting a RARA release. Enforces the release order that prevents tag versions from diverging from the Cargo package version.
Add or update tests for the RARA codebase. Use when implementing non-trivial behavior changes, fixing regressions, tightening TUI rendering, or adding repo-specific test coverage in Rust. Especially relevant for focused unit tests, TUI snapshot tests, agent/runtime regressions, and behavior-driven test updates in this repository.
Use when preparing commit messages, pull request titles, or first-line summaries for the RARA repository. Enforces the repo's short conventional title subset using feat, fix, chore, or test.
Use when creating, updating, or reviewing RARA implementation journals under docs/journal/. Applies to dated rollout notes, implementation checkpoints, validation evidence, and deciding what belongs in a journal versus a feature spec or docs/todo.md.
Use when creating, revising, or reviewing RARA canonical feature specs under docs/features/. Applies to stable runtime, TUI, protocol, memory, provider, skill, plugin, and tool contracts, including scope boundaries and validation matrices.