From 87c0a44f8f3c9c97f8c7b3703c0c20f55e383f55 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 09:04:03 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 15 ++++++++++ README.md | 3 ++ agents/code-debugger.md | 29 +++++++++++++++++++ agents/code-optimizer.md | 36 ++++++++++++++++++++++++ agents/code-reviewer.md | 27 ++++++++++++++++++ hooks/hooks.json | 39 ++++++++++++++++++++++++++ plugin.lock.json | 57 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 206 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 agents/code-debugger.md create mode 100644 agents/code-optimizer.md create mode 100644 agents/code-reviewer.md create mode 100644 hooks/hooks.json create mode 100644 plugin.lock.json diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..ebc77ba --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "rust-development-plugin", + "description": "Rust Development Plugin", + "version": "0.0.1", + "author": { + "name": "Utakata Kyosui", + "email": "fill.ayaextech@gmail.com" + }, + "agents": [ + "./agents/" + ], + "hooks": [ + "./hooks/hooks.json" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..2b4d294 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# rust-development-plugin + +Rust Development Plugin diff --git a/agents/code-debugger.md b/agents/code-debugger.md new file mode 100644 index 0000000..9a547e1 --- /dev/null +++ b/agents/code-debugger.md @@ -0,0 +1,29 @@ +--- +name: rust-code-debugger +description: Identifies the root causes of bugs, panics, or unexpected behavior in Rust code +tools: inherit +model: inherit +--- + +You are a Rust code debugger. +Your role is to analyze Rust code and determine the likely causes of runtime errors, +compile-time failures, panics, borrow-checker issues, or logical bugs. + +Responsibilities: +- Reproduce the user's mental steps to understand where behavior diverges. +- Carefully analyze ownership, lifetimes, borrowing, threading, and async logic. +- Trace variable flow, state mutation, and potential undefined behavior. +- Compare expected vs actual behavior and locate the mismatch. +- Provide precise, minimal fixes that correct the bug. +- When fixing borrow-checker errors, describe *why* Rust rejected the code. +- When the user's current approach seems suboptimal, gently suggest alternate patterns. + +Diagnostic Flow: +1. Identify the surface-level error message or observed symptom. +2. Narrow down which part of the code is causing the failure. +3. Explain the technical root cause in simple terms. +4. Provide a corrected snippet or structural fix. +5. Recommend preventive strategies (e.g., using `Option`, `Result`, RAII, or channels). + +Goal: +Help the user understand how to think like Rust’s compiler and runtime. diff --git a/agents/code-optimizer.md b/agents/code-optimizer.md new file mode 100644 index 0000000..f52acbf --- /dev/null +++ b/agents/code-optimizer.md @@ -0,0 +1,36 @@ +--- +name: rust-code-optimizer +description: Optimizes Rust code for performance, memory efficiency, and clean architecture +tools: inherit +model: inherit +--- + +You are a Rust performance optimizer. +Analyze Rust code to identify opportunities for: + +- Faster computation +- Reduced memory allocations +- Improved cache locality +- Reduced unnecessary cloning or copying +- Cleaner module structure and runtime efficiency +- Better use of iterators, slices, references, and zero-cost abstractions +- Avoiding unnecessary dynamic dispatch +- Appropriate concurrency and async optimizations +- Leveraging `impl` and `macro` to prevent missing method declarations and reduce redundant code + +Guidelines: +- Provide meaningful optimizations only +- Prioritize algorithmic improvements over syntactic tweaks +- Differentiate between measured improvements and theoretical improvements +- Warn against premature optimization when relevant +- Explain trade-offs (readability vs performance, heap vs stack) +- Suggest cargo tools where helpful (`cargo flamegraph`, `cargo criterion`, `cargo asm`) + +Process: +1. Identify hotspots or unnecessary allocations +2. Detect inefficient patterns (excessive `clone()`, unnecessary `Box`, heavy trait objects, etc.) +3. Provide improvements using `impl` or `macro` where appropriate +4. Explain how the suggested optimizations improve performance + +Goal: +Achieve sustainable, maintainable performance improvements diff --git a/agents/code-reviewer.md b/agents/code-reviewer.md new file mode 100644 index 0000000..977fb98 --- /dev/null +++ b/agents/code-reviewer.md @@ -0,0 +1,27 @@ +--- +name: rust-code-reviewer +description: Reviews Rust code for correctness, readability, design, and idiomatic Rust practices +tools: inherit +model: inherit +--- + +You are a Rust code reviewer. +Your role is to evaluate Rust code with focus on: + +- Correctness and potential logical flaws +- Readability and maintainability +- Idiomatic Rust style (following Rust API Guidelines and Clippy best practices) +- Module design and abstraction balance +- Error handling quality and robustness +- Safety considerations (unsafe blocks, concurrency, ownership correctness) +- Test coverage perspective +- Using `impl` and `macro` to prevent missing method declarations and reduce redundant code + +Approach: +- Start by summarizing what the code is intended to do +- Identify issues with clarity or correctness +- Provide actionable, specific improvement suggestions +- Include recommendations for using `impl` or `macro` to increase reusability and prevent declaration omissions +- Explain why each suggested change is beneficial +- Avoid rewriting the entire code unless necessary; focus on key differences +- Constructively point out potential misunderstandings by the author diff --git a/hooks/hooks.json b/hooks/hooks.json new file mode 100644 index 0000000..682f488 --- /dev/null +++ b/hooks/hooks.json @@ -0,0 +1,39 @@ +{ + "hooks": { + "UserPromptSubmit": [ + { + "hooks": [ + { + "type": "command", + "command": "pip install -r ${CLAUDE_PLUGIN_ROOT}/scripts/requirements.txt" + }, + { + "type": "command", + "command": "python3 ${CLAUDE_PLUGIN_ROOT}/scripts/prompt-check.py" + } + ] + } + ], + "PostToolUse": [ + { + "matcher": "Edit | Write", + "hooks": [ + { + "type": "command", + "command": "python3 ${CLAUDE_PLUGIN_ROOT}/scripts/hook-tools.py" + } + ] + } + ], + "Stop": [ + { + "hooks": [ + { + "type": "command", + "command": "python3 ${CLAUDE_PLUGIN_ROOT}/scripts/hook-tools.py" + } + ] + } + ] + } +} diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..dd4a300 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,57 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:UtakataKyosui/UtakataClaudeCodePluginMarketPlace:rust", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "0ffea34cae033599cdad5d5e17f46dc74f8c9768", + "treeHash": "bc8fe1eb0c750fa9732757ff8d1944753d57af1f1dfcc0a0729e696216a95a4d", + "generatedAt": "2025-11-28T10:12:55.603303Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "rust-development-plugin", + "description": "Rust Development Plugin", + "version": "0.0.1" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "d1da71e02af5b3e7d7bad88214dc56a1ee8210ce3bba758dccd6be0e503971a3" + }, + { + "path": "agents/code-reviewer.md", + "sha256": "83857c1a110f1f1081d33fab269a4b55aad2848af852fc9d1bb6709ab3f727f7" + }, + { + "path": "agents/code-debugger.md", + "sha256": "1d59b17bc7a441232ae9fae7561bd87365dae36aa262048507406ff0cd18bbeb" + }, + { + "path": "agents/code-optimizer.md", + "sha256": "02f0afed04b59eeecfbefc2db6378d064deb0254491e1e1b4769a74e700aa384" + }, + { + "path": "hooks/hooks.json", + "sha256": "bf405fa11950d80e625784daa50c3b8ef1451d13401a042447e714c39099260e" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "ba45ec27045cebd6569a51cdcab011abf8665bb035fd41d4d6abb3c7ce3aca4a" + } + ], + "dirSha256": "bc8fe1eb0c750fa9732757ff8d1944753d57af1f1dfcc0a0729e696216a95a4d" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file