From e6d46bb0c334768deb1856225b29fe9d7bde241c Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sat, 29 Nov 2025 17:51:54 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 12 +++ README.md | 3 + plugin.lock.json | 45 +++++++++ skills/coderabbit-fix-flow/SKILL.md | 143 ++++++++++++++++++++++++++++ 4 files changed, 203 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 plugin.lock.json create mode 100644 skills/coderabbit-fix-flow/SKILL.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..1d953c4 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,12 @@ +{ + "name": "coderabbit-fix-flow", + "description": "Systematic workflow for processing CodeRabbit code review feedback with MCP-powered analysis and fixes", + "version": "1.0.0", + "author": { + "name": "AlchemistStudios", + "email": "tunahorse@users.noreply.github.com" + }, + "skills": [ + "./skills" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..90ffce7 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# coderabbit-fix-flow + +Systematic workflow for processing CodeRabbit code review feedback with MCP-powered analysis and fixes diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..bf7a3a3 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,45 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:alchemiststudiosDOTai/coderabbit-fix-flow-plugin:", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "51549fab9d7a26de02c821479b259c12997079c7", + "treeHash": "5492539881b8f46a11768799df4d9d3b76ad158ff3892da72d75d0d6d6839cfb", + "generatedAt": "2025-11-28T10:13:07.565048Z", + "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": "coderabbit-fix-flow", + "description": "Systematic workflow for processing CodeRabbit code review feedback with MCP-powered analysis and fixes", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "6df771b85231c856e09a826268658a0d56fa6a8094c8cf90b3e09e475c77a290" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "64b4617bfb269a14d1821a4dc10a33bf6a053fa5399042cbbfa89b9e62e4c075" + }, + { + "path": "skills/coderabbit-fix-flow/SKILL.md", + "sha256": "72f0e25e98277481beb743f2c6c73f8a6715b89db1d36fd319d26d316e93bdef" + } + ], + "dirSha256": "5492539881b8f46a11768799df4d9d3b76ad158ff3892da72d75d0d6d6839cfb" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/coderabbit-fix-flow/SKILL.md b/skills/coderabbit-fix-flow/SKILL.md new file mode 100644 index 0000000..f0eae7a --- /dev/null +++ b/skills/coderabbit-fix-flow/SKILL.md @@ -0,0 +1,143 @@ +--- +name: coderabbit-fix-flow +description: This skill should be used when CodeRabbit code review feedback needs to be processed and fixed systematically. Use after running `coderabbit --plain` to automatically save feedback, analyze issues using MCP tools, and implement minimal code fixes with proper planning. +--- + +# CodeRabbit Fix Flow + +## Overview + +This skill automates the workflow of processing CodeRabbit code review feedback by saving the review output to a timestamped document, then using MCP tools (sequential thinking and Exa context) to analyze and implement fixes with minimal code changes. + +## When to Use + +Use this skill immediately after running `coderabbit --plain` or when you have CodeRabbit feedback that needs systematic processing. The skill handles type safety issues, code style violations, and other CodeRabbit-identified problems. + +## Workflow + +### Step 1: Execute CodeRabbit Review + +Run the CodeRabbit review command in plain text mode: +```bash +coderabbit --plain +``` + +### Step 2: Save Feedback Document + +Save the CodeRabbit output to a timestamped QA document: +- Create file: `memory-bank/qa/coderabbit/cr-qa-{timestamp}.md` +- Include the full CodeRabbit output in the document +- Add YAML front matter with metadata: + ```yaml + --- + title: "CodeRabbit QA Review - {timestamp}" + link: "cr-qa-{timestamp}" + type: "qa" + tags: + - code-review + - coderabbit + - type-safety + created_at: "{timestamp}" + updated_at: "{timestamp}" + uuid: "{generate-uuid}" + --- + ``` + +### Step 3: Analyze Issues with Sequential Thinking + +Use the sequential thinking MCP tool to analyze all identified issues: +1. **Categorize issues** by type (type safety, performance, style, security) +2. **Prioritize fixes** (critical runtime issues first, then documentation) +3. **Plan minimal changes** to achieve the fixes +4. **Identify dependencies** between issues + +### Step 4: Get Best Practices Context + +Use the Exa code context MCP tool to research current best practices for each issue type: +- For type issues: "TypeScript type guards runtime validation best practices" +- For Python type issues: "Python type annotations Optional None best practices" +- For performance: "Performance optimization best practices [language]" +- For security: "Security vulnerability fixes [language]" + +### Step 5: Implement Fixes Systematically + +Execute the fixes following the sequential thinking plan: + +1. **Create TodoWrite list** tracking all issues +2. **Mark each issue** as in_progress → completed +3. **Apply minimal code changes** using best practices from Exa context +4. **Verify fixes** address the root cause identified by CodeRabbit + +### Step 6: Validate and Document + +Run validation as appropriate: +- TypeScript: `npm run build` or `tsc --noEmit` +- Python: `mypy` or `ruff check` +- JavaScript: `npm run lint` or biome + +Document the fixes in the QA document with: +- What was fixed +- How it was fixed +- Validation results + +## Issue Type Patterns + +### Type Safety Issues +- Use proper type guards instead of assertions +- Apply Optional/Union types for nullable fields +- Implement runtime validation where needed + +### Code Style Issues +- Follow language-specific style guides +- Use linting tools to verify fixes +- Maintain consistency with existing codebase + +### Performance Issues +- Research current optimization patterns +- Implement minimal impactful changes +- Measure before/after when possible + +### Security Issues +- Understand the vulnerability context +- Apply security best practices +- Ensure fixes don't break functionality + +## Examples + +### Type Safety Fix Pattern +```typescript +// Before (unsafe) +const data = response as ResearchDataShape; + +// After (safe) +const data = isResearchDataShape(response) ? response : {} as ResearchDataShape; +``` + +### Python Type Annotation Fix Pattern +```python +# Before (incorrect) +timestamp: float = None +metadata: dict[str, Any] = None + +# After (correct) +timestamp: float | None = None +metadata: dict[str, Any] | None = None +``` + +## MCP Tool Usage + +### Sequential Thinking Tool +Use for: +- Breaking down complex issues into steps +- Planning fix order and dependencies +- Analyzing multiple issues systematically + +### Exa Code Context Tool +Use for: +- Getting current best practices +- Understanding language-specific patterns +- Finding optimal implementation approaches + +## Resources + +This skill doesn't require bundled resources as it relies on MCP tools for context and the existing codebase for implementation. \ No newline at end of file