ima-claude 2.20.0 → 2.26.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/README.md +74 -9
- package/dist/cli.js +2 -1
- package/package.json +1 -1
- package/plugins/ima-claude/.claude-plugin/plugin.json +2 -2
- package/plugins/ima-claude/agents/explorer.md +29 -15
- package/plugins/ima-claude/agents/implementer.md +58 -13
- package/plugins/ima-claude/agents/memory.md +19 -19
- package/plugins/ima-claude/agents/reviewer.md +84 -34
- package/plugins/ima-claude/agents/tester.md +59 -16
- package/plugins/ima-claude/agents/wp-developer.md +66 -21
- package/plugins/ima-claude/hooks/bootstrap.sh +42 -44
- package/plugins/ima-claude/hooks/prompt_coach_digest.md +14 -17
- package/plugins/ima-claude/hooks/prompt_coach_system.md +10 -12
- package/plugins/ima-claude/personalities/README.md +17 -6
- package/plugins/ima-claude/personalities/enable-efficient.md +61 -0
- package/plugins/ima-claude/personalities/enable-terse.md +71 -0
- package/plugins/ima-claude/skills/agentic-workflows/SKILL.md +35 -71
- package/plugins/ima-claude/skills/architect/SKILL.md +54 -168
- package/plugins/ima-claude/skills/compound-bridge/SKILL.md +41 -94
- package/plugins/ima-claude/skills/design-to-code/SKILL.md +43 -78
- package/plugins/ima-claude/skills/discourse/SKILL.md +79 -194
- package/plugins/ima-claude/skills/discourse-admin/SKILL.md +41 -103
- package/plugins/ima-claude/skills/docs-organize/SKILL.md +63 -203
- package/plugins/ima-claude/skills/ember-discourse/SKILL.md +90 -200
- package/plugins/ima-claude/skills/espocrm/SKILL.md +14 -23
- package/plugins/ima-claude/skills/espocrm-api/SKILL.md +79 -192
- package/plugins/ima-claude/skills/functional-programmer/SKILL.md +33 -237
- package/plugins/ima-claude/skills/gh-cli/SKILL.md +26 -65
- package/plugins/ima-claude/skills/ima-bootstrap/SKILL.md +71 -104
- package/plugins/ima-claude/skills/ima-bootstrap/references/ima-brand.md +32 -22
- package/plugins/ima-claude/skills/ima-brand/SKILL.md +18 -23
- package/plugins/ima-claude/skills/ima-copywriting/SKILL.md +68 -179
- package/plugins/ima-claude/skills/ima-doc2pdf/SKILL.md +32 -102
- package/plugins/ima-claude/skills/ima-editorial-scorecard/SKILL.md +38 -63
- package/plugins/ima-claude/skills/ima-editorial-workflow/SKILL.md +69 -114
- package/plugins/ima-claude/skills/ima-email-creator/SKILL.md +16 -22
- package/plugins/ima-claude/skills/ima-forms-expert/SKILL.md +21 -37
- package/plugins/ima-claude/skills/ima-git/SKILL.md +81 -0
- package/plugins/ima-claude/skills/jira-checkpoint/SKILL.md +39 -120
- package/plugins/ima-claude/skills/jquery/SKILL.md +107 -233
- package/plugins/ima-claude/skills/js-fp/SKILL.md +75 -296
- package/plugins/ima-claude/skills/js-fp-api/SKILL.md +52 -162
- package/plugins/ima-claude/skills/js-fp-react/SKILL.md +47 -270
- package/plugins/ima-claude/skills/js-fp-vue/SKILL.md +55 -209
- package/plugins/ima-claude/skills/js-fp-wordpress/SKILL.md +59 -204
- package/plugins/ima-claude/skills/livecanvas/SKILL.md +19 -32
- package/plugins/ima-claude/skills/mcp-atlassian/SKILL.md +92 -162
- package/plugins/ima-claude/skills/mcp-context7/SKILL.md +32 -64
- package/plugins/ima-claude/skills/mcp-gitea/SKILL.md +98 -188
- package/plugins/ima-claude/skills/mcp-github/SKILL.md +60 -124
- package/plugins/ima-claude/skills/mcp-memory/SKILL.md +1 -177
- package/plugins/ima-claude/skills/mcp-qdrant/SKILL.md +58 -115
- package/plugins/ima-claude/skills/mcp-sequential/SKILL.md +32 -87
- package/plugins/ima-claude/skills/mcp-serena/SKILL.md +54 -80
- package/plugins/ima-claude/skills/mcp-tavily/SKILL.md +40 -63
- package/plugins/ima-claude/skills/mcp-vestige/SKILL.md +75 -116
- package/plugins/ima-claude/skills/php-authnet/SKILL.md +32 -65
- package/plugins/ima-claude/skills/php-fp/SKILL.md +50 -129
- package/plugins/ima-claude/skills/php-fp-wordpress/SKILL.md +25 -73
- package/plugins/ima-claude/skills/phpunit-wp/SKILL.md +103 -463
- package/plugins/ima-claude/skills/playwright/SKILL.md +69 -220
- package/plugins/ima-claude/skills/prompt-starter/SKILL.md +33 -83
- package/plugins/ima-claude/skills/prompt-starter/references/code-review.md +38 -0
- package/plugins/ima-claude/skills/py-fp/SKILL.md +78 -384
- package/plugins/ima-claude/skills/quasar-fp/SKILL.md +54 -255
- package/plugins/ima-claude/skills/quickstart/SKILL.md +7 -11
- package/plugins/ima-claude/skills/rails/SKILL.md +63 -184
- package/plugins/ima-claude/skills/resume-session/SKILL.md +14 -35
- package/plugins/ima-claude/skills/rg/SKILL.md +61 -146
- package/plugins/ima-claude/skills/ruby-fp/SKILL.md +66 -163
- package/plugins/ima-claude/skills/save-session/SKILL.md +10 -39
- package/plugins/ima-claude/skills/scorecard/SKILL.md +42 -40
- package/plugins/ima-claude/skills/skill-analyzer/SKILL.md +42 -71
- package/plugins/ima-claude/skills/skill-creator/SKILL.md +79 -250
- package/plugins/ima-claude/skills/task-master/SKILL.md +11 -31
- package/plugins/ima-claude/skills/task-planner/SKILL.md +44 -153
- package/plugins/ima-claude/skills/task-runner/SKILL.md +61 -143
- package/plugins/ima-claude/skills/unit-testing/SKILL.md +59 -134
- package/plugins/ima-claude/skills/wp-ddev/SKILL.md +38 -120
- package/plugins/ima-claude/skills/wp-local/SKILL.md +26 -108
|
@@ -5,36 +5,19 @@ description: "FP API patterns for Node.js with security-first SQL and middleware
|
|
|
5
5
|
|
|
6
6
|
# JavaScript FP - Node.js API
|
|
7
7
|
|
|
8
|
-
Functional programming patterns for Node.js APIs with security-first SQL, middleware dependency injection, and self-contained routes.
|
|
9
|
-
|
|
10
|
-
## When to Use This Skill
|
|
11
|
-
|
|
12
|
-
- Building REST APIs with Node.js
|
|
13
|
-
- Need security-first SQL patterns
|
|
14
|
-
- Implementing middleware-based dependency injection
|
|
15
|
-
- Self-contained route architecture
|
|
16
|
-
- Testing API endpoints comprehensively
|
|
17
|
-
|
|
18
|
-
## Core Philosophy
|
|
19
|
-
|
|
20
|
-
**Self-contained routes** (300-500 lines max) with **security-first SQL**, **middleware DI**, and **pure business logic separation** when genuinely reusable (3+ routes).
|
|
21
|
-
|
|
22
|
-
**Foundation**: This skill builds on `js-fp` core principles. Reference `../js-fp/SKILL.md` for purity, composition, dependency injection, and testing patterns.
|
|
23
|
-
|
|
24
8
|
## CRITICAL: Security-First SQL (MANDATORY)
|
|
25
9
|
|
|
26
|
-
|
|
10
|
+
Never use string concatenation for SQL. Always use parameterized queries returning `{sql, params}`.
|
|
27
11
|
|
|
28
12
|
```javascript
|
|
29
|
-
// NEVER
|
|
30
|
-
const sql = `SELECT * FROM events WHERE domain LIKE '%${domain}%'` //
|
|
13
|
+
// NEVER
|
|
14
|
+
const sql = `SELECT * FROM events WHERE domain LIKE '%${domain}%'` // SQL injection!
|
|
31
15
|
|
|
32
|
-
// ALWAYS
|
|
16
|
+
// ALWAYS
|
|
33
17
|
const buildDomainFilter = (domain) => {
|
|
34
18
|
const validation = validateDomain(domain)
|
|
35
19
|
if (!validation.valid) throw new Error(validation.error)
|
|
36
20
|
if (validation.domain === 'all') return { sql: '', params: {} }
|
|
37
|
-
|
|
38
21
|
return {
|
|
39
22
|
sql: 'AND from_address LIKE @domain_pattern',
|
|
40
23
|
params: { domain_pattern: `%${validation.domain}%` }
|
|
@@ -42,28 +25,26 @@ const buildDomainFilter = (domain) => {
|
|
|
42
25
|
}
|
|
43
26
|
```
|
|
44
27
|
|
|
45
|
-
|
|
28
|
+
See `references/security-sql.md` for advanced SQL patterns, triple-layer curry, domain whitelisting.
|
|
46
29
|
|
|
47
|
-
##
|
|
48
|
-
|
|
49
|
-
### File Structure
|
|
30
|
+
## Architecture
|
|
50
31
|
|
|
51
32
|
```
|
|
52
33
|
/api/
|
|
53
34
|
├── middleware/ # DI only (database.js, auth.js)
|
|
54
35
|
├── shared/ # ONLY if 3+ routes use it
|
|
55
|
-
│ ├── validators.js
|
|
36
|
+
│ ├── validators.js
|
|
56
37
|
│ ├── filters.js # SQL builders returning {sql, params}
|
|
57
|
-
│ └── constants.js
|
|
58
|
-
├── business/ # Pure functions
|
|
38
|
+
│ └── constants.js
|
|
39
|
+
├── business/ # Pure functions only (calculations, transformations)
|
|
59
40
|
└── routes/
|
|
60
|
-
├── [domain]/
|
|
41
|
+
├── [domain]/
|
|
61
42
|
│ ├── index.js # Route orchestrator
|
|
62
43
|
│ └── [endpoint].js # 300-500 lines MAX
|
|
63
|
-
└── [simple].js
|
|
44
|
+
└── [simple].js
|
|
64
45
|
```
|
|
65
46
|
|
|
66
|
-
|
|
47
|
+
## Self-Contained Route Pattern
|
|
67
48
|
|
|
68
49
|
```javascript
|
|
69
50
|
import { Hono } from 'hono'
|
|
@@ -72,10 +53,8 @@ import { buildDomainFilter } from '../../shared/filters.js'
|
|
|
72
53
|
|
|
73
54
|
const route = new Hono()
|
|
74
55
|
|
|
75
|
-
// ───── Route-scoped validation ─────
|
|
76
56
|
const validateRequest = (ctx) => {
|
|
77
|
-
const
|
|
78
|
-
const validation = validateDomain(domain)
|
|
57
|
+
const validation = validateDomain(ctx.req.query('domain'))
|
|
79
58
|
if (!validation.valid) {
|
|
80
59
|
const error = new Error(validation.error)
|
|
81
60
|
error.status = 400
|
|
@@ -84,29 +63,19 @@ const validateRequest = (ctx) => {
|
|
|
84
63
|
return { domain: validation.domain }
|
|
85
64
|
}
|
|
86
65
|
|
|
87
|
-
// ───── Security-first SQL building ─────
|
|
88
66
|
const buildQuery = (env, { domain }) => {
|
|
89
67
|
const table = getTableReference(env)('events')
|
|
90
68
|
const filters = buildDomainFilter(domain)
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
sql: `SELECT * FROM ${table} WHERE 1=1 ${filters.sql}`,
|
|
94
|
-
params: filters.params
|
|
95
|
-
}
|
|
69
|
+
return { sql: `SELECT * FROM ${table} WHERE 1=1 ${filters.sql}`, params: filters.params }
|
|
96
70
|
}
|
|
97
71
|
|
|
98
|
-
|
|
99
|
-
const processData = (raw) => raw.map(r => ({
|
|
100
|
-
...r,
|
|
101
|
-
timestamp: r.timestamp + 'Z'
|
|
102
|
-
}))
|
|
72
|
+
const processData = (raw) => raw.map(r => ({ ...r, timestamp: r.timestamp + 'Z' }))
|
|
103
73
|
|
|
104
|
-
// ───── Clean orchestration ─────
|
|
105
74
|
route.get('/', async (c) => {
|
|
106
75
|
try {
|
|
107
76
|
const params = validateRequest(c)
|
|
108
77
|
const { sql, params: qp } = buildQuery(c.env, params)
|
|
109
|
-
const raw = await c.db.queryWithParams(sql, qp)
|
|
78
|
+
const raw = await c.db.queryWithParams(sql, qp)
|
|
110
79
|
return c.json({ success: true, data: processData(raw) })
|
|
111
80
|
} catch (error) {
|
|
112
81
|
return c.json({ success: false, error: error.message }, error.status || 500)
|
|
@@ -118,7 +87,7 @@ export default route
|
|
|
118
87
|
|
|
119
88
|
## Middleware Dependency Injection
|
|
120
89
|
|
|
121
|
-
Inject
|
|
90
|
+
Inject via middleware context, not per-request instantiation.
|
|
122
91
|
|
|
123
92
|
```javascript
|
|
124
93
|
// middleware/database.js
|
|
@@ -131,18 +100,14 @@ export const databaseMiddleware = async (c, next) => {
|
|
|
131
100
|
}
|
|
132
101
|
await next()
|
|
133
102
|
}
|
|
134
|
-
|
|
135
|
-
// Usage in routes: await c.db.queryWithParams(sql, params)
|
|
136
103
|
```
|
|
137
104
|
|
|
138
|
-
|
|
105
|
+
See `references/middleware-patterns.md` for function factories, auth middleware, testing.
|
|
139
106
|
|
|
140
|
-
##
|
|
107
|
+
## Extract to business/ Only If
|
|
141
108
|
|
|
142
|
-
|
|
143
|
-
-
|
|
144
|
-
- Pure calculation/transformation
|
|
145
|
-
- No side effects
|
|
109
|
+
- Used by 3+ routes
|
|
110
|
+
- Pure calculation/transformation, no side effects
|
|
146
111
|
- 100% testable
|
|
147
112
|
|
|
148
113
|
```javascript
|
|
@@ -150,131 +115,56 @@ export const databaseMiddleware = async (c, next) => {
|
|
|
150
115
|
export const calculateTotalRevenue = (orders) =>
|
|
151
116
|
orders.reduce((sum, order) => sum + order.total, 0)
|
|
152
117
|
|
|
153
|
-
export const calculateAverageOrderValue = (orders) =>
|
|
154
|
-
|
|
155
|
-
return calculateTotalRevenue(orders) / orders.length
|
|
156
|
-
}
|
|
118
|
+
export const calculateAverageOrderValue = (orders) =>
|
|
119
|
+
orders.length === 0 ? 0 : calculateTotalRevenue(orders) / orders.length
|
|
157
120
|
```
|
|
158
121
|
|
|
159
|
-
## Anti-Patterns
|
|
160
|
-
|
|
161
|
-
```javascript
|
|
162
|
-
// Routes >500 lines → Split to business/
|
|
163
|
-
// Service layer files → Keep in-route or business/
|
|
164
|
-
// String concatenation SQL → Use {sql, params}
|
|
165
|
-
// Manual client init → Use middleware DI
|
|
166
|
-
// Validation files used by <3 routes → Keep in-route
|
|
167
|
-
// Abstraction layers → Direct implementation
|
|
168
|
-
// Complex error handling frameworks → Simple try/catch
|
|
169
|
-
// Over-engineered logging → Simple logger DI
|
|
170
|
-
```
|
|
122
|
+
## Anti-Patterns
|
|
171
123
|
|
|
172
|
-
|
|
124
|
+
- Routes >500 lines → split to business/
|
|
125
|
+
- Service layer files → keep in-route or business/
|
|
126
|
+
- String concatenation SQL → use `{sql, params}`
|
|
127
|
+
- Manual client init → use middleware DI
|
|
128
|
+
- Shared validation used by <3 routes → keep in-route
|
|
129
|
+
- Abstraction layers, complex error frameworks, over-engineered logging
|
|
173
130
|
|
|
174
|
-
|
|
131
|
+
## Testing
|
|
175
132
|
|
|
176
133
|
```javascript
|
|
177
|
-
|
|
178
|
-
|
|
134
|
+
// Pure logic
|
|
179
135
|
describe('calculateTotalRevenue', () => {
|
|
180
136
|
it('sums order totals', () => {
|
|
181
|
-
|
|
182
|
-
expect(calculateTotalRevenue(orders)).toBe(350)
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
it('handles empty array', () => {
|
|
186
|
-
expect(calculateTotalRevenue([])).toBe(0)
|
|
137
|
+
expect(calculateTotalRevenue([{ total: 100 }, { total: 200 }])).toBe(300)
|
|
187
138
|
})
|
|
188
139
|
})
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Route Integration Tests
|
|
192
140
|
|
|
193
|
-
|
|
141
|
+
// Route integration
|
|
194
142
|
describe('GET /orders', () => {
|
|
195
|
-
const mockDb = {
|
|
196
|
-
queryWithParams: jest.fn().mockResolvedValue([{ id: 1, total: 100 }])
|
|
197
|
-
}
|
|
143
|
+
const mockDb = { queryWithParams: jest.fn().mockResolvedValue([{ id: 1, total: 100 }]) }
|
|
198
144
|
|
|
199
|
-
it('returns orders
|
|
145
|
+
it('returns orders', async () => {
|
|
200
146
|
const res = await app.request('/orders', { method: 'GET' }, { db: mockDb })
|
|
201
147
|
expect(res.status).toBe(200)
|
|
202
148
|
})
|
|
203
|
-
|
|
204
|
-
it('validates required parameters', async () => {
|
|
205
|
-
const res = await app.request('/orders?domain=invalid', { method: 'GET' }, { db: mockDb })
|
|
206
|
-
expect(res.status).toBe(400)
|
|
207
|
-
})
|
|
208
149
|
})
|
|
209
150
|
```
|
|
210
151
|
|
|
211
|
-
|
|
152
|
+
See `references/middleware-patterns.md` for comprehensive testing patterns.
|
|
212
153
|
|
|
213
154
|
## Quality Gates
|
|
214
155
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
- Building complex multi-filter queries
|
|
231
|
-
- Implementing triple-layer curry pattern
|
|
232
|
-
- Training team on SQL security
|
|
233
|
-
- Debugging injection vulnerabilities
|
|
234
|
-
**Contains**: Parameterized queries, SQL builders, domain whitelisting, security checklist
|
|
235
|
-
|
|
236
|
-
### Middleware Patterns
|
|
237
|
-
**File**: `references/middleware-patterns.md`
|
|
238
|
-
**Load When**:
|
|
239
|
-
- Building custom middleware
|
|
240
|
-
- Implementing function factories for O(1) performance
|
|
241
|
-
- Setting up auth middleware
|
|
242
|
-
- Writing comprehensive integration tests
|
|
243
|
-
**Contains**: Context-based DI, function factories, auth patterns, testing with mocks
|
|
244
|
-
|
|
245
|
-
### Validation Strategies
|
|
246
|
-
**File**: `references/validation-patterns.md`
|
|
247
|
-
**Load When**:
|
|
248
|
-
- Implementing complex validation logic
|
|
249
|
-
- Building composable validators
|
|
250
|
-
- Deciding where to place validation code
|
|
251
|
-
- Implementing error accumulation
|
|
252
|
-
**Contains**: validateAll utility, composition patterns, result objects, when to extract
|
|
253
|
-
|
|
254
|
-
### Working Examples
|
|
255
|
-
**Directory**: `examples/`
|
|
256
|
-
**Load When**: Need complete working API examples
|
|
257
|
-
**Contains**: Full CRUD endpoints, authentication, authorization, testing
|
|
258
|
-
|
|
259
|
-
## Foundation Reference
|
|
260
|
-
|
|
261
|
-
**Core FP Principles**: `../js-fp/SKILL.md`
|
|
262
|
-
- Purity and side effect isolation
|
|
263
|
-
- Composition patterns
|
|
264
|
-
- Dependency injection
|
|
265
|
-
- Immutability
|
|
266
|
-
- Testing strategies
|
|
267
|
-
|
|
268
|
-
**Deep Dive**: `../js-fp/core-principles.md` for complete FP philosophy
|
|
269
|
-
|
|
270
|
-
## Success Metrics
|
|
271
|
-
|
|
272
|
-
- **Security**: Zero SQL injection vulnerabilities
|
|
273
|
-
- **Testability**: 95%+ coverage for pure functions
|
|
274
|
-
- **Maintainability**: Routes under 500 lines
|
|
275
|
-
- **Performance**: Sub-200ms response times
|
|
276
|
-
- **Code Quality**: Clear, self-documenting code
|
|
277
|
-
|
|
278
|
-
## Philosophy
|
|
279
|
-
|
|
280
|
-
*"Self-contained routes with security-first SQL and minimal abstraction - optimize for readability and security over clever architecture."*
|
|
156
|
+
1. SQL uses `{sql, params}` pattern?
|
|
157
|
+
2. Route <500 lines?
|
|
158
|
+
3. Validation route-scoped or shared (3+ routes)?
|
|
159
|
+
4. Using middleware DI (`c.db`, `c.bq`, `c.logger`)?
|
|
160
|
+
5. Business logic extracted only if reusable (3+)?
|
|
161
|
+
6. All dependencies injectable for testing?
|
|
162
|
+
|
|
163
|
+
## Reference Files
|
|
164
|
+
|
|
165
|
+
| File | Load When |
|
|
166
|
+
|------|-----------|
|
|
167
|
+
| `references/security-sql.md` | Complex multi-filter queries, triple-layer curry, SQL security training |
|
|
168
|
+
| `references/middleware-patterns.md` | Custom middleware, function factories, auth, integration tests |
|
|
169
|
+
| `references/validation-patterns.md` | Complex validation, composable validators, error accumulation |
|
|
170
|
+
| `../js-fp/SKILL.md` | Core FP: purity, composition, DI, immutability, testing |
|