@itz4blitz/agentful 1.2.1 → 1.4.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 (75) hide show
  1. package/README.md +20 -41
  2. package/bin/cli.js +41 -1056
  3. package/bin/hooks/architect-drift-detector.js +242 -0
  4. package/bin/hooks/block-file-creation.js +271 -0
  5. package/bin/hooks/context-awareness.js +369 -0
  6. package/bin/hooks/post-action-suggestions.js +75 -0
  7. package/bin/hooks/product-spec-watcher.js +151 -0
  8. package/bin/hooks/session-start.js +93 -0
  9. package/lib/context-awareness.js +369 -0
  10. package/lib/index.js +17 -14
  11. package/lib/init.js +99 -24
  12. package/lib/parallel-execution.js +235 -0
  13. package/lib/presets.js +80 -4
  14. package/lib/state-validator.README.md +442 -0
  15. package/lib/state-validator.example.js +262 -0
  16. package/lib/state-validator.js +562 -0
  17. package/package.json +4 -7
  18. package/template/.claude/agents/architect.md +2 -2
  19. package/template/.claude/agents/backend.md +17 -30
  20. package/template/.claude/agents/frontend.md +17 -39
  21. package/template/.claude/agents/orchestrator.md +63 -4
  22. package/template/.claude/agents/product-analyzer.md +1 -1
  23. package/template/.claude/agents/tester.md +16 -29
  24. package/template/.claude/commands/agentful-analyze.md +47 -59
  25. package/template/.claude/commands/agentful-decide.md +73 -95
  26. package/template/.claude/commands/agentful-generate.md +221 -14
  27. package/template/.claude/commands/agentful-init.md +621 -0
  28. package/template/.claude/commands/agentful-product.md +27 -38
  29. package/template/.claude/commands/agentful-start.md +133 -120
  30. package/template/.claude/commands/agentful-status.md +51 -68
  31. package/template/.claude/commands/agentful-validate.md +29 -69
  32. package/template/.claude/commands/agentful.md +1 -1
  33. package/template/.claude/product/EXAMPLES.md +2 -2
  34. package/template/.claude/product/index.md +1 -1
  35. package/template/.claude/settings.json +39 -0
  36. package/template/.claude/skills/research/SKILL.md +432 -0
  37. package/template/CLAUDE.md +226 -33
  38. package/template/bin/hooks/analyze-trigger.js +69 -0
  39. package/template/bin/hooks/architect-drift-detector.js +242 -0
  40. package/template/bin/hooks/block-file-creation.js +271 -0
  41. package/template/bin/hooks/health-check.js +153 -0
  42. package/template/bin/hooks/product-spec-watcher.js +151 -0
  43. package/version.json +1 -1
  44. package/bin/hooks/post-agent.js +0 -101
  45. package/bin/hooks/post-feature.js +0 -227
  46. package/bin/hooks/pre-agent.js +0 -118
  47. package/bin/hooks/pre-feature.js +0 -138
  48. package/lib/VALIDATION_README.md +0 -455
  49. package/lib/ci/claude-action-integration.js +0 -641
  50. package/lib/ci/index.js +0 -10
  51. package/lib/core/analyzer.js +0 -497
  52. package/lib/core/cli.js +0 -141
  53. package/lib/core/detectors/conventions.js +0 -342
  54. package/lib/core/detectors/framework.js +0 -276
  55. package/lib/core/detectors/index.js +0 -15
  56. package/lib/core/detectors/language.js +0 -199
  57. package/lib/core/detectors/patterns.js +0 -356
  58. package/lib/core/generator.js +0 -626
  59. package/lib/core/index.js +0 -9
  60. package/lib/core/output-parser.js +0 -458
  61. package/lib/core/storage.js +0 -515
  62. package/lib/core/templates.js +0 -556
  63. package/lib/pipeline/cli.js +0 -423
  64. package/lib/pipeline/engine.js +0 -928
  65. package/lib/pipeline/executor.js +0 -440
  66. package/lib/pipeline/index.js +0 -33
  67. package/lib/pipeline/integrations.js +0 -559
  68. package/lib/pipeline/schemas.js +0 -288
  69. package/lib/remote/client.js +0 -361
  70. package/lib/server/auth.js +0 -270
  71. package/lib/server/client-example.js +0 -190
  72. package/lib/server/executor.js +0 -477
  73. package/lib/server/index.js +0 -494
  74. package/lib/update-helpers.js +0 -505
  75. package/lib/validation.js +0 -460
@@ -0,0 +1,432 @@
1
+ ---
2
+ name: research
3
+ description: Research best practices for tech stacks and product domains using Context7 or WebSearch
4
+ ---
5
+
6
+ # Research Skill
7
+
8
+ Enables agents to research current best practices, design patterns, and implementation approaches for technologies and product domains.
9
+
10
+ ## When to Use
11
+
12
+ - **Tech Stack Analysis**: Learning current best practices for detected frameworks/languages
13
+ - **Domain Patterns**: Understanding implementation approaches for specific business domains
14
+ - **Agent Generation**: Informing specialized agent creation with research findings
15
+ - **Architecture Decisions**: Comparing approaches before implementation
16
+ - **Trend Analysis**: Understanding what's current vs deprecated
17
+
18
+ ## Available Research Methods
19
+
20
+ ### 1. Context7 MCP (Preferred)
21
+
22
+ Context7 provides curated, high-quality technical documentation and best practices.
23
+
24
+ **Advantages**:
25
+ - ✅ Curated, accurate results
26
+ - ✅ Up-to-date framework documentation
27
+ - ✅ Language-specific patterns
28
+ - ✅ Faster than web search
29
+ - ✅ No noise or outdated content
30
+
31
+ **Check Availability**:
32
+ ```javascript
33
+ function hasContext7() {
34
+ // Check if Context7 MCP is connected
35
+ // Claude Code automatically exposes MCP tools
36
+ return typeof mcp__context7__search !== 'undefined';
37
+ }
38
+ ```
39
+
40
+ **Usage**:
41
+ ```javascript
42
+ // Example: Research Next.js 15 patterns
43
+ const results = await mcp__context7__search({
44
+ query: 'Next.js 15 app router best practices',
45
+ limit: 5
46
+ });
47
+
48
+ // Results include:
49
+ // - Official documentation
50
+ // - Verified patterns
51
+ // - Current recommendations
52
+ ```
53
+
54
+ ### 2. WebSearch (Fallback)
55
+
56
+ When Context7 is unavailable, use WebSearch for broader coverage.
57
+
58
+ **Advantages**:
59
+ - ✅ Always available
60
+ - ✅ Broader coverage (blogs, forums, etc.)
61
+ - ✅ Real-world examples
62
+ - ✅ Community insights
63
+
64
+ **Limitations**:
65
+ - ⚠️ May include outdated content
66
+ - ⚠️ Requires filtering and verification
67
+ - ⚠️ More noise
68
+
69
+ **Usage**:
70
+ ```javascript
71
+ const results = await WebSearch({
72
+ query: 'Next.js 15 app router best practices 2026',
73
+ limit: 5
74
+ });
75
+
76
+ // Always include current year in query for freshness
77
+ ```
78
+
79
+ ## Research Workflow
80
+
81
+ ### Step 1: Determine Research Method
82
+
83
+ ```javascript
84
+ const researchMethod = hasContext7() ? 'context7' : 'websearch';
85
+
86
+ console.log(`Research method: ${researchMethod}`);
87
+ ```
88
+
89
+ ### Step 2: Formulate Queries
90
+
91
+ Create specific, targeted queries:
92
+
93
+ **Good queries**:
94
+ - "Next.js 15 server components best practices"
95
+ - "React 19 concurrent rendering patterns"
96
+ - "PostgreSQL connection pooling with Prisma"
97
+ - "Authentication implementation patterns 2026"
98
+
99
+ **Bad queries**:
100
+ - "Next.js" (too broad)
101
+ - "How to code" (too generic)
102
+ - "Best JavaScript framework" (subjective, not actionable)
103
+
104
+ **Query Template**:
105
+ ```
106
+ [Technology/Framework] + [Specific Topic] + [Year]
107
+ ```
108
+
109
+ ### Step 3: Execute Research
110
+
111
+ ```javascript
112
+ async function researchTopic(topic, context = {}) {
113
+ const queries = generateQueries(topic, context);
114
+ const findings = [];
115
+
116
+ for (const query of queries) {
117
+ let result;
118
+
119
+ if (hasContext7()) {
120
+ result = await mcp__context7__search({
121
+ query,
122
+ limit: 3
123
+ });
124
+ } else {
125
+ result = await WebSearch({
126
+ query: `${query} ${new Date().getFullYear()}`,
127
+ limit: 3
128
+ });
129
+ }
130
+
131
+ findings.push({
132
+ query,
133
+ results: result,
134
+ source: hasContext7() ? 'context7' : 'websearch'
135
+ });
136
+ }
137
+
138
+ return findings;
139
+ }
140
+ ```
141
+
142
+ ### Step 4: Synthesize Findings
143
+
144
+ Extract actionable insights from research results:
145
+
146
+ ```javascript
147
+ function synthesizeResearch(findings, context) {
148
+ // Aggregate findings by category
149
+ const synthesis = {
150
+ techStackPatterns: {},
151
+ domainPatterns: {},
152
+ bestPractices: [],
153
+ commonPitfalls: [],
154
+ references: []
155
+ };
156
+
157
+ for (const finding of findings) {
158
+ // Extract tech stack patterns
159
+ if (finding.query.includes(context.techStack.framework)) {
160
+ synthesis.techStackPatterns[context.techStack.framework] = extractPatterns(finding.results);
161
+ }
162
+
163
+ // Extract domain-specific patterns
164
+ for (const domain of context.domains || []) {
165
+ if (finding.query.includes(domain)) {
166
+ synthesis.domainPatterns[domain] = extractPatterns(finding.results);
167
+ }
168
+ }
169
+
170
+ // Collect best practices
171
+ synthesis.bestPractices.push(...extractBestPractices(finding.results));
172
+
173
+ // Collect common pitfalls
174
+ synthesis.commonPitfalls.push(...extractPitfalls(finding.results));
175
+
176
+ // Store references
177
+ synthesis.references.push({
178
+ query: finding.query,
179
+ source: finding.source,
180
+ url: extractURL(finding.results)
181
+ });
182
+ }
183
+
184
+ // Deduplicate and rank
185
+ synthesis.bestPractices = deduplicateAndRank(synthesis.bestPractices);
186
+ synthesis.commonPitfalls = deduplicateAndRank(synthesis.commonPitfalls);
187
+
188
+ return synthesis;
189
+ }
190
+ ```
191
+
192
+ ## Research Use Cases
193
+
194
+ ### Use Case 1: Tech Stack Research
195
+
196
+ Research current best practices for detected technologies:
197
+
198
+ ```javascript
199
+ // Called by /agentful-generate after tech stack detection
200
+ const techStack = {
201
+ framework: 'Next.js',
202
+ version: '15.1.0',
203
+ language: 'TypeScript',
204
+ database: 'PostgreSQL',
205
+ orm: 'Prisma'
206
+ };
207
+
208
+ const queries = [
209
+ `${techStack.framework} ${techStack.version} best practices`,
210
+ `${techStack.framework} project structure patterns`,
211
+ `${techStack.orm} with ${techStack.database} optimization`,
212
+ `TypeScript configuration for ${techStack.framework}`
213
+ ];
214
+
215
+ const findings = await researchTopic('tech-stack', { techStack, queries });
216
+ const synthesis = synthesizeResearch(findings, { techStack });
217
+
218
+ // Use synthesis to inform:
219
+ // - Agent generation (what agents should know)
220
+ // - Skill creation (patterns to document)
221
+ // - Architecture decisions
222
+ ```
223
+
224
+ ### Use Case 2: Domain Research
225
+
226
+ Research implementation patterns for product domains:
227
+
228
+ ```javascript
229
+ // Called by /agentful-generate after domain discovery
230
+ const product = {
231
+ type: 'task management app',
232
+ domains: ['authentication', 'tasks', 'collaboration']
233
+ };
234
+
235
+ const queries = [
236
+ `${product.type} architecture patterns`,
237
+ `authentication implementation best practices ${techStack.framework}`,
238
+ `task management data model design`,
239
+ `real-time collaboration implementation`
240
+ ];
241
+
242
+ const findings = await researchTopic('domains', { product, queries });
243
+ const synthesis = synthesizeResearch(findings, { domains: product.domains });
244
+
245
+ // Use synthesis to inform:
246
+ // - Domain agent specialization
247
+ // - Database schema design
248
+ // - API design patterns
249
+ ```
250
+
251
+ ### Use Case 3: Pre-Implementation Research
252
+
253
+ Research before implementing a complex feature:
254
+
255
+ ```javascript
256
+ // Called by orchestrator before delegating complex work
257
+ const feature = {
258
+ name: 'Real-time notifications',
259
+ complexity: 'high',
260
+ technologies: ['WebSockets', 'Redis', 'React']
261
+ };
262
+
263
+ const queries = [
264
+ `WebSocket implementation ${techStack.framework}`,
265
+ `Redis pub/sub patterns for notifications`,
266
+ `React real-time updates best practices`,
267
+ `scaling WebSocket connections`
268
+ ];
269
+
270
+ const findings = await researchTopic('feature', { feature, queries });
271
+ const synthesis = synthesizeResearch(findings, { feature });
272
+
273
+ // Share findings with specialist agent before implementation
274
+ ```
275
+
276
+ ## Quality Criteria
277
+
278
+ When evaluating research findings:
279
+
280
+ 1. **Recency**: Prefer results from current year
281
+ 2. **Authority**: Official docs > verified blogs > forums
282
+ 3. **Specificity**: Specific patterns > general advice
283
+ 4. **Actionability**: Code examples > theory
284
+ 5. **Relevance**: Exact version match > general version
285
+
286
+ ## Integration Points
287
+
288
+ ### /agentful-generate
289
+
290
+ Research is integrated into agent generation:
291
+
292
+ ```javascript
293
+ // Step 3 of /agentful-generate workflow
294
+ console.log('Researching best practices...');
295
+
296
+ const research = await researchTopic('generation', {
297
+ techStack,
298
+ domains,
299
+ productType
300
+ });
301
+
302
+ const synthesis = synthesizeResearch(research, { techStack, domains });
303
+
304
+ // Use synthesis when generating:
305
+ // - Domain agent responsibilities
306
+ // - Tech skill documentation
307
+ // - Best practices sections
308
+ ```
309
+
310
+ ### Orchestrator
311
+
312
+ Research can inform architectural decisions:
313
+
314
+ ```javascript
315
+ // Before implementing complex features
316
+ if (feature.complexity === 'high') {
317
+ console.log(`Researching implementation approaches for ${feature.name}...`);
318
+
319
+ const research = await researchTopic('feature-planning', {
320
+ feature,
321
+ techStack
322
+ });
323
+
324
+ const synthesis = synthesizeResearch(research, { feature });
325
+
326
+ // Present findings to user for decision
327
+ AskUserQuestion({
328
+ question: `
329
+ Research findings for ${feature.name}:
330
+
331
+ Recommended approach:
332
+ ${synthesis.bestPractices[0]}
333
+
334
+ Alternatives:
335
+ ${synthesis.bestPractices.slice(1, 3).join('\n')}
336
+
337
+ Which approach should we use?
338
+ `,
339
+ options: synthesis.bestPractices.map(p => p.summary)
340
+ });
341
+ }
342
+ ```
343
+
344
+ ## Example: Full Research Flow
345
+
346
+ ```javascript
347
+ // 1. Detect tech stack
348
+ const techStack = detectTechStack();
349
+
350
+ // 2. Read product requirements
351
+ const product = Read('.claude/product/index.md');
352
+ const productType = extractProductType(product);
353
+ const domains = extractDomains(product);
354
+
355
+ // 3. Research
356
+ console.log('Researching best practices...');
357
+
358
+ const method = hasContext7() ? 'Context7' : 'WebSearch';
359
+ console.log(`Method: ${method}`);
360
+
361
+ // Tech stack research
362
+ const techResearch = await researchTopic('tech-stack', {
363
+ techStack,
364
+ queries: [
365
+ `${techStack.framework} ${techStack.version} best practices`,
366
+ `${techStack.framework} project structure`,
367
+ `${techStack.orm} patterns`
368
+ ]
369
+ });
370
+
371
+ // Domain research
372
+ const domainResearch = await researchTopic('domains', {
373
+ domains,
374
+ queries: domains.map(d => `${d} domain implementation patterns`)
375
+ });
376
+
377
+ // Product type research
378
+ const productResearch = await researchTopic('product-type', {
379
+ productType,
380
+ queries: [`${productType} application architecture`]
381
+ });
382
+
383
+ // 4. Synthesize
384
+ const synthesis = synthesizeResearch(
385
+ [...techResearch, ...domainResearch, ...productResearch],
386
+ { techStack, domains, productType }
387
+ );
388
+
389
+ // 5. Apply findings
390
+ console.log('Research complete. Applying findings to agent generation...');
391
+
392
+ // Generate agents with research-informed patterns
393
+ generateAgentsWithResearch(synthesis);
394
+ ```
395
+
396
+ ## Error Handling
397
+
398
+ ```javascript
399
+ async function safeResearch(query, context = {}) {
400
+ try {
401
+ if (hasContext7()) {
402
+ return await mcp__context7__search({ query, limit: 3 });
403
+ } else {
404
+ return await WebSearch({ query: `${query} ${new Date().getFullYear()}`, limit: 3 });
405
+ }
406
+ } catch (error) {
407
+ console.warn(`Research failed for query "${query}": ${error.message}`);
408
+ return {
409
+ query,
410
+ results: [],
411
+ error: error.message,
412
+ fallback: true
413
+ };
414
+ }
415
+ }
416
+ ```
417
+
418
+ ## Best Practices
419
+
420
+ 1. **Always check Context7 availability first** - More accurate results
421
+ 2. **Include year in WebSearch queries** - Ensure freshness
422
+ 3. **Limit queries to 5-10** - Balance coverage vs speed
423
+ 4. **Synthesize findings** - Don't just dump raw results
424
+ 5. **Cache research results** - Avoid redundant queries
425
+ 6. **Provide references** - Link to source material
426
+ 7. **Time-box research** - Don't spend hours researching
427
+
428
+ ## References
429
+
430
+ - Context7 MCP Documentation
431
+ - Claude Code WebSearch API
432
+ - Research methodology best practices