@jmylchreest/aide-plugin 0.0.24 → 0.0.26

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.
@@ -0,0 +1,240 @@
1
+ ---
2
+ name: implement
3
+ description: TDD implementation - make failing tests pass
4
+ triggers:
5
+ - implement this
6
+ - implement the
7
+ - make tests pass
8
+ - dev stage
9
+ - development stage
10
+ ---
11
+
12
+ # Implement Mode
13
+
14
+ **Recommended model tier:** smart (opus) - this skill requires complex reasoning
15
+
16
+ Focused TDD implementation: make failing tests pass with minimal code.
17
+
18
+ ## Purpose
19
+
20
+ This is the DEV stage of the SDLC pipeline. Tests already exist from the TEST stage. Your job is to write the minimal implementation that makes them pass.
21
+
22
+ ## Prerequisites
23
+
24
+ Before starting:
25
+ - Tests exist and are failing (from TEST stage)
26
+ - Design/spec is available (from DESIGN stage)
27
+ - You know which files to create/modify
28
+
29
+ ## Workflow
30
+
31
+ ### Step 1: Verify Tests Exist and Fail
32
+
33
+ ```bash
34
+ # Run the tests - they MUST fail initially
35
+ npm test -- path/to/feature.test.ts
36
+ # or
37
+ go test ./pkg/feature/...
38
+ ```
39
+
40
+ **If tests pass**: The work is already done. Mark complete and move on.
41
+
42
+ **If tests don't exist**: This is wrong - go back to TEST stage.
43
+
44
+ ### Step 2: Read the Tests
45
+
46
+ Understand what the tests expect:
47
+ - What functions/methods need to exist?
48
+ - What are the expected inputs and outputs?
49
+ - What edge cases are covered?
50
+
51
+ ```bash
52
+ # Read the test file
53
+ Read path/to/feature.test.ts
54
+ ```
55
+
56
+ ### Step 3: Check Design Decisions
57
+
58
+ Use `mcp__plugin_aide_aide__decision_get` with the feature topic to review decisions from DESIGN stage.
59
+ Use `mcp__plugin_aide_aide__decision_list` to see all project decisions.
60
+
61
+ ### Step 4: Implement Incrementally
62
+
63
+ Write code to make tests pass **one at a time**:
64
+
65
+ 1. Pick the simplest failing test
66
+ 2. Write minimal code to pass it
67
+ 3. Run tests
68
+ 4. If passing, move to next test
69
+ 5. If failing, fix before proceeding
70
+
71
+ ```bash
72
+ # Run specific test
73
+ npm test -- --grep "should create user"
74
+ # or
75
+ go test -run TestCreateUser ./pkg/...
76
+ ```
77
+
78
+ ### Step 5: Backpressure Checkpoint (REQUIRED)
79
+
80
+ **You CANNOT proceed until ALL tests pass.**
81
+
82
+ ```bash
83
+ # Full test run
84
+ npm test -- path/to/feature.test.ts
85
+ # or
86
+ go test -v ./pkg/feature/...
87
+ ```
88
+
89
+ **BLOCKING RULE**: If any test fails:
90
+ 1. Analyze the failure
91
+ 2. Fix the issue
92
+ 3. Re-run tests
93
+ 4. Repeat until ALL pass
94
+
95
+ **DO NOT skip failing tests. DO NOT proceed with red tests.**
96
+
97
+ ### Step 6: Verify Build
98
+
99
+ ```bash
100
+ # Ensure it compiles
101
+ npm run build
102
+ # or
103
+ go build ./...
104
+ ```
105
+
106
+ ### Step 7: Commit
107
+
108
+ ```bash
109
+ git add -A
110
+ git commit -m "feat: implement <feature> - tests passing"
111
+ ```
112
+
113
+ ## Rules
114
+
115
+ 1. **Tests First**: Never write code without a failing test
116
+ 2. **Minimal Code**: Only write what's needed to pass tests
117
+ 3. **No Gold Plating**: Don't add features not covered by tests
118
+ 4. **Red → Green**: Tests must fail before they pass
119
+ 5. **Atomic Commits**: One logical change per commit
120
+ 6. **No Skipping**: Every test must pass
121
+
122
+ ## Common Patterns
123
+
124
+ ### TypeScript/JavaScript
125
+
126
+ ```typescript
127
+ // Read test expectations
128
+ describe('UserService', () => {
129
+ it('should create user with email and name', async () => {
130
+ const user = await service.createUser({ email: 'test@example.com', name: 'Test' });
131
+ expect(user.id).toBeDefined();
132
+ expect(user.email).toBe('test@example.com');
133
+ });
134
+ });
135
+
136
+ // Implement to match
137
+ export class UserService {
138
+ async createUser(input: CreateUserInput): Promise<User> {
139
+ return {
140
+ id: crypto.randomUUID(),
141
+ email: input.email,
142
+ name: input.name,
143
+ createdAt: new Date(),
144
+ };
145
+ }
146
+ }
147
+ ```
148
+
149
+ ### Go
150
+
151
+ ```go
152
+ // Read test expectations
153
+ func TestCreateUser(t *testing.T) {
154
+ svc := NewUserService()
155
+ user, err := svc.CreateUser(context.Background(), CreateUserInput{
156
+ Email: "test@example.com",
157
+ Name: "Test",
158
+ })
159
+ require.NoError(t, err)
160
+ assert.NotEmpty(t, user.ID)
161
+ assert.Equal(t, "test@example.com", user.Email)
162
+ }
163
+
164
+ // Implement to match
165
+ func (s *UserService) CreateUser(ctx context.Context, input CreateUserInput) (*User, error) {
166
+ return &User{
167
+ ID: uuid.New().String(),
168
+ Email: input.Email,
169
+ Name: input.Name,
170
+ CreatedAt: time.Now(),
171
+ }, nil
172
+ }
173
+ ```
174
+
175
+ ## Failure Handling
176
+
177
+ ### Test Won't Pass After Multiple Attempts
178
+
179
+ 1. Re-read the test - is the expectation correct?
180
+ 2. Check if test has a bug (it happens)
181
+ 3. Check design decisions - is implementation matching spec?
182
+ 4. Record blocker:
183
+ ```bash
184
+ aide memory add --category=blocker "Cannot pass test X: <reason>"
185
+ ```
186
+ 5. If stuck after 3 attempts, ask for help
187
+
188
+ ### Build Fails
189
+
190
+ 1. Read error message carefully
191
+ 2. Check for missing imports
192
+ 3. Check for type mismatches
193
+ 4. Fix and re-run build
194
+ 5. Then re-run tests
195
+
196
+ ### Test Passes But Implementation Feels Wrong
197
+
198
+ 1. If tests pass, the contract is met
199
+ 2. Don't refactor during implement stage
200
+ 3. Note concerns for future:
201
+ ```bash
202
+ aide memory add --category=issue "Implementation of X could be improved: <how>"
203
+ ```
204
+ 4. Proceed - refactoring is a separate concern
205
+
206
+ ## Verification Checklist
207
+
208
+ Before completing:
209
+ - [ ] All tests pass (not just some)
210
+ - [ ] Build succeeds
211
+ - [ ] Changes are committed
212
+ - [ ] No debug code left (console.log, fmt.Println for debugging)
213
+
214
+ ## Completion
215
+
216
+ When all tests pass:
217
+
218
+ ```bash
219
+ # Final verification
220
+ npm test -- path/to/feature.test.ts && npm run build
221
+
222
+ # Or Go
223
+ go test -v ./pkg/feature/... && go build ./...
224
+ ```
225
+
226
+ Output: "Implementation complete. All tests passing. Ready for VERIFY stage."
227
+
228
+ ## Integration with SDLC Pipeline
229
+
230
+ This skill is designed for the DEV stage:
231
+
232
+ ```
233
+ [DESIGN] → [TEST] → [DEV/IMPLEMENT] → [VERIFY] → [DOCS]
234
+
235
+ YOU ARE HERE
236
+ ```
237
+
238
+ - **Input**: Failing tests from TEST stage
239
+ - **Output**: Passing tests, working implementation
240
+ - **Next**: VERIFY stage runs full validation
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: memorise
3
+ description: Capture key learnings, patterns, gotchas, or context as persistent memories
4
+ triggers:
5
+ - remember this
6
+ - remember that
7
+ - dont forget
8
+ - memorise
9
+ - note that
10
+ - note this
11
+ - save this
12
+ - store this
13
+ - for future
14
+ - keep in mind
15
+ allowed-tools: Bash(aide memory add *)
16
+ ---
17
+
18
+ # Memorise
19
+
20
+ **Recommended model tier:** balanced (sonnet) - this skill performs straightforward operations
21
+
22
+ Capture important information for future sessions by storing it in the aide memory database.
23
+
24
+ ## How to Store
25
+
26
+ Use the `aide memory add` CLI command via Bash:
27
+
28
+ ```bash
29
+ aide memory add --category=<category> --tags=<comma,separated,tags> "<content>"
30
+ ```
31
+
32
+ ## Categories
33
+
34
+ - `learning` - Something discovered about the codebase or tools
35
+ - `decision` - An architectural or design choice made
36
+ - `session` - Summary of a work session
37
+ - `pattern` - A reusable approach or pattern identified
38
+ - `gotcha` - A pitfall or issue to avoid in future
39
+
40
+ ## When to Use
41
+
42
+ - End of a significant task or session
43
+ - After discovering something important about the codebase
44
+ - When a decision is made that should persist
45
+ - After solving a tricky problem (capture the solution)
46
+ - When user shares a preference or important information
47
+
48
+ ## Examples
49
+
50
+ ### Simple preference (global - injected at session start)
51
+ ```bash
52
+ aide memory add --category=learning --tags=preferences,colour,scope:global "User's favourite colour is blue"
53
+ ```
54
+
55
+ ### Technical learning (project-specific)
56
+ ```bash
57
+ aide memory add --category=learning --tags=testing,vitest,project:myapp,session:abc12345 "Vitest requires .js extensions for ESM imports even for .ts files. Configure moduleResolution: NodeNext in tsconfig."
58
+ ```
59
+
60
+ ### Session summary
61
+ ```bash
62
+ aide memory add --category=session --tags=auth,api,project:myapp,session:abc12345 "Implemented JWT auth with 15min access tokens, 7day refresh tokens in httpOnly cookies. Files: src/auth/jwt.ts, src/middleware/auth.ts, src/routes/auth.ts"
63
+ ```
64
+
65
+ ### Gotcha (global - applies everywhere)
66
+ ```bash
67
+ aide memory add --category=gotcha --tags=hooks,claude-code,scope:global "Hooks must not write to stderr - Claude Code interprets any stderr as error. Debug logging must go to files only."
68
+ ```
69
+
70
+ ## Instructions
71
+
72
+ When the user invokes `/aide:memorise <something>`:
73
+
74
+ 1. Parse what they want to remember
75
+ 2. Determine the scope:
76
+ - **User preference** (colour, style, etc.) → add `scope:global`
77
+ - **Project-specific learning** → add `project:<project-name>,session:${CLAUDE_SESSION_ID:0:8}`
78
+ - **Session summary** → add `project:<project-name>,session:${CLAUDE_SESSION_ID:0:8}`
79
+ 3. Choose appropriate category and descriptive tags
80
+ 4. Format the content concisely but completely
81
+ 5. Call `aide memory add` via Bash to store it
82
+ 6. **Verify success** - check exit code is 0 and output contains the memory ID
83
+ 7. Confirm what was stored
84
+
85
+ Keep content concise - aim for 1-3 sentences unless it's a complex session summary.
86
+
87
+ ## Failure Handling
88
+
89
+ If `aide memory add` fails:
90
+
91
+ 1. **Check error message** - common issues:
92
+ - Database not accessible: ensure aide MCP server is running
93
+ - Invalid category: use one of `learning`, `decision`, `session`, `pattern`, `gotcha`
94
+ - Empty content: content must be non-empty
95
+
96
+ 2. **Retry with fixes** if the issue is correctable
97
+
98
+ 3. **Report failure** if unable to store:
99
+ ```
100
+ Failed to store memory: <error details>
101
+ Please check aide MCP server status.
102
+ ```
103
+
104
+ ## Verification
105
+
106
+ A successful memory add returns:
107
+ ```
108
+ Added memory: <ULID>
109
+ ```
110
+
111
+ You can verify by searching for the memory:
112
+ ```bash
113
+ aide memory search "<key term from content>" --limit=1
114
+ ```
115
+
116
+ ## Scope Tags
117
+
118
+ Use scope tags to control when memories are injected:
119
+
120
+ | Tag | When to Use | Injection |
121
+ |-----|-------------|-----------|
122
+ | `scope:global` | User preferences, universal learnings | Every session |
123
+ | `project:<name>` | Project-specific learnings | Sessions in that project |
124
+ | `session:<id>` | Context for this work session | Recent session injection |
125
+
126
+ ### Tagging Rules
127
+
128
+ - **User preferences** (favourite colour, coding style): Always add `scope:global`
129
+ - **Project learnings** (API patterns, testing approach): Add `project:<name>,session:<id>`
130
+ - **Session summaries**: Add `project:<name>,session:<id>` with `category=session`
131
+
132
+ Get the project name from the git remote or directory name. Session ID is available as `$CLAUDE_SESSION_ID` (use first 8 chars).
133
+
134
+ ## For Swarm/Multi-Agent
135
+
136
+ Add agent context to tags:
137
+ ```bash
138
+ aide memory add --category=session --tags=swarm,agent:main "Overall task outcome..."
139
+ ```
@@ -0,0 +1,305 @@
1
+ ---
2
+ name: perf
3
+ description: Performance analysis and optimization workflow
4
+ triggers:
5
+ - "optimize"
6
+ - "performance"
7
+ - "slow"
8
+ - "too slow"
9
+ - "speed up"
10
+ - "make faster"
11
+ ---
12
+
13
+ # Performance Mode
14
+
15
+ **Recommended model tier:** smart (opus) - this skill requires complex reasoning
16
+
17
+ Systematic approach to identifying and fixing performance issues.
18
+
19
+ ## Prerequisites
20
+
21
+ Before starting:
22
+ - Identify the specific operation or endpoint that is slow
23
+ - Understand what "fast enough" means (target latency, throughput)
24
+ - Ensure you can measure performance reproducibly
25
+
26
+ ## Workflow
27
+
28
+ ### Step 1: Establish Baseline Measurement
29
+
30
+ **Never optimize without data.** Measure current performance:
31
+
32
+ ```bash
33
+ # Node.js - simple timing
34
+ time node script.js
35
+
36
+ # Node.js - CPU profiling
37
+ node --cpu-prof script.js
38
+ # Creates CPU.*.cpuprofile - analyze in Chrome DevTools
39
+
40
+ # Go - benchmarks
41
+ go test -bench=. -benchmem ./...
42
+
43
+ # API endpoint
44
+ curl -w "@curl-format.txt" -o /dev/null -s "http://localhost:3000/api/endpoint"
45
+ ```
46
+
47
+ **Record baseline metrics:**
48
+ - Execution time (p50, p95, p99 if available)
49
+ - Memory usage
50
+ - Number of operations per second
51
+ - Number of I/O operations
52
+
53
+ ### Step 2: Identify Hotspots
54
+
55
+ Find where time is being spent:
56
+
57
+ ```bash
58
+ # Node.js profiling
59
+ node --cpu-prof app.js
60
+ # Then load .cpuprofile in Chrome DevTools > Performance
61
+
62
+ # Go profiling
63
+ go test -cpuprofile=cpu.prof -bench=.
64
+ go tool pprof -http=:8080 cpu.prof
65
+ ```
66
+
67
+ ```
68
+ # Search for common expensive patterns
69
+ mcp__plugin_aide_aide__code_search query="forEach" kind="function"
70
+ mcp__plugin_aide_aide__code_search query="map" kind="function"
71
+
72
+ # Find database queries
73
+ Grep for "SELECT", "find(", "query("
74
+
75
+ # Find network calls
76
+ Grep for "fetch", "axios", "http.Get"
77
+ ```
78
+
79
+ ### Step 3: Analyze Performance Patterns
80
+
81
+ Look for these common issues:
82
+
83
+ | Issue | Pattern | Solution |
84
+ |-------|---------|----------|
85
+ | N+1 queries | Loop containing DB call | Batch/eager load |
86
+ | Repeated computation | Same calculation in loop | Memoize/cache |
87
+ | Large allocations | Creating objects in loop | Reuse/pool objects |
88
+ | Blocking I/O | Sync file/network ops | Make async/concurrent |
89
+ | Missing indexes | Slow DB queries | Add database indexes |
90
+ | Unnecessary work | Processing unused data | Filter/skip early |
91
+ | Serial execution | Sequential independent ops | Parallelize |
92
+
93
+ ### Step 4: Apply Optimizations
94
+
95
+ **Priority order (highest impact first):**
96
+
97
+ 1. **Algorithmic improvements** - O(n^2) -> O(n log n)
98
+ 2. **Reduce I/O** - Batch requests, add caching
99
+ 3. **Parallelize** - Concurrent operations
100
+ 4. **Reduce allocations** - Reuse objects, pre-allocate
101
+ 5. **Micro-optimizations** - Only as last resort
102
+
103
+ **Make one optimization at a time and measure after each.**
104
+
105
+ ### Step 5: Measure After Each Change
106
+
107
+ ```bash
108
+ # Same measurement as baseline
109
+ time node script.js
110
+ go test -bench=. -benchmem ./...
111
+ ```
112
+
113
+ Compare:
114
+ - Did the metric improve?
115
+ - By how much (percentage)?
116
+ - Any negative side effects?
117
+
118
+ **If no improvement:** Revert and try different approach.
119
+
120
+ ### Step 6: Verify No Regressions
121
+
122
+ ```bash
123
+ # Run all tests
124
+ npm test
125
+ go test ./...
126
+
127
+ # Check for correctness
128
+ # Ensure output is still correct after optimization
129
+ ```
130
+
131
+ ## Failure Handling
132
+
133
+ | Situation | Action |
134
+ |-----------|--------|
135
+ | Cannot measure reliably | Increase sample size, reduce variance sources |
136
+ | Optimization made it slower | Revert, analyze why, profile more carefully |
137
+ | Optimization broke tests | Fix tests or revert if behavior changed |
138
+ | Bottleneck is external | Document, consider caching, async processing |
139
+ | Memory improved but CPU worse | Evaluate trade-off for use case |
140
+
141
+ ## Common Optimizations
142
+
143
+ ### JavaScript/TypeScript
144
+
145
+ ```typescript
146
+ // BAD: N+1 queries
147
+ for (const user of users) {
148
+ const posts = await db.getPosts(user.id);
149
+ }
150
+
151
+ // GOOD: Batch query
152
+ const userIds = users.map(u => u.id);
153
+ const posts = await db.getPostsForUsers(userIds);
154
+
155
+ // BAD: Repeated work
156
+ const typeA = items.filter(x => x.type === 'a').map(x => x.value);
157
+ const typeB = items.filter(x => x.type === 'b').map(x => x.value);
158
+
159
+ // GOOD: Single pass
160
+ const grouped = { a: [], b: [] };
161
+ for (const x of items) {
162
+ if (x.type in grouped) grouped[x.type].push(x.value);
163
+ }
164
+
165
+ // BAD: Serial async
166
+ const result1 = await fetch(url1);
167
+ const result2 = await fetch(url2);
168
+
169
+ // GOOD: Parallel async
170
+ const [result1, result2] = await Promise.all([
171
+ fetch(url1),
172
+ fetch(url2)
173
+ ]);
174
+ ```
175
+
176
+ ### Go
177
+
178
+ ```go
179
+ // BAD: Allocation in loop
180
+ var result []T
181
+ for _, item := range items {
182
+ result = append(result, process(item))
183
+ }
184
+
185
+ // GOOD: Pre-allocate
186
+ result := make([]T, 0, len(items))
187
+ for _, item := range items {
188
+ result = append(result, process(item))
189
+ }
190
+
191
+ // BAD: String concatenation
192
+ s := ""
193
+ for _, item := range items {
194
+ s += item
195
+ }
196
+
197
+ // GOOD: Builder
198
+ var b strings.Builder
199
+ for _, item := range items {
200
+ b.WriteString(item)
201
+ }
202
+ ```
203
+
204
+ ### SQL
205
+
206
+ ```sql
207
+ -- BAD: Missing index on frequently queried column
208
+ SELECT * FROM users WHERE email = 'x@y.com';
209
+
210
+ -- GOOD: Add index
211
+ CREATE INDEX idx_users_email ON users(email);
212
+
213
+ -- BAD: SELECT *
214
+ SELECT * FROM users;
215
+
216
+ -- GOOD: Select only needed columns
217
+ SELECT id, name, email FROM users;
218
+
219
+ -- BAD: Query in loop
220
+ -- for each user: SELECT * FROM posts WHERE user_id = ?
221
+
222
+ -- GOOD: Single batch query
223
+ SELECT * FROM posts WHERE user_id IN (?, ?, ?);
224
+ ```
225
+
226
+ ## MCP Tools
227
+
228
+ - `mcp__plugin_aide_aide__code_search` - Find loops, queries, expensive operations
229
+ - `mcp__plugin_aide_aide__code_symbols` - Understand function structure
230
+ - `mcp__plugin_aide_aide__memory_search` - Check past performance decisions
231
+
232
+ ## Profiling Commands Reference
233
+
234
+ ### Node.js
235
+ ```bash
236
+ # CPU profiling
237
+ node --cpu-prof app.js
238
+ # Produces .cpuprofile file
239
+
240
+ # Memory profiling
241
+ node --heap-prof app.js
242
+ # Produces .heapprofile file
243
+
244
+ # Clinic.js for analysis
245
+ npx clinic doctor -- node app.js
246
+ npx clinic flame -- node app.js
247
+ ```
248
+
249
+ ### Go
250
+ ```bash
251
+ # CPU profiling
252
+ go test -cpuprofile=cpu.prof -bench=.
253
+ go tool pprof -http=:8080 cpu.prof
254
+
255
+ # Memory profiling
256
+ go test -memprofile=mem.prof -bench=.
257
+ go tool pprof -http=:8080 mem.prof
258
+
259
+ # Execution trace
260
+ go test -trace=trace.out -bench=.
261
+ go tool trace trace.out
262
+ ```
263
+
264
+ ### Browser
265
+ - DevTools -> Performance -> Record
266
+ - DevTools -> Memory -> Heap snapshot
267
+ - Lighthouse for overall page performance
268
+
269
+ ## Verification Criteria
270
+
271
+ Before completing:
272
+ - [ ] Baseline measurement recorded
273
+ - [ ] Improvement quantified (percentage)
274
+ - [ ] All tests still pass
275
+ - [ ] No correctness regressions
276
+ - [ ] Memory usage acceptable
277
+
278
+ ## Output Format
279
+
280
+ ```markdown
281
+ ## Performance Analysis: [Operation/Endpoint Name]
282
+
283
+ ### Baseline
284
+ - Execution time: 450ms (p50), 680ms (p95)
285
+ - Memory: 125MB peak
286
+ - Database queries: 150
287
+
288
+ ### Hotspots Identified
289
+ 1. `db.getUsers()` - 300ms (67% of total)
290
+ 2. `processData()` - 100ms (22% of total)
291
+ 3. `formatOutput()` - 50ms (11% of total)
292
+
293
+ ### Optimizations Applied
294
+ 1. Batched user queries - 300ms -> 50ms
295
+ 2. Memoized processData for repeated calls - 100ms -> 5ms
296
+
297
+ ### Results
298
+ - Execution time: 450ms -> 105ms (77% faster)
299
+ - Memory: 125MB -> 80MB (36% reduction)
300
+ - Database queries: 150 -> 3 (98% reduction)
301
+
302
+ ### Verification
303
+ - All tests: PASS
304
+ - Output correctness: VERIFIED
305
+ ```