ima-claude 2.18.0 → 2.25.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.
Files changed (103) hide show
  1. package/README.md +55 -9
  2. package/dist/cli.js +5 -1
  3. package/package.json +1 -1
  4. package/plugins/ima-claude/.claude-plugin/plugin.json +2 -2
  5. package/plugins/ima-claude/agents/explorer.md +29 -15
  6. package/plugins/ima-claude/agents/implementer.md +58 -13
  7. package/plugins/ima-claude/agents/memory.md +19 -19
  8. package/plugins/ima-claude/agents/reviewer.md +56 -34
  9. package/plugins/ima-claude/agents/tester.md +59 -16
  10. package/plugins/ima-claude/agents/wp-developer.md +66 -21
  11. package/plugins/ima-claude/hooks/bootstrap.sh +42 -44
  12. package/plugins/ima-claude/hooks/prompt_coach_digest.md +14 -17
  13. package/plugins/ima-claude/hooks/prompt_coach_system.md +10 -12
  14. package/plugins/ima-claude/personalities/README.md +17 -6
  15. package/plugins/ima-claude/personalities/enable-efficient.md +61 -0
  16. package/plugins/ima-claude/personalities/enable-terse.md +71 -0
  17. package/plugins/ima-claude/skills/agentic-workflows/SKILL.md +97 -0
  18. package/plugins/ima-claude/skills/agentic-workflows/references/phases/deliver.md +181 -0
  19. package/plugins/ima-claude/skills/agentic-workflows/references/phases/draft.md +99 -0
  20. package/plugins/ima-claude/skills/agentic-workflows/references/phases/gather.md +130 -0
  21. package/plugins/ima-claude/skills/agentic-workflows/references/phases/outline.md +106 -0
  22. package/plugins/ima-claude/skills/agentic-workflows/references/phases/review.md +137 -0
  23. package/plugins/ima-claude/skills/agentic-workflows/references/standards/draft-format.md +159 -0
  24. package/plugins/ima-claude/skills/agentic-workflows/references/standards/editorial-standards.md +160 -0
  25. package/plugins/ima-claude/skills/agentic-workflows/references/standards/outline-format.md +110 -0
  26. package/plugins/ima-claude/skills/agentic-workflows/references/templates/avada-construction-guide.md +263 -0
  27. package/plugins/ima-claude/skills/agentic-workflows/references/templates/avada-webinar-example.txt +275 -0
  28. package/plugins/ima-claude/skills/agentic-workflows/references/templates/cta-block-catalog.md +169 -0
  29. package/plugins/ima-claude/skills/agentic-workflows/references/templates/espo-email-preparation.md +241 -0
  30. package/plugins/ima-claude/skills/agentic-workflows/references/templates/webinar-recap-email-espo.html +339 -0
  31. package/plugins/ima-claude/skills/agentic-workflows/references/templates/webinar-reminder-email-espo.html +458 -0
  32. package/plugins/ima-claude/skills/agentic-workflows/references/workflows/editorial/webinar-summary.md +81 -0
  33. package/plugins/ima-claude/skills/architect/SKILL.md +54 -168
  34. package/plugins/ima-claude/skills/compound-bridge/SKILL.md +41 -94
  35. package/plugins/ima-claude/skills/design-to-code/SKILL.md +91 -0
  36. package/plugins/ima-claude/skills/design-to-code/references/guardrails.md +46 -0
  37. package/plugins/ima-claude/skills/design-to-code/references/phase-a-design-to-prompt.md +141 -0
  38. package/plugins/ima-claude/skills/design-to-code/references/phase-b-prompt-to-code.md +155 -0
  39. package/plugins/ima-claude/skills/design-to-code/references/prompt-template.md +95 -0
  40. package/plugins/ima-claude/skills/discourse/SKILL.md +79 -194
  41. package/plugins/ima-claude/skills/discourse-admin/SKILL.md +41 -103
  42. package/plugins/ima-claude/skills/docs-organize/SKILL.md +63 -203
  43. package/plugins/ima-claude/skills/ember-discourse/SKILL.md +90 -200
  44. package/plugins/ima-claude/skills/espocrm/SKILL.md +14 -23
  45. package/plugins/ima-claude/skills/espocrm-api/SKILL.md +79 -192
  46. package/plugins/ima-claude/skills/functional-programmer/SKILL.md +33 -237
  47. package/plugins/ima-claude/skills/gh-cli/SKILL.md +26 -65
  48. package/plugins/ima-claude/skills/ima-bootstrap/SKILL.md +71 -104
  49. package/plugins/ima-claude/skills/ima-bootstrap/references/ima-brand.md +32 -22
  50. package/plugins/ima-claude/skills/ima-brand/SKILL.md +18 -23
  51. package/plugins/ima-claude/skills/ima-copywriting/SKILL.md +68 -179
  52. package/plugins/ima-claude/skills/ima-doc2pdf/SKILL.md +32 -102
  53. package/plugins/ima-claude/skills/ima-editorial-scorecard/SKILL.md +38 -63
  54. package/plugins/ima-claude/skills/ima-editorial-workflow/SKILL.md +69 -114
  55. package/plugins/ima-claude/skills/ima-email-creator/SKILL.md +16 -22
  56. package/plugins/ima-claude/skills/ima-forms-expert/SKILL.md +21 -37
  57. package/plugins/ima-claude/skills/jira-checkpoint/SKILL.md +39 -120
  58. package/plugins/ima-claude/skills/jquery/SKILL.md +107 -233
  59. package/plugins/ima-claude/skills/js-fp/SKILL.md +75 -296
  60. package/plugins/ima-claude/skills/js-fp-api/SKILL.md +52 -162
  61. package/plugins/ima-claude/skills/js-fp-react/SKILL.md +47 -270
  62. package/plugins/ima-claude/skills/js-fp-vue/SKILL.md +55 -209
  63. package/plugins/ima-claude/skills/js-fp-wordpress/SKILL.md +59 -204
  64. package/plugins/ima-claude/skills/livecanvas/SKILL.md +19 -32
  65. package/plugins/ima-claude/skills/mcp-atlassian/SKILL.md +146 -136
  66. package/plugins/ima-claude/skills/mcp-atlassian/references/direct-api-attachments.md +115 -0
  67. package/plugins/ima-claude/skills/mcp-atlassian/references/direct-api-auth.md +103 -0
  68. package/plugins/ima-claude/skills/mcp-atlassian/references/direct-api-bulk.md +149 -0
  69. package/plugins/ima-claude/skills/mcp-atlassian/references/direct-api-misc.md +195 -0
  70. package/plugins/ima-claude/skills/mcp-atlassian/references/direct-api-sprints.md +158 -0
  71. package/plugins/ima-claude/skills/mcp-context7/SKILL.md +32 -64
  72. package/plugins/ima-claude/skills/mcp-gitea/SKILL.md +98 -188
  73. package/plugins/ima-claude/skills/mcp-github/SKILL.md +60 -124
  74. package/plugins/ima-claude/skills/mcp-memory/SKILL.md +1 -177
  75. package/plugins/ima-claude/skills/mcp-qdrant/SKILL.md +58 -115
  76. package/plugins/ima-claude/skills/mcp-sequential/SKILL.md +32 -87
  77. package/plugins/ima-claude/skills/mcp-serena/SKILL.md +54 -80
  78. package/plugins/ima-claude/skills/mcp-tavily/SKILL.md +40 -63
  79. package/plugins/ima-claude/skills/mcp-vestige/SKILL.md +75 -116
  80. package/plugins/ima-claude/skills/php-authnet/SKILL.md +32 -65
  81. package/plugins/ima-claude/skills/php-fp/SKILL.md +50 -129
  82. package/plugins/ima-claude/skills/php-fp-wordpress/SKILL.md +25 -73
  83. package/plugins/ima-claude/skills/phpunit-wp/SKILL.md +103 -463
  84. package/plugins/ima-claude/skills/playwright/SKILL.md +69 -220
  85. package/plugins/ima-claude/skills/prompt-starter/SKILL.md +35 -82
  86. package/plugins/ima-claude/skills/prompt-starter/references/code-review.md +38 -0
  87. package/plugins/ima-claude/skills/py-fp/SKILL.md +78 -384
  88. package/plugins/ima-claude/skills/quasar-fp/SKILL.md +54 -255
  89. package/plugins/ima-claude/skills/quickstart/SKILL.md +7 -11
  90. package/plugins/ima-claude/skills/rails/SKILL.md +63 -184
  91. package/plugins/ima-claude/skills/resume-session/SKILL.md +14 -35
  92. package/plugins/ima-claude/skills/rg/SKILL.md +61 -146
  93. package/plugins/ima-claude/skills/ruby-fp/SKILL.md +66 -163
  94. package/plugins/ima-claude/skills/save-session/SKILL.md +10 -39
  95. package/plugins/ima-claude/skills/scorecard/SKILL.md +24 -38
  96. package/plugins/ima-claude/skills/skill-analyzer/SKILL.md +42 -71
  97. package/plugins/ima-claude/skills/skill-creator/SKILL.md +79 -250
  98. package/plugins/ima-claude/skills/task-master/SKILL.md +11 -31
  99. package/plugins/ima-claude/skills/task-planner/SKILL.md +44 -153
  100. package/plugins/ima-claude/skills/task-runner/SKILL.md +61 -143
  101. package/plugins/ima-claude/skills/unit-testing/SKILL.md +59 -134
  102. package/plugins/ima-claude/skills/wp-ddev/SKILL.md +38 -120
  103. package/plugins/ima-claude/skills/wp-local/SKILL.md +26 -108
@@ -5,64 +5,29 @@ description: "Core FP principles with anti-over-engineering focus - Simple > Com
5
5
 
6
6
  # JavaScript Functional Programming
7
7
 
8
- Core functional programming principles for JavaScript with anti-over-engineering enforcement. This skill provides error-preventing essentials and references to deep-dive content.
8
+ ## CRITICAL: Anti-Over-Engineering
9
9
 
10
- ## When to Use This Skill
10
+ **"Simple > Complex | Evidence > Assumptions"**
11
11
 
12
- - Implementing pure, testable functions
13
- - Need FP architectural guidance
14
- - Preventing over-engineering and custom FP utility creation
15
- - Comprehensive testing strategies
16
- - Evidence-based performance optimization
17
-
18
- ## ⚠️ CRITICAL: Anti-Over-Engineering (PRIMARY FOCUS)
19
-
20
- **Core Principle**: "Simple > Complex | Evidence > Assumptions"
21
-
22
- > **Clarification**: This skill prevents CREATING custom FP utility functions (pipe, compose, curry) to make JavaScript "feel" like Haskell. Using established libraries (lodash, date-fns, etc.) is perfectly fine. FP is a mindset—pure functions, immutability, composition—not a rigid API signature.
23
-
24
- ### Don't Create Custom FP Utilities
12
+ FP is a mindset — pure functions, immutability, composition — not a rigid API signature. Never create custom FP utilities to make JavaScript "feel" like Haskell. Using established libraries (lodash, date-fns, etc.) is fine.
25
13
 
26
14
  ```javascript
27
- // ❌ DON'T CREATE: pipe() utility
15
+ // ❌ DON'T CREATE pipe/compose/curry utilities
28
16
  const pipe = (...fns) => x => fns.reduce((v, f) => f(v), x)
29
17
 
30
- // ✅ INSTEAD: Native function calls with early returns
18
+ // ✅ Native function calls with early returns
31
19
  const validateUser = (userData) => {
32
20
  const requiredCheck = validateRequired(['email', 'name'])(userData)
33
21
  if (!requiredCheck.valid) return requiredCheck
34
-
35
22
  const emailCheck = validateEmail(userData)
36
23
  if (!emailCheck.valid) return emailCheck
37
-
38
24
  return validateNameLength(userData)
39
25
  }
40
26
 
41
- // ❌ DON'T CREATE: compose() utility
42
- const compose = (...fns) => x => fns.reduceRight((v, f) => f(v), x)
43
-
44
- // ✅ INSTEAD: Direct function calls
45
- const processData = (raw) => {
46
- const normalized = normalize(raw)
47
- const validated = validate(normalized)
48
- return transform(validated)
49
- }
50
-
51
- // ❌ DON'T CREATE: curry() utility
52
- const curry = (fn) => (...args) => args.length >= fn.length
53
- ? fn(...args)
54
- : (...more) => curry(fn)(...args, ...more)
55
-
56
- // ✅ INSTEAD: Native closures and function factories
57
- const createValidator = (rules) => (value) => {
58
- const errors = rules.filter(rule => !rule.validator(value))
59
- return errors.length === 0 ? { valid: true } : { valid: false, errors }
60
- }
61
-
62
- // ❌ DON'T CREATE: Custom monads
27
+ // ❌ DON'T CREATE custom monads
63
28
  class Maybe { /* complex monad implementation */ }
64
29
 
65
- // ✅ INSTEAD: Native error handling and conditionals
30
+ // ✅ Native error handling
66
31
  const getUser = async (id) => {
67
32
  try {
68
33
  const user = await fetchUser(id)
@@ -73,17 +38,16 @@ const getUser = async (id) => {
73
38
  }
74
39
  ```
75
40
 
76
- ### Context-Appropriate Complexity
41
+ **Context-appropriate complexity:**
77
42
 
78
43
  ```javascript
79
- // CLI Script: Simple and direct
44
+ // CLI Script: simple and direct
80
45
  const processFile = (filePath) => {
81
46
  const data = readFileSync(filePath, 'utf8')
82
- const lines = data.split('\n').filter(line => line.trim())
83
- return lines.map(line => line.toUpperCase())
47
+ return data.split('\n').filter(line => line.trim()).map(line => line.toUpperCase())
84
48
  }
85
49
 
86
- // Production Service: Appropriate error handling
50
+ // Production Service: appropriate error handling + logging
87
51
  const processFile = async (filePath, logger) => {
88
52
  try {
89
53
  const data = await readFile(filePath, 'utf8')
@@ -95,71 +59,46 @@ const processFile = async (filePath, logger) => {
95
59
  return { success: false, error: error.message }
96
60
  }
97
61
  }
98
-
99
- // Big Data System: Performance optimization with evidence
100
- const createFileProcessor = (config) => {
101
- // Pre-compile expensive transformations
102
- const transformers = config.transforms.map(compileTransformer)
103
-
104
- return async (filePath, logger) => {
105
- const stream = createReadStream(filePath)
106
- return processStream(stream, transformers, logger)
107
- }
108
- }
109
62
  ```
110
63
 
111
- ## Core FP Patterns (Error-Preventing Essentials)
64
+ ## Core Patterns
112
65
 
113
66
  ### 1. Purity and Side Effect Isolation
114
67
 
115
- **Rule**: Separate business logic from side effects.
68
+ Separate business logic from side effects. Pure core + impure shell.
116
69
 
117
70
  ```javascript
118
- // ❌ Impure - side effects mixed with logic
71
+ // ❌ Side effects mixed with logic
119
72
  function calculateTotal(items) {
120
- console.log('Processing items') // Side effect
121
- total += items.reduce((sum, item) => sum + item.price, 0) // Mutation
73
+ console.log('Processing items')
74
+ total += items.reduce((sum, item) => sum + item.price, 0) // mutation
122
75
  return total
123
76
  }
124
77
 
125
- // ✅ Pure business logic
78
+ // ✅ Pure logic
126
79
  const calculateTotal = (items) =>
127
80
  items.reduce((sum, item) => sum + item.price, 0)
128
81
 
129
82
  // ✅ Side effects isolated
130
83
  const logAndCalculate = (items, logger) => {
131
- const total = calculateTotal(items) // Pure calculation
132
- logger.log(`Total: ${total}`) // Side effect isolated
84
+ const total = calculateTotal(items)
85
+ logger.log(`Total: ${total}`)
133
86
  return total
134
87
  }
135
88
  ```
136
89
 
137
- **Benefits**:
138
- - 100% testable with all edge cases
139
- - Predictable behavior and debugging
140
- - Safe for parallel execution
141
- - Enables optimization through memoization
142
-
143
90
  ### 2. Composition Over Inheritance
144
91
 
145
- **Rule**: Build complex behavior from simple functions.
146
-
147
92
  ```javascript
148
- // ❌ Class hierarchy approach
149
- class BaseValidator {
150
- validate() { throw new Error('Not implemented') }
151
- }
152
- class EmailValidator extends BaseValidator {
153
- validate(value) { /* email logic */ }
154
- }
93
+ // ❌ Class hierarchy
94
+ class BaseValidator { validate() { throw new Error('Not implemented') } }
95
+ class EmailValidator extends BaseValidator { validate(value) { /* email logic */ } }
155
96
 
156
- // ✅ Function composition (no utilities needed)
97
+ // ✅ Function composition, no utilities needed
157
98
  const validateRequired = (value) => value != null && value !== ''
158
99
  const validateEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)
159
- const validateLength = (min, max) => (value) =>
160
- value.length >= min && value.length <= max
100
+ const validateLength = (min, max) => (value) => value.length >= min && value.length <= max
161
101
 
162
- // Simple composition without pipe() utility
163
102
  const validateUserEmail = (email) => {
164
103
  if (!validateRequired(email)) return { valid: false, error: 'Required' }
165
104
  if (!validateEmail(email)) return { valid: false, error: 'Invalid email' }
@@ -168,18 +107,18 @@ const validateUserEmail = (email) => {
168
107
  }
169
108
  ```
170
109
 
171
- ### 3. Dependency Injection Through Parameters
110
+ ### 3. Dependency Injection via Parameters
172
111
 
173
- **Rule**: Pass dependencies explicitly, avoid global state.
112
+ Pass dependencies explicitly. No global state, no hidden dependencies.
174
113
 
175
114
  ```javascript
176
- // ❌ Hidden dependencies, hard to test
115
+ // ❌ Hidden dependencies
177
116
  function saveUser(userData) {
178
- const hashedPassword = bcrypt.hash(userData.password) // Hidden
179
- return database.save({ ...userData, password: hashedPassword }) // Hidden
117
+ const hashedPassword = bcrypt.hash(userData.password)
118
+ return database.save({ ...userData, password: hashedPassword })
180
119
  }
181
120
 
182
- // ✅ Explicit dependencies, fully testable
121
+ // ✅ Explicit dependencies
183
122
  const saveUser = async (userData, hasher, database) => {
184
123
  const hashedPassword = await hasher.hash(userData.password)
185
124
  return database.save({ ...userData, password: hashedPassword })
@@ -192,135 +131,84 @@ const createUserService = (hasher, database) => ({
192
131
  })
193
132
  ```
194
133
 
195
- ### 4. Immutability Patterns
196
-
197
- **Rule**: Avoid mutations, create new objects/arrays.
134
+ ### 4. Immutability
198
135
 
199
136
  ```javascript
200
- // ❌ Mutation approach
137
+ // ❌ Mutation
201
138
  function updateUserSettings(user, settings) {
202
- user.settings = { ...user.settings, ...settings } // Mutates user
139
+ user.settings = { ...user.settings, ...settings }
203
140
  user.updatedAt = new Date()
204
141
  return user
205
142
  }
206
143
 
207
- // ✅ Immutable approach
144
+ // ✅ Create new objects
208
145
  const updateUserSettings = (user, settings) => ({
209
146
  ...user,
210
147
  settings: { ...user.settings, ...settings },
211
148
  updatedAt: new Date()
212
149
  })
213
150
 
214
- // ✅ Array operations without mutation
215
151
  const addItem = (items, newItem) => [...items, newItem]
216
152
  const removeItem = (items, id) => items.filter(item => item.id !== id)
217
153
  const updateItem = (items, id, updates) =>
218
154
  items.map(item => item.id === id ? { ...item, ...updates } : item)
219
155
  ```
220
156
 
221
- ## Testing Essentials (Enabled by Purity)
157
+ ## Testing (Enabled by Purity)
222
158
 
223
- **Philosophy**: Pure functions enable testing all edge cases systematically.
159
+ Pure functions enable systematic edge case coverage.
224
160
 
225
161
  ```javascript
226
- // Traditional testing (limited coverage)
227
162
  describe('calculateDiscount', () => {
228
- it('should calculate 10% discount', () => {
229
- expect(calculateDiscount(100, 0.1)).toBe(10)
163
+ const testCases = [
164
+ [100, 0.1, 10],
165
+ [50, 0.2, 10],
166
+ [0, 0.1, 0]
167
+ ]
168
+ testCases.forEach(([price, rate, expected]) => {
169
+ it(`${rate*100}% on ${price} = ${expected}`, () =>
170
+ expect(calculateDiscount(price, rate)).toBe(expected))
230
171
  })
231
- })
232
-
233
- // FP comprehensive testing (all edge cases)
234
- describe('calculateDiscount - FP Comprehensive', () => {
235
- describe('valid inputs', () => {
236
- const testCases = [
237
- [100, 0.1, 10],
238
- [50, 0.2, 10],
239
- [0, 0.1, 0]
240
- ]
241
-
242
- testCases.forEach(([price, rate, expected]) => {
243
- it(`${rate*100}% discount on ${price} = ${expected}`, () => {
244
- expect(calculateDiscount(price, rate)).toBe(expected)
245
- })
246
- })
247
- })
248
-
249
- describe('all data types - systematic edge cases', () => {
250
- const invalidTypes = [null, undefined, NaN, true, [], {}, '100']
251
172
 
252
- invalidTypes.forEach(input => {
253
- it(`handles ${typeof input} gracefully`, () => {
254
- expect(() => calculateDiscount(input, 0.1)).not.toThrow()
255
- expect(calculateDiscount(input, 0.1)).toBe(0)
256
- })
173
+ const invalidTypes = [null, undefined, NaN, true, [], {}, '100']
174
+ invalidTypes.forEach(input => {
175
+ it(`handles ${typeof input} gracefully`, () => {
176
+ expect(() => calculateDiscount(input, 0.1)).not.toThrow()
177
+ expect(calculateDiscount(input, 0.1)).toBe(0)
257
178
  })
258
179
  })
259
180
  })
260
181
  ```
261
182
 
262
- ## Performance Patterns (Evidence-Based)
183
+ ## Performance (Evidence-Based Only)
263
184
 
264
- **⚠️ IMPORTANT**: Optimize only when needed with evidence.
265
-
266
- ### Configuration Pre-Compilation (When Actually Needed)
267
-
268
- **Use When**: Processing large datasets (>10K items) with repeated configuration access.
185
+ Optimize only when measured. For large datasets (>10K items), pre-compile configuration.
269
186
 
270
187
  ```javascript
271
- // Problem: O(records × fields) complexity
188
+ // Problem: O(records × fields) — repeated config access per record
272
189
  function processRecords(records, schema) {
273
- return records.map(record => {
274
- return schema.fields.reduce((obj, field) => { // ← Repeated config access
190
+ return records.map(record =>
191
+ schema.fields.reduce((obj, field) => {
275
192
  obj[field.name] = transformField(record[field.name], field.type)
276
193
  return obj
277
- }, {})
278
- })
194
+ }, {}))
279
195
  }
280
196
 
281
- // Solution: O(records + fields) - pre-compile configuration
282
- function createRecordProcessor(schema) {
283
- // Setup once - extract expensive configuration
197
+ // Solution: O(records + fields) pay config cost once
198
+ const createRecordProcessor = (schema) => {
284
199
  const fieldProcessors = schema.fields.map(field =>
285
- value => transformField(value, field.type)
286
- )
287
-
200
+ value => transformField(value, field.type))
288
201
  return record => fieldProcessors.reduce((obj, processor, i) => {
289
202
  obj[schema.fields[i].name] = processor(record[schema.fields[i].name])
290
203
  return obj
291
204
  }, {})
292
205
  }
293
206
 
294
- // Usage: Configuration cost paid once
295
- const processor = createRecordProcessor(schema) // Setup phase
296
- const results = records.map(processor) // Linear execution
207
+ const processor = createRecordProcessor(schema) // setup once
208
+ const results = records.map(processor) // linear execution
297
209
  ```
298
210
 
299
- ### Function Factories for Reusable Logic
300
-
301
- ```javascript
302
- // Create specialized functions instead of generic ones
303
- const createValidator = (rules) => (value) => {
304
- const errors = []
305
- for (const rule of rules) {
306
- if (!rule.validator(value)) {
307
- errors.push(rule.message)
308
- }
309
- }
310
- return errors.length === 0 ? { valid: true } : { valid: false, errors }
311
- }
312
-
313
- // Usage: Configure once, use many times
314
- const validateEmail = createValidator([
315
- { validator: v => typeof v === 'string', message: 'Must be string' },
316
- { validator: v => v.includes('@'), message: 'Must contain @' },
317
- { validator: v => v.length > 5, message: 'Too short' }
318
- ])
319
- ```
320
-
321
- ## Language-Specific Idioms
322
-
323
- ### Native JavaScript Patterns
211
+ ## Native JavaScript Idioms
324
212
 
325
213
  ```javascript
326
214
  // Native array methods over loops
@@ -330,134 +218,25 @@ const processUsers = (users) =>
330
218
  .map(user => ({ ...user, displayName: `${user.firstName} ${user.lastName}` }))
331
219
  .sort((a, b) => a.lastName.localeCompare(b.lastName))
332
220
 
333
- // Native async/await over callbacks
221
+ // async/await with result types
334
222
  const fetchUserData = async (userId, fetcher) => {
335
223
  try {
336
- const user = await fetcher.getUser(userId)
337
- const preferences = await fetcher.getPreferences(userId)
338
- return { ...user, preferences }
224
+ const [user, preferences] = await Promise.all([
225
+ fetcher.getUser(userId),
226
+ fetcher.getPreferences(userId)
227
+ ])
228
+ return { success: true, data: { ...user, preferences } }
339
229
  } catch (error) {
340
- return { error: error.message }
341
- }
342
- }
343
-
344
- // WeakMap for performance when appropriate
345
- const createMemoized = () => {
346
- const cache = new WeakMap()
347
- return (obj, computeFn) => {
348
- if (cache.has(obj)) return cache.get(obj)
349
- const result = computeFn(obj)
350
- cache.set(obj, result)
351
- return result
352
- }
353
- }
354
- ```
355
-
356
- ## Quality Gates (Pre-Implementation Checklist)
357
-
358
- 1. **"Can this be pure?"** → Separate business logic from side effects
359
- 2. **"Can this use native patterns?"** → Avoid creating custom FP utilities, use language features
360
- 3. **"Can this be simplified?"** → Choose simple solution over complex abstraction
361
- 4. **"Is this complexity justified?"** → Evidence-based complexity decisions
362
- 5. **"Is this testable?"** → Pure functions enable comprehensive testing
363
- 6. **"Is this context-appropriate?"** → CLI script ≠ production service ≠ big data system
364
-
365
- ## When to Load Additional Content
366
-
367
- ### Deep Principles and Explanations
368
- **File**: `core-principles.md` (~800 lines)
369
- **When**: Learning mode, explaining WHY, architectural decisions
370
- **Contains**: Complete FP philosophy, detailed pattern explanations, cross-pattern comparisons
371
-
372
- ### Comprehensive Anti-Patterns
373
- **File**: `anti-patterns.md` (~400 lines)
374
- **When**: Code review, preventing specific mistakes, team training
375
- **Contains**: Exhaustive anti-patterns, common mistakes, migration strategies
376
-
377
- ### Testing Methodology
378
- **File**: `testing-patterns.md` (~500 lines)
379
- **When**: Building test suites, improving coverage, edge case analysis
380
- **Contains**: Full testing strategies, edge case patterns, property-based testing
381
-
382
- ### Performance Deep-Dive
383
- **File**: `performance-patterns.md` (~400 lines)
384
- **When**: Performance issues identified, optimization needed, benchmarking
385
- **Contains**: Detailed optimization strategies, profiling techniques, benchmarking patterns
386
-
387
- ### Working Examples
388
- **Directory**: `examples/`
389
- **When**: Learning implementation, need working code, integration examples
390
- **Contains**: Complete working examples with tests
391
-
392
- ## Integration with Domain Skills
393
-
394
- This core skill provides the foundation for domain-specific skills:
395
-
396
- - **js-fp-api**: Node.js API patterns with FP principles
397
- - **js-fp-react**: React component patterns with FP principles
398
- - **js-fp-vue**: Vue.js component patterns with FP principles
399
- - **js-fp-wordpress**: WordPress patterns with FP principles
400
-
401
- Each domain skill references this core and adds domain-specific patterns.
402
-
403
- ## Common Use Cases
404
-
405
- ### Data Validation
406
- ```javascript
407
- const createValidationRules = (schema) => {
408
- const rules = schema.map(rule => ({
409
- field: rule.field,
410
- validator: compileValidator(rule.type, rule.options),
411
- message: rule.message
412
- }))
413
-
414
- return (data) => {
415
- const errors = []
416
- for (const rule of rules) {
417
- if (!rule.validator(data[rule.field])) {
418
- errors.push({ field: rule.field, message: rule.message })
419
- }
420
- }
421
- return errors.length === 0 ? { valid: true } : { valid: false, errors }
230
+ return { success: false, error: error.message }
422
231
  }
423
232
  }
424
233
  ```
425
234
 
426
- ### Data Transformation
427
- ```javascript
428
- // Pipeline without utilities - native chaining
429
- const processUserData = (rawData) => {
430
- const normalized = normalizeUserData(rawData)
431
- if (!normalized.valid) return normalized
432
-
433
- const validated = validateUserData(normalized.data)
434
- if (!validated.valid) return validated
435
-
436
- const enhanced = enhanceWithDefaults(validated.data)
437
- return { valid: true, data: enhanced }
438
- }
439
- ```
440
-
441
- ## Success Metrics
442
-
443
- ### Code Quality
444
- - **Simplicity**: Readable, maintainable code over clever solutions
445
- - **Testability**: 100% testable pure functions with edge case coverage
446
- - **Native Integration**: Uses language features effectively
447
- - **Context-Appropriate**: Matches complexity to actual requirements
448
-
449
- ### Performance (When Needed)
450
- - **Evidence-Based**: Optimizations backed by measurements
451
- - **Appropriate Scale**: Simple solutions for small/medium data
452
- - **Native Optimization**: Leverages language/runtime optimizations
453
- - **Avoid Over-Engineering**: No complex monitoring for simple apps
454
-
455
- ### Maintainability
456
- - **Predictable Patterns**: Consistent FP approaches
457
- - **Easy Testing**: Comprehensive test coverage enabled by purity
458
- - **Simple Maintenance**: Easy to understand and modify
459
- - **Documentation**: Clear examples and usage patterns
460
-
461
- ## Philosophy
235
+ ## Pre-Implementation Checklist
462
236
 
463
- *"Pure functions, native language patterns, appropriate complexity, and comprehensive testing for maintainable, predictable code that respects the language and solves real problems simply."*
237
+ 1. Can this be pure? separate business logic from side effects
238
+ 2. Can this use native patterns? — avoid custom FP utilities
239
+ 3. Can this be simplified? — prefer simple over clever
240
+ 4. Is complexity justified? — evidence, not assumptions
241
+ 5. Is this testable? — pure functions enable comprehensive coverage
242
+ 6. Is this context-appropriate? — CLI script ≠ production service