@runecraft/grimoire 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/catalog.json +9 -0
- package/dist/grimoire.js +1758 -0
- package/package.json +54 -0
- package/references/definition-of-done.md +67 -0
- package/references/testing-patterns.md +260 -0
- package/skills/code-review-and-quality/README.md +13 -0
- package/skills/code-review-and-quality/SKILL.md +389 -0
- package/skills/code-simplification/README.md +13 -0
- package/skills/code-simplification/SKILL.md +338 -0
- package/skills/debugging-and-error-recovery/README.md +13 -0
- package/skills/debugging-and-error-recovery/SKILL.md +343 -0
- package/skills/debugging-and-error-recovery/scripts/__pycache__/triage_state.cpython-314.pyc +0 -0
- package/skills/debugging-and-error-recovery/scripts/triage_state.py +206 -0
- package/skills/deprecation-and-migration/README.md +13 -0
- package/skills/deprecation-and-migration/SKILL.md +248 -0
- package/skills/deprecation-and-migration/scripts/__pycache__/migration_tracker.cpython-314.pyc +0 -0
- package/skills/deprecation-and-migration/scripts/migration_tracker.py +237 -0
- package/skills/doubt-driven-development/README.md +13 -0
- package/skills/doubt-driven-development/SKILL.md +251 -0
- package/skills/git-commit-learning/.skill-meta.json +14 -0
- package/skills/git-commit-learning/README.md +205 -0
- package/skills/git-commit-learning/SKILL.md +435 -0
- package/skills/git-commit-learning/references/commit-patterns.md +595 -0
- package/skills/git-worktree/README.md +13 -0
- package/skills/git-worktree/SKILL.md +220 -0
- package/skills/idea-refine/README.md +13 -0
- package/skills/idea-refine/SKILL.md +186 -0
- package/skills/interview-me/README.md +13 -0
- package/skills/interview-me/SKILL.md +233 -0
- package/skills/linkedin-audit/SKILL.md +98 -0
- package/skills/linkedin-audit/references/dashboard-spec.md +43 -0
- package/skills/memory-management/README.md +13 -0
- package/skills/memory-management/SKILL.md +198 -0
- package/skills/security-and-hardening/README.md +13 -0
- package/skills/security-and-hardening/SKILL.md +472 -0
- package/skills/shipping-and-launch/README.md +13 -0
- package/skills/shipping-and-launch/SKILL.md +317 -0
- package/skills/skill-forge/README.md +153 -0
- package/skills/skill-forge/SKILL.md +291 -0
- package/skills/skill-forge/assets/SKILL.template.md +73 -0
- package/skills/skill-forge/references/authoring-patterns.md +249 -0
- package/skills/skill-forge/references/description-optimization.md +171 -0
- package/skills/skill-forge/references/output-evaluation.md +276 -0
- package/skills/skill-forge/references/scripts-guide.md +232 -0
- package/skills/skill-forge/references/spec.md +175 -0
- package/skills/skill-forge/scripts/validate.py +536 -0
- package/skills/spec-driven/.skill-meta.json +14 -0
- package/skills/spec-driven/README.md +335 -0
- package/skills/spec-driven/SKILL.md +174 -0
- package/skills/spec-driven/references/code-analysis.md +98 -0
- package/skills/spec-driven/references/coding-principles.md +56 -0
- package/skills/spec-driven/references/context-limits.md +31 -0
- package/skills/spec-driven/references/design.md +199 -0
- package/skills/spec-driven/references/discuss.md +136 -0
- package/skills/spec-driven/references/implement.md +425 -0
- package/skills/spec-driven/references/lessons.md +113 -0
- package/skills/spec-driven/references/memory.md +126 -0
- package/skills/spec-driven/references/specify.md +210 -0
- package/skills/spec-driven/references/sub-agents.md +96 -0
- package/skills/spec-driven/references/tasks.md +484 -0
- package/skills/spec-driven/references/validate.md +350 -0
- package/skills/spec-driven/scripts/__pycache__/lessons.cpython-314.pyc +0 -0
- package/skills/spec-driven/scripts/lessons.py +370 -0
- package/skills/spec-loop/README.md +36 -0
- package/skills/spec-loop/SKILL.md +61 -0
- package/skills/test-driven-development/README.md +13 -0
- package/skills/test-driven-development/SKILL.md +388 -0
- package/skills/typescript-patterns/README.md +13 -0
- package/skills/typescript-patterns/SKILL.md +346 -0
- package/skills/using-agent-skills/README.md +13 -0
- package/skills/using-agent-skills/SKILL.md +187 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://img.shields.io/badge/Skill-git--commit--learning-blue?style=for-the-badge" alt="skill badge" />
|
|
3
|
+
<img src="https://img.shields.io/badge/Stack-Agnostic-green?style=for-the-badge" alt="stack agnostic" />
|
|
4
|
+
<img src="https://img.shields.io/badge/Version-1.0.0-purple?style=for-the-badge" alt="version" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 align="center">📚 git-commit-learning</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<strong>Transforma histórico Git em memória de projeto para agentes de IA.<br/>Analisa commits para extrair padrões. Escreve commits que ensinam.<br/>Modelo RPI: Research → Plan → Implement → Verify.</strong>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ✨ What Is This Skill?
|
|
16
|
+
|
|
17
|
+
**git-commit-learning** ensina agentes de IA a usar o histórico Git como fonte de aprendizado do projeto. Dois modos:
|
|
18
|
+
|
|
19
|
+
- **ANALYZE** — Lê o `git log`, extrai padrões do projeto, decisões técnicas e produz lições reutilizáveis.
|
|
20
|
+
- **WRITE** — Cria mensagens de commit estruturadas no formato RPI (Research, Plan, Implement) com validação binária.
|
|
21
|
+
|
|
22
|
+
Baseado nos princípios de Context Engineering e nas práticas de desenvolvimento assistido por IA: spec-first, decisões explícitas, validação reprodutível.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 🚀 Quick Start
|
|
27
|
+
|
|
28
|
+
### Installation
|
|
29
|
+
|
|
30
|
+
Install with the catalog installer (`npx @runecraft/grimoire install`) or copy the skill folder manually — see the [catalog README](../../README.md) for targets and options.
|
|
31
|
+
|
|
32
|
+
### Common Triggers (PT/EN)
|
|
33
|
+
|
|
34
|
+
| Mode | Português | English |
|
|
35
|
+
|------|-----------|---------|
|
|
36
|
+
| **Analyze** | "analisa o histórico do módulo billing" | "analyze billing module git history" |
|
|
37
|
+
| **Analyze** | "extraia padrões dos commits recentes" | "extract patterns from recent commits" |
|
|
38
|
+
| **Write** | "cria um commit para essa mudança" | "write a commit message for this change" |
|
|
39
|
+
| **Write** | "commita isso para IA aprender" | "commit this so AI can learn from it" |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 📝 RPI Commit Template
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
<type>(<scope>): <descrição clara da mudança>
|
|
47
|
+
|
|
48
|
+
[CONTEXTO]
|
|
49
|
+
- <task, spec, ticket, issue>
|
|
50
|
+
- <problema de negócio>
|
|
51
|
+
|
|
52
|
+
[ALTERAÇÕES ATÔMICAS]
|
|
53
|
+
- <ações verificáveis no diff>
|
|
54
|
+
|
|
55
|
+
[DECISÕES TÉCNICAS (Mini-ADR)]
|
|
56
|
+
- <decisão, alternativa rejeitada, razão>
|
|
57
|
+
|
|
58
|
+
[VALIDAÇÃO]
|
|
59
|
+
- <comando> — <passou | falhou>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
RPI = Research → Plan → Implement → Verify.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## ✅ Example (PT/EN)
|
|
67
|
+
|
|
68
|
+
### Português
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
feat(api): implementa integração com Stripe conforme task CAM-42
|
|
72
|
+
|
|
73
|
+
[CONTEXTO]
|
|
74
|
+
- Resolvida a task CAM-42 referente ao fluxo de checkout.
|
|
75
|
+
- Implementação segue a Spec em docs/specs/payments-v1.md.
|
|
76
|
+
|
|
77
|
+
[ALTERAÇÕES ATÔMICAS]
|
|
78
|
+
- Adicionado StripeService para gerenciar sessões de checkout.
|
|
79
|
+
- Criado endpoint POST /payments/create-session validado por DTO.
|
|
80
|
+
- Configurado webhook para checkout.session.completed.
|
|
81
|
+
|
|
82
|
+
[DECISÕES TÉCNICAS (Mini-ADR)]
|
|
83
|
+
- Utilizada versão 14.x do SDK do Stripe por compatibilidade com rules do projeto.
|
|
84
|
+
- Optado por não persistir dados sensíveis localmente, delegando segurança ao Stripe conforme RFC-09.
|
|
85
|
+
|
|
86
|
+
[VALIDAÇÃO]
|
|
87
|
+
- npm test src/services/stripe.service.spec.ts — passou (8/8).
|
|
88
|
+
- npm run typecheck — passou.
|
|
89
|
+
- npm run lint — passou.
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### English
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
feat(api): implement Stripe integration per task CAM-42
|
|
96
|
+
|
|
97
|
+
[CONTEXTO]
|
|
98
|
+
- Resolves task CAM-42 for the checkout flow.
|
|
99
|
+
- Implementation follows the Spec in docs/specs/payments-v1.md.
|
|
100
|
+
|
|
101
|
+
[ALTERAÇÕES ATÔMICAS]
|
|
102
|
+
- Added StripeService to manage checkout sessions.
|
|
103
|
+
- Created POST /payments/create-session endpoint validated by DTO.
|
|
104
|
+
- Configured webhook for checkout.session.completed events.
|
|
105
|
+
|
|
106
|
+
[DECISÕES TÉCNICAS (Mini-ADR)]
|
|
107
|
+
- Used Stripe SDK v14.x for compatibility with project rules.
|
|
108
|
+
- Chose not to persist sensitive data locally, delegating security to Stripe per RFC-09.
|
|
109
|
+
|
|
110
|
+
[VALIDAÇÃO]
|
|
111
|
+
- npm test src/services/stripe.service.spec.ts — passed (8/8).
|
|
112
|
+
- npm run typecheck — passed.
|
|
113
|
+
- npm run lint — passed.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 📁 Structure
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
git-commit-learning/
|
|
122
|
+
├── SKILL.md — Agent instructions (load this)
|
|
123
|
+
├── .skill-meta.json — Metadata
|
|
124
|
+
├── README.md — Human documentation
|
|
125
|
+
└── references/
|
|
126
|
+
└── commit-patterns.md — Templates, anti-patterns, bilingual examples
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 🔄 The Two Modes
|
|
132
|
+
|
|
133
|
+
### ANALYZE — Extract Project Knowledge from Git
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
DECIDE → SCOPE → INVESTIGATE → EXTRACT → REPORT
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
1. Define escopo: arquivo, módulo, domínio ou período.
|
|
140
|
+
2. Usa comandos Git somente leitura (`git log`, `git show`, `git blame`).
|
|
141
|
+
3. Extrai estrutura por commit: scope, type, intent, decision, validation.
|
|
142
|
+
4. Detecta padrões recorrentes com nível de confiança (HIGH/MEDIUM/LOW).
|
|
143
|
+
5. Produz AI Lessons reutilizáveis com evidência de commits.
|
|
144
|
+
|
|
145
|
+
### WRITE — Create AI-Learnable Commits (RPI Model)
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
READ DIFF → CLASSIFY → RESEARCH → PLAN → IMPLEMENT → WRITE → VERIFY
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
1. Lê diff e status.
|
|
152
|
+
2. Classifica: type, scope, size (TRIVIAL/NORMAL/SIGNIFICANT).
|
|
153
|
+
3. **Research**: coleta referências (task, spec, ticket, issue, log).
|
|
154
|
+
4. **Plan**: extrai decisões técnicas e alternativas rejeitadas.
|
|
155
|
+
5. **Implement**: lista alterações atômicas verificáveis.
|
|
156
|
+
6. **Write**: monta mensagem no template RPI.
|
|
157
|
+
7. **Verify**: confere se as 4 perguntas estão respondidas.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## ❌ Anti-Patterns the Skill Rejects
|
|
162
|
+
|
|
163
|
+
```text
|
|
164
|
+
fix: ajustes # no domain, no intent
|
|
165
|
+
wip / update / cleanup # zero context
|
|
166
|
+
refactor: melhora código # what was improved? why?
|
|
167
|
+
|
|
168
|
+
[VALIDAÇÃO]
|
|
169
|
+
- testado manualmente # subjective, not reproducible
|
|
170
|
+
- parece funcionar # binary result or nothing
|
|
171
|
+
|
|
172
|
+
[DECISÕES TÉCNICAS]
|
|
173
|
+
- Seguir boas práticas. # generic, teaches nothing
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 🤖 Compatibility
|
|
179
|
+
|
|
180
|
+
| Agent | Status |
|
|
181
|
+
|-------|--------|
|
|
182
|
+
| Claude Code | ✅ |
|
|
183
|
+
| Cursor | ✅ |
|
|
184
|
+
| Opencode | ✅ |
|
|
185
|
+
| GitHub Copilot | ✅ |
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## 🔗 Integration
|
|
190
|
+
|
|
191
|
+
| Skill | How |
|
|
192
|
+
|-------|-----|
|
|
193
|
+
| **spec-driven** | During BUILD phase: reads spec/tasks for [CONTEXTO], uses acceptance criteria for [VALIDAÇÃO], extracts decisions from design doc for [DECISÕES TÉCNICAS] |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 📄 License
|
|
198
|
+
|
|
199
|
+
MIT
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
<p align="center">
|
|
204
|
+
<sub>Part of the <a href="https://github.com/runecraftai/skills">Grimoire</a> catalog</sub>
|
|
205
|
+
</p>
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-commit-learning
|
|
3
|
+
description: >
|
|
4
|
+
Transforms Git history into reusable project memory for AI agents. Guides agents to analyze git log to extract domain patterns, decisions, and lessons, and to write AI-learnable commit messages with context, intent, validation, and domain signals. Use when asked to "analyze git history", "extract project learnings from commits", "write a commit message the AI can learn from", "make commits searchable for agents", "teach agents through Git", "review commit history for context", or "extract AI lessons from PRs". Also trigger on Portuguese: "analisa o histórico", "extrai aprendizado dos commits", "cria commit para IA aprender", "faz o git virar memória". Do NOT use for generic Git commands (status, push, pull, branch), release notes, changelogs, merge conflict resolution, or code review.
|
|
5
|
+
license: CC-BY-4.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# git-commit-learning
|
|
9
|
+
|
|
10
|
+
Transforma o histórico Git em memória de projeto reutilizável para agentes de IA. Dois modos: **análise** (extrair aprendizado do histórico) e **escrita** (criar commits que ensinam). Baseado no fluxo RPI: Research (contexto e referências), Plan (decisões técnicas), Implement (alterações atômicas).
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
DECIDE MODE → RESEARCH → EXECUTE → VERIFY
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Mode Decision
|
|
19
|
+
|
|
20
|
+
Antes de agir, decida o modo com base no pedido do usuário.
|
|
21
|
+
|
|
22
|
+
| Trigger | Mode | Action |
|
|
23
|
+
|---------|------|--------|
|
|
24
|
+
| "analisa histórico", "aprenda com git", "extraia padrões", "veja como foi feito", "use git para entender", "extract learnings" | **ANALYZE** | Ler histórico, extrair padrões e lições |
|
|
25
|
+
| "crie commit", "escreva mensagem", "commitar isso", "gere commit", "como commitar", "write commit" | **WRITE** | Escrever mensagem de commit ensinável |
|
|
26
|
+
| "analisa e depois commita", "veja o histórico e crie o commit" | **BOTH** | Analisar primeiro, escrever depois |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Mode: ANALYZE
|
|
31
|
+
|
|
32
|
+
Use quando o usuário quer extrair conhecimento do histórico Git sem modificar nada.
|
|
33
|
+
|
|
34
|
+
### Step 1: Scope the Investigation
|
|
35
|
+
|
|
36
|
+
Identifique o que pesquisar:
|
|
37
|
+
- Se o usuário mencionou um arquivo ou módulo: use `git log --oneline -- <path>`
|
|
38
|
+
- Se mencionou um domínio: busque por commits com o nome do domínio
|
|
39
|
+
- Se é exploração geral: use `git log --oneline -30` para visão recente
|
|
40
|
+
|
|
41
|
+
Comandos somente leitura permitidos:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
git log --oneline -- <path>
|
|
45
|
+
git log --follow --stat -- <path>
|
|
46
|
+
git log -p -- <path>
|
|
47
|
+
git show --stat <hash>
|
|
48
|
+
git show <hash>
|
|
49
|
+
git log --grep="<pattern>" --oneline
|
|
50
|
+
git log --author="<name>" --oneline
|
|
51
|
+
git log --since="<date>" --oneline
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Nunca** execute comandos que modificam o repositório durante análise.
|
|
55
|
+
|
|
56
|
+
### Step 2: Extract Structure
|
|
57
|
+
|
|
58
|
+
Para cada commit relevante, extraia:
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
Commit: <hash> — <subject>
|
|
62
|
+
Scope: <domínio afetado — billing, auth, catalog, etc.>
|
|
63
|
+
Type: feat | fix | refactor | docs | test | chore | perf | security
|
|
64
|
+
Intent: <por que essa mudança foi feita>
|
|
65
|
+
Decision: <que decisão técnica foi tomada>
|
|
66
|
+
Validation: <como foi validado, se houver evidência>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Step 3: Detect Patterns
|
|
70
|
+
|
|
71
|
+
Agrupe commits por domínio e identifique:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
Recurring scopes: (quais domínios mais mudam)
|
|
75
|
+
Commit type distribution: (muitos fix? muitos refactor?)
|
|
76
|
+
Validation patterns: (testes? typecheck? lint?)
|
|
77
|
+
Decision patterns: (que tipos de decisão aparecem?)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Step 4: Produce AI Lessons
|
|
81
|
+
|
|
82
|
+
Transforme padrões em lições reutilizáveis:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
AI Lesson:
|
|
86
|
+
- Trigger: <quando aplicar este conhecimento>
|
|
87
|
+
- Avoid: <antipadrão detectado no projeto>
|
|
88
|
+
- Prefer: <padrão correto observado nos commits>
|
|
89
|
+
- Evidence: <commits que suportam esta lição>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Separe fatos de inferências.** Só declare como padrão do projeto o que tiver evidência em múltiplos commits.
|
|
93
|
+
|
|
94
|
+
### Step 5: Report
|
|
95
|
+
|
|
96
|
+
Output final deve incluir:
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
Scope: <arquivos e domínio analisados>
|
|
100
|
+
Time range: <período coberto>
|
|
101
|
+
Commits examined: <quantidade>
|
|
102
|
+
Patterns found: <padrões detectados com evidência>
|
|
103
|
+
AI Lessons: <lições extraídas>
|
|
104
|
+
Confidence: <HIGH | MEDIUM | LOW — baseado na quantidade de evidência>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Mode: WRITE
|
|
110
|
+
|
|
111
|
+
Use quando o usuário quer commitar mudanças e quer que o commit sirva como aprendizado futuro para IA.
|
|
112
|
+
|
|
113
|
+
### Step 1: Read the Diff
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git diff --staged
|
|
117
|
+
git status --short
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Se nada estiver staged, pergunte ao usuário se deve commitar tudo ou selecionar arquivos.
|
|
121
|
+
|
|
122
|
+
### Step 2: Classify the Change
|
|
123
|
+
|
|
124
|
+
Determine:
|
|
125
|
+
|
|
126
|
+
```text
|
|
127
|
+
Type: feat | fix | refactor | docs | test | chore | perf | security
|
|
128
|
+
Scope: <domínio — billing, identity, catalog, auth, infra, docs, ai, etc.>
|
|
129
|
+
Size: TRIVIAL (1 arquivo, sem decisão) | NORMAL (2-5 arquivos) | SIGNIFICANT (6+ arquivos ou decisão arquitetural)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Se a mudança for SIGNIFICANT, pergunte ao usuário se quer dividir em commits incrementais.
|
|
133
|
+
|
|
134
|
+
### Step 3: Research — Collect Context
|
|
135
|
+
|
|
136
|
+
Antes de escrever a mensagem, colete referências:
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
Existe task, spec, design doc, ADR, RFC ou issue relacionada?
|
|
140
|
+
Qual problema de negócio motivou a mudança?
|
|
141
|
+
Qual o escopo — está contido em um só domínio?
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Se não souber as respostas, pergunte ao usuário. **Nunca invente contexto.**
|
|
145
|
+
|
|
146
|
+
### Step 4: Plan — Extract Decisions
|
|
147
|
+
|
|
148
|
+
Identifique decisões técnicas que merecem registro:
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
Qual decisão técnica foi tomada?
|
|
152
|
+
Qual alternativa foi rejeitada (e por quê)?
|
|
153
|
+
Existe ADR ou RFC que documenta esta decisão?
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Nem todo commit tem decisão arquitetural. Registre apenas quando houver escolha técnica relevante para o futuro.
|
|
157
|
+
|
|
158
|
+
### Step 5: Implement — List Atomic Changes
|
|
159
|
+
|
|
160
|
+
Liste as alterações atômicas — cada item deve ser verificável no diff:
|
|
161
|
+
|
|
162
|
+
```text
|
|
163
|
+
- O que foi adicionado, modificado ou removido.
|
|
164
|
+
- Uma ação por linha.
|
|
165
|
+
- Evitar misturar domínios não relacionados.
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Step 6: Decide Template
|
|
169
|
+
|
|
170
|
+
| Size | Template |
|
|
171
|
+
|------|----------|
|
|
172
|
+
| TRIVIAL | Curto: `<type>(<scope>): <descrição precisa>` |
|
|
173
|
+
| NORMAL | Full RPI template |
|
|
174
|
+
| SIGNIFICANT | Full RPI template + consider splitting into incremental commits |
|
|
175
|
+
|
|
176
|
+
### Step 7: Write the Message — RPI Template
|
|
177
|
+
|
|
178
|
+
Template completo (use para NORMAL e SIGNIFICANT):
|
|
179
|
+
|
|
180
|
+
```text
|
|
181
|
+
<type>(<scope>): <descrição clara da mudança comportamental>
|
|
182
|
+
|
|
183
|
+
[CONTEXTO]
|
|
184
|
+
- <task, spec, design doc, RFC, ADR, issue ou referência que originou esta mudança>
|
|
185
|
+
- <problema de negócio ou técnico que motivou a mudança>
|
|
186
|
+
- <escopo — domínio afetado, compatibilidade>
|
|
187
|
+
|
|
188
|
+
[ALTERAÇÕES ATÔMICAS]
|
|
189
|
+
- <ação 1 — adicionado, modificado, removido>
|
|
190
|
+
- <ação 2>
|
|
191
|
+
- <ação N>
|
|
192
|
+
|
|
193
|
+
[DECISÕES TÉCNICAS (Mini-ADR)]
|
|
194
|
+
- <decisão tomada>
|
|
195
|
+
- <alternativa rejeitada, se relevante>
|
|
196
|
+
- <razão da escolha>
|
|
197
|
+
- <ref para ADR/RFC quando existir>
|
|
198
|
+
|
|
199
|
+
[VALIDAÇÃO]
|
|
200
|
+
- <comando executado> — <passou | falhou>
|
|
201
|
+
- <comando 2> — <passou | falhou>
|
|
202
|
+
- Se não houver teste automatizado, explicar por quê.
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
O commit ideal conecta as 4 fases do RPI:
|
|
206
|
+
|
|
207
|
+
```text
|
|
208
|
+
Research → [CONTEXTO]: de onde veio e por quê.
|
|
209
|
+
Plan → [DECISÕES TÉCNICAS]: o que foi decidido.
|
|
210
|
+
Implement → [ALTERAÇÕES ATÔMICAS]: o que foi feito.
|
|
211
|
+
Verify → [VALIDAÇÃO]: como foi comprovado.
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Step 8: Verify the Message
|
|
215
|
+
|
|
216
|
+
Antes de propor o commit, confira:
|
|
217
|
+
|
|
218
|
+
- [ ] Scope reflete o domínio correto
|
|
219
|
+
- [ ] Título descreve o comportamento, não a implementação
|
|
220
|
+
- [ ] [CONTEXTO] referencia task/spec/ADR quando existir
|
|
221
|
+
- [ ] [ALTERAÇÕES ATÔMICAS] são verificáveis no diff
|
|
222
|
+
- [ ] [DECISÕES TÉCNICAS] capturam escolhas relevantes (não genéricas)
|
|
223
|
+
- [ ] [VALIDAÇÃO] usa comandos reais com resultado binário (passou/falhou)
|
|
224
|
+
- [ ] Se não há teste, o motivo está explicado
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## RPI Commit Model
|
|
229
|
+
|
|
230
|
+
O modelo RPI (Research, Plan, Implement) + Verify garante que o histórico Git seja uma fonte completa de contexto para IA:
|
|
231
|
+
|
|
232
|
+
| Fase | Seção no Commit | Pergunta que Responde |
|
|
233
|
+
|------|----------------|----------------------|
|
|
234
|
+
| **Research** | [CONTEXTO] | De onde veio? Por quê? Qual o problema? |
|
|
235
|
+
| **Plan** | [DECISÕES TÉCNICAS (Mini-ADR)] | O que foi decidido? Qual alternativa foi rejeitada? |
|
|
236
|
+
| **Implement** | [ALTERAÇÕES ATÔMICAS] | O que foi feito exatamente? |
|
|
237
|
+
| **Verify** | [VALIDAÇÃO] | Como foi comprovado que funciona? Passou ou falhou? |
|
|
238
|
+
|
|
239
|
+
Quando uma IA futura lê `git log`, ela pode:
|
|
240
|
+
1. Usar as referências em [CONTEXTO] para buscar specs e tickets via MCP.
|
|
241
|
+
2. Usar [DECISÕES TÉCNICAS] para manter coerência arquitetural.
|
|
242
|
+
3. Usar [VALIDAÇÃO] como âncora de confiança — output binário, não julgamento subjetivo.
|
|
243
|
+
4. Usar [ALTERAÇÕES ATÔMICAS] para entender o escopo real da mudança.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Examples (PT/EN)
|
|
248
|
+
|
|
249
|
+
### Exemplo em Português
|
|
250
|
+
|
|
251
|
+
```text
|
|
252
|
+
feat(api): implementa integração com Stripe conforme task CAM-42
|
|
253
|
+
|
|
254
|
+
[CONTEXTO]
|
|
255
|
+
- Resolvida a task CAM-42 referente ao fluxo de checkout.
|
|
256
|
+
- Implementação segue a Spec em docs/specs/payments-v1.md.
|
|
257
|
+
- Vinculado ao Design Doc de Arquitetura de Pagamentos para conformidade com padrões do projeto.
|
|
258
|
+
|
|
259
|
+
[ALTERAÇÕES ATÔMICAS]
|
|
260
|
+
- Adicionado StripeService para gerenciar sessões de checkout.
|
|
261
|
+
- Criado endpoint POST /payments/create-session validado por DTO.
|
|
262
|
+
- Configurado webhook para ouvir eventos de checkout.session.completed.
|
|
263
|
+
|
|
264
|
+
[DECISÕES TÉCNICAS (Mini-ADR)]
|
|
265
|
+
- Utilizada versão 14.x do SDK do Stripe por compatibilidade com as rules do projeto.
|
|
266
|
+
- Optado por não persistir dados sensíveis localmente, delegando segurança ao Stripe conforme RFC-09.
|
|
267
|
+
|
|
268
|
+
[VALIDAÇÃO]
|
|
269
|
+
- npm test src/services/stripe.service.spec.ts — passou (8/8).
|
|
270
|
+
- curl -X POST /payments/create-session — retornou session URL (201).
|
|
271
|
+
- npm run typecheck — passou.
|
|
272
|
+
- npm run lint — passou.
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Example in English
|
|
276
|
+
|
|
277
|
+
```text
|
|
278
|
+
feat(api): implement Stripe integration per task CAM-42
|
|
279
|
+
|
|
280
|
+
[CONTEXTO]
|
|
281
|
+
- Resolves task CAM-42 for the checkout flow.
|
|
282
|
+
- Implementation follows the Spec in docs/specs/payments-v1.md.
|
|
283
|
+
- Aligned with the Payments Architecture Design Doc to ensure project standards.
|
|
284
|
+
|
|
285
|
+
[ALTERAÇÕES ATÔMICAS]
|
|
286
|
+
- Added StripeService to manage checkout sessions.
|
|
287
|
+
- Created POST /payments/create-session endpoint validated by DTO.
|
|
288
|
+
- Configured webhook to listen for checkout.session.completed events.
|
|
289
|
+
|
|
290
|
+
[DECISÕES TÉCNICAS (Mini-ADR)]
|
|
291
|
+
- Used Stripe SDK v14.x for compatibility with project rules.
|
|
292
|
+
- Chose not to persist sensitive data locally, delegating security to Stripe per RFC-09.
|
|
293
|
+
|
|
294
|
+
[VALIDAÇÃO]
|
|
295
|
+
- npm test src/services/stripe.service.spec.ts — passed (8/8).
|
|
296
|
+
- curl -X POST /payments/create-session — returned session URL (201).
|
|
297
|
+
- npm run typecheck — passed.
|
|
298
|
+
- npm run lint — passed.
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Commit Quality Rules
|
|
304
|
+
|
|
305
|
+
### Reject (peça para refinar)
|
|
306
|
+
|
|
307
|
+
```text
|
|
308
|
+
fix: ajustes
|
|
309
|
+
update
|
|
310
|
+
wip
|
|
311
|
+
cleanup
|
|
312
|
+
mudanças finais
|
|
313
|
+
refactor: melhora código
|
|
314
|
+
fix: corrige bug
|
|
315
|
+
feat: adiciona feature
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Motivo: vagos demais. Uma IA futura não consegue entender o que mudou nem por quê.
|
|
319
|
+
|
|
320
|
+
### Reject — Validation Without Binary Result
|
|
321
|
+
|
|
322
|
+
```text
|
|
323
|
+
[VALIDAÇÃO]
|
|
324
|
+
- testado manualmente
|
|
325
|
+
- parece funcionar
|
|
326
|
+
- revisão ok
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Motivo: subjetivo. IA trabalha melhor com "passou/falhou", não com julgamentos subjetivos de qualidade.
|
|
330
|
+
|
|
331
|
+
### Prefer
|
|
332
|
+
|
|
333
|
+
```text
|
|
334
|
+
fix(billing): resolve TaxOverride ausente para clientes EU
|
|
335
|
+
refactor(catalog): centraliza normalização de SKU no domínio catalog
|
|
336
|
+
feat(auth): adiciona logout OIDC com revogação de sessão
|
|
337
|
+
docs(ai): registra padrão de commits ensináveis para agentes
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Cross-Domain Changes
|
|
341
|
+
|
|
342
|
+
Se a mudança toca múltiplos domínios, avalie:
|
|
343
|
+
|
|
344
|
+
- É um rename de campo público de evento? → Um commit, scope do domínio dono, explique o impacto.
|
|
345
|
+
- São mudanças independentes em billing e catalog? → Commits separados por domínio.
|
|
346
|
+
- Não tem como separar? → Use scope mais amplo e explique o motivo.
|
|
347
|
+
|
|
348
|
+
```text
|
|
349
|
+
refactor(events): renomeia PaymentCaptured.userId para customerId
|
|
350
|
+
|
|
351
|
+
[CONTEXTO]
|
|
352
|
+
- userId era ambíguo — não deixava claro se era o usuário logado ou o cliente da transação.
|
|
353
|
+
|
|
354
|
+
[ALTERAÇÕES ATÔMICAS]
|
|
355
|
+
- Renomeado campo userId para customerId no evento PaymentCaptured.
|
|
356
|
+
- Atualizados consumidores: billing, orders, analytics.
|
|
357
|
+
|
|
358
|
+
[DECISÕES TÉCNICAS (Mini-ADR)]
|
|
359
|
+
- Campo de evento público — mudança precisa ser atômica para evitar inconsistência entre serviços.
|
|
360
|
+
|
|
361
|
+
[VALIDAÇÃO]
|
|
362
|
+
- npm test —events — passou (34/34).
|
|
363
|
+
- Publishers e consumers validados com schema registry.
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Incremental Commits
|
|
369
|
+
|
|
370
|
+
Para mudanças SIGNIFICANT, proponha sequência de commits atômicos:
|
|
371
|
+
|
|
372
|
+
```text
|
|
373
|
+
feat(auth): adiciona contrato para logout OIDC
|
|
374
|
+
feat(auth): implementa revogação de sessão local
|
|
375
|
+
feat(auth): integra redirect OIDC ao fluxo de logout
|
|
376
|
+
test(auth): cobre logout OIDC e fallback legado
|
|
377
|
+
docs(auth): registra decisão de compatibilidade com login legado
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
Cada commit deve ser autocontido e responder às 4 perguntas RPI: de onde veio, o que foi decidido, o que foi feito, como foi comprovado.
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## What Makes a Commit AI-Learnable
|
|
385
|
+
|
|
386
|
+
Um commit é útil para IA futura quando responde estas perguntas:
|
|
387
|
+
|
|
388
|
+
```text
|
|
389
|
+
De onde veio? → [CONTEXTO] — task, spec, ticket, issue.
|
|
390
|
+
O que foi decidido? → [DECISÕES TÉCNICAS] — escolha, alternativa descartada, razão.
|
|
391
|
+
O que foi feito? → [ALTERAÇÕES ATÔMICAS] — ações verificáveis no diff.
|
|
392
|
+
Como foi comprovado? → [VALIDAÇÃO] — comandos executados, resultado binário (passou/falhou).
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Se o commit não responde a maioria dessas perguntas, ele serve para humano ver diff mas não serve para IA aprender o projeto via Git.
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Error Recovery
|
|
400
|
+
|
|
401
|
+
### Nothing staged
|
|
402
|
+
|
|
403
|
+
Pergunte: "Nada staged. Quer commitar todas as mudanças ou selecionar arquivos específicos?"
|
|
404
|
+
|
|
405
|
+
### Empty diff after analysis
|
|
406
|
+
|
|
407
|
+
Reporte: "Nenhum commit encontrado para o escopo solicitado. Amplie o período ou o caminho."
|
|
408
|
+
|
|
409
|
+
### User rejects message
|
|
410
|
+
|
|
411
|
+
Ajuste com base no feedback. Pergunte qual parte não ficou clara e refine.
|
|
412
|
+
|
|
413
|
+
### Ambiguous scope
|
|
414
|
+
|
|
415
|
+
Se não conseguir determinar o domínio pelo diff, pergunte ao usuário em vez de adivinhar.
|
|
416
|
+
|
|
417
|
+
### No task/spec reference
|
|
418
|
+
|
|
419
|
+
Se não houver task ou spec associada, não invente. Use apenas o [CONTEXTO] com o problema de negócio. Se o usuário mencionar uma task, inclua.
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Integration with spec-driven
|
|
424
|
+
|
|
425
|
+
Quando spec-driven estiver ativo e um commit for gerado durante a fase BUILD:
|
|
426
|
+
- Use a spec como referência em [CONTEXTO]
|
|
427
|
+
- Use os acceptance criteria da task como base para [VALIDAÇÃO]
|
|
428
|
+
- Extraia decisões do design doc para [DECISÕES TÉCNICAS (Mini-ADR)]
|
|
429
|
+
- Inclua o ID da task na primeira linha de [CONTEXTO]
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## Further Reference
|
|
434
|
+
|
|
435
|
+
Para exemplos detalhados, anti-padrões e variações por tipo de commit (feat, fix, refactor, docs, test, perf, security), leia `references/commit-patterns.md`.
|