@champpaba/claude-agent-kit 2.4.0 → 2.5.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/.claude/CLAUDE.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # CLAUDE.md
2
2
 
3
3
  > **Navigation Hub for AI Agents**
4
- > **Template Version:** 2.4.0 - Adaptive Depth Research
5
- > **Latest:** Dynamic research layers (0-10+) per change + Zero-maintenance tech detection + Claude 4.5 optimized agents
4
+ > **Template Version:** 2.5.0 - Smart Topic Query
5
+ > **Latest:** Cross-library integration detection + Integration risk summary + Proactive error prevention
6
6
 
7
7
  ---
8
8
 
@@ -131,18 +131,22 @@ Universal, framework-agnostic template for AI-assisted development.
131
131
 
132
132
  ---
133
133
 
134
- ## 📚 Best Practices System (v2.3.0 - Zero Maintenance)
134
+ ## 📚 Best Practices System (v2.5.0 - Smart Topic Query)
135
135
 
136
136
  **Quick Summary:**
137
137
  - `/csetup` **dynamically detects any library** from spec text + package files (no hardcoded mappings)
138
138
  - **Works with any language:** JavaScript, Python, Rust, Go, PHP, Ruby - automatically
139
139
  - **Context7 validates** each potential library name and resolves to official docs
140
+ - **v2.5.0:** Smart Topic Query includes other library names for cross-library integration docs
141
+ - **v2.5.0:** Auto-generates `INTEGRATION_RISKS.md` with detected concerns
140
142
  - Files created in `.claude/contexts/domain/project/best-practices/`
141
- - **Agents read** best practices before coding (validated by agent-executor)
143
+ - **Agents read** best practices + integration risks before coding
142
144
 
143
- **Key Change in v2.3.0:**
144
- - Old: Hardcoded regex patterns + manual ID mappings (required maintenance)
145
- - ✅ New: NLP extraction + Context7 resolution (zero maintenance, any library)
145
+ **Key Changes:**
146
+ | Version | Change |
147
+ |---------|--------|
148
+ | v2.3.0 | NLP extraction + Context7 resolution (zero maintenance) |
149
+ | v2.5.0 | Smart Topic Query + Integration Risk Detection |
146
150
 
147
151
  **Detection Sources:**
148
152
  | Source | Examples |
@@ -155,15 +159,24 @@ Universal, framework-agnostic template for AI-assisted development.
155
159
  | PHP | composer.json |
156
160
  | Ruby | Gemfile |
157
161
 
158
- **Flow:**
162
+ **Flow (v2.5.0):**
159
163
  ```
160
164
  /csetup → extract potential library names from ALL text sources
161
165
  → Context7 resolve-library-id (validates if real library)
162
- → Context7 get-library-docs (fetch best practices)
166
+ → Context7 get-library-docs (Smart Topic Query with other lib names)
167
+ → detect integration risks from docs content
163
168
  → generate .md files for each verified library
169
+ → generate INTEGRATION_RISKS.md if risks detected
164
170
  /cdev → inject paths into prompt → agent reads → validation checks
165
171
  ```
166
172
 
173
+ **Output Files:**
174
+ | File | Content |
175
+ |------|---------|
176
+ | `{lib}.md` | Library best practices with integration info |
177
+ | `INTEGRATION_RISKS.md` | Cross-library risks + checklist (if any detected) |
178
+ | `index.md` | Registry of all best practices files |
179
+
167
180
  ---
168
181
 
169
182
  ## 🎨 Design System v2.0.0 (Interactive Setup)
@@ -305,6 +318,86 @@ User: "Build login system"
305
318
 
306
319
  ---
307
320
 
321
+ ## 🆕 v2.5.0: Smart Topic Query + Integration Risk Detection
322
+
323
+ **Problem Solved:** Context7 queries used static topic "best practices" which missed adapter/integration documentation. Example: Drizzle + Auth.js requires specific column naming (snake_case) but this wasn't detected, causing runtime errors.
324
+
325
+ **Solution:** Smart Topic Query includes other library names in topic + automatic integration risk detection.
326
+
327
+ ### How Smart Topic Query Works
328
+
329
+ ```
330
+ Old (v2.4.0):
331
+ topic: "best practices, patterns, anti-patterns, common mistakes"
332
+ → Misses adapter-specific docs
333
+
334
+ New (v2.5.0):
335
+ topic: "best practices, patterns, adapter, integration, schema, {other-lib-names}"
336
+ → Gets cross-library integration docs automatically
337
+ ```
338
+
339
+ ### Key Features
340
+
341
+ | Feature | Description |
342
+ |---------|-------------|
343
+ | **Smart Topic** | Includes other detected library names in Context7 topic |
344
+ | **Bidirectional Query** | Query BOTH libraries (Auth.js → Drizzle, Drizzle → Auth.js) |
345
+ | **Risk Pattern Detection** | Scans docs for adapter, schema, column, sync, webhook patterns |
346
+ | **INTEGRATION_RISKS.md** | Auto-generated summary of detected integration concerns |
347
+ | **Zero Maintenance** | No hardcoded library pairs - works with any combination |
348
+
349
+ ### Integration Risk Patterns Detected
350
+
351
+ | Pattern | Keywords | Example |
352
+ |---------|----------|---------|
353
+ | Adapter | adapter, drizzleadapter, prismaadapter | ORM + Auth integrations |
354
+ | Schema | column, snake_case, camelcase, mapping | Column naming mismatches |
355
+ | Sync | sync, migrate, syncurl, embedded replica | Mobile/Edge data sync |
356
+ | Webhook | webhook, webhookendpoint | Payment/notification handlers |
357
+ | Lifecycle | beforeall, aftereach, setup, teardown | Test configuration |
358
+
359
+ ### Output Files
360
+
361
+ | File | Content |
362
+ |------|---------|
363
+ | `best-practices/{lib}.md` | Library-specific best practices (enhanced with integration docs) |
364
+ | `best-practices/INTEGRATION_RISKS.md` | Cross-library risk summary + checklist |
365
+
366
+ ### Example Flow
367
+
368
+ ```
369
+ Detected: [drizzle, auth.js, stripe]
370
+
371
+ Query drizzle with topic: "best practices, adapter, integration, auth.js, stripe"
372
+ → Gets: Drizzle adapter patterns, column naming
373
+
374
+ Query auth.js with topic: "best practices, adapter, integration, drizzle, stripe"
375
+ → Gets: DrizzleAdapter config, usersTable/accountsTable schema
376
+
377
+ Query stripe with topic: "best practices, adapter, integration, drizzle, auth.js"
378
+ → Gets: Webhook patterns, payment integration
379
+
380
+ Risk Detection:
381
+ → auth.js mentions "drizzleadapter", "userstable" → SCHEMA pattern
382
+ → stripe mentions "webhook", "webhooksecret" → WEBHOOK pattern
383
+
384
+ Output:
385
+ → drizzle.md (with auth.js integration info)
386
+ → auth-js.md (with Drizzle adapter config)
387
+ → stripe.md (with webhook patterns)
388
+ → INTEGRATION_RISKS.md (summary of all detected risks)
389
+ ```
390
+
391
+ ### Files Changed
392
+
393
+ | File | Change |
394
+ |------|--------|
395
+ | `csetup.md` Step 2.7 | Smart Topic Query implementation |
396
+ | `detectIntegrationRisks()` | New: Pattern detection from docs |
397
+ | `generateIntegrationRiskSummary()` | New: INTEGRATION_RISKS.md output |
398
+
399
+ ---
400
+
308
401
  ## 🆕 v2.4.0: Adaptive Depth Research
309
402
 
310
403
  **Problem Solved:** Previous feature detection was hardcoded (only 4 types: auth, payment, fileUpload, apiDesign) and used fixed standards. Missing domain-level best practices like "how to design a good database" or "healthcare compliance requirements."
@@ -1045,6 +1045,7 @@ if (resolvedLibraries.length === 0) {
1045
1045
  }
1046
1046
 
1047
1047
  // 5. Generate best-practices files for resolved libraries
1048
+ // v2.5.0: Smart Topic Query - include other library names for cross-library integration docs
1048
1049
  const bpDir = '.claude/contexts/domain/project/best-practices/'
1049
1050
  const existingBp = fileExists(bpDir) ? listFiles(bpDir) : []
1050
1051
 
@@ -1056,22 +1057,53 @@ const newLibraries = resolvedLibraries.filter(lib => {
1056
1057
 
1057
1058
  if (newLibraries.length > 0) {
1058
1059
  output(`\n📚 Generating Best Practices from Context7...`)
1060
+ output(` 💡 Using Smart Topic Query for cross-library integration docs`)
1059
1061
 
1060
1062
  // Create directory if needed
1061
1063
  if (!fileExists(bpDir)) {
1062
1064
  mkdir(bpDir)
1063
1065
  }
1064
1066
 
1067
+ // Collect all integration risks for summary
1068
+ const integrationRisks = []
1069
+
1065
1070
  for (const lib of newLibraries) {
1066
1071
  output(` 📖 Fetching ${lib.title} best practices...`)
1067
1072
 
1068
1073
  try {
1074
+ // v2.5.0: Smart Topic Query - include other library names in topic
1075
+ // WHY: This captures integration docs (e.g., "drizzle adapter" in auth.js docs)
1076
+ const otherLibNames = resolvedLibraries
1077
+ .filter(l => l.name !== lib.name)
1078
+ .map(l => l.name.toLowerCase())
1079
+ .slice(0, 5) // Limit to 5 to avoid topic overflow
1080
+ .join(', ')
1081
+
1082
+ const smartTopic = [
1083
+ 'best practices',
1084
+ 'patterns',
1085
+ 'anti-patterns',
1086
+ 'common mistakes',
1087
+ 'adapter', // Key for ORM + Auth integrations
1088
+ 'integration', // Key for multi-library setups
1089
+ 'schema', // Key for database + auth column naming
1090
+ 'configuration', // Key for setup requirements
1091
+ otherLibNames // Include other detected libraries
1092
+ ].filter(Boolean).join(', ')
1093
+
1069
1094
  const docs = await mcp__context7__get_library_docs({
1070
1095
  context7CompatibleLibraryID: lib.context7Id,
1071
- topic: 'best practices, patterns, anti-patterns, common mistakes',
1096
+ topic: smartTopic,
1072
1097
  mode: 'code'
1073
1098
  })
1074
1099
 
1100
+ // v2.5.0: Detect integration risks from docs content
1101
+ const risks = detectIntegrationRisks(docs, lib.name, resolvedLibraries)
1102
+ if (risks.length > 0) {
1103
+ integrationRisks.push(...risks)
1104
+ output(` ⚠️ Found ${risks.length} integration pattern(s) to review`)
1105
+ }
1106
+
1075
1107
  const bpContent = generateBestPracticesFile(lib.title, docs, lib.context7Id)
1076
1108
  const safeName = lib.name.toLowerCase().replace(/[^a-z0-9]/g, '-')
1077
1109
  Write(`${bpDir}${safeName}.md`, bpContent)
@@ -1082,6 +1114,13 @@ if (newLibraries.length > 0) {
1082
1114
  }
1083
1115
  }
1084
1116
 
1117
+ // v2.5.0: Generate integration risk summary if any found
1118
+ if (integrationRisks.length > 0) {
1119
+ generateIntegrationRiskSummary(integrationRisks, bpDir, resolvedLibraries)
1120
+ output(`\n⚠️ Integration Risk Summary generated (${integrationRisks.length} items)`)
1121
+ output(` 📄 ${bpDir}INTEGRATION_RISKS.md`)
1122
+ }
1123
+
1085
1124
  // Generate/update index.md
1086
1125
  generateBestPracticesIndex(resolvedLibraries, changeId)
1087
1126
  output(` ✅ index.md updated`)
@@ -1771,6 +1810,228 @@ function extractChecklist(docs: string): string {
1771
1810
 
1772
1811
  ---
1773
1812
 
1813
+ ### Helper: detectIntegrationRisks() - v2.5.0
1814
+
1815
+ > **Smart Risk Detection:** Scans Context7 docs for integration patterns that require attention.
1816
+ > **WHY:** Proactively catch integration requirements BEFORE implementation, not at runtime.
1817
+
1818
+ ```typescript
1819
+ function detectIntegrationRisks(
1820
+ docs: string,
1821
+ currentLib: string,
1822
+ allLibs: Array<{ name: string; title: string }>
1823
+ ): Array<{ library: string; risk: string; pattern: string; recommendation: string }> {
1824
+ const risks = []
1825
+ const docsLower = docs.toLowerCase()
1826
+
1827
+ // Integration risk patterns to detect
1828
+ const riskPatterns = [
1829
+ // Adapter patterns (ORM + Auth)
1830
+ {
1831
+ keywords: ['adapter', 'drizzleadapter', 'prismaadapter'],
1832
+ risk: 'Database adapter configuration required',
1833
+ pattern: 'adapter',
1834
+ recommendation: 'Verify adapter schema matches expected column names'
1835
+ },
1836
+ // Column naming patterns
1837
+ {
1838
+ keywords: ['column', 'columnname', 'snake_case', 'camelcase', 'mapping'],
1839
+ risk: 'Column naming convention mismatch possible',
1840
+ pattern: 'schema',
1841
+ recommendation: 'Check column naming between ORM schema and library expectations'
1842
+ },
1843
+ // Schema patterns
1844
+ {
1845
+ keywords: ['userstable', 'accountstable', 'sessionstable', 'schema'],
1846
+ risk: 'Custom table schema required',
1847
+ pattern: 'schema',
1848
+ recommendation: 'Ensure table schemas match library documentation exactly'
1849
+ },
1850
+ // Sync/Migration patterns
1851
+ {
1852
+ keywords: ['sync', 'migrate', 'migration', 'syncurl', 'embedded replica'],
1853
+ risk: 'Data synchronization setup required',
1854
+ pattern: 'sync',
1855
+ recommendation: 'Configure sync intervals and handle offline scenarios'
1856
+ },
1857
+ // Webhook patterns
1858
+ {
1859
+ keywords: ['webhook', 'webhookendpoint', 'webhooksecret'],
1860
+ risk: 'Webhook endpoint configuration required',
1861
+ pattern: 'webhook',
1862
+ recommendation: 'Set up webhook endpoints and verify signatures'
1863
+ },
1864
+ // API Key patterns
1865
+ {
1866
+ keywords: ['apikey', 'secretkey', 'authtoken', 'bearer'],
1867
+ risk: 'API credentials setup required',
1868
+ pattern: 'credentials',
1869
+ recommendation: 'Store credentials securely in environment variables'
1870
+ },
1871
+ // Lifecycle patterns
1872
+ {
1873
+ keywords: ['beforeall', 'afterall', 'beforeeach', 'aftereach', 'setup', 'teardown'],
1874
+ risk: 'Test lifecycle hooks required',
1875
+ pattern: 'lifecycle',
1876
+ recommendation: 'Implement proper setup/teardown in test configuration'
1877
+ }
1878
+ ]
1879
+
1880
+ for (const rp of riskPatterns) {
1881
+ const found = rp.keywords.some(kw => docsLower.includes(kw.toLowerCase()))
1882
+ if (found) {
1883
+ // Check if this risk involves other detected libraries
1884
+ const involvedLibs = allLibs
1885
+ .filter(l => l.name !== currentLib)
1886
+ .filter(l => docsLower.includes(l.name.toLowerCase()))
1887
+ .map(l => l.name)
1888
+
1889
+ risks.push({
1890
+ library: currentLib,
1891
+ risk: rp.risk,
1892
+ pattern: rp.pattern,
1893
+ recommendation: rp.recommendation,
1894
+ involvedLibraries: involvedLibs
1895
+ })
1896
+ }
1897
+ }
1898
+
1899
+ return risks
1900
+ }
1901
+ ```
1902
+
1903
+ ---
1904
+
1905
+ ### Helper: generateIntegrationRiskSummary() - v2.5.0
1906
+
1907
+ > **Risk Summary Output:** Creates INTEGRATION_RISKS.md with all detected cross-library concerns.
1908
+ > **WHY:** Agents can review this BEFORE implementation to avoid common integration mistakes.
1909
+
1910
+ ```typescript
1911
+ function generateIntegrationRiskSummary(
1912
+ risks: Array<{
1913
+ library: string
1914
+ risk: string
1915
+ pattern: string
1916
+ recommendation: string
1917
+ involvedLibraries?: string[]
1918
+ }>,
1919
+ bpDir: string,
1920
+ allLibs: Array<{ name: string; title: string }>
1921
+ ): void {
1922
+ // Group risks by pattern type
1923
+ const byPattern = {}
1924
+ for (const r of risks) {
1925
+ if (!byPattern[r.pattern]) byPattern[r.pattern] = []
1926
+ byPattern[r.pattern].push(r)
1927
+ }
1928
+
1929
+ const content = `# Integration Risk Summary
1930
+
1931
+ > **Generated:** ${new Date().toISOString().split('T')[0]}
1932
+ > **Template Version:** 2.5.0 - Smart Topic Query
1933
+ > **Detected Libraries:** ${allLibs.map(l => l.name).join(', ')}
1934
+
1935
+ ---
1936
+
1937
+ ## ⚠️ Review Before Implementation
1938
+
1939
+ The following integration patterns were detected from library documentation.
1940
+ **Agents should review these items in STEP 0 before writing code.**
1941
+
1942
+ ---
1943
+
1944
+ ${Object.entries(byPattern).map(([pattern, patternRisks]) => `
1945
+ ### ${pattern.toUpperCase()} Patterns
1946
+
1947
+ | Library | Risk | Recommendation |
1948
+ |---------|------|----------------|
1949
+ ${patternRisks.map(r => `| ${r.library} | ${r.risk} | ${r.recommendation} |`).join('\n')}
1950
+ ${patternRisks.some(r => r.involvedLibraries?.length > 0) ? `
1951
+ **Cross-library concerns:**
1952
+ ${patternRisks.filter(r => r.involvedLibraries?.length > 0).map(r => `- ${r.library} ↔ ${r.involvedLibraries.join(', ')}: ${r.risk}`).join('\n')}
1953
+ ` : ''}
1954
+ `).join('\n')}
1955
+
1956
+ ---
1957
+
1958
+ ## Quick Checklist
1959
+
1960
+ Before implementing integrations:
1961
+
1962
+ ${[...new Set(risks.map(r => r.recommendation))].map(rec => `- [ ] ${rec}`).join('\n')}
1963
+
1964
+ ---
1965
+
1966
+ **This file is auto-generated by /csetup v2.5.0**
1967
+ **Agents read this in STEP 0 alongside best-practices files**
1968
+ `
1969
+
1970
+ Write(`${bpDir}INTEGRATION_RISKS.md`, content)
1971
+ }
1972
+ ```
1973
+
1974
+ ---
1975
+
1976
+ ### Helper: generateBestPracticesIndex() - v2.5.0
1977
+
1978
+ > **Index File:** Creates index.md registry of all best practices files.
1979
+ > **v2.5.0:** Now includes INTEGRATION_RISKS.md if present.
1980
+
1981
+ ```typescript
1982
+ function generateBestPracticesIndex(
1983
+ resolvedLibraries: Array<{ name: string; title: string; context7Id: string }>,
1984
+ changeId: string
1985
+ ): void {
1986
+ const bpDir = '.claude/contexts/domain/project/best-practices/'
1987
+ const hasIntegrationRisks = fileExists(`${bpDir}INTEGRATION_RISKS.md`)
1988
+
1989
+ const content = `# Best Practices Index
1990
+
1991
+ > **Generated:** ${new Date().toISOString().split('T')[0]}
1992
+ > **Template Version:** 2.5.0 - Smart Topic Query
1993
+ > **Change:** ${changeId}
1994
+
1995
+ ---
1996
+
1997
+ ## 📚 Library Best Practices
1998
+
1999
+ | Library | File | Context7 ID |
2000
+ |---------|------|-------------|
2001
+ ${resolvedLibraries.map(lib => {
2002
+ const safeName = lib.name.toLowerCase().replace(/[^a-z0-9]/g, '-')
2003
+ return `| ${lib.title} | [${safeName}.md](./${safeName}.md) | \`${lib.context7Id}\` |`
2004
+ }).join('\n')}
2005
+
2006
+ ---
2007
+
2008
+ ${hasIntegrationRisks ? `## ⚠️ Integration Risks
2009
+
2010
+ Cross-library integration concerns detected. **Review before implementation.**
2011
+
2012
+ → [INTEGRATION_RISKS.md](./INTEGRATION_RISKS.md)
2013
+
2014
+ ---
2015
+
2016
+ ` : ''}## Usage
2017
+
2018
+ Agents read these files in **STEP 0** before implementation:
2019
+
2020
+ 1. Read \`index.md\` (this file) for overview
2021
+ 2. Read relevant \`{library}.md\` files for specific best practices
2022
+ ${hasIntegrationRisks ? '3. Read `INTEGRATION_RISKS.md` for cross-library concerns' : ''}
2023
+
2024
+ ---
2025
+
2026
+ **Auto-generated by /csetup v2.5.0**
2027
+ `
2028
+
2029
+ Write(`${bpDir}index.md`, content)
2030
+ }
2031
+ ```
2032
+
2033
+ ---
2034
+
1774
2035
  ### Step 3: Analyze Tasks
1775
2036
 
1776
2037
  **Parse tasks.md content and detect keywords:**
package/README.md CHANGED
@@ -29,12 +29,31 @@ cak init
29
29
 
30
30
  ## Features
31
31
 
32
+ - **Smart Topic Query (v2.5.0)** - Cross-library integration detection + risk summary
32
33
  - **Adaptive Depth Research (v2.4.0)** - Dynamic research layers (0-10+) based on change complexity
33
34
  - **Zero-Maintenance Tech Detection** - Auto-detects ANY library in ANY language via Context7
34
35
  - **Visual Page Planning** - Layout wireframes, component plans, animation blueprints
35
36
  - **Cross-session Context** - `PROJECT_STATUS.yml` maintains state across sessions
36
37
  - **Design System v2.0** - Interactive setup with theme selection
37
38
 
39
+ ## Smart Topic Query (v2.5.0)
40
+
41
+ ```
42
+ Problem: Context7 queries missed integration docs (e.g., Drizzle + Auth.js adapter)
43
+
44
+ Solution: Include other library names in Context7 topic query
45
+
46
+ Old: topic = "best practices, patterns"
47
+ New: topic = "best practices, adapter, integration, {other-lib-names}"
48
+
49
+ Result:
50
+ ├── drizzle.md (with Auth.js adapter info)
51
+ ├── auth-js.md (with DrizzleAdapter config)
52
+ └── INTEGRATION_RISKS.md (cross-library concerns)
53
+ ```
54
+
55
+ **Detected Risk Patterns:** adapter, schema/column naming, sync, webhook, lifecycle
56
+
38
57
  ## Adaptive Depth Research (v2.4.0)
39
58
 
40
59
  ```
@@ -51,7 +70,7 @@ Knowledge Sources:
51
70
  └── Stack (Prisma, React, Next.js) → Context7
52
71
  ```
53
72
 
54
- ## Flow (v2.4.0)
73
+ ## Flow (v2.5.0)
55
74
 
56
75
  ```
57
76
  /designsetup → tokens.json, patterns/*.md
@@ -59,9 +78,10 @@ Knowledge Sources:
59
78
  /pageplan → page-plan.md (VISUAL: layout, components, animations)
60
79
 
61
80
  /csetup → research-checklist.md (RESEARCH: best practices, content)
62
- → best-practices/*.md (Stack: Context7)
81
+ → best-practices/*.md (Stack: Context7 + Smart Topic Query)
82
+ → INTEGRATION_RISKS.md (if cross-library risks detected)
63
83
 
64
- /cdev → Agents read both files
84
+ /cdev → Agents read all files in STEP 0
65
85
  ```
66
86
 
67
87
  **Separation of Concerns:**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@champpaba/claude-agent-kit",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Universal multi-agent template for Claude Code - AI-assisted development with specialized agents",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {