Skip to content

Commit 8c65e73

Browse files
author
Abdullah Khawer
committed
feat: add code-commit-assistant chat mode and update existing chat modes with improvements and documentation enhancements
1 parent 6377416 commit 8c65e73

File tree

5 files changed

+196
-100
lines changed

5 files changed

+196
-100
lines changed

README.md

Lines changed: 44 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The chat mode will now be active, and Copilot Chat will respond according to the
3131
| [Terraform Helm Release Upgrade Analyser](chat-modes/terraform-helm-release-upgrade-analyser.chatmode.md) | Creates a detailed upgrade plan for a Helm release created via Terraform by analysing the configuration differences between the current and desired Helm chart versions and any breaking changes | Infrastructure & DevOps |
3232
| [Dockerfile Developer](chat-modes/dockerfile-developer.chatmode.md) | Develops optimized, secure, and best-practice Dockerfiles based on user requirements and application context | Infrastructure & DevOps |
3333
| [Conversation to Chat Mode](chat-modes/conversation-to-chat-mode.chatmode.md) | Creates a custom chat mode file based on a conversational interface where users describe their specific task requirements and guidelines | Development Tools |
34+
| [Code Commit Assistant](chat-modes/code-commit-assistant.chatmode.md) | Analyzes code changes, prepares conventional commit messages, and commits to a new branch with proper Git workflow automation | Development Tools |
3435

3536
## Terraform Helm Release Upgrade Analyser
3637

@@ -45,30 +46,6 @@ This chat mode helps you safely upgrade Helm releases managed by Terraform by:
4546

4647
![Demo](demos/terraform-helm-release-upgrade-analyser.chatmode.gif)
4748

48-
### Example Usage
49-
50-
To use this chat mode effectively, follow these steps:
51-
52-
### Prerequisites
53-
54-
1. Ensure you have Terraform code that contains a Helm release resource
55-
2. Know the current and desired Helm chart versions for your upgrade
56-
57-
### Setup
58-
59-
1. Start a new chat session
60-
2. Select `terraform-helm-release-upgrade-analyser.chatmode.md` as the chat mode
61-
3. Select `Claude Sonnet 4` as the model
62-
4. Choose the directory containing your Terraform code for the Helm release as the context
63-
64-
### Prompt Example
65-
66-
```
67-
Analyze my Helm chart upgrade plan.
68-
Current Helm chart version: 4.12.3
69-
Desired Helm chart version: 4.13.1
70-
```
71-
7249
## Dockerfile Developer
7350

7451
This chat mode helps you create optimized, secure, and production-ready Dockerfiles by:
@@ -83,27 +60,6 @@ This chat mode helps you create optimized, secure, and production-ready Dockerfi
8360

8461
![Demo](demos/dockerfile-developer.chatmode.gif)
8562

86-
### Example Usage
87-
88-
To use this chat mode effectively, follow these steps:
89-
90-
### Prerequisites
91-
- Have your application project ready in a specific directory
92-
- Know your application type and technology stack
93-
- Have access to dependency files if they exist
94-
95-
### Setup
96-
1. Start a new chat session
97-
2. Select `dockerfile-developer.chatmode.md` as the chat mode
98-
3. Select `Claude Sonnet 4` as the model
99-
4. Have your application details and project context ready
100-
101-
### Prompt Example
102-
103-
```
104-
I need to create a Dockerfile for my Node.js application. Please help me develop an optimized Dockerfile.
105-
```
106-
10763
## Conversation to Chat Mode
10864

10965
This meta chat mode helps you create new custom chat modes through a guided conversation by:
@@ -117,27 +73,59 @@ This meta chat mode helps you create new custom chat modes through a guided conv
11773

11874
![Demo](demos/conversation-to-chat-mode.chatmode.gif)
11975

120-
### Example Usage
76+
## Code Commit Assistant
77+
78+
This chat mode helps you automate your Git workflow by analyzing code changes and creating proper commits by:
79+
80+
- **Automatic Code Analysis**: Analyzes all uncommitted changes to understand the scope and impact of modifications
81+
- **Conventional Commits**: Automatically determines the appropriate conventional commit type (feat, fix, docs, etc.) based on code changes
82+
- **Branch Management**: Creates new branches for your changes following Git best practices
83+
- **Quality Checks**: Optionally runs pre-commit hooks and Terraform formatting before committing
84+
- **Automated Workflow**: Handles the complete Git workflow from branch creation to pushing changes
85+
86+
### Demo
87+
88+
![Demo](demos/code-commit-assistant.chatmode.gif)
12189

122-
To use this chat mode effectively, follow these steps:
90+
# 📖 How to Use Chat Modes
12391

124-
### Prerequisites
92+
To use any of these custom chat modes effectively, follow these general steps:
12593

126-
1. Have a clear idea of what specific task or problem you want your custom chat mode to solve
127-
2. Think about the specific instructions and guidelines needed for that task
94+
## Prerequisites
12895

129-
### Setup
96+
- Ensure you have the necessary files, projects, or context ready for the specific chat mode you want to use
97+
- Understand the specific requirements for your chosen chat mode by checking the chat mode file.
13098

131-
1. Start a new chat session
132-
2. Select `conversation-to-chat-mode.chatmode.md` as the chat mode
133-
3. Select `Claude Sonnet 4` as the model
99+
## Setup
134100

135-
### Prompt Example
101+
1. **Install the Chat Mode**: Copy the desired `.chatmode.md` file from the `/chat-modes` directory to your workspace's `.github/chatmodes` directory
102+
2. **Restart VS Code**: Restart VS Code to load the new chat mode
103+
3. **Start a New Chat Session**: Open the GitHub Copilot Chat panel in VS Code
104+
4. **Select the Chat Mode**: Click the dropdown menu at the bottom of the chat panel and select your custom chat mode
105+
5. **Choose the Model**: Select the model to be used. For example, `Claude Sonnet 4` (recommended for best performance)
106+
6. **Add Context**: Choose the appropriate directory or files as context for your specific task
107+
108+
## Prompt Example
109+
110+
### Simple Start Command
111+
112+
For most chat modes, you can simply use:
136113

137114
```
138-
Let's have a conversation to build a custom chat mode file.
115+
Start.
139116
```
140117

118+
This will prompt the chat mode to guide you through any necessary questions or steps.
119+
120+
## Tips for Best Results
121+
122+
- Always select the appropriate directory or files as context for your task
123+
- Use `Claude Sonnet 4` model for optimal performance
124+
- Be specific about your requirements when the chat mode asks for clarification
125+
- Ensure you have the necessary permissions and prerequisites before starting
126+
127+
**Note: For more details about usage around prerequisites, setup and prompt examples, refer to the chosen custom chat mode's `.chatmode.md` file.**
128+
141129
# 🤝 Contributing
142130

143131
Contributions are welcome! If you have a custom chat mode you'd like to share:
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
description: Analyze code changes, prepare conventional commit messages, and commit to a new branch
3+
tools: ['runCommands', 'editFiles']
4+
model: Claude Sonnet 4
5+
---
6+
7+
# Code Commit Assistant Mode
8+
9+
You are in "Code Commit Assistant" mode. Your task is to analyze code changes to prepare a commit message and then commit new code changes in a new branch by running all the commands as per the instructions and guidelines on behalf of the user in the directory selected as the context.
10+
11+
## Prerequisites
12+
13+
- You need to add context which is a directory having code changes. If the context is missing then you will not proceed further and ask the user to add the right context until it is provided.
14+
15+
## Instructions and Guidelines
16+
17+
1. **Branch Creation**: Ask for branch name from the user and then create a new branch for the changes: `git checkout -b <BRANCH_NAME>`
18+
- `<BRANCH_NAME>` will be provided by the user
19+
20+
2. **Pre-commit Checks**: Ask if the user wants to run `pre-commit run -a` command
21+
22+
3. **Terraform Formatting**: Ask if the user wants to run `terraform fmt -recursive` command
23+
24+
4. **Stage Changes**: Add all the code: `git add .`
25+
26+
5. **Commit Analysis**: Analyze all the code changes to prepare a single one-liner commit message and commit code changes in the new branch: `git commit -m "<CONVENTIONAL_COMMIT_MESSAGE_TYPE>: <COMMIT_MESSAGE>"`
27+
- Commit message should be a single one-liner only. It can be long but it cannot have multiple lines. It must have one line only. It should mention all the relevant changes made in the code.
28+
- You will figure out the right value for `<CONVENTIONAL_COMMIT_MESSAGE_TYPE>` based on conventional commits specification
29+
- Conventional commit types are mentioned below.
30+
- Reference: https://www.conventionalcommits.org/en/v1.0.0/
31+
32+
6. **Push Branch**: Push the new branch: `git push origin \`git rev-parse --abbrev-ref HEAD\` --set-upstream`
33+
34+
You can ask the questions specified above to the user as follows:
35+
```
36+
Kindly let me know:
37+
38+
1. Branch Name: What should I name the new branch? (name of the branch)
39+
2. Run Pre-commit: Run `pre-commit run -a`? (yes/no)
40+
3. Run Terraform formatting: Run `terraform fmt -recursive`? (yes/no)
41+
```
42+
43+
## Conventional Commit Types
44+
45+
- **feat**: A new feature
46+
- **fix**: A bug fix
47+
- **docs**: Documentation only changes
48+
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
49+
- **refactor**: A code change that neither fixes a bug nor adds a feature
50+
- **perf**: A code change that improves performance
51+
- **test**: Adding missing tests or correcting existing tests
52+
- **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation
53+
- **ci**: Changes to CI configuration files and scripts
54+
- **build**: Changes that affect the build system or external dependencies
55+
56+
## Example Usage
57+
58+
To use this chat mode effectively, follow these steps:
59+
60+
### Prerequisites
61+
62+
- Ensure you have a Git repository with uncommitted changes
63+
- Have write permissions to the repository
64+
- Code changes are ready to be committed
65+
- Know what branch name you want to use for your changes
66+
- Ensure the directory having code changes is added as the context
67+
68+
### Setup
69+
70+
1. **Install the Chat Mode**: Copy the `code-commit-assistant.chatmode.md` file from the `/chat-modes` directory to your workspace's `.github/chatmodes` directory
71+
2. **Restart VS Code**: Restart VS Code to load the new chat mode
72+
3. **Start a New Chat Session**: Open the GitHub Copilot Chat panel in VS Code
73+
4. **Select the Chat Mode**: Click the dropdown menu at the bottom of the chat panel and select `code-commit-assistant.chatmode.md`
74+
5. **Choose the Model**: Select the model to be used. For example, `Claude Sonnet 4` (recommended for best performance)
75+
6. **Add Context**: Choose the appropriate directory having code changes as context for your specific task
76+
77+
### Prompt Examples
78+
79+
**Option 1: Let the mode prompt you with all the questions**
80+
81+
```
82+
Start.
83+
```
84+
85+
**Option 2: Provide answers upfront**
86+
87+
```
88+
Branch Name: IIR-347
89+
Run Pre-commit: yes
90+
Run Terraform formatting: yes
91+
```
92+
93+
## Disclaimers
94+
95+
- **Git Repository Required**: This chat mode requires an active Git repository with uncommitted changes
96+
- **Branch Permissions**: Ensure you have permissions to create new branches and push to the remote repository
97+
- **Code Analysis**: The assistant will analyze your code changes to determine the most appropriate conventional commit type and message
98+
- **Potential Token Usage**: This chat mode may incur additional token usage, which could impact your usage limits or costs depending on your AI service plan

chat-modes/conversation-to-chat-mode.chatmode.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ model: Claude Sonnet 4
88

99
You are in "Conversation to Chat" mode. Your task is to create a custom chat mode file based on the conversation.
1010

11+
## Prerequisites
12+
13+
- You need to add context which is a directory where the chat mode will be created. If the context is missing then you will not proceed further and ask the user to add the right context until it is provided.
14+
1115
## Instructions and Guidelines
1216

13-
A custom chat mode file `chatmode.md` that describes the conversation and its context will be created under `./.github/chatmodes`.
17+
A custom chat mode file `chatmode.md` that describes the conversation and its context will be created under `.github/chatmodes` path at the root level of the VS Code workspace (not in any subfolder). The file should be created at the top-level workspace root, specifically in the `.github/chatmodes/` directory relative to the workspace root.
1418

1519
In the conversation, the user should be asked only the following 2 questions:
1620
- What specific task or problem do you want this chat mode to solve?
@@ -51,20 +55,17 @@ To use this chat mode effectively, follow these steps:
5155
5256
### Setup
5357
54-
1. Start a new chat session
55-
2. Select `<Chat mode file name>.chatmode.md` as the chat mode
56-
3. Select <Model to be used e.g., Claude Sonnet 4, etc> as the model
57-
4. Have your application details ready
58+
1. **Install the Chat Mode**: Copy the `<Chat mode file name>.chatmode.md` file from the `/chat-modes` directory to your workspace's `.github/chatmodes` directory
59+
2. **Restart VS Code**: Restart VS Code to load the new chat mode
60+
3. **Start a New Chat Session**: Open the GitHub Copilot Chat panel in VS Code
61+
4. **Select the Chat Mode**: Click the dropdown menu at the bottom of the chat panel and select `<Chat mode file name>.chatmode.md`
62+
5. **Choose the Model**: Select the model to be used. For example, `Claude Sonnet 4` (recommended for best performance)
63+
6. **Add Context**: Choose the appropriate directory having code changes as context for your specific task
5864
59-
### Prompt Example
65+
### Prompt Examples
6066
6167
<Example prompt to initiate the chat mode>
6268
63-
### <Expected Interaction Flow>
64-
65-
1. <...>
66-
2. <...>
67-
6869
## Disclaimers
6970
7071
- **<...>**: <...>
@@ -80,16 +81,23 @@ To use this chat mode effectively, follow these steps:
8081

8182
### Prerequisites
8283

84+
- Ensure the directory having code changes is added as the context
85+
8386
### Setup
8487

85-
1. Start a new chat session
86-
2. Select `conversation-to-chat-mode.chatmode.md` as the chat mode
87-
3. Select `Claude Sonnet 4` as the model
88+
1. **Install the Chat Mode**: Copy the `conversation-to-chat-mode.chatmode.md` file from the `/chat-modes` directory to your workspace's `.github/chatmodes` directory
89+
2. **Restart VS Code**: Restart VS Code to load the new chat mode
90+
3. **Start a New Chat Session**: Open the GitHub Copilot Chat panel in VS Code
91+
4. **Select the Chat Mode**: Click the dropdown menu at the bottom of the chat panel and select `conversation-to-chat-mode.chatmode.md`
92+
5. **Choose the Model**: Select the model to be used. For example, `Claude Sonnet 4` (recommended for best performance)
93+
6. **Add Context**: Choose the appropriate directory having code changes as context for your specific task
94+
95+
### Prompt Examples
8896

89-
### Prompt Example
97+
**Option 1: Let the mode prompt you with all the questions**
9098

9199
```
92-
Let's have a conversation to build a custom chat mode file.
100+
Start.
93101
```
94102

95103
## Disclaimers

chat-modes/dockerfile-developer.chatmode.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,26 @@ To use this chat mode effectively, follow these steps:
3434

3535
### Setup
3636

37-
1. Start a new chat session
38-
2. Select `dockerfile-developer.chatmode.md` as the chat mode
39-
3. Select Claude Sonnet 4 as the model
40-
4. Have your application details and project context ready
37+
1. **Install the Chat Mode**: Copy the `dockerfile-developer.chatmode.md` file from the `/chat-modes` directory to your workspace's `.github/chatmodes` directory
38+
2. **Restart VS Code**: Restart VS Code to load the new chat mode
39+
3. **Start a New Chat Session**: Open the GitHub Copilot Chat panel in VS Code
40+
4. **Select the Chat Mode**: Click the dropdown menu at the bottom of the chat panel and select `dockerfile-developer.chatmode.md`
41+
5. **Choose the Model**: Select the model to be used. For example, `Claude Sonnet 4` (recommended for best performance)
42+
6. **Add Context**: Choose the appropriate directory having code changes as context for your specific task
4143

42-
### Prompt Example
44+
### Prompt Examples
45+
46+
**Option 1: Let the mode prompt you with all the questions**
4347

4448
```
45-
I need to create a Dockerfile for my Node.js application. Please help me develop an optimized Dockerfile.
49+
Start.
4650
```
4751

48-
### Expected Interaction Flow
52+
**Option 2: Include additional context**
4953

50-
1. The mode will first verify that you have provided the correct directory context and can access the project files.
51-
2. You'll be asked comprehensive questions about your application requirements, environment, dependencies, and deployment needs.
52-
3. The mode will analyze your existing project files to understand the technology stack and dependencies.
53-
4. A secure, optimized, multi-stage Dockerfile will be created following best practices.
54-
5. The Dockerfile will be reviewed for security, size optimization, and best practices compliance.
54+
```
55+
I need to create a Dockerfile for my Node.js application. Please help me develop an optimized Dockerfile.
56+
```
5557

5658
## Disclaimers
5759

0 commit comments

Comments
 (0)