Skip to content

Commit caa5f37

Browse files
committed
Add skill files to prepare cli repo fo agentic workflows
1 parent 2107d8c commit caa5f37

11 files changed

Lines changed: 1522 additions & 4 deletions

File tree

Lines changed: 338 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,338 @@
1+
---
2+
name: commit-message
3+
description: This skill should be used when the user asks to "create a commit", "generate commit message", "commit changes", "make a commit", mentions "conventional commits", or discusses commit message formatting. Provides guided workflow for creating properly formatted commit messages with line length validation and required trailers.
4+
version: 0.2.0
5+
---
6+
7+
# Conventional Commit Message Creation
8+
9+
Create properly formatted conventional commit messages following project standards with line length validation and required trailers.
10+
11+
## Purpose
12+
13+
Generate commit messages that:
14+
15+
- Follow conventional commits format (`type(scope): description`)
16+
- Use component names or GitHub issue numbers as scope
17+
- Respect line length limits (50 for subject, 72 for body)
18+
- Include required trailers (Signed-off-by, Assisted-by)
19+
- Match [Tekton commit message standards](https://github.com/tektoncd/community/blob/master/standards.md#commit-messages)
20+
21+
## Quick Workflow
22+
23+
1. **Analyze changes**: Run git status and git diff to understand modifications
24+
2. **Determine scope**: Use component name from changed files, or GitHub issue number if available
25+
3. **Generate message**: Create conventional commit message with proper formatting
26+
4. **Add trailers**: Include Signed-off-by and Assisted-by trailers
27+
5. **Confirm with user**: Display message and wait for approval before committing
28+
29+
**CRITICAL**: Never commit without explicit user confirmation.
30+
31+
## Conventional Commit Format
32+
33+
### Structure
34+
35+
```text
36+
<type>(<scope>): <description>
37+
38+
[optional body]
39+
40+
Signed-off-by: <name> <email>
41+
Assisted-by: <Model name> (via <Tool>)
42+
```
43+
44+
### Type Selection
45+
46+
Choose the appropriate commit type based on changes:
47+
48+
| Type | Description | Example |
49+
| ------ | ------------- | --------- |
50+
| `feat` | New features | `feat(pipeline): add start --output flag` |
51+
| `fix` | Bug fixes | `fix(taskrun): resolve log streaming race` |
52+
| `docs` | Documentation | `docs(README): update installation steps` |
53+
| `refactor` | Code refactoring | `refactor(actions): simplify CRUD helpers` |
54+
| `test` | Test changes | `test(pipelinerun): add describe unit tests` |
55+
| `chore` | Maintenance | `chore(deps): update go dependencies` |
56+
| `build` | Build system | `build(Makefile): add vendor target` |
57+
| `ci` | CI/CD changes | `ci(github): add golangci-lint action` |
58+
| `perf` | Performance | `perf(log): optimize pod log streaming` |
59+
| `style` | Code style | `style(format): run goimports formatter` |
60+
| `revert` | Revert commit | `revert: undo breaking CLI flag change` |
61+
62+
For complete type reference, see `references/commit-types.md`.
63+
64+
### Scope Rules
65+
66+
#### Priority 1: Component from changed files
67+
68+
Analyze staged files to identify the primary component:
69+
70+
```bash
71+
git diff --cached --name-only
72+
```
73+
74+
| File pattern | Scope | Example commit |
75+
| ------------ | ----- | -------------- |
76+
| `pkg/cmd/pipeline/*` | `pipeline` | `feat(pipeline): add start --dry-run flag` |
77+
| `pkg/cmd/task/*` | `task` | `fix(task): resolve list filtering` |
78+
| `pkg/cmd/pipelinerun/*` | `pipelinerun` | `feat(pipelinerun): add cancel subcommand` |
79+
| `pkg/cmd/taskrun/*` | `taskrun` | `fix(taskrun): correct log streaming` |
80+
| `pkg/actions/*` | `actions` | `refactor(actions): simplify CRUD` |
81+
| `pkg/formatted/*` | `formatted` | `feat(formatted): add JSON output` |
82+
| `pkg/log/*` | `log` | `fix(log): handle container restart` |
83+
| `pkg/pods/*` | `pods` | `fix(pods): resolve container lookup` |
84+
| `pkg/cli/*` | `cli` | `refactor(cli): extract client setup` |
85+
| `pkg/flags/*` | `flags` | `feat(flags): add --output flag` |
86+
| `pkg/plugins/*` | `plugins` | `feat(plugins): add discovery logic` |
87+
| `pkg/version/*` | `version` | `fix(version): correct server detection` |
88+
| `docs/*` | `docs` or filename | `docs(README): update steps` |
89+
| `test/*` | component being tested | `test(pipeline): add E2E tests` |
90+
| `cmd/*` | command name | `feat(tkn): add new subcommand` |
91+
| Root files | filename | `chore(Makefile): add target` |
92+
| `AGENTS.md`, `CLAUDE.md` | `docs` | `docs(AGENTS.md): update conventions` |
93+
94+
#### Priority 2: GitHub issue number (optional)
95+
96+
If the work is tracked in a GitHub issue and the user provides one, it can be used as the scope:
97+
98+
```text
99+
# Branch: fix-123-log-race
100+
# Scope: #123 or component name
101+
# Result: fix(log): resolve streaming race condition
102+
103+
Fixes #123
104+
```
105+
106+
Add `Fixes #NNN` or `Closes #NNN` in the commit body (not the scope) — this is the standard GitHub convention for auto-closing issues.
107+
108+
#### Priority 3: Ask user
109+
110+
If changed files span multiple components or scope is unclear, ask the user which component is the primary focus.
111+
112+
## Line Length Requirements
113+
114+
### Subject Line
115+
116+
- **Target**: 50 characters maximum
117+
- **Hard limit**: 72 characters
118+
- **Format**: `type(scope): description` counts toward limit
119+
- **Tips**: Use present tense, no period at end
120+
121+
```text
122+
# Good (40 chars)
123+
feat(pipeline): add start --dry-run
124+
125+
# Too long - exceeds 72 char hard limit
126+
feat(pipeline): add comprehensive dry-run support with preview output for pipeline start command
127+
```
128+
129+
### Body
130+
131+
- **Wrap at 72 characters per line**
132+
- **Blank line** required between subject and body
133+
- **Content**: Explain why, not what (code shows what)
134+
- **Format**: Wrap manually or use heredoc in git commit
135+
136+
```text
137+
feat(pipeline): add start --dry-run
138+
139+
Add dry-run flag to pipeline start command that previews the
140+
PipelineRun YAML without creating it. Useful for validating
141+
parameters and workspace bindings before submission.
142+
143+
Signed-off-by: Developer Name <developer@example.com>
144+
Assisted-by: <Model name> (via <Tool>)
145+
```
146+
147+
## Required Trailers
148+
149+
### Signed-off-by
150+
151+
**Always include**: `Signed-off-by: <name> <email>`
152+
153+
This certifies the Developer Certificate of Origin (DCO) — required by tektoncd upstream.
154+
155+
**Detection priority order**:
156+
157+
1. Environment variables: `$GIT_AUTHOR_NAME` and `$GIT_AUTHOR_EMAIL`
158+
2. Git config: `git config user.name` and `git config user.email`
159+
3. If neither configured, ask user to provide details
160+
161+
```bash
162+
echo "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>"
163+
git config user.name
164+
git config user.email
165+
```
166+
167+
If neither is configured, ask the user to provide their name and email.
168+
169+
### Assisted-by
170+
171+
**Always include**: `Assisted-by: <model-name> (via <Tool>)`
172+
173+
**Format examples**:
174+
175+
```text
176+
Assisted-by: <Model name> (via <Tool>)
177+
```
178+
179+
Use the actual model name (Claude Sonnet 4.5, Claude Opus 4.5, etc.).
180+
181+
## User Confirmation Requirement
182+
183+
**CRITICAL RULE**: Always ask for user confirmation before executing `git commit`.
184+
185+
### Confirmation Workflow
186+
187+
1. **Generate** the commit message following all rules above
188+
2. **Display** the complete message to the user with separator
189+
3. **Ask**: "Should I commit with this message? (y/n)"
190+
4. **Wait** for user response
191+
5. **Commit** only if user confirms (yes/y/affirmative)
192+
193+
### Example Interaction
194+
195+
```text
196+
Generated commit message:
197+
---
198+
feat(pipeline): add JSON output support
199+
200+
Add --output=json flag to pipeline list and describe commands.
201+
Uses the existing formatted package JSON helpers.
202+
203+
Signed-off-by: Developer Name <developer@example.com>
204+
Assisted-by: <Model name> (via <Tool>)
205+
---
206+
207+
Should I commit with this message? (y/n)
208+
```
209+
210+
Wait for user response before proceeding.
211+
212+
## Commit Execution
213+
214+
Use heredoc format for proper multi-line handling:
215+
216+
```bash
217+
git commit -m "$(cat <<'EOF'
218+
feat(pipeline): add JSON output support
219+
220+
Add --output=json flag to pipeline list and describe commands.
221+
222+
Signed-off-by: Developer Name <developer@example.com>
223+
Assisted-by: <Model name> (via <Tool>)
224+
EOF
225+
)"
226+
```
227+
228+
**Never use**:
229+
230+
- `--no-verify` (skips pre-commit hooks)
231+
- `--no-gpg-sign` (skips signing)
232+
- `--amend` (unless explicitly requested and safe)
233+
234+
## Complete Examples
235+
236+
### Feature with component scope
237+
238+
```text
239+
feat(pipeline): add start --dry-run
240+
241+
Add dry-run flag to pipeline start command that previews the
242+
PipelineRun YAML without creating it on the cluster.
243+
244+
Signed-off-by: Developer Name <developer@example.com>
245+
Assisted-by: <Model name> (via <Tool>)
246+
```
247+
248+
### Bug fix closing a GitHub issue
249+
250+
```text
251+
fix(log): resolve concurrent streaming panic
252+
253+
Prevent nil pointer dereference when multiple containers stream
254+
logs simultaneously during a TaskRun.
255+
256+
Fixes #789
257+
258+
Signed-off-by: Developer Name <developer@example.com>
259+
Assisted-by: <Model name> (via <Tool>)
260+
```
261+
262+
### Documentation update
263+
264+
```text
265+
docs(AGENTS.md): update architecture conventions
266+
267+
Add command tree structure and clarify golden-file testing
268+
rules for contributors.
269+
270+
Signed-off-by: Developer Name <developer@example.com>
271+
Assisted-by: <Model name> (via <Tool>)
272+
```
273+
274+
### Breaking change
275+
276+
```text
277+
feat(cli)!: remove deprecated --namespace flag
278+
279+
Remove the deprecated short-form --namespace flag from all
280+
commands. Use -n instead. Deprecated since v0.30.
281+
282+
BREAKING CHANGE: Removed --namespace long flag from all
283+
commands. Use -n or --ns instead.
284+
285+
Signed-off-by: Developer Name <developer@example.com>
286+
Assisted-by: <Model name> (via <Tool>)
287+
```
288+
289+
## Validation Rules
290+
291+
Every commit message must pass these checks:
292+
293+
1. **Subject line format**: Must match `type(scope): description` (conventional commits)
294+
2. **Subject line length**: Target 50 chars, hard limit 72 chars
295+
3. **No trailing punctuation**: Subject must not end with `.` `!` `?` `,` `:` `;` (exception: `!` for breaking changes like `feat!:`)
296+
4. **No trailing whitespace**: On any line
297+
5. **Blank line after subject**: Required before body text
298+
6. **Body line length**: Wrap at 72 characters per line
299+
7. **Valid commit type**: Must be one of: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`, `build`, `ci`, `perf`, `revert`
300+
8. **Signed-off-by trailer**: Required — `Signed-off-by: Name <email>`
301+
9. **Assisted-by trailer**: Required when AI assists — `Assisted-by: <Model name>`
302+
10. **Trailer spacing**: Blank line before trailers, no blank lines between them, no trailing blank lines
303+
304+
## Format standards
305+
306+
Follow [Tekton commit message standards](https://github.com/tektoncd/community/blob/master/standards.md#commit-messages):
307+
308+
- Conventional commit format (`type(scope): description`)
309+
- Subject line: target 50 characters, hard limit 72
310+
- Body lines wrapped at 72 characters
311+
- Required `Signed-off-by` trailer (DCO)
312+
- No trailing punctuation on the subject
313+
314+
## Auto-Detection Summary
315+
316+
When generating commit messages:
317+
318+
1. Run `git status` (without -uall flag)
319+
2. Run `git diff` for staged and unstaged changes
320+
3. Identify primary component from staged file paths
321+
4. If scope unclear, ask user
322+
5. If user mentions a GitHub issue number, add `Fixes #NNN` to body
323+
6. Analyze staged files to determine commit type
324+
7. Generate appropriate scope and description
325+
8. Detect author info from environment variables or git config
326+
9. Ensure subject line is ≤50 characters (max 72)
327+
10. Wrap body text at 72 characters per line
328+
11. Add required trailers (Signed-off-by and Assisted-by)
329+
12. Format according to conventional commits standard
330+
13. **Display message and ask for user confirmation**
331+
14. Only commit after receiving confirmation
332+
333+
## Additional Resources
334+
335+
For detailed information:
336+
337+
- **`references/commit-types.md`** - Complete commit type reference with descriptions
338+
- **`references/trailer-detection.md`** - Author detection logic and priority order

0 commit comments

Comments
 (0)