Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .claude/commands/.kodus-managed-skills.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
"kodus-business-rules-validation",
"kodus-kody-rules",
"kodus-pr-suggestions-resolver",
"kodus-review"
]
93 changes: 93 additions & 0 deletions .claude/commands/kodus-kody-rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
name: kodus-kody-rules
description: Use when the user wants to create, update or view Kody Rules via `kodus rules` command.
---

# Kodus Kody Rules

## Overview

Kody Rules are a set of guidelines that Kody follows when generating code. They help ensure that the generated code is consistent, high-quality, and aligned with the user's preferences and project requirements.

## Goal

Manage Kody Rules through Kodus CLI only. Do not suggest creating rule files manually.

ALWAYS Use `kodus rules` subcommands for all create, update, and view operations. All these rules are ALWAYS managed by the `kodus rules` command from the CLI. Do NOT suggest creating files or storing rules in any other way. When the user wants to create, update or view Kody Rules, utilize the `kodus rules` command with the appropriate subcommands and options as outlined in the instructions files.

## Shared Workflow

1. Confirm the requested action:

- `create`: add a new rule.
- `update`: modify an existing rule.
- `view`: list all rules or fetch a specific rule.

2. Resolve repository scope:

- Use `global` when the user does not provide a repository scope. Always confirm if the user intends to use `global` scope when no repository is specified.
- For repository-specific requests with unknown id, run:

```bash
kodus config remote list --json
```

Then select and pass `--repo-id <id>`.

3. Validate rule fields before running commands:

- `title`: short and specific.
- `rule`: clear and actionable guidance.
- `severity`: `low | medium | high | critical`.
- `scope`: `file | pull request`.
- `path`: optional glob, default effectively `**/*`.

4. Execute the proper command and report results clearly.

## How to Use

Read individual instructions files for detailed explanations and examples:

- [instructions/create-kody-rule.md](instructions/create-kody-rule.md): Guidelines for creating new Kody Rules.
- [instructions/update-kody-rule.md](instructions/update-kody-rule.md): Guidelines for updating existing Kody Rules.
- [instructions/view-kody-rules.md](instructions/view-kody-rules.md): Guidelines for viewing and retrieving Kody Rules.

You MUST always load at least one of these instructions files to handle the specific user request related to Kody Rules. Each file contains detailed steps and examples for the corresponding action (create, update, view). Always ensure that you are following the instructions in these files when managing Kody Rules through the `kodus rules` command.

Should the user request an action that is not covered by these instructions, you should first clarify the user's intent and then determine if it falls under create, update, or view operations. If it does, proceed to load the corresponding instructions file to ensure that you are following the correct workflow for managing Kody Rules through the `kodus rules` command.

Should the user request a new action related to Kody Rules that differs from the initial action, you should load the appropriate instructions file for that new action to ensure that you are following the correct workflow for managing Kody Rules through the `kodus rules` command.

## Structure of a Kody Rule

A Kody Rule typically consists of the following components:

- **Repository ID**: The repository scope where the rule is stored and applied.
- Use `global` for shared rules that apply across all repositories.
- **Title**: A concise title that captures the essence of the rule.
- **Rule**: A detailed explanation of what the rule is and why it is important.
- **Severity**: A level indicating the importance of the rule (one of "low", "medium", "high" or "critical").
- **Low**: The rule is a suggestion and can be ignored without significant consequences.
- **Medium**: The rule should be followed, but violations are not critical. Default severity level.
- **High**: The rule is important and should be followed to avoid potential issues.
- **Critical**: The rule is essential and must be followed to prevent severe issues or failures.
- **Scope**: The level at which the rule applies (one of "pull request" or "file").
- **Pull Request**: The rule applies to the entire pull request and is evaluated based on the overall changes in the PR.
- **File**: The rule applies to individual files and is evaluated on a per-file basis. Default scope level.
- **Path**: An optional glob pattern indicating which files the rule applies to.
- For example, `src/**/*.js` would apply the rule to all JavaScript files in the `src` directory and its subdirectories.
- Default is all files, `**/*`.

## Example of a Kody Rule

**Title**: Use Async/Await for Asynchronous Operations

**Rule**: Ensure that all asynchronous operations in the codebase use async/await syntax for better readability and error handling. Avoid using raw Promises or callback functions for asynchronous code.

**Severity**: High

**Scope**: File

**Path**: `**/*.ts`

**Repository ID**: `global`
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ kodus review --prompt-only # Structured output for AI agents

Reviews are **context-aware** — Kodus reads your `.cursorrules`, `claude.md`, and `.kodus.md` so suggestions follow your team's standards. [More on review modes](#review-modes)

### Kody Rules

Create, update, and inspect the Kody Rules that guide Kodus behavior for your team.

```bash
kodus rules create --title "Use async/await" --rule "Prefer async/await over raw promises" --repo-id global --severity high --scope file --path "**/*.ts"
kodus rules update --uuid <uuid> --repo-id global --severity critical
kodus rules view --repo-id global
```

`kodus rules update` requires `--uuid`.

Defaults:

- `repo-id` defaults to `global`
- `severity` defaults to `medium`
- `scope` defaults to `file`
- `path` is optional (omitted means all files)

### PR Suggestions

Fetch AI-powered suggestions for open pull requests directly from your terminal.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"url": "https://github.com/kodustech/cli/issues"
},
"scripts": {
"build": "yarn clean && tsc",
"build": "yarn clean && tsc && chmod +x dist/index.js",
"dev": "tsc --watch",
"start": "node dist/index.js",
"start:local": "KODUS_API_URL=http://localhost:3001 node dist/index.js",
Expand Down
93 changes: 93 additions & 0 deletions skills/kodus-kody-rules/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
name: kodus-kody-rules
description: Use when the user wants to create, update or view Kody Rules via `kodus rules` command.
---

# Kodus Kody Rules

## Overview

Kody Rules are a set of guidelines that Kody follows when generating code. They help ensure that the generated code is consistent, high-quality, and aligned with the user's preferences and project requirements.

## Goal

Manage Kody Rules through Kodus CLI only. Do not suggest creating rule files manually.

ALWAYS Use `kodus rules` subcommands for all create, update, and view operations. All these rules are ALWAYS managed by the `kodus rules` command from the CLI. Do NOT suggest creating files or storing rules in any other way. When the user wants to create, update or view Kody Rules, utilize the `kodus rules` command with the appropriate subcommands and options as outlined in the instructions files.

## Shared Workflow

1. Confirm the requested action:

- `create`: add a new rule.
- `update`: modify an existing rule.
- `view`: list all rules or fetch a specific rule.

2. Resolve repository scope:

- Use `global` when the user does not provide a repository scope. Always confirm if the user intends to use `global` scope when no repository is specified.
- For repository-specific requests with unknown id, run:

```bash
kodus config remote list --json
```

Then select and pass `--repo-id <id>`.

3. Validate rule fields before running commands:

- `title`: short and specific.
- `rule`: clear and actionable guidance.
- `severity`: `low | medium | high | critical`.
- `scope`: `file | pull request`.
- `path`: optional glob, default effectively `**/*`.

4. Execute the proper command and report results clearly.

## How to Use

Read individual instructions files for detailed explanations and examples:

- [instructions/create-kody-rule.md](instructions/create-kody-rule.md): Guidelines for creating new Kody Rules.
- [instructions/update-kody-rule.md](instructions/update-kody-rule.md): Guidelines for updating existing Kody Rules.
- [instructions/view-kody-rules.md](instructions/view-kody-rules.md): Guidelines for viewing and retrieving Kody Rules.

You MUST always load at least one of these instructions files to handle the specific user request related to Kody Rules. Each file contains detailed steps and examples for the corresponding action (create, update, view). Always ensure that you are following the instructions in these files when managing Kody Rules through the `kodus rules` command.

Should the user request an action that is not covered by these instructions, you should first clarify the user's intent and then determine if it falls under create, update, or view operations. If it does, proceed to load the corresponding instructions file to ensure that you are following the correct workflow for managing Kody Rules through the `kodus rules` command.

Should the user request a new action related to Kody Rules that differs from the initial action, you should load the appropriate instructions file for that new action to ensure that you are following the correct workflow for managing Kody Rules through the `kodus rules` command.

## Structure of a Kody Rule

A Kody Rule typically consists of the following components:

- **Repository ID**: The repository scope where the rule is stored and applied.
- Use `global` for shared rules that apply across all repositories.
- **Title**: A concise title that captures the essence of the rule.
- **Rule**: A detailed explanation of what the rule is and why it is important.
- **Severity**: A level indicating the importance of the rule (one of "low", "medium", "high" or "critical").
- **Low**: The rule is a suggestion and can be ignored without significant consequences.
- **Medium**: The rule should be followed, but violations are not critical. Default severity level.
- **High**: The rule is important and should be followed to avoid potential issues.
- **Critical**: The rule is essential and must be followed to prevent severe issues or failures.
- **Scope**: The level at which the rule applies (one of "pull request" or "file").
- **Pull Request**: The rule applies to the entire pull request and is evaluated based on the overall changes in the PR.
- **File**: The rule applies to individual files and is evaluated on a per-file basis. Default scope level.
- **Path**: An optional glob pattern indicating which files the rule applies to.
- For example, `src/**/*.js` would apply the rule to all JavaScript files in the `src` directory and its subdirectories.
- Default is all files, `**/*`.

## Example of a Kody Rule

**Title**: Use Async/Await for Asynchronous Operations

**Rule**: Ensure that all asynchronous operations in the codebase use async/await syntax for better readability and error handling. Avoid using raw Promises or callback functions for asynchronous code.

**Severity**: High

**Scope**: File

**Path**: `**/*.ts`

**Repository ID**: `global`
46 changes: 46 additions & 0 deletions skills/kodus-kody-rules/instructions/create-kody-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: create-kody-rule
description: Kody Rule Creation Guidelines - Use when the user wants to create a new Kody Rule for Kodus to follow when generating code.
---

# Kody Rule Creation Guidelines

## Overview

When creating a new Kody Rule, it's important to ensure that the rule is clear, actionable, and aligned with the overall goals of code generation. A well-defined Kody Rule helps Kody produce code that meets the user's expectations and project requirements.

## Workflow for Creating a Kody Rule

1. **Collect the user's intent**: Understand the specific coding practice, style, or requirement that the user wants to enforce with the new Kody Rule. Ask clarifying questions if necessary to ensure you have a clear understanding of the user's intent.

2. **Draft the Kody Rule**: Based on the user's intent, draft a Kody Rule that includes a clear description, title, and any relevant metadata such as severity and scope. Use the guidelines outlined in the "Guidelines for Creating a Kody Rule" section to ensure the rule is well-structured and effective.

3. **Review the Kody Rule with the user**: Present the drafted Kody Rule to the user for feedback. Discuss any potential edge cases, exceptions, or clarifications needed to ensure the rule is comprehensive and actionable.

4. **Refine the Kody Rule**: Based on the user's feedback, refine the Kody Rule to address any concerns or suggestions. Ensure that the final version of the rule is clear, specific, and aligned with the user's goals.

5. **Save and Implement the Kody Rule**: Once the Kody Rule is finalized and approved by the user, save it. Send the title, rule, and any optional fields such as severity, scope, and path.

Always include the repository id when creating a rule. Use `global` when the user does not provide one.

Use the following command to save the Kody Rule:

```
kodus rules create --title <title> --rule <rule-content> [--repo-id <repository-id>] [--severity <severity-level>] [--scope <scope-level>] [--path <glob-pattern>]
```

If `--repo-id` is omitted, the default repository id is `global`.

6. **Communicate the new Kody Rule**: Inform the user about the new Kody Rule and how it will be applied in future code generation.

## Guidelines for Creating a Kody Rule

1. **Identify the Purpose**: Clearly define what the Kody Rule is intended to achieve. Is it meant to enforce a coding style, ensure best practices, or address a specific use case?

2. **Be Specific**: The rule should be specific and unambiguous. Avoid vague language and ensure that the rule can be easily understood and applied by Kody.

3. **Consider Edge Cases**: Think about any edge cases or exceptions that might arise when applying the rule. Address these in the rule definition to ensure Kody can handle them appropriately.

4. **Align with Project Goals**: Ensure that the Kody Rule aligns with the overall goals and requirements of the project. The rule should contribute to producing code that is maintainable, efficient, and meets the user's needs.

5. **Review and Refine**: After drafting the Kody Rule, review it for clarity and completeness. Present it to the user for feedback and refine it as necessary to ensure it effectively guides Kody's code generation process.
53 changes: 53 additions & 0 deletions skills/kodus-kody-rules/instructions/update-kody-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: update-kody-rule
description: Kody Rule Update Guidelines - Use when the user wants to update an existing Kody Rule to modify its behavior, scope, or severity for Kodus to follow when generating code.
---

# Kody Rule Update Guidelines

## Overview

When updating an existing Kody Rule, it's important to ensure that the changes are clear, justified, and aligned with the overall goals of code generation. Updating a Kody Rule can help refine its effectiveness and ensure that it continues to meet the user's expectations and project requirements.

## Workflow for Updating a Kody Rule

1. **Identify the Kody Rule to Update**: If the user did not specify which Kody Rule they want to update, ask for one of:
- `--uuid <uuid>`

Updates must use `--uuid`.

2. **Collect the user's intent for the update**: Understand the specific changes the user wants to make to the existing Kody Rule. Ask clarifying questions if necessary to ensure you have a clear understanding of the user's intent.

3. **Review the existing Kody Rule**: Retrieve the current definition of the Kody Rule that is being updated. This will help you understand the existing behavior and identify what changes need to be made.

4. **Draft the updated Kody Rule**: Based on the user's intent and the existing rule, draft an updated version of the Kody Rule that includes the desired changes. Use the guidelines outlined in the "Guidelines for Updating a Kody Rule" section to ensure the updated rule is well-structured and effective.

5. **Review the updated Kody Rule with the user**: Present the drafted updated Kody Rule to the user for feedback. Discuss any potential edge cases, exceptions, or clarifications needed to ensure the updated rule is comprehensive and actionable.

6. **Refine the updated Kody Rule**: Based on the user's feedback, refine the updated Kody Rule to address any concerns or suggestions. Ensure that the final version of the updated rule is clear, specific, and aligned with the user's goals.

7. **Save and Implement the updated Kody Rule**: Once the updated Kody Rule is finalized and approved by the user, save it. Send only the fields that were updated, along with the `uuid` to identify which rule to update.

Always include the repository id when updating a rule. Use `global` when the user does not provide one.

Use the following command to save the updated Kody Rule:

```
kodus rules update --uuid <uuid> [--repo-id <repository-id>] [--title <title>] [--rule <rule-content>] [--severity <severity-level>] [--scope <scope-level>] [--path <glob-pattern>]
```

If `--repo-id` is omitted, the default repository id is `global`.

8. **Communicate the updated Kody Rule**: Inform the user about the updated Kody Rule and how the changes will affect future code generation.

## Guidelines for Updating a Kody Rule

1. **Identify the Changes**: Clearly define what changes are being made to the existing Kody Rule. Are you modifying the rule's behavior, scope, severity, or other attributes?

2. **Justify the Changes**: Ensure that there is a clear justification for the changes being made to the Kody Rule. The updates should contribute to producing code that is more maintainable, efficient, or better aligned with the user's needs.

3. **Consider Edge Cases**: Think about any edge cases or exceptions that might arise from the updated rule. Address these in the updated rule definition to ensure Kody can handle them appropriately.

4. **Align with Project Goals**: Ensure that the updated Kody Rule continues to align with the overall goals and requirements of the project. The updated rule should contribute to producing code that meets the user's expectations and project requirements.

5. **Review and Refine**: After drafting the updated Kody Rule, review it for clarity and completeness. Present it to the user for feedback and refine it as necessary to ensure it effectively guides Kody's code generation process.
Loading
Loading