diff --git a/Home.md b/Home.md index 2253e39..a3dff08 100644 --- a/Home.md +++ b/Home.md @@ -84,3 +84,6 @@ When a pull request is opened or updated, Kodo kicks in automatically: - [🔀 Local Kodo Tool](local-kodo-tool) — how to install and run the reviewer locally - [🔧 Overriding Local Settings](local-overriding-settings) — how to customize the local review prompt +- [đŸ› ī¸ Kodo Skills for AI agents](cc-kodo-tool) — how to install and run code review Skills for AI agents + - [🔧 code-review skill](code-review-skill) — source file for the code-review skill. + - [🔧 apply-review skill](apply-review-skill) — source file for the apply-review skill. diff --git a/_Sidebar.md b/_Sidebar.md index 928e35b..e2dcd3e 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -48,3 +48,6 @@ - [Local Kodo Tool](local-kodo-tool) - [Overriding Local Settings](local-overriding-settings) +- [Kodo Skills](cc-kodo-tool) + - [Code Review Skill](code-review-skill) + - [Apply Review Skill](apply-review-skill) diff --git a/apply-review-skill.md b/apply-review-skill.md new file mode 100644 index 0000000..2c1f4a3 --- /dev/null +++ b/apply-review-skill.md @@ -0,0 +1,69 @@ +--- +name: apply-review +description: Read review-result.md and automatically apply the suggested fixes to the codebase. Use after code-review when asked to apply fixes, implement review suggestions, or auto-fix review findings. +allowed-tools: Read, Write, Edit, MultiEdit, Bash(git diff:*), Bash(git status:*), Bash(git branch:*) +disable-model-invocation: false +--- + +# Apply Review Fixes + +## Your task + +1. Read the file `review-result.md` from the project root using the Read tool. + - If the file does not exist, stop and tell the user to run `/code-review` first. + +2. Read the current git status and branch using git tools to understand the repository state. + +3. Parse all issues from `review-result.md` and apply actionable fixes. + +## Priority order + +Apply issues in this order: + +1. ⛔ `Blocking` — always apply +2. ⛔ `Security` — always apply +3. âš ī¸ `Non Blocking` with a `🤖 Suggested Code` block — apply if unambiguous +4. â„šī¸ `Information` with a `🤖 Suggested Code` block — apply only if safe and clear + +**Skip** issues with labels: `Praise`, `Thought`, `Note` — these are observations, not action items. + +## For each actionable issue + +1. Use the Read tool to open the referenced file at the specified path +2. Understand the problem from the comment description +3. Apply the fix using the Edit tool: + - If `🤖 Suggested Code` is present → use it as the basis for the fix + - If no code is suggested → reason about the correct fix from the description +4. Verify the change makes sense in the surrounding code context +5. If a fix seems risky, breaks existing logic, or is ambiguous → skip it and log it + +## Rules + +- Only modify files referenced in the review +- Match the surrounding code style, indentation, and naming conventions +- Apply fixes one at a time, sequentially +- If a referenced file path does not exist → skip and log under "Manual Action Required" +- Do not run tests or builds — only apply code changes + +## After applying all fixes + +Append the following section to `review-result.md` using the Edit tool (do not overwrite the existing content): + +``` +--- + +## Applied Fixes Log + +**Applied at:** [current date and time] + +### Applied +- `[file:line]` — [brief description of what was fixed] + +### Skipped +- `[file:line]` — [reason: risky / unclear / informational only / no suggested code] + +### Manual Action Required +- `[file:line]` — [description of issue that needs a human decision or cannot be auto-applied] +``` + +Finally, show a brief summary in the chat of what was applied and what needs manual attention. diff --git a/cc-kodo-tool.md b/cc-kodo-tool.md new file mode 100644 index 0000000..952b6dc --- /dev/null +++ b/cc-kodo-tool.md @@ -0,0 +1,57 @@ +# Kodo Skills for AI agents + +This guide explains how to set up the `code-review` and `apply-review` skills so that they are available, for example, in Claude Code as slash commands: `/code-review` and `/apply-review`. +In fact, this can be done not only in Claude Code but also in other providers that support skills. + + +## Overview + +| Skill | Slash Command | What it does | +|---|---|---| +| `code-review` | `/code-review` | Reviews changes in the current branch and writes findings to `review-result.md` | +| `apply-review` | `/apply-review` | Reads `review-result.md` and automatically applies the suggested fixes | + +These two skills form a complete **review → fix** workflow. Run `/code-review` first, then `/apply-review` to patch the issues automatically. + + +## Installation + +Follow the official Claude Code skills documentation to learn how to install skills and where to place the files: +**https://code.claude.com/docs/en/skills** + +Once you understand the structure, place the two provided `SKILL.md` files into their respective skill folders: + +``` +.claude/ +└── skills/ + ├── code-review/ + │ └── SKILL.md ← use the provided code-review SKILL.md + └── apply-review/ + └── SKILL.md ← use the provided apply-review SKILL.md +``` + +Source files for code review skills: + - [code-review](code-review-skill) — source file for the code-review skill. + - [apply-review](apply-review-skill) — source file for the apply-review skill. + +## How to Use + +``` +# 1. Make your changes on a branch, then run the review: +/code-review + +# 2. Read review-result.md, then apply the fixes automatically: +/apply-review +``` + +The workflow always goes **review first, apply second**. `/apply-review` will stop and remind you to run `/code-review` if `review-result.md` does not exist yet. + + +## Extending Review Rules with CONSTITUTION.md + +You can add a `.review/CONSTITUTION.md` file containing custom review rules. The `code-review` skill reads it automatically and applies its rules during every review. Use it to encode project-specific conventions, forbidden patterns, naming rules, or architectural constraints. The `.review/CONSTITUTION.md` file has no effect on the `/apply-review` skill. + +``` +.review/ +└── CONSTITUTION.md ← project-specific review rules (optional) +``` diff --git a/code-review-skill.md b/code-review-skill.md new file mode 100644 index 0000000..ade3a24 --- /dev/null +++ b/code-review-skill.md @@ -0,0 +1,83 @@ +--- +name: code-review +description: Perform a comprehensive code review of the current branch changes and write results to review-result.md. Use when asked to review code, check changes, or audit a branch. +allowed-tools: Read, Write, Bash(git diff:*), Bash(git log:*), Bash(git branch:*), Bash(git status:*) +disable-model-invocation: false +--- + +# Review Context +You must review the current branch with changes in the current repository. +Your main task is to review the changes and leave comments with problems and their solutions if they are found. It is important to review only the changes that were made in this branch; do not check the remaining code. +Write comments with recommendations in the markdown file "review-result.md" with a clear structure and links to the file. If such a file already exists, rewrite all the data in it so that it contains only the results of your current review. + +# Prepared Environment +- Check for the file ".review/CONSTITUTION.md". If it exists, you MUST read its contents and it is CRITICALLY IMPORTANT to use it when performing the review. This file contains important information about the project and some rules for working with the project + +# AI Code Reviewer - Role Definition + +## Primary Role +You are an **AI code reviewer** with direct access to branch with changes. Your mission is to provide comprehensive, context-aware code reviews by analyzing changes within the full repository context. + +## Core Capabilities +- Analyze branch changes using complete repository context and base branch. +- Write comments on the issues found in the "review-result.md" file with links to the files. +- Provide structured feedback following standardized formats + +## Review Philosophy +Your reviews are context-driven: you analyze not only the changes in the Pull Request but also the existing codebase in the target branch. This ensures your feedback considers how changes integrate with the broader system architecture and existing patterns. +**YOU MUST FINISH A REVIEW BY WRITING A SUMMARY COMMENT. THIS IS CRITICALLY IMPORTANT. A REVIEW RESULT MUST ALWAYS CONTAIN A CONTENT.** + +## !IMPORTANT CRITICAL! Checklist for verification +Use this checklist to ensure that all reviews are completed correctly. +1. [ ] - Check for the file ".review/CONSTITUTION.md". If it exists, you MUST read its contents and it is CRITICALLY IMPORTANT to use it when performing the review. +2. [ ] - Create a review plan. +3. [ ] - Perform a code review for current branch +4. [ ] - Write comments on the issues found in the "review-result.md" file with links to the files + +# Detailed description of steps. **IT IS CRITICALLY IMPORTANT TO FOLLOW THEM** + +## **Review algorithm** +**IT'S A CRITICAL IMPORTANT REVIEW STEP THAT MUST ALWAYS BE PERFORMED** +Use these steps to perform a code review: +1. Read the CLAUDE.md file if it exists. +2. Create a review plan and follow it. +3. **IMPORTANT CRITICAL STEP, DO NOT IGNORE IT** -> Review the changes in the current branch. These changes must be verified to meet the following criteria: + - Rules from the file ".review/CONSTITUTION.MD" if it exists. + - Code quality and best practices + - Compliance with code principles: KISS, DRY, YAGNI, SOLID. + - Potential bugs or issues. + - Security vulnerabilities. + - Performance considerations. + - Maintainability and readability. + - Test coverage gaps. Check which important parts of the code must have tests written for them. + - Documenting complex logic. + - Optimal implementation of algorithms in terms of speed and memory usage. + - You need to verify that the commit messages in the current branch are formatted correctly. +4. During the review, write comments on the issues found in the "review-result.md" file with links to the files. + - **CRITICAL IMPORTANCE**. Analyze the changes. If you find a problem, ONLY COMMENT ON THE NEW CODE and use the line number from this file. **IT IS CRITICAL TO USE THE LINE NUMBER FROM THIS FILE.**. + - [Optional] Analyze and, if possible, provide code to fix the detected issue. The code should offer a solution to the issue described. If the suggestion does not make sense, do not add this block. Set the language for the specified code in GitHub Linguist format if the code has been suggested. + - If you are proposing code, use code markup syntax, for example ```code```. + - Use the Conventional Comments Standard when creating comment content. Use the following icons to indicate the severity of the problem: ⛔ - Critical, âš ī¸ - Warning or â„šī¸ - Information. If "Label" is a problem or "Decorator" is blocking, then always use ⛔ - Critical. + - **Important!** When writing comments using the Conventional Comments Standard, minimize the number of comments with the following "Label": note, chore, thought, nitpick, praise, polish. There should be no more than a couple of these comments. If you decide to write them, choose the most important ones and don't write them for simple things. + - Do not use any other icons, only use the ones specified. + - Comments must be concise and to the point, and should follow the format below: + ``` + [⛔|âš ī¸|â„šī¸] [Suggestion|Issue|TODO|Typo|Praise|Nitpick|Thought|Chore|Note|Polish] ([Non Blocking|Blocking|Security|Test]): [PROBLEM DESCRIPTION] + + [**OPTIONAL BLOCK OF CODE** + 🤖 Suggested Code: + [SUGGESTED CODE] + ] + ``` + - Message sample: + ``` + ⛔ Issue (Non Blocking): The loglevel parameter is not set. + + 🤖 Suggested Code: + Console.WriteLine("Hello World!"); + ``` + - Strictly follow the specified comment template. + - For lines of code that have not been changed, do not leave comments or provide feedback. You **must** leave inline comments ONLY for changed lines of code. + +## **IMPORTANT CRITICAL RULE FOR COMMENTS** +ALWAYS CHECK THE FORMAT OF COMMENTS BEFORE WRITING. THEY MUST CONFORM TO THE TEMPLATES.