Skip to content

Commit 9a3821a

Browse files
committed
feat(skills): Add git-commit skill; move skill docs
Relocates existing skill documentation to the .github/skills directory.
1 parent b01402c commit 9a3821a

3 files changed

Lines changed: 166 additions & 26 deletions

File tree

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@ dotnet add ./src/ProjectName/ProjectName.csproj package PackageName
5353
### Directory.Packages.props Structure
5454

5555
```xml
56+
5657
<Project>
57-
<PropertyGroup>
58-
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
59-
</PropertyGroup>
60-
<ItemGroup>
61-
<PackageVersion Include="PackageName" Version="1.0.0" />
62-
</ItemGroup>
58+
<PropertyGroup>
59+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
60+
</PropertyGroup>
61+
<ItemGroup>
62+
<PackageVersion Include="PackageName" Version="1.0.0" />
63+
</ItemGroup>
6364
</Project>
6465
```
6566

@@ -73,7 +74,7 @@ dotnet add ./src/ProjectName/ProjectName.csproj package PackageName
7374
### Key Projects
7475

7576
| Project | Purpose |
76-
| -------------------------- | ------------------------------------- |
77+
|----------------------------|---------------------------------------|
7778
| `GitVersion.Core` | Core version calculation logic |
7879
| `GitVersion.App` | CLI application |
7980
| `GitVersion.Configuration` | Configuration file handling |
@@ -248,7 +249,9 @@ dotnet build ./src/GitVersion.slnx -warnaserror
248249

249250
## Public API Management
250251

251-
This repository uses [Microsoft.CodeAnalysis.PublicApiAnalyzers](https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md) to track public API surface.
252+
This repository
253+
uses [Microsoft.CodeAnalysis.PublicApiAnalyzers](https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)
254+
to track public API surface.
252255

253256
### Rules
254257

@@ -258,6 +261,7 @@ This repository uses [Microsoft.CodeAnalysis.PublicApiAnalyzers](https://github.
258261
### Workflow
259262

260263
1. When adding new public APIs, they automatically get flagged and should be added to `PublicAPI.Unshipped.txt`
261-
2. When modifying existing APIs, move the old entry from `PublicAPI.Shipped.txt` to `PublicAPI.Unshipped.txt` (marked as removed) and add the new signature to `PublicAPI.Unshipped.txt`
264+
2. When modifying existing APIs, move the old entry from `PublicAPI.Shipped.txt` to `PublicAPI.Unshipped.txt` (marked as
265+
removed) and add the new signature to `PublicAPI.Unshipped.txt`
262266
3. Only remove entries from `PublicAPI.Shipped.txt` when an API is being deleted
263267
4. During release, unshipped APIs get moved to shipped via the `mark-shipped.ps1` script

.github/skills/git-commit/SKILL.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
name: git-commit
3+
description: 'Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping'
4+
license: MIT
5+
allowed-tools: Bash
6+
---
7+
8+
# Git Commit with Conventional Commits
9+
10+
## Overview
11+
12+
Create standardized, semantic git commits using the Conventional Commits specification. Analyze the actual diff to
13+
determine appropriate type, scope, and message.
14+
15+
## Conventional Commit Format
16+
17+
```
18+
<type>[optional scope]: <description>
19+
20+
[optional body]
21+
22+
[optional footer(s)]
23+
```
24+
25+
## Commit Types
26+
27+
| Type | Purpose |
28+
|------------|--------------------------------|
29+
| `feat` | New feature |
30+
| `fix` | Bug fix |
31+
| `docs` | Documentation only |
32+
| `style` | Formatting/style (no logic) |
33+
| `refactor` | Code refactor (no feature/fix) |
34+
| `perf` | Performance improvement |
35+
| `test` | Add/update tests |
36+
| `build` | Build system/dependencies |
37+
| `ci` | CI/config changes |
38+
| `chore` | Maintenance/misc |
39+
| `revert` | Revert commit |
40+
41+
## Breaking Changes
42+
43+
```
44+
# Exclamation mark after type/scope
45+
feat!: remove deprecated endpoint
46+
47+
# BREAKING CHANGE footer
48+
feat: allow config to extend other configs
49+
50+
BREAKING CHANGE: `extends` key behavior changed
51+
```
52+
53+
## Workflow
54+
55+
### 1. Analyze Diff
56+
57+
```bash
58+
# If files are staged, use staged diff
59+
git diff --staged
60+
61+
# If nothing staged, use working tree diff
62+
git diff
63+
64+
# Also check status
65+
git status --porcelain
66+
```
67+
68+
### 2. Stage Files (if needed)
69+
70+
If nothing is staged, or you want to group changes differently:
71+
72+
```bash
73+
# Stage specific files
74+
git add path/to/file1 path/to/file2
75+
76+
# Stage by pattern
77+
git add *.test.*
78+
git add src/components/*
79+
80+
# Interactive staging
81+
git add -p
82+
```
83+
84+
**Never commit secrets** (.env, credentials.json, private keys).
85+
86+
### 3. Generate Commit Message
87+
88+
Analyze the diff to determine:
89+
90+
- **Type**: What kind of change is this?
91+
- **Scope**: What area/module is affected?
92+
- **Description**: One-line summary of what changed (present tense, imperative mood, <72 chars)
93+
94+
### 4. Execute Commit
95+
96+
```bash
97+
# Single line
98+
git commit -m "<type>[scope]: <description>"
99+
100+
# Multi-line with body/footer
101+
git commit -m "$(cat <<'EOF'
102+
<type>[scope]: <description>
103+
104+
<optional body>
105+
106+
<optional footer>
107+
EOF
108+
)"
109+
```
110+
111+
## Best Practices
112+
113+
- One logical change per commit
114+
- Present tense: "add" not "added"
115+
- Imperative mood: "fix bug" not "fixes bug"
116+
- Reference issues: `Closes #123`, `Refs #456`
117+
- Keep the description under 72 characters
118+
119+
## Git Safety Protocol
120+
121+
- NEVER update git config
122+
- NEVER run destructive commands (--force, hard reset) without an explicit request
123+
- NEVER skip hooks (--no-verify) unless user asks
124+
- NEVER force push to main/master
125+
- If the commit fails due to hooks, fix and create a NEW commit (don't amend)
Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ description: 'Manage NuGet packages in .NET projects/solutions. Use this skill w
77

88
## Overview
99

10-
This skill ensures consistent and safe management of NuGet packages across .NET projects. It prioritizes using the `dotnet` CLI to maintain project integrity and enforces a strict verification and restoration workflow for version updates.
10+
This skill ensures consistent and safe management of NuGet packages across .NET projects. It prioritizes using the
11+
`dotnet` CLI to maintain project integrity and enforces a strict verification and restoration workflow for version
12+
updates.
1113

1214
## Prerequisites
1315

@@ -17,9 +19,10 @@ This skill ensures consistent and safe management of NuGet packages across .NET
1719

1820
## Core Rules
1921

20-
1. **NEVER** directly edit `.csproj`, `.props`, or `Directory.Packages.props` files to **add** or **remove** packages. Always use `dotnet add package` and `dotnet remove package` commands.
21-
2. **DIRECT EDITING** is ONLY permitted for **changing versions** of existing packages.
22-
3. **VERSION UPDATES** must follow the mandatory workflow:
22+
1. **NEVER** directly edit `.csproj`, `.props`, or `Directory.Packages.props` files to **add** or **remove** packages.
23+
Always use `dotnet add package` and `dotnet remove package` commands.
24+
2. **DIRECT EDITING** is ONLY permitted for **changing versions** of existing packages.
25+
3. **VERSION UPDATES** must follow the mandatory workflow:
2326
- Verify the target version exists on NuGet.
2427
- Determine if versions are managed per-project (`.csproj`) or centrally (`Directory.Packages.props`).
2528
- Update the version string in the appropriate file.
@@ -28,41 +31,49 @@ This skill ensures consistent and safe management of NuGet packages across .NET
2831
## Workflows
2932

3033
### Adding a Package
34+
3135
Use `dotnet add [<PROJECT>] package <PACKAGE_NAME> [--version <VERSION>]`.
3236
Example: `dotnet add src/MyProject/MyProject.csproj package Newtonsoft.Json`
3337

3438
### Removing a Package
39+
3540
Use `dotnet remove [<PROJECT>] package <PACKAGE_NAME>`.
3641
Example: `dotnet remove src/MyProject/MyProject.csproj package Newtonsoft.Json`
3742

3843
### Updating Package Versions
44+
3945
When updating a version, follow these steps:
4046

41-
1. **Verify Version Existence**:
42-
Check if the version exists using the `dotnet package search` command with exact match and JSON formatting.
43-
Using `jq`:
44-
`dotnet package search <PACKAGE_NAME> --exact-match --format json | jq -e '.searchResult[].packages[] | select(.version == "<VERSION>")'`
45-
Using PowerShell:
46-
`(dotnet package search <PACKAGE_NAME> --exact-match --format json | ConvertFrom-Json).searchResult.packages | Where-Object { $_.version -eq "<VERSION>" }`
47+
1. **Verify Version Existence**:
48+
Check if the version exists using the `dotnet package search` command with exact match and JSON formatting.
49+
Using `jq`:
50+
`dotnet package search <PACKAGE_NAME> --exact-match --format json | jq -e '.searchResult[].packages[] | select(.version == "<VERSION>")'`
51+
Using PowerShell:
52+
`(dotnet package search <PACKAGE_NAME> --exact-match --format json | ConvertFrom-Json).searchResult.packages | Where-Object { $_.version -eq "<VERSION>" }`
4753

48-
2. **Determine Version Management**:
49-
- Search for `Directory.Packages.props` in the solution root. If present, versions should be managed there via `<PackageVersion Include="Package.Name" Version="1.2.3" />`.
54+
2. **Determine Version Management**:
55+
- Search for `Directory.Packages.props` in the solution root. If present, versions should be managed there via
56+
`<PackageVersion Include="Package.Name" Version="1.2.3" />`.
5057
- If absent, check individual `.csproj` files for `<PackageReference Include="Package.Name" Version="1.2.3" />`.
5158

52-
3. **Apply Changes**:
53-
Modify the identified file with the new version string.
59+
3. **Apply Changes**:
60+
Modify the identified file with the new version string.
5461

55-
4. **Verify Stability**:
56-
Run `dotnet restore` on the project or solution. If errors occur, revert the change and investigate.
62+
4. **Verify Stability**:
63+
Run `dotnet restore` on the project or solution. If errors occur, revert the change and investigate.
5764

5865
## Examples
5966

6067
### User: "Add Serilog to the WebApi project"
68+
6169
**Action**: Execute `dotnet add src/WebApi/WebApi.csproj package Serilog`.
6270

6371
### User: "Update Newtonsoft.Json to 13.0.3 in the whole solution"
72+
6473
**Action**:
65-
1. Verify 13.0.3 exists: `dotnet package search Newtonsoft.Json --exact-match --format json` (and parse output to confirm "13.0.3" is present).
74+
75+
1. Verify 13.0.3 exists: `dotnet package search Newtonsoft.Json --exact-match --format json` (and parse output to
76+
confirm "13.0.3" is present).
6677
2. Find where it's defined (e.g., `Directory.Packages.props`).
6778
3. Edit the file to update the version.
6879
4. Run `dotnet restore`.

0 commit comments

Comments
 (0)