Commit Message Storyteller

Commit Message Storyteller

Turns git diffs, staged changes or descriptions into narrative Conventional Commits messages that explain why the change was made, not only what changed.

Skill files2 files

references/

SKILL.md148 lines
1
---
2
name: commit-message-storyteller
3
description: 'Analyzes git diffs or staged changes and generates narrative commit messages that explain WHY a change was made, not just what changed — following Conventional Commits format. Use when asked to "write a commit message", "describe my changes", "what should I commit this as", or "summarize my diff". Works with git diff output, staged files, or plain descriptions of changes. Does not run git commit; to stage files and make the commit, use the git-commit skill.'
4
---
5
6
# Commit Message Storyteller
7
8
Transforms raw git diffs and change descriptions into clear, story-driven commit messages that follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. Instead of "update file.js", you get messages that communicate intent, context, and impact.
9
10
## When to Use This Skill
11
12
- User says "write a commit message"
13
- User pastes a git diff or describes code changes
14
- User says "what should I commit this as?" or "summarize my diff"
15
- User wants better commit history for their team or open-source project
16
- User is preparing a pull request and wants meaningful commit messages
17
18
## Prerequisites
19
20
Have at least one of the following ready:
21
22
- Output from `git diff` or `git diff --staged`
23
- A description of what you changed and why
24
- A list of modified files
25
26
## How It Works
27
28
### Step 1: Gather the Change Context
29
30
Ask the user (or infer from the diff) for:
31
32
1. **What changed** — files, functions, logic affected
33
2. **Why it changed** — bug fix, new feature, refactor, performance, etc.
34
3. **Who/what triggered it** — issue number, user request, tech debt, etc.
35
36
If the user provides a raw `git diff`, extract this context automatically from the diff.
37
38
### Step 2: Identify the Commit Type
39
40
Map the change to a Conventional Commits type using this guide:
41
42
| Type | Use When |
43
| ------ | ---------- |
44
| `feat` | A new feature or capability is added |
45
| `fix` | A bug or incorrect behavior is corrected |
46
| `refactor` | Code restructured without changing behavior |
47
| `perf` | A change that improves performance |
48
| `docs` | Documentation only changes |
49
| `style` | Formatting, whitespace, missing semicolons (no logic change) |
50
| `test` | Adding or updating tests |
51
| `build` | Build system or dependency changes |
52
| `chore` | Other maintenance that does not change source or tests |
53
| `ci` | CI/CD pipeline changes |
54
| `revert` | Reverting a previous commit |
55
56
See `references/conventional-commits-guide.md` for detailed examples.
57
58
### Step 3: Write the Commit Message
59
60
Follow this structure:
61
62
```text
63
<type>(<optional scope>): <short imperative summary>
64
65
<body — the story: why this change was made, what problem it solves>
66
67
<footer — issue refs, breaking change notices>
68
```
69
70
#### Rules for Each Part
71
72
**Subject line (first line):**
73
74
- Use imperative mood: "add", "fix", "remove" — not "added" or "fixes"
75
- Max 72 characters
76
- No period at the end
77
- Lowercase after the colon
78
79
**Body (the story):**
80
81
- Explain the *why*, not the *what* (the diff already shows the what)
82
- Describe the problem that existed before this change
83
- Mention any alternatives considered if relevant
84
- Keep lines under 100 characters
85
- Separate from subject with a blank line
86
87
**Footer:**
88
89
- Reference issues: `Closes #123`, `Fixes #456`, `Refs #789`
90
- Mark breaking changes: `BREAKING CHANGE: <description>`
91
92
### Step 4: Generate Output
93
94
Produce the commit message in a copyable code block, followed by a one-line plain-English explanation of the story you told.
95
96
**Example output:**
97
98
```text
99
fix(auth): prevent token refresh loop on expired sessions
100
101
When a user's session expired mid-request, the auth middleware was
102
triggering a token refresh, which itself failed validation and triggered
103
another refresh — causing an infinite retry loop that crashed the app.
104
105
This adds a recursion guard flag that aborts the refresh cycle if a
106
refresh is already in progress, returning a clean 401 instead.
107
108
Closes #312
109
```
110
111
> **Story told:** A silent infinite loop on session expiry was crashing the app; this stops the cycle early and returns a clean error.
112
113
---
114
115
## Multiple Commits from One Diff
116
117
If the diff contains **logically separate changes**, split them into multiple commit messages and tell the user. Use this heuristic:
118
119
- Different files with unrelated purposes → likely separate commits
120
- Same file but distinct concerns (e.g., bug fix + refactor) → suggest splitting
121
- Everything tightly coupled → one commit is fine
122
123
---
124
125
## Edge Cases
126
127
| Situation | How to Handle |
128
| ----------- | --------------- |
129
| User provides no context beyond a diff | Infer type and scope from file names and changed symbols |
130
| Changes span many files with no clear theme | Ask: "Is this one logical change, or multiple?" |
131
| Breaking change detected | Add `BREAKING CHANGE:` footer automatically |
132
| User says "keep it short" | Omit body, just write a strong subject line |
133
| No issue number available | Omit the footer entirely |
134
135
---
136
137
## Quick Reference
138
139
```bash
140
# Get your staged diff to paste into Copilot
141
git diff --staged
142
143
# Or get the last uncommitted working tree changes
144
git diff
145
```
146
147
See `references/conventional-commits-guide.md` for type examples and scope guidelines.
148

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…