fix-rust-lints
Classify clippy/compiler failures by lint family and apply canonical idiomatic fixes.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Classify clippy/compiler failures by lint family and apply canonical idiomatic fixes.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
ICN development companion for the InterCooperative Network Rust monorepo. Use when working on ICN code, docs, deployment, or protocol design. Provides crate-aware routing to specialist agents (icn-architect, icn-economist, icn-ops), enforces project conventions, and understands the current sprint state, cluster topology, and demo flow status. Triggers on: any ICN crate names, "cooperative contract", "mutual credit", "governance", "gossip", "K3s", "icn-dev", "ops/mcp", "Sprint", "demo flow", "CCL", "federation", "DID", "ledger", "trust graph", "icnd", "icnctl".
Full sprint-batch or stacked-PR integration pipeline. Owns merge order, rebases, local gates, and main sync.
Full sprint-batch or stacked-PR integration pipeline. Owns merge order, rebases, local gates, and main sync.
Show full ICN development status dashboard — active sessions, sprint tasks, worktree freshness, CI state, and cluster health
ICN session preflight. This skill should be used when the user explicitly invokes "/icn-agent-pack:preflight", or asks to "run preflight", "orient me on ICN", or "check the ICN session environment". Loads canonical docs and the latest handoff, then verifies branch, gh auth, ports, toolchain, and a light cargo check. Read-only; reports, never fixes.
ICN repo navigator / knowledge graph. This skill should be used when the user explicitly invokes "/icn-agent-pack:navigator", or asks to "map the repo", "build/refresh the knowledge graph", "trace this concept to its source", or "show the conceptual map / impact map". Begins the living repository knowledge-graph and conceptual-map workflow, grounded in the icn-ops MCP tools and (future) generated graph artifacts.
SOC 직업 분류 기준
| name | fix-rust-lints |
| description | Classify clippy/compiler failures by lint family and apply canonical idiomatic fixes. |
| argument-hint | [lint output | --scan] |
| user-invocable | true |
| allowed-tools | Bash, Read, Edit, Grep |
| truth_contract | {"canonical_sources":["ops/state/config/repo-map.json"],"live_load_required":["cargo clippy --workspace --all-targets -- -D warnings 2>&1","git diff --name-only $(git merge-base HEAD origin/main)..HEAD"],"examples_only":[],"never_hardcode":["toolchain version (read from rust-toolchain.toml)","branch name or changed file list (always live-query)"]} |
Turn recurring Rust lint failures into known remediation classes. Never debug clippy from scratch.
The transcript discovered two lint patterns mid-run and fixed them ad hoc. Those same patterns will recur. This skill pre-encodes them as named classes with canonical fix shapes so the model stops relearning under pressure.
Collect failures: If $ARGUMENTS is empty, run:
cargo clippy --workspace --all-targets -- -D warnings 2>&1 | grep "^error"
Or read from provided output.
Classify each error by lint name (appears in brackets after error:):
cargo clippy ... 2>&1 | grep -E "^error\[|^\s+-->"
Apply canonical fix from the playbook below.
Scan for recurrences of the same anti-pattern in nearby code:
grep -rn "<pattern>" crates/ apps/ bins/
Verify: Re-run the scoped clippy command to confirm the fix.
field_reassign_with_defaultTrigger: let mut x = T::default(); x.field = value;
Canonical fix: Struct update syntax
// BEFORE
let mut cfg = FooConfig::default();
cfg.some_field = new_value;
// AFTER
let cfg = FooConfig {
some_field: new_value,
..Default::default()
};
Why: Removes the mut binding, signals intent at construction, eliminates post-init mutation.
Scan for recurrences:
grep -rn "let mut .* = .*::default();" crates/ apps/ bins/ --include="*.rs"
--all-targets (test code)Trigger: use of deprecated ... in test modules when compiling with --all-targets -D warnings
Root cause: #[deprecated] is transitive. CI uses --all-targets, which compiles test code.
A deprecated constant marked in a library still fires as an error wherever test code references it,
even if the non-test code is clean.
Canonical fix: Replace deprecated references with the recommended replacement, even in tests.
Do NOT use #[allow(deprecated)] unless the replacement doesn't exist yet.
// BEFORE (in test)
membership_age_secs: MIN_MEMBERSHIP_AGE_SECS + 1,
// AFTER
membership_age_secs: AttestationThresholds::default().min_membership_age_secs + 1,
Scan for recurrences:
# Find uses of deprecated constants in test modules
grep -rn "MIN_MEMBERSHIP_AGE_SECS\|MAX_ATTESTATIONS_PER_PERIOD\|MIN_TRUST_TO_ATTEST" \
crates/ apps/ --include="*.rs" | grep -v "pub const\|#\[deprecated"
Re-export workaround: When a module re-exports deprecated items for backward compat,
add #[allow(deprecated)] on the pub use block only, not on callers:
#[allow(deprecated)]
pub use attestation::{LEGACY_CONST, old_function};
clippy::unwrap_used / clippy::expect_used in testsTrigger: error: used unwrap() on a Result value in test code
Canonical fix: Add workspace-level test allowance or use #![cfg_attr(test, allow(...))]
in the crate root. Do NOT sprinkle #[allow] throughout test functions.
// In lib.rs crate root:
#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used))]
clippy::too_many_argumentsTrigger: Function has 8+ parameters.
Canonical fix: Either group related params into a config struct, or accept the lint suppression if the function is a one-off constructor:
// Group into struct when params are logically related
pub fn build_policy(config: PolicyConfig) -> Policy { ... }
// Or suppress if it's an internal constructor unlikely to be called repeatedly
#[allow(clippy::too_many_arguments)]
pub fn new_internal(a: T, b: U, ...) -> Self { ... }
ICN note: Prefer the config struct approach for any function that appears in lifecycle.rs, since those wire multiple values from config objects.
clippy::missing_errors_doc / clippy::missing_panics_docTrigger: Public function lacks # Errors / # Panics doc section.
Canonical fix: Add the section, or suppress at crate level with #![allow(missing_docs)]
if the crate already has that allowance:
/// Does the thing.
///
/// # Errors
/// Returns `Err` if the configuration is invalid.
pub fn do_thing(&self) -> Result<(), String> { ... }
Trigger: SystemTime subtraction that can underflow, or u64::checked_mul missing.
Canonical fix:
// BEFORE (panics on underflow in debug mode)
let cutoff = now - duration;
// AFTER
let cutoff = now.checked_sub(duration).unwrap_or(SystemTime::UNIX_EPOCH);
// For u64 multiplication that might overflow:
let secs = days.checked_mul(SECONDS_PER_DAY).unwrap_or(u64::MAX);
cargo clippy -p <crate> may still fail CI --workspace --all-targets.
Always scope-check with --all-targets before declaring victory.