@vpxa/aikit 0.1.74 → 0.1.75

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.
Files changed (134) hide show
  1. package/package.json +6 -1
  2. package/packages/cli/dist/index.js +2 -2
  3. package/packages/cli/dist/{init-DQkar6Es.js → init-CuRXmyD9.js} +1 -1
  4. package/packages/cli/dist/scaffold-WMQ2uQ48.js +2 -0
  5. package/packages/cli/dist/{user-CopNWxHP.js → user-vbJwa7x2.js} +1 -1
  6. package/scaffold/dist/adapters/claude-code.mjs +4 -0
  7. package/scaffold/dist/adapters/copilot.mjs +75 -0
  8. package/scaffold/dist/adapters/flows.mjs +1 -0
  9. package/scaffold/dist/adapters/skills.mjs +1 -0
  10. package/scaffold/{compiled → dist/compiled}/flows-data.mjs +304 -446
  11. package/scaffold/{compiled → dist/compiled}/skills-data.mjs +554 -2281
  12. package/scaffold/dist/definitions/agents.mjs +9 -0
  13. package/scaffold/{definitions → dist/definitions}/bodies.mjs +6 -229
  14. package/scaffold/dist/definitions/exclusions.mjs +1 -0
  15. package/scaffold/dist/definitions/hooks.mjs +1 -0
  16. package/scaffold/dist/definitions/models.mjs +1 -0
  17. package/scaffold/dist/definitions/plugins.mjs +1 -0
  18. package/scaffold/{definitions → dist/definitions}/prompts.mjs +9 -149
  19. package/scaffold/{definitions → dist/definitions}/protocols.mjs +9 -37
  20. package/scaffold/dist/definitions/tools.mjs +1 -0
  21. package/packages/cli/dist/scaffold-ukCDW3wQ.js +0 -2
  22. package/scaffold/_preview/agents/Architect-Reviewer-Alpha.agent.md +0 -132
  23. package/scaffold/_preview/agents/Architect-Reviewer-Beta.agent.md +0 -132
  24. package/scaffold/_preview/agents/Code-Reviewer-Alpha.agent.md +0 -112
  25. package/scaffold/_preview/agents/Code-Reviewer-Beta.agent.md +0 -112
  26. package/scaffold/_preview/agents/Debugger.agent.md +0 -412
  27. package/scaffold/_preview/agents/Documenter.agent.md +0 -468
  28. package/scaffold/_preview/agents/Explorer.agent.md +0 -76
  29. package/scaffold/_preview/agents/Frontend.agent.md +0 -440
  30. package/scaffold/_preview/agents/Implementer.agent.md +0 -425
  31. package/scaffold/_preview/agents/Orchestrator.agent.md +0 -452
  32. package/scaffold/_preview/agents/Planner.agent.md +0 -481
  33. package/scaffold/_preview/agents/README.md +0 -57
  34. package/scaffold/_preview/agents/Refactor.agent.md +0 -435
  35. package/scaffold/_preview/agents/Researcher-Alpha.agent.md +0 -151
  36. package/scaffold/_preview/agents/Researcher-Beta.agent.md +0 -152
  37. package/scaffold/_preview/agents/Researcher-Delta.agent.md +0 -153
  38. package/scaffold/_preview/agents/Researcher-Gamma.agent.md +0 -152
  39. package/scaffold/_preview/agents/Security.agent.md +0 -433
  40. package/scaffold/_preview/agents/_shared/architect-reviewer-base.md +0 -104
  41. package/scaffold/_preview/agents/_shared/code-agent-base.md +0 -366
  42. package/scaffold/_preview/agents/_shared/code-reviewer-base.md +0 -87
  43. package/scaffold/_preview/agents/_shared/decision-protocol.md +0 -27
  44. package/scaffold/_preview/agents/_shared/forge-protocol.md +0 -90
  45. package/scaffold/_preview/agents/_shared/researcher-base.md +0 -114
  46. package/scaffold/_preview/agents/templates/adr-template.md +0 -28
  47. package/scaffold/_preview/agents/templates/execution-state.md +0 -26
  48. package/scaffold/_preview/flows/_epilogue/steps/docs-sync/README.md +0 -120
  49. package/scaffold/_preview/flows/aikit-advanced/README.md +0 -70
  50. package/scaffold/_preview/flows/aikit-advanced/steps/design/README.md +0 -178
  51. package/scaffold/_preview/flows/aikit-advanced/steps/execute/README.md +0 -145
  52. package/scaffold/_preview/flows/aikit-advanced/steps/plan/README.md +0 -122
  53. package/scaffold/_preview/flows/aikit-advanced/steps/spec/README.md +0 -121
  54. package/scaffold/_preview/flows/aikit-advanced/steps/task/README.md +0 -119
  55. package/scaffold/_preview/flows/aikit-advanced/steps/verify/README.md +0 -145
  56. package/scaffold/_preview/flows/aikit-basic/README.md +0 -51
  57. package/scaffold/_preview/flows/aikit-basic/steps/assess/README.md +0 -109
  58. package/scaffold/_preview/flows/aikit-basic/steps/design/README.md +0 -116
  59. package/scaffold/_preview/flows/aikit-basic/steps/implement/README.md +0 -131
  60. package/scaffold/_preview/flows/aikit-basic/steps/verify/README.md +0 -123
  61. package/scaffold/_preview/prompts/aikit-ask.prompt.md +0 -13
  62. package/scaffold/_preview/prompts/aikit-debug.prompt.md +0 -15
  63. package/scaffold/_preview/prompts/aikit-design.prompt.md +0 -15
  64. package/scaffold/_preview/prompts/aikit-flow-add.prompt.md +0 -84
  65. package/scaffold/_preview/prompts/aikit-flow-create.prompt.md +0 -80
  66. package/scaffold/_preview/prompts/aikit-flow-manage.prompt.md +0 -24
  67. package/scaffold/_preview/prompts/aikit-implement.prompt.md +0 -17
  68. package/scaffold/_preview/prompts/aikit-plan.prompt.md +0 -15
  69. package/scaffold/_preview/prompts/aikit-review.prompt.md +0 -24
  70. package/scaffold/_preview/skills/adr-skill/SKILL.md +0 -335
  71. package/scaffold/_preview/skills/adr-skill/assets/templates/adr-madr.md +0 -89
  72. package/scaffold/_preview/skills/adr-skill/assets/templates/adr-readme.md +0 -20
  73. package/scaffold/_preview/skills/adr-skill/assets/templates/adr-simple.md +0 -46
  74. package/scaffold/_preview/skills/adr-skill/references/adr-conventions.md +0 -95
  75. package/scaffold/_preview/skills/adr-skill/references/examples.md +0 -193
  76. package/scaffold/_preview/skills/adr-skill/references/review-checklist.md +0 -77
  77. package/scaffold/_preview/skills/adr-skill/references/template-variants.md +0 -52
  78. package/scaffold/_preview/skills/adr-skill/scripts/bootstrap_adr.js +0 -259
  79. package/scaffold/_preview/skills/adr-skill/scripts/new_adr.js +0 -391
  80. package/scaffold/_preview/skills/adr-skill/scripts/set_adr_status.js +0 -169
  81. package/scaffold/_preview/skills/aikit/SKILL.md +0 -754
  82. package/scaffold/_preview/skills/brainstorming/SKILL.md +0 -265
  83. package/scaffold/_preview/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
  84. package/scaffold/_preview/skills/c4-architecture/SKILL.md +0 -389
  85. package/scaffold/_preview/skills/c4-architecture/references/advanced-patterns.md +0 -552
  86. package/scaffold/_preview/skills/c4-architecture/references/c4-syntax.md +0 -510
  87. package/scaffold/_preview/skills/c4-architecture/references/common-mistakes.md +0 -437
  88. package/scaffold/_preview/skills/c4-architecture/references/html-design-system.md +0 -337
  89. package/scaffold/_preview/skills/c4-architecture/references/html-template.html +0 -627
  90. package/scaffold/_preview/skills/docs/SKILL.md +0 -553
  91. package/scaffold/_preview/skills/docs/references/diataxis-anti-patterns.md +0 -147
  92. package/scaffold/_preview/skills/docs/references/diataxis-compass.md +0 -123
  93. package/scaffold/_preview/skills/docs/references/diataxis-quadrants.md +0 -192
  94. package/scaffold/_preview/skills/docs/references/diataxis-quality.md +0 -76
  95. package/scaffold/_preview/skills/docs/references/diataxis-templates.md +0 -120
  96. package/scaffold/_preview/skills/docs/references/flow-artifacts-guide.md +0 -70
  97. package/scaffold/_preview/skills/docs/references/project-knowledge-gotchas.md +0 -32
  98. package/scaffold/_preview/skills/docs/references/project-knowledge-templates.md +0 -281
  99. package/scaffold/_preview/skills/docs/references/project-knowledge-workflow.md +0 -80
  100. package/scaffold/_preview/skills/frontend-design/SKILL.md +0 -237
  101. package/scaffold/_preview/skills/lesson-learned/SKILL.md +0 -113
  102. package/scaffold/_preview/skills/lesson-learned/references/anti-patterns.md +0 -55
  103. package/scaffold/_preview/skills/lesson-learned/references/se-principles.md +0 -109
  104. package/scaffold/_preview/skills/multi-agents-development/SKILL.md +0 -448
  105. package/scaffold/_preview/skills/multi-agents-development/architecture-review-prompt.md +0 -81
  106. package/scaffold/_preview/skills/multi-agents-development/code-quality-review-prompt.md +0 -91
  107. package/scaffold/_preview/skills/multi-agents-development/implementer-prompt.md +0 -93
  108. package/scaffold/_preview/skills/multi-agents-development/parallel-dispatch-example.md +0 -167
  109. package/scaffold/_preview/skills/multi-agents-development/spec-review-prompt.md +0 -81
  110. package/scaffold/_preview/skills/present/SKILL.md +0 -616
  111. package/scaffold/_preview/skills/react/SKILL.md +0 -309
  112. package/scaffold/_preview/skills/repo-access/SKILL.md +0 -178
  113. package/scaffold/_preview/skills/repo-access/references/error-patterns.md +0 -116
  114. package/scaffold/_preview/skills/repo-access/references/platform-matrix.md +0 -142
  115. package/scaffold/_preview/skills/requirements-clarity/SKILL.md +0 -333
  116. package/scaffold/_preview/skills/session-handoff/SKILL.md +0 -199
  117. package/scaffold/_preview/skills/session-handoff/references/handoff-template.md +0 -139
  118. package/scaffold/_preview/skills/session-handoff/references/resume-checklist.md +0 -80
  119. package/scaffold/_preview/skills/session-handoff/scripts/check_staleness.js +0 -269
  120. package/scaffold/_preview/skills/session-handoff/scripts/create_handoff.js +0 -299
  121. package/scaffold/_preview/skills/session-handoff/scripts/list_handoffs.js +0 -113
  122. package/scaffold/_preview/skills/session-handoff/scripts/validate_handoff.js +0 -241
  123. package/scaffold/_preview/skills/typescript/SKILL.md +0 -405
  124. package/scaffold/adapters/claude-code.mjs +0 -73
  125. package/scaffold/adapters/copilot.mjs +0 -292
  126. package/scaffold/adapters/flows.mjs +0 -27
  127. package/scaffold/adapters/skills.mjs +0 -25
  128. package/scaffold/definitions/agents.mjs +0 -266
  129. package/scaffold/definitions/exclusions.mjs +0 -58
  130. package/scaffold/definitions/hooks.mjs +0 -43
  131. package/scaffold/definitions/models.mjs +0 -84
  132. package/scaffold/definitions/plugins.mjs +0 -147
  133. package/scaffold/definitions/tools.mjs +0 -250
  134. package/scaffold/generate.mjs +0 -92
@@ -1,237 +0,0 @@
1
- ---
2
- name: frontend-design
3
- description: "Comprehensive frontend design system — visual design thinking, typography, color, layout, motion, accessibility, performance, and anti-pattern detection."
4
- metadata:
5
- category: domain
6
- domain: frontend
7
- applicability: on-demand
8
- inputs: [ui-requirements, codebase]
9
- outputs: [design-guidance, patterns]
10
- relatedSkills: [react]
11
- ---
12
-
13
- # Frontend Design
14
-
15
- > Comprehensive frontend design system — visual design thinking, typography, color, layout, motion, accessibility, performance, and anti-pattern detection. Synthesized from Anthropic's frontend-design skill, Vercel Web Interface Guidelines, and Impeccable design patterns.
16
-
17
- ## When to Use
18
-
19
- **MANDATORY** for the Frontend agent on every task. Also use when:
20
- - Building any UI component, page, or layout
21
- - Styling, theming, or visual design work
22
- - Reviewing UI for quality, accessibility, or design consistency
23
- - User says "make it look good", "design", "UI", "styling", "responsive", "dark mode", "animation"
24
-
25
- ## Context Gathering Protocol
26
-
27
- Before any design work, gather answers to these questions (infer from codebase if user doesn't specify):
28
-
29
- 1. **Design System** — Does one exist? Tokens, variables, component library?
30
- 2. **Brand Guidelines** — Colors, fonts, logo usage, tone?
31
- 3. **Accessibility Requirements** — WCAG level (AA default), assistive tech?
32
- 4. **Responsive Breakpoints** — Mobile-first? Specific breakpoints?
33
- 5. **Motion Preferences** — Animation budget, reduced-motion support?
34
- 6. **Content Model** — CMS, static, dynamic, i18n?
35
- 7. **Dark Mode** — Required? System preference detection?
36
- 8. **Target Platforms** — Desktop, mobile web, tablet, native?
37
-
38
- ## Design Thinking Process
39
-
40
- Follow this cycle: **Understand → Explore → Evaluate → Refine**
41
-
42
- 1. **Understand** — What is the user trying to accomplish? What are the constraints?
43
- 2. **Explore** — Generate at minimum 2-3 distinct design directions. Name each direction. Describe the aesthetic and rationale.
44
- 3. **Evaluate** — Compare against requirements, accessibility, performance, and the AI Slop Test.
45
- 4. **Refine** — Iterate on the chosen direction. Polish details.
46
-
47
- ## Typography
48
-
49
- ### Hierarchy
50
- - Use a **clear scale**: display → h1 → h2 → h3 → body → caption → overline
51
- - Maximum **3 font sizes** per viewport visible at once
52
- - Use `font-weight` to create hierarchy within same size
53
- - Line height: 1.5 for body text, 1.2-1.3 for headings
54
- - **Fluid typography**: use `clamp()` for responsive sizing — e.g., `clamp(1rem, 2.5vw, 1.5rem)`
55
-
56
- ### Rules
57
- - Never use more than 2 typeface families
58
- - Ensure minimum **16px** body text on mobile
59
- - Use `rem` for font sizes, `em` for component-relative spacing
60
- - Monospace only for code: use a dedicated code font family
61
- - Set `max-width: 65ch` on text blocks for readability
62
- - Use `text-wrap: balance` on headings, `text-wrap: pretty` on body
63
- - Provide room for **text expansion** (50%+) for i18n
64
-
65
- ## Color
66
-
67
- ### 60-30-10 Rule
68
- - **60%** — Background/surface (neutral)
69
- - **30%** — Secondary/container (brand subtle)
70
- - **10%** — Accent/CTA (brand strong)
71
-
72
- ### Systematic Color
73
- - Define colors as design tokens with semantic names: `--color-surface`, `--color-text-primary`, `--color-accent`
74
- - Every color needs **4.5:1 contrast ratio** minimum (WCAG AA) for text
75
- - Non-text elements need **3:1** minimum
76
- - Never rely on color alone to convey information — pair with icons, text, or patterns
77
- - Test with color blindness simulators
78
-
79
- ### Dark Mode
80
- - Detect system preference with `prefers-color-scheme`
81
- - Don't just invert — re-design surfaces: dark surfaces get lighter elevation, reduce saturation
82
- - Smooth transition between modes (CSS transitions on `background-color`, `color`)
83
- - Diagrams/images: consider `filter: invert(1)` or provide alternate assets
84
- - Store user preference and sync with system default
85
-
86
- ## Layout & Spacing
87
-
88
- ### Grid System
89
- - Use an **8px base grid** — all spacing is a multiple of 8 (4px for tight spaces)
90
- - CSS Grid for 2D layouts, Flexbox for 1D alignment
91
- - Consistent spacing tokens: `--space-xs: 4px`, `--space-sm: 8px`, `--space-md: 16px`, `--space-lg: 24px`, `--space-xl: 32px`, `--space-2xl: 48px`, `--space-3xl: 64px`
92
-
93
- ### Responsive Design
94
- - **Mobile-first**: design for 320px, scale up
95
- - Breakpoints: only add when the layout breaks, not at device widths
96
- - Use `container queries` for component-level responsiveness
97
- - Fluid layouts with `minmax()`, `auto-fill`, `auto-fit`
98
- - Every interactive target: minimum **44×44px** touch area (WCAG 2.5.5)
99
-
100
- ### Rules
101
- - Use consistent gutters — don't mix random padding values
102
- - Stacking: define a z-index scale (e.g., base: 0, dropdown: 100, modal: 200, toast: 300)
103
- - Avoid magic numbers — extract to named tokens
104
-
105
- ## Motion & Animation
106
-
107
- ### Principles
108
- - **Purpose before polish** — every animation must serve a purpose: orientation, feedback, continuity, or delight
109
- - **Spring physics** over linear easing — use `cubic-bezier(0.175, 0.885, 0.32, 1.275)` or spring-based libraries
110
- - Duration budget: micro-interactions **100-200ms**, transitions **200-400ms**, page transitions **300-500ms**
111
- - Never exceed **500ms** unless it's a storytelling/onboarding animation
112
-
113
- ### Performance
114
- - Animate only `transform` and `opacity` — these run on the compositor thread
115
- - Never animate `width`, `height`, `top`, `left`, `margin`, `padding` (trigger layout)
116
- - Use `will-change` sparingly and only before the animation starts
117
- - `requestAnimationFrame` for JS animations
118
-
119
- ### Accessibility
120
- - **Always respect `prefers-reduced-motion`**: reduce or remove animations when set
121
- - Layout animations: use `layout` prop (Framer Motion) or FLIP technique
122
- - Skeleton screens during loading — never an empty blank page
123
- - Skeleton loading → content: smooth fade transition, not a hard swap
124
-
125
- ### Patterns
126
- - Enter/exit transitions with stagger for lists
127
- - Shared element transitions between route changes
128
- - Micro-interactions on hover/focus: subtle scale, bg-color shift, shadow change
129
- - Pull-to-refresh, swipe gestures (mobile) with physics-based feel
130
-
131
- ## Accessibility (WCAG AA Mandatory)
132
-
133
- ### Structure
134
- - Use **semantic HTML**: `header`, `nav`, `main`, `section`, `article`, `aside`, `footer`
135
- - Every `<img>` has a meaningful `alt` (or `alt=""` for decorative)
136
- - Every form field has a visible `<label>` (not just placeholder)
137
- - Headings form a logical hierarchy (`h1` → `h2` → `h3`, no skipping)
138
-
139
- ### Keyboard Navigation
140
- - All interactive elements reachable via **Tab** key
141
- - Logical tab order (follows visual reading order)
142
- - Focus indicators: visible, high-contrast, never `outline: none` without replacement
143
- - Escape to close modals/dropdowns, Enter/Space to activate
144
- - Skip-to-content link for screen readers
145
-
146
- ### Screen Readers
147
- - ARIA labels on icons-only buttons: `aria-label="Close"`
148
- - Live regions for dynamic content: `aria-live="polite"` for updates, `"assertive"` for errors
149
- - Landmark roles if semantic HTML is insufficient
150
- - Don't use ARIA when a native HTML element works (`<button>` not `<div role="button">`)
151
-
152
- ### Testing
153
- - Tab through entire flow without mouse
154
- - Test with screen reader (NVDA, VoiceOver)
155
- - Run Lighthouse accessibility audit
156
- - Test at 200% zoom — nothing should break or overflow
157
-
158
- ## Forms
159
-
160
- - **Instant inline validation** — validate on blur, not on every keystroke
161
- - Show error messages below the field, not in an alert
162
- - Preserve user input on error — never clear a form on submit failure
163
- - **Auto-save** drafts for long forms (debounced)
164
- - Use `inputmode` for mobile: `numeric`, `email`, `tel`, `url`
165
- - Multi-step forms: show progress indicator and allow back-navigation
166
- - File uploads: drag-and-drop zone, progress indicator, file type restrictions, preview
167
- - **Optimistic UI**: show success immediately, revert on error
168
-
169
- ## Navigation & State
170
-
171
- - URL should always reflect application state (`/settings/profile` not `/settings#profile`)
172
- - Support deep linking — any URL should be shareable and land on the right view
173
- - Breadcrumbs for hierarchical navigation (3+ levels deep)
174
- - Keyboard shortcuts for power users (document them)
175
- - Browser back/forward must work correctly — don't break history
176
-
177
- ## Performance
178
-
179
- - **Virtual scroll** for lists > 100 items — don't render 10,000 DOM nodes
180
- - **Lazy load** images: use `loading="lazy"`, provide dimensions to prevent layout shift
181
- - **Prefetch** next-likely routes on hover/viewport intersection
182
- - **Code split** by route — each page only loads its own JavaScript
183
- - **Edge rendering** — render at the CDN edge when possible (SSR, RSC)
184
- - Optimize images: use `<picture>` with WebP/AVIF + fallback
185
- - Font loading: `font-display: swap`, preload critical fonts
186
- - Target LCP < 2.5s, INP < 200ms, CLS < 0.1
187
-
188
- ## Error Handling
189
-
190
- - **Graceful degradation** — partial failures shouldn't crash the entire page
191
- - Show retry buttons on transient errors
192
- - Offline indicator when network is lost
193
- - Clear error messages: what happened, what the user can do about it
194
- - Error boundaries in React: catch rendering errors, show fallback UI
195
- - Never show raw error messages, stack traces, or error codes to users
196
-
197
- ## SSR & Hydration
198
-
199
- - Prevent hydration mismatches: no `Date.now()`, `Math.random()`, `window` in server render
200
- - Use streaming SSR for faster TTFB
201
- - Optimistic mutations: update UI before server confirms
202
- - Handle loading states with Suspense boundaries
203
-
204
- ## Internationalization (i18n)
205
-
206
- - **RTL support**: use logical properties (`margin-inline-start` not `margin-left`)
207
- - Format dates/numbers/currencies locale-aware — never hardcode formats
208
- - Text expansion room: German/French can be 50%+ longer than English
209
- - Unicode support: test with CJK, Arabic, emoji
210
- - Externalize all user-visible strings
211
-
212
- ## AI Slop Test — MANDATORY CHECK
213
-
214
- Before shipping ANY design, verify it does NOT have these AI-generated tells:
215
-
216
- | AI Slop Pattern | What to check |
217
- |-----------------|---------------|
218
- | Centered hero + gradient blob | Does it look like every AI demo landing page? ADD ASYMMETRY |
219
- | Lowercase geometric sans headings | Add personality: case choices, weight variation, size contrast |
220
- | Purple-to-blue gradient | If using gradients, use brand-specific or creative color stops |
221
- | Uniform card grid with icon + heading + text | Vary card sizes, add imagery, break the grid |
222
- | Stock illustration style | Use real photos, custom illustrations, or no imagery |
223
- | "Modern SaaS template" look | Add something unexpected: editorial layout, bold typography, color blocking |
224
- | Generic placeholder copy | Real content or clearly marked FPO (For Placement Only) |
225
- | Identical padding everywhere | Vary rhythm — tight grouping inside sections, generous between |
226
- | No texture or depth | Add subtle noise, shadows, borders, layering |
227
- | Perfectly symmetrical everything | Break symmetry deliberately — offset grids, varied alignments |
228
-
229
- If 3+ items match → **STOP and redesign**. The goal is distinctive, not generic.
230
-
231
- ## Implementation Principles
232
-
233
- 1. **Design tokens before code** — define variables/tokens first, then use them everywhere
234
- 2. **Component boundaries** — each component owns its internal layout, parent owns its placement
235
- 3. **Progressive enhancement** — works without JS, enhanced with JS
236
- 4. **Content-first** — design with real content, not lorem ipsum
237
- 5. **Test in context** — view components inside the actual page, not just in isolation
@@ -1,113 +0,0 @@
1
- ---
2
- name: lesson-learned
3
- description: "Analyze recent code changes via git history and extract software engineering lessons. Use when the user asks 'what is the lesson here?', 'what can I learn from this?', 'engineering takeaway', 'what did I just learn?', 'reflect on this code', or wants to extract principles from recent work."
4
- metadata:
5
- category: cross-cutting
6
- domain: general
7
- applicability: on-demand
8
- inputs: [git-history, code-changes]
9
- outputs: [engineering-lessons]
10
- requires: [aikit]
11
- relatedSkills: [session-handoff]
12
- ---
13
-
14
- # Lesson Learned
15
-
16
- Extract specific, grounded software engineering lessons from actual code changes. Not a lecture -- a mirror. Show the user what their code already demonstrates.
17
-
18
- ## Before You Begin
19
-
20
- **Load the principles reference first.**
21
-
22
- 1. Read `references/se-principles.md` to have the principle catalog available
23
- 2. Optionally read `references/anti-patterns.md` if you suspect the changes include areas for improvement
24
- 3. Determine the scope of analysis (see Phase 1)
25
-
26
- **Do not proceed until you've loaded at least `se-principles.md`.**
27
-
28
- ## Phase 1: Determine Scope
29
-
30
- Ask the user or infer from context what to analyze.
31
-
32
- | Scope | Git Commands | When to Use |
33
- |-------|-------------|-------------|
34
- | Feature branch | `git log main..HEAD --oneline` + `git diff main...HEAD` | User is on a non-main branch (default) |
35
- | Last N commits | `git log --oneline -N` + `git diff HEAD~N..HEAD` | User specifies a range, or on main (default N=5) |
36
- | Specific commit | `git show <sha>` | User references a specific commit |
37
- | Working changes | `git diff` + `git diff --cached` | User says "what about these changes?" before committing |
38
-
39
- **Default behavior:**
40
- - If on a feature branch: analyze branch commits vs main
41
- - If on main: analyze the last 5 commits
42
- - If the user provides a different scope, use that
43
-
44
- ## Phase 2: Gather Changes
45
-
46
- 1. Run `git log` with the determined scope to get the commit list and messages
47
- 2. Run `git diff` for the full diff of the scope
48
- 3. If the diff is large (>500 lines), use `git diff --stat` first, then selectively read the top 3-5 most-changed files
49
- 4. **Read commit messages carefully** -- they contain intent that raw diffs miss
50
- 5. Only read changed files. Do not read the entire repo.
51
-
52
- ## Phase 3: Analyze
53
-
54
- Identify the **dominant pattern** -- the single most instructive thing about these changes.
55
-
56
- Look for:
57
- - **Structural decisions** -- How was the code organized? Why those boundaries?
58
- - **Trade-offs made** -- What was gained vs. sacrificed? (readability vs. performance, DRY vs. clarity, speed vs. correctness)
59
- - **Problems solved** -- What was the before/after? What made the "after" better?
60
- - **Missed opportunities** -- Where could the code improve? (present gently as "next time, consider...")
61
-
62
- Map findings to specific principles from `references/se-principles.md`. Be specific -- quote actual code, reference actual file names and line changes.
63
-
64
- ## Phase 4: Present the Lesson
65
-
66
- Use this template:
67
-
68
- ```markdown
69
- ## Lesson: [Principle Name]
70
-
71
- **What happened in the code:**
72
- [2-3 sentences describing the specific change, referencing files and commits]
73
-
74
- **The principle at work:**
75
- [1-2 sentences explaining the SE principle]
76
-
77
- **Why it matters:**
78
- [1-2 sentences on the practical consequence -- what would go wrong without this, or what goes right because of it]
79
-
80
- **Takeaway for next time:**
81
- [One concrete, actionable sentence the user can apply to future work]
82
- ```
83
-
84
- If there is a second lesson worth noting (maximum 2 additional):
85
-
86
- ```markdown
87
- ---
88
-
89
- ### Also worth noting: [Principle Name]
90
-
91
- **In the code:** [1 sentence]
92
- **The principle:** [1 sentence]
93
- **Takeaway:** [1 sentence]
94
- ```
95
-
96
- ## What NOT to Do
97
-
98
- | Avoid | Why | Instead |
99
- |-------|-----|---------|
100
- | Listing every principle that vaguely applies | Overwhelming and generic | Pick the 1-2 most relevant |
101
- | Analyzing files that were not changed | Scope creep | Stick to the diff |
102
- | Ignoring commit messages | They contain intent that diffs miss | Read them as primary context |
103
- | Abstract advice disconnected from the code | Not actionable | Always reference specific files/lines |
104
- | Negative-only feedback | Demoralizing | Lead with what works, then suggest improvements |
105
- | More than 3 lessons | Dilutes the insight | One well-grounded lesson beats seven vague ones |
106
-
107
- ## Conversation Style
108
-
109
- - **Reflective, not prescriptive.** Use the user's own code as primary evidence.
110
- - **Never say "you should have..."** -- instead use "the approach here shows..." or "next time you face this, consider..."
111
- - **If the code is good, say so.** Not every lesson is about what went wrong. Recognizing good patterns reinforces them.
112
- - **If the changes are trivial** (a single config tweak, a typo fix), say so honestly rather than forcing a lesson. "These changes are straightforward -- no deep lesson here, just good housekeeping."
113
- - **Be specific.** Generic advice is worthless. Every claim must point to a concrete code change.
@@ -1,55 +0,0 @@
1
- ---
2
- description: Common anti-patterns to detect in code diffs. Use alongside se-principles.md for balanced analysis -- principles show what's good, anti-patterns show what to watch for.
3
- ---
4
-
5
- # Anti-Patterns
6
-
7
- When analyzing a diff, check for these signals. Present findings gently -- as opportunities, not failures.
8
-
9
- ## God Object / God Class
10
-
11
- One module doing too much.
12
- **Diff signals:** A single file with many unrelated changes. One class/module imported everywhere. A file over 500 lines that keeps growing.
13
- **Suggest:** Extract responsibilities into focused modules (SRP).
14
-
15
- ## Shotgun Surgery
16
-
17
- One logical change scattered across many files.
18
- **Diff signals:** 10+ files changed for a single feature or fix. The same type of edit repeated in many places. A rename or config change touching dozens of files.
19
- **Suggest:** Consolidate the scattered logic. If one change requires editing many files, the abstraction boundaries may be wrong.
20
-
21
- ## Feature Envy
22
-
23
- A function that uses another module's data more than its own.
24
- **Diff signals:** Heavy cross-module imports. A function reaching deep into another object's properties. Utility functions that only serve one caller in a different module.
25
- **Suggest:** Move the function closer to the data it uses.
26
-
27
- ## Premature Abstraction
28
-
29
- Abstracting before there are multiple concrete cases.
30
- **Diff signals:** An interface with exactly one implementation. A factory that creates only one type. A generic solution for a problem that exists only once.
31
- **Suggest:** Wait for the second or third use case before abstracting (Rule of Three).
32
-
33
- ## Copy-Paste Programming
34
-
35
- Duplicated code blocks with minor variations.
36
- **Diff signals:** Similar code appearing in multiple places in the diff. Functions that differ by only a parameter or two. Repeated patterns that could be parameterized.
37
- **Suggest:** Extract shared logic, parameterize the differences.
38
-
39
- ## Magic Numbers / Strings
40
-
41
- Literal values without explanation.
42
- **Diff signals:** Hardcoded numbers in conditions (`if (retries > 3)`). String literals used as keys or identifiers. Timeouts, limits, or thresholds without named constants.
43
- **Suggest:** Extract to named constants that explain the "why."
44
-
45
- ## Long Method
46
-
47
- Functions that do too much.
48
- **Diff signals:** New functions over 40-50 lines. Functions with multiple levels of nesting. Functions that require scrolling to read.
49
- **Suggest:** Extract sub-steps into named functions. Each function should do one thing.
50
-
51
- ## Excessive Comments
52
-
53
- Comments explaining "what" instead of "why."
54
- **Diff signals:** Comments restating the code (`// increment counter`). Large comment blocks before straightforward code. Commented-out code left in place.
55
- **Suggest:** Make the code self-documenting through better naming. Use comments only for "why" -- intent, trade-offs, non-obvious constraints.
@@ -1,109 +0,0 @@
1
- ---
2
- description: Curated catalog of software engineering principles. Load this before analyzing code changes so you can map observations to named principles.
3
- ---
4
-
5
- # Software Engineering Principles
6
-
7
- Use this as a lookup table. When you spot a pattern in a diff, find the matching principle here. Each entry includes **code signals** -- what to look for in actual changes.
8
-
9
- ## Design Principles (SOLID)
10
-
11
- **Single Responsibility Principle (SRP)**
12
- A module should have one reason to change.
13
- Code signals: A class/file was split into two. A function was extracted. A component stopped handling both UI and data fetching.
14
-
15
- **Open/Closed Principle (OCP)**
16
- Open for extension, closed for modification.
17
- Code signals: New behavior added without changing existing code. A plugin/hook/callback system introduced. Strategy pattern or configuration used instead of conditionals.
18
-
19
- **Liskov Substitution Principle (LSP)**
20
- Subtypes must be substitutable for their base types.
21
- Code signals: An interface was introduced to unify implementations. A subclass override changed behavior in a way that broke callers (violation). Type narrowing or guards added.
22
-
23
- **Interface Segregation Principle (ISP)**
24
- No client should depend on methods it doesn't use.
25
- Code signals: A large interface was split into smaller ones. Optional methods removed from an interface. A "fat" props object was broken into focused ones.
26
-
27
- **Dependency Inversion Principle (DIP)**
28
- Depend on abstractions, not concretions.
29
- Code signals: A concrete dependency replaced with an interface/injection. A factory or provider pattern introduced. Import paths changed from specific implementations to abstract layers.
30
-
31
- **Composition over Inheritance**
32
- Favor object composition over class inheritance.
33
- Code signals: Inheritance hierarchy replaced with delegation. Mixins or HOCs replaced with hooks or composition. A "base class" was removed.
34
-
35
- ## Simplicity Principles
36
-
37
- **DRY (Don't Repeat Yourself)**
38
- Every piece of knowledge should have a single representation.
39
- Code signals: Duplicate code extracted into a shared function. A constant replaced repeated literals. A template/generator replaced copy-pasted boilerplate.
40
-
41
- **KISS (Keep It Simple, Stupid)**
42
- The simplest solution that works is the best.
43
- Code signals: A complex abstraction replaced with a straightforward implementation. Unnecessary indirection removed. A clever one-liner replaced with readable code.
44
-
45
- **YAGNI (You Aren't Gonna Need It)**
46
- Don't build it until you actually need it.
47
- Code signals: Speculative features removed. Unused configuration options deleted. An over-engineered solution simplified to match actual requirements.
48
-
49
- **Rule of Three**
50
- Wait until the third duplication before abstracting.
51
- Code signals: Similar code exists in 2 places and was left alone (good). A premature abstraction was introduced after only one use (violation). Third occurrence triggered extraction (textbook application).
52
-
53
- **Principle of Least Surprise**
54
- Code should behave the way most users would expect.
55
- Code signals: A function renamed to better describe what it does. Return types made consistent. Side effects made explicit or removed.
56
-
57
- ## Structural Principles
58
-
59
- **Separation of Concerns**
60
- Different responsibilities should live in different modules.
61
- Code signals: Business logic extracted from UI components. Data access separated from domain logic. Configuration separated from behavior. A "god file" split into focused modules.
62
-
63
- **High Cohesion**
64
- Related functionality should live together.
65
- Code signals: Scattered related functions gathered into one module. A utility file broken up so each piece lives near its consumers. A feature folder created.
66
-
67
- **Loose Coupling**
68
- Modules should depend on each other as little as possible.
69
- Code signals: Direct imports replaced with events/callbacks. A shared dependency removed. Modules communicate through well-defined interfaces instead of reaching into internals.
70
-
71
- **Encapsulation**
72
- Hide internal details, expose only what's necessary.
73
- Code signals: Public methods reduced. Internal helpers made private. A module's API surface shrunk. Implementation details hidden behind a facade.
74
-
75
- **Information Hiding**
76
- Modules should not expose their internal data structures.
77
- Code signals: Raw data structures wrapped in accessor methods. Internal state made private. A data transformation moved inside the module that owns the data.
78
-
79
- ## Pragmatic Principles
80
-
81
- **Boy Scout Rule**
82
- Leave the code better than you found it.
83
- Code signals: Small cleanups alongside a feature change. A renamed variable for clarity. A dead code path removed. An outdated comment updated.
84
-
85
- **Fail Fast**
86
- Detect and report errors as early as possible.
87
- Code signals: Input validation added at entry points. Assertions added for invariants. Early returns replacing deep nesting. Error handling moved closer to the source.
88
-
89
- **Defensive Programming**
90
- Anticipate and handle unexpected inputs gracefully.
91
- Code signals: Null checks added. Default values provided. Edge cases handled. Error boundaries introduced.
92
-
93
- **Premature Optimization (avoiding it)**
94
- Don't optimize until you've measured.
95
- Code signals: A simple implementation chosen over a "faster" complex one. Readability prioritized over micro-performance. A profiling step added before optimization work.
96
-
97
- ## Refactoring Patterns
98
-
99
- **Extract Method/Function**
100
- Code signals: A long function split into named sub-functions. Inline logic replaced with a well-named call.
101
-
102
- **Extract Class/Module**
103
- Code signals: A file split into multiple files. A class split into two with distinct responsibilities.
104
-
105
- **Replace Conditional with Polymorphism**
106
- Code signals: A switch/if-else chain replaced with a strategy pattern or subclass dispatch. A type map introduced.
107
-
108
- **Introduce Parameter Object**
109
- Code signals: Multiple related parameters grouped into a single options/config object. Function signatures simplified.