@smicolon/ai-kit 0.3.2 → 0.4.1

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 (155) hide show
  1. package/README.md +73 -40
  2. package/dist/index.js +312 -127
  3. package/package.json +5 -5
  4. package/.claude-plugin/marketplace.json +0 -369
  5. package/packs/architect/CHANGELOG.md +0 -17
  6. package/packs/architect/README.md +0 -58
  7. package/packs/architect/agents/system-architect.md +0 -768
  8. package/packs/architect/commands/diagram-create.md +0 -300
  9. package/packs/better-auth/.mcp.json +0 -14
  10. package/packs/better-auth/CHANGELOG.md +0 -26
  11. package/packs/better-auth/README.md +0 -125
  12. package/packs/better-auth/agents/auth-architect.md +0 -278
  13. package/packs/better-auth/commands/auth-provider-add.md +0 -265
  14. package/packs/better-auth/commands/auth-setup.md +0 -298
  15. package/packs/better-auth/skills/auth-security/SKILL.md +0 -425
  16. package/packs/better-auth/skills/better-auth-patterns/SKILL.md +0 -455
  17. package/packs/dev-loop/CHANGELOG.md +0 -69
  18. package/packs/dev-loop/README.md +0 -155
  19. package/packs/dev-loop/commands/cancel-dev.md +0 -21
  20. package/packs/dev-loop/commands/dev-loop.md +0 -72
  21. package/packs/dev-loop/commands/dev-plan.md +0 -351
  22. package/packs/dev-loop/hooks/hooks.json +0 -15
  23. package/packs/dev-loop/hooks/stop-hook.sh +0 -178
  24. package/packs/dev-loop/scripts/setup-dev-loop.sh +0 -194
  25. package/packs/dev-loop/skills/tdd-planner/SKILL.md +0 -249
  26. package/packs/dev-loop/skills/tdd-planner/references/framework-patterns.md +0 -874
  27. package/packs/dev-loop/skills/tdd-planner/references/good-example.md +0 -260
  28. package/packs/dev-loop/skills/tdd-planner/references/plan-template.md +0 -275
  29. package/packs/django/CHANGELOG.md +0 -39
  30. package/packs/django/README.md +0 -92
  31. package/packs/django/agents/django-architect.md +0 -182
  32. package/packs/django/agents/django-builder.md +0 -250
  33. package/packs/django/agents/django-feature-based.md +0 -420
  34. package/packs/django/agents/django-reviewer.md +0 -253
  35. package/packs/django/agents/django-tester.md +0 -230
  36. package/packs/django/commands/api-endpoint.md +0 -285
  37. package/packs/django/commands/model-create.md +0 -178
  38. package/packs/django/commands/test-generate.md +0 -325
  39. package/packs/django/rules/migrations.md +0 -138
  40. package/packs/django/rules/models.md +0 -167
  41. package/packs/django/rules/serializers.md +0 -126
  42. package/packs/django/rules/services.md +0 -131
  43. package/packs/django/rules/tests.md +0 -140
  44. package/packs/django/rules/views.md +0 -102
  45. package/packs/django/skills/import-convention-enforcer/SKILL.md +0 -226
  46. package/packs/django/skills/import-convention-enforcer/patterns/django-imports.md +0 -343
  47. package/packs/django/skills/migration-safety-checker/SKILL.md +0 -375
  48. package/packs/django/skills/model-entity-validator/SKILL.md +0 -298
  49. package/packs/django/skills/performance-optimizer/SKILL.md +0 -447
  50. package/packs/django/skills/red-phase-verifier/SKILL.md +0 -180
  51. package/packs/django/skills/security-first-validator/SKILL.md +0 -435
  52. package/packs/django/skills/test-coverage-advisor/SKILL.md +0 -394
  53. package/packs/django/skills/test-validity-checker/SKILL.md +0 -194
  54. package/packs/failure-log/CHANGELOG.md +0 -20
  55. package/packs/failure-log/README.md +0 -168
  56. package/packs/failure-log/commands/failure-add.md +0 -106
  57. package/packs/failure-log/commands/failure-list.md +0 -89
  58. package/packs/failure-log/hooks/hooks.json +0 -16
  59. package/packs/failure-log/hooks/scripts/inject-failures.sh +0 -64
  60. package/packs/failure-log/skills/failure-log-manager/SKILL.md +0 -164
  61. package/packs/flutter/CHANGELOG.md +0 -19
  62. package/packs/flutter/README.md +0 -170
  63. package/packs/flutter/agents/flutter-architect.md +0 -166
  64. package/packs/flutter/agents/flutter-builder.md +0 -303
  65. package/packs/flutter/agents/release-manager.md +0 -355
  66. package/packs/flutter/commands/fastlane-setup.md +0 -188
  67. package/packs/flutter/commands/flutter-build.md +0 -90
  68. package/packs/flutter/commands/flutter-deploy.md +0 -133
  69. package/packs/flutter/commands/flutter-test.md +0 -117
  70. package/packs/flutter/commands/signing-setup.md +0 -209
  71. package/packs/flutter/hooks/hooks.json +0 -17
  72. package/packs/flutter/skills/fastlane-knowledge/SKILL.md +0 -193
  73. package/packs/flutter/skills/flutter-architecture/SKILL.md +0 -127
  74. package/packs/flutter/skills/store-publishing/SKILL.md +0 -163
  75. package/packs/hono/CHANGELOG.md +0 -19
  76. package/packs/hono/README.md +0 -143
  77. package/packs/hono/agents/hono-architect.md +0 -240
  78. package/packs/hono/agents/hono-builder.md +0 -285
  79. package/packs/hono/agents/hono-reviewer.md +0 -279
  80. package/packs/hono/agents/hono-tester.md +0 -346
  81. package/packs/hono/commands/middleware-create.md +0 -223
  82. package/packs/hono/commands/project-init.md +0 -306
  83. package/packs/hono/commands/route-create.md +0 -153
  84. package/packs/hono/commands/rpc-client.md +0 -263
  85. package/packs/hono/skills/cloudflare-bindings/SKILL.md +0 -408
  86. package/packs/hono/skills/hono-patterns/SKILL.md +0 -309
  87. package/packs/hono/skills/rpc-typesafe/SKILL.md +0 -388
  88. package/packs/hono/skills/zod-validation/SKILL.md +0 -332
  89. package/packs/nestjs/CHANGELOG.md +0 -29
  90. package/packs/nestjs/README.md +0 -75
  91. package/packs/nestjs/agents/nestjs-architect.md +0 -402
  92. package/packs/nestjs/agents/nestjs-builder.md +0 -301
  93. package/packs/nestjs/agents/nestjs-tester.md +0 -437
  94. package/packs/nestjs/commands/module-create.md +0 -369
  95. package/packs/nestjs/rules/controllers.md +0 -92
  96. package/packs/nestjs/rules/dto.md +0 -124
  97. package/packs/nestjs/rules/entities.md +0 -102
  98. package/packs/nestjs/rules/services.md +0 -106
  99. package/packs/nestjs/skills/barrel-export-manager/SKILL.md +0 -389
  100. package/packs/nestjs/skills/import-convention-enforcer/SKILL.md +0 -365
  101. package/packs/nextjs/CHANGELOG.md +0 -36
  102. package/packs/nextjs/README.md +0 -76
  103. package/packs/nextjs/agents/frontend-tester.md +0 -680
  104. package/packs/nextjs/agents/frontend-visual.md +0 -820
  105. package/packs/nextjs/agents/nextjs-architect.md +0 -331
  106. package/packs/nextjs/agents/nextjs-modular.md +0 -433
  107. package/packs/nextjs/commands/component-create.md +0 -398
  108. package/packs/nextjs/rules/api-routes.md +0 -129
  109. package/packs/nextjs/rules/components.md +0 -106
  110. package/packs/nextjs/rules/hooks.md +0 -132
  111. package/packs/nextjs/skills/accessibility-validator/SKILL.md +0 -445
  112. package/packs/nextjs/skills/import-convention-enforcer/SKILL.md +0 -399
  113. package/packs/nextjs/skills/react-form-validator/SKILL.md +0 -569
  114. package/packs/nuxtjs/CHANGELOG.md +0 -30
  115. package/packs/nuxtjs/README.md +0 -56
  116. package/packs/nuxtjs/agents/frontend-tester.md +0 -680
  117. package/packs/nuxtjs/agents/frontend-visual.md +0 -820
  118. package/packs/nuxtjs/agents/nuxtjs-architect.md +0 -537
  119. package/packs/nuxtjs/commands/component-create.md +0 -223
  120. package/packs/nuxtjs/rules/components.md +0 -101
  121. package/packs/nuxtjs/rules/composables.md +0 -118
  122. package/packs/nuxtjs/rules/server-routes.md +0 -127
  123. package/packs/nuxtjs/skills/accessibility-validator/SKILL.md +0 -183
  124. package/packs/nuxtjs/skills/import-convention-enforcer/SKILL.md +0 -196
  125. package/packs/nuxtjs/skills/veevalidate-form-validator/SKILL.md +0 -190
  126. package/packs/onboard/CHANGELOG.md +0 -22
  127. package/packs/onboard/README.md +0 -103
  128. package/packs/onboard/agents/onboard-guide.md +0 -118
  129. package/packs/onboard/commands/onboard.md +0 -313
  130. package/packs/onboard/skills/onboard-context-provider/SKILL.md +0 -98
  131. package/packs/tanstack-router/CHANGELOG.md +0 -30
  132. package/packs/tanstack-router/README.md +0 -113
  133. package/packs/tanstack-router/agents/tanstack-architect.md +0 -173
  134. package/packs/tanstack-router/agents/tanstack-builder.md +0 -360
  135. package/packs/tanstack-router/agents/tanstack-tester.md +0 -454
  136. package/packs/tanstack-router/commands/form-create.md +0 -313
  137. package/packs/tanstack-router/commands/query-create.md +0 -263
  138. package/packs/tanstack-router/commands/route-create.md +0 -190
  139. package/packs/tanstack-router/commands/table-create.md +0 -413
  140. package/packs/tanstack-router/skills/ai-patterns/SKILL.md +0 -370
  141. package/packs/tanstack-router/skills/db-patterns/SKILL.md +0 -346
  142. package/packs/tanstack-router/skills/devtools-patterns/SKILL.md +0 -415
  143. package/packs/tanstack-router/skills/form-patterns/SKILL.md +0 -425
  144. package/packs/tanstack-router/skills/pacer-patterns/SKILL.md +0 -341
  145. package/packs/tanstack-router/skills/query-patterns/SKILL.md +0 -359
  146. package/packs/tanstack-router/skills/router-patterns/SKILL.md +0 -285
  147. package/packs/tanstack-router/skills/store-patterns/SKILL.md +0 -351
  148. package/packs/tanstack-router/skills/table-patterns/SKILL.md +0 -531
  149. package/packs/tanstack-router/skills/tanstack-conventions/SKILL.md +0 -428
  150. package/packs/tanstack-router/skills/virtual-patterns/SKILL.md +0 -490
  151. package/packs/worktree/CHANGELOG.md +0 -45
  152. package/packs/worktree/README.md +0 -219
  153. package/packs/worktree/commands/wt.md +0 -93
  154. package/packs/worktree/scripts/wt.sh +0 -957
  155. package/packs/worktree/skills/worktree-manager/SKILL.md +0 -113
@@ -1,127 +0,0 @@
1
- ---
2
- name: flutter-architecture
3
- description: >-
4
- Provides Flutter app architecture patterns with feature-first structure, clean architecture,
5
- and state management (Bloc, Riverpod, Provider). Use when user asks about Flutter project
6
- structure, state management selection, dependency injection, or designing Flutter app architecture.
7
- version: 1.0.0
8
- ---
9
-
10
- # Flutter Architecture Patterns
11
-
12
- Apply these patterns when designing or implementing Flutter applications.
13
-
14
- ## Feature-First Project Structure
15
-
16
- Organize Flutter projects by feature, not by layer:
17
-
18
- ```
19
- lib/
20
- ├── core/ # Shared infrastructure
21
- │ ├── constants/ # App-wide constants
22
- │ ├── errors/ # Error classes and handling
23
- │ ├── extensions/ # Dart extensions
24
- │ ├── network/ # HTTP client, interceptors
25
- │ ├── theme/ # App theme, colors, typography
26
- │ └── utils/ # Utility functions
27
- ├── features/ # Feature modules
28
- │ ├── auth/
29
- │ │ ├── data/ # Data layer
30
- │ │ │ ├── datasources/ # Remote and local data sources
31
- │ │ │ ├── models/ # Data models (JSON serializable)
32
- │ │ │ └── repositories/ # Repository implementations
33
- │ │ ├── domain/ # Domain layer
34
- │ │ │ ├── entities/ # Business entities
35
- │ │ │ ├── repositories/ # Repository interfaces
36
- │ │ │ └── usecases/ # Business logic
37
- │ │ └── presentation/ # UI layer
38
- │ │ ├── bloc/ # State management
39
- │ │ ├── pages/ # Screen widgets
40
- │ │ └── widgets/ # Feature-specific widgets
41
- │ └── [other_features]/
42
- ├── shared/ # Shared UI components
43
- │ ├── widgets/ # Reusable widgets
44
- │ └── services/ # Shared services
45
- └── main.dart
46
- ```
47
-
48
- ## Clean Architecture Layers
49
-
50
- ### Dependency Rule
51
- - Presentation → Domain ← Data
52
- - Domain has NO external dependencies
53
- - Data implements Domain interfaces
54
-
55
- ### Layer Responsibilities
56
-
57
- **Presentation**: UI components, state management, user interaction handling
58
- **Domain**: Business entities, use cases, repository contracts
59
- **Data**: API calls, local storage, data transformation
60
-
61
- ## State Management Selection
62
-
63
- ### Use Bloc When:
64
- - Building enterprise applications
65
- - Need explicit state transitions
66
- - Complex business logic with multiple states
67
- - Team prefers reactive programming patterns
68
-
69
- ### Use Riverpod When:
70
- - Want compile-time safety for providers
71
- - Need flexible dependency injection
72
- - Building modern, testable applications
73
- - Auto-dispose of resources is important
74
-
75
- ### Use Provider When:
76
- - Building simpler applications
77
- - Team is new to Flutter
78
- - Don't need complex state management
79
- - Rapid prototyping
80
-
81
- ## Key Dependencies
82
-
83
- ```yaml
84
- dependencies:
85
- # State Management (choose one)
86
- flutter_bloc: ^8.1.0 # Bloc
87
- flutter_riverpod: ^2.4.0 # Riverpod
88
- provider: ^6.1.0 # Provider
89
-
90
- # Dependency Injection
91
- get_it: ^7.6.0
92
- injectable: ^2.3.0
93
-
94
- # Navigation
95
- go_router: ^13.0.0
96
-
97
- # Networking
98
- dio: ^5.4.0
99
-
100
- # Code Generation
101
- freezed_annotation: ^2.4.0
102
- json_annotation: ^4.8.0
103
-
104
- dev_dependencies:
105
- build_runner: ^2.4.0
106
- freezed: ^2.4.0
107
- json_serializable: ^6.7.0
108
- injectable_generator: ^2.4.0
109
-
110
- # Testing
111
- bloc_test: ^9.1.0
112
- mocktail: ^1.0.0
113
- ```
114
-
115
- ## Quick Reference
116
-
117
- | Aspect | Recommendation |
118
- |--------|----------------|
119
- | Structure | Feature-first |
120
- | State | Bloc (enterprise), Riverpod (modern), Provider (simple) |
121
- | DI | get_it + injectable |
122
- | Navigation | go_router |
123
- | HTTP | Dio |
124
- | Immutability | Freezed |
125
- | Testing | mocktail + bloc_test |
126
-
127
- For detailed implementation examples, consult the flutter-architect agent.
@@ -1,163 +0,0 @@
1
- ---
2
- name: store-publishing
3
- description: >-
4
- Provides App Store and Google Play publishing requirements, metadata management,
5
- screenshot specifications, review guidelines, and compliance requirements.
6
- Use when user asks about publishing apps, store requirements, app review, or store metadata.
7
- version: 1.0.0
8
- ---
9
-
10
- # Store Publishing Guide
11
-
12
- Requirements and best practices for App Store and Google Play publishing.
13
-
14
- ## App Store Connect (iOS)
15
-
16
- ### Required Metadata
17
- - App name (30 characters max)
18
- - Subtitle (30 characters max)
19
- - Description (4000 characters max)
20
- - Keywords (100 characters, comma-separated)
21
- - Support URL
22
- - Marketing URL (optional)
23
- - Privacy Policy URL (required)
24
-
25
- ### Screenshots Required
26
-
27
- | Device | Size | Required |
28
- |--------|------|----------|
29
- | iPhone 6.7" | 1290 x 2796 | Yes |
30
- | iPhone 6.5" | 1284 x 2778 | Yes |
31
- | iPhone 5.5" | 1242 x 2208 | Optional |
32
- | iPad Pro 12.9" | 2048 x 2732 | If iPad supported |
33
-
34
- ### App Review Guidelines
35
- - No placeholder content
36
- - Complete functionality
37
- - Accurate screenshots
38
- - Clear privacy policy
39
- - No hidden features
40
- - Proper age rating
41
-
42
- ### Common Rejection Reasons
43
- 1. Incomplete information
44
- 2. Bugs or crashes
45
- 3. Placeholder content
46
- 4. Misleading screenshots
47
- 5. Privacy policy issues
48
- 6. Guideline 4.2 (minimum functionality)
49
-
50
- ## Google Play Console (Android)
51
-
52
- ### Required Metadata
53
- - App name (50 characters max)
54
- - Short description (80 characters max)
55
- - Full description (4000 characters max)
56
- - Application type
57
- - Category
58
- - Content rating
59
- - Privacy policy URL
60
-
61
- ### Graphics Required
62
-
63
- | Asset | Size | Format |
64
- |-------|------|--------|
65
- | App icon | 512 x 512 | PNG (32-bit) |
66
- | Feature graphic | 1024 x 500 | PNG/JPEG |
67
- | Phone screenshots | 16:9 or 9:16 | PNG/JPEG |
68
- | Tablet screenshots | 16:9 or 9:16 | If tablet supported |
69
-
70
- ### Release Tracks
71
-
72
- | Track | Purpose | Review |
73
- |-------|---------|--------|
74
- | Internal | Team testing | No review |
75
- | Closed | Limited testers | No review |
76
- | Open | Public beta | Light review |
77
- | Production | Public release | Full review |
78
-
79
- ### Data Safety Declaration
80
- Required information about:
81
- - Data collection practices
82
- - Data sharing
83
- - Security practices
84
- - Data deletion options
85
-
86
- ## Pre-Submission Checklist
87
-
88
- ### iOS
89
- - [ ] App icon (1024x1024)
90
- - [ ] Screenshots for required devices
91
- - [ ] Privacy policy URL accessible
92
- - [ ] App description complete
93
- - [ ] Keywords optimized
94
- - [ ] Age rating set
95
- - [ ] In-app purchases configured (if any)
96
- - [ ] Export compliance answered
97
-
98
- ### Android
99
- - [ ] App icon (512x512)
100
- - [ ] Feature graphic
101
- - [ ] Screenshots uploaded
102
- - [ ] Privacy policy URL
103
- - [ ] Content rating questionnaire completed
104
- - [ ] Data safety form completed
105
- - [ ] Target API level compliance
106
- - [ ] App signing by Google Play enabled
107
-
108
- ## Store Listing Best Practices
109
-
110
- ### App Name
111
- - Include main keyword
112
- - Keep concise and memorable
113
- - Avoid generic terms
114
-
115
- ### Description
116
- - First 1-2 lines most important
117
- - Include key features
118
- - Use bullet points
119
- - Add call to action
120
- - Include keywords naturally
121
-
122
- ### Screenshots
123
- - Show actual app screens
124
- - Add captions/overlays
125
- - Highlight key features
126
- - Use consistent style
127
- - First screenshot most important
128
-
129
- ## Version Management
130
-
131
- ### Semantic Versioning
132
- ```
133
- MAJOR.MINOR.PATCH+BUILD
134
- 1.2.3+45
135
- ```
136
-
137
- ### iOS Build Numbers
138
- - Must increment for each upload
139
- - Use CI build number
140
-
141
- ### Android Version Codes
142
- - Integer, must increment
143
- - Use formula: `MAJOR*10000 + MINOR*100 + PATCH`
144
-
145
- ## Release Notes Template
146
-
147
- ```markdown
148
- ## What's New in Version X.Y.Z
149
-
150
- ### New Features
151
- - Feature 1 description
152
- - Feature 2 description
153
-
154
- ### Improvements
155
- - Improvement 1
156
- - Improvement 2
157
-
158
- ### Bug Fixes
159
- - Fixed issue with...
160
- - Resolved crash when...
161
- ```
162
-
163
- For automated store submissions, use the `/flutter-deploy` command.
@@ -1,19 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to the smi-hono plugin will be documented in this file.
4
-
5
- ## [Unreleased]
6
-
7
- ### Changed
8
- - Renamed from `smi-hono` to `hono` as part of ai-kit migration
9
- - Moved from `plugins/smi-hono/` to `packs/hono/`
10
-
11
- ## [0.1.0] - 2025-01-02
12
-
13
- ### Added
14
- - Initial release (experimental)
15
- - 4 agents: hono-architect, hono-builder, hono-tester, hono-reviewer
16
- - 4 commands: route-create, middleware-create, project-init, rpc-client
17
- - 4 skills: hono-patterns, cloudflare-bindings, zod-validation, rpc-typesafe
18
- - Support for Bun and Cloudflare Workers
19
- - Type-safe RPC client generation
@@ -1,143 +0,0 @@
1
- # hono
2
-
3
- Claude Code plugin for **Hono** - the ultrafast web framework for the Edge. Provides scaffolding, conventions, testing, and deployment support for Bun and Cloudflare Workers.
4
-
5
- ## Features
6
-
7
- - **4 Specialized Agents** for architecture, building, testing, and code review
8
- - **4 Commands** for scaffolding routes, middleware, projects, and RPC clients
9
- - **4 Auto-activating Skills** for Hono patterns, CF Workers bindings, Zod validation, and RPC
10
- - **Convention Enforcement** via hooks
11
-
12
- ## Installation
13
-
14
- ```bash
15
- # Add Smicolon marketplace (if not already added)
16
- /plugin marketplace add https://github.com/smicolon/ai-kit
17
-
18
- # Install the plugin
19
- /plugin install hono
20
- ```
21
-
22
- ## Agents
23
-
24
- | Agent | Description |
25
- |-------|-------------|
26
- | `@hono-architect` | Design API architecture, project structure, routing organization |
27
- | `@hono-builder` | Implement features, routes, middleware, handlers |
28
- | `@hono-tester` | Write tests using Bun test or Vitest for CF Workers |
29
- | `@hono-reviewer` | Security review, best practices, performance audit |
30
-
31
- ### Usage
32
-
33
- ```bash
34
- @hono-architect "Design a REST API for user management with authentication"
35
- @hono-builder "Implement the /users routes with CRUD operations"
36
- @hono-tester "Write tests for the user service"
37
- @hono-reviewer "Review the authentication middleware for security issues"
38
- ```
39
-
40
- ## Commands
41
-
42
- | Command | Description |
43
- |---------|-------------|
44
- | `/route-create` | Create new routes with handlers, validators, and types |
45
- | `/middleware-create` | Create custom middleware with proper typing |
46
- | `/project-init` | Initialize a new Hono project (Bun/CF Workers) |
47
- | `/rpc-client` | Generate type-safe RPC client from server routes |
48
-
49
- ### Usage
50
-
51
- ```bash
52
- /route-create
53
- /middleware-create
54
- /project-init
55
- /rpc-client
56
- ```
57
-
58
- ## Skills (Auto-activating)
59
-
60
- These skills automatically activate based on context:
61
-
62
- | Skill | Triggers When |
63
- |-------|---------------|
64
- | `hono-patterns` | Writing Hono routes, handlers, middleware |
65
- | `cloudflare-bindings` | Working with KV, D1, R2, Durable Objects |
66
- | `zod-validation` | Form/JSON validation in Hono handlers |
67
- | `rpc-typesafe` | Setting up type-safe client-server communication |
68
-
69
- ## Conventions Enforced
70
-
71
- ### Project Structure
72
-
73
- ```
74
- src/
75
- ├── routes/ # Route handlers organized by resource
76
- │ ├── users.ts
77
- │ └── posts.ts
78
- ├── middleware/ # Custom middleware
79
- │ ├── auth.ts
80
- │ └── logger.ts
81
- ├── validators/ # Zod schemas
82
- │ └── user.schema.ts
83
- ├── types/ # TypeScript types
84
- │ └── bindings.ts
85
- ├── lib/ # Shared utilities
86
- └── index.ts # App entry point
87
- ```
88
-
89
- ### Import Pattern
90
-
91
- ```typescript
92
- // Named imports (standard Hono style)
93
- import { Hono } from 'hono'
94
- import { zValidator } from '@hono/zod-validator'
95
- import { cors } from 'hono/cors'
96
- ```
97
-
98
- ### Handler Pattern
99
-
100
- ```typescript
101
- // Use factory pattern for typed handlers
102
- import { createFactory } from 'hono/factory'
103
-
104
- const factory = createFactory<{ Bindings: Env }>()
105
-
106
- export const getUser = factory.createHandlers(
107
- zValidator('param', z.object({ id: z.string().uuid() })),
108
- async (c) => {
109
- const { id } = c.req.valid('param')
110
- // ...
111
- }
112
- )
113
- ```
114
-
115
- ### Type-Safe Bindings
116
-
117
- ```typescript
118
- // types/bindings.ts
119
- export type Env = {
120
- Bindings: {
121
- DB: D1Database
122
- KV: KVNamespace
123
- BUCKET: R2Bucket
124
- API_KEY: string
125
- }
126
- Variables: {
127
- user: User
128
- }
129
- }
130
- ```
131
-
132
- ## Supported Platforms
133
-
134
- - **Bun** (primary development runtime)
135
- - **Cloudflare Workers** (primary deployment target)
136
- - **Deno**
137
- - **Node.js**
138
-
139
- ## Requirements
140
-
141
- - Bun >= 1.0
142
- - TypeScript >= 5.0
143
- - Wrangler (for Cloudflare Workers deployment)
@@ -1,240 +0,0 @@
1
- ---
2
- name: hono-architect
3
- description: Senior Hono architect for designing Edge-first API architecture with TypeScript, Zod validation, and multi-platform support (Bun, Cloudflare Workers).
4
- model: inherit
5
- skills:
6
- - hono-patterns
7
- - cloudflare-bindings
8
- - rpc-typesafe
9
- ---
10
-
11
- # Hono Architect
12
-
13
- You are a senior Hono architect specializing in Edge-first API design.
14
-
15
- ## Current Task
16
- Analyze the request and provide architectural guidance for Hono API development.
17
-
18
- ## Tech Stack Context
19
- - **Framework**: Hono (ultrafast Edge framework)
20
- - **Primary Runtime**: Bun
21
- - **Deployment**: Cloudflare Workers
22
- - **Language**: TypeScript (strict mode)
23
- - **Validation**: Zod + @hono/zod-validator
24
- - **Client**: hc (type-safe RPC client)
25
-
26
- ## Your Role
27
-
28
- 1. **Analyze Requirements**: Understand the API domain
29
- 2. **Design Route Structure**: Plan modular routing with `app.route()`
30
- 3. **Design Types**: Plan TypeScript types and Zod schemas
31
- 4. **Plan Middleware**: Identify authentication, logging, CORS needs
32
- 5. **Design Bindings**: Plan Cloudflare KV, D1, R2 usage
33
- 6. **Plan RPC**: Design type-safe client-server communication
34
-
35
- ## Architecture Principles
36
-
37
- ### Project Structure
38
-
39
- ```
40
- src/
41
- ├── routes/ # Route handlers organized by resource
42
- │ ├── users.ts # /api/users routes
43
- │ ├── posts.ts # /api/posts routes
44
- │ └── index.ts # Route aggregator
45
- ├── middleware/ # Custom middleware
46
- │ ├── auth.ts # Authentication
47
- │ ├── logger.ts # Request logging
48
- │ └── index.ts # Barrel export
49
- ├── validators/ # Zod schemas
50
- │ ├── user.schema.ts
51
- │ └── post.schema.ts
52
- ├── types/ # TypeScript types
53
- │ ├── bindings.ts # CF Worker bindings
54
- │ └── api.ts # API types
55
- ├── lib/ # Shared utilities
56
- │ ├── errors.ts # Custom errors
57
- │ └── utils.ts # Helpers
58
- └── index.ts # App entry point
59
- ```
60
-
61
- ### Bindings Type Definition
62
-
63
- ```typescript
64
- // types/bindings.ts
65
- export type Env = {
66
- Bindings: {
67
- // Cloudflare bindings
68
- DB: D1Database
69
- KV: KVNamespace
70
- BUCKET: R2Bucket
71
- // Environment variables
72
- API_KEY: string
73
- JWT_SECRET: string
74
- }
75
- Variables: {
76
- // Request-scoped variables set by middleware
77
- user: User
78
- requestId: string
79
- }
80
- }
81
- ```
82
-
83
- ### Route Organization
84
-
85
- ```typescript
86
- // routes/users.ts
87
- import { Hono } from 'hono'
88
- import { zValidator } from '@hono/zod-validator'
89
- import type { Env } from '../types/bindings'
90
- import { createUserSchema, updateUserSchema } from '../validators/user.schema'
91
-
92
- const users = new Hono<Env>()
93
-
94
- users.get('/', async (c) => {
95
- const db = c.env.DB
96
- const users = await db.prepare('SELECT * FROM users').all()
97
- return c.json(users.results)
98
- })
99
-
100
- users.post('/',
101
- zValidator('json', createUserSchema),
102
- async (c) => {
103
- const data = c.req.valid('json')
104
- // Create user logic
105
- return c.json({ id: 'uuid', ...data }, 201)
106
- }
107
- )
108
-
109
- export { users }
110
- ```
111
-
112
- ### App Composition
113
-
114
- ```typescript
115
- // index.ts
116
- import { Hono } from 'hono'
117
- import { cors } from 'hono/cors'
118
- import { logger } from 'hono/logger'
119
- import type { Env } from './types/bindings'
120
- import { users } from './routes/users'
121
- import { posts } from './routes/posts'
122
- import { authMiddleware } from './middleware/auth'
123
-
124
- const app = new Hono<Env>()
125
-
126
- // Global middleware
127
- app.use('*', logger())
128
- app.use('*', cors())
129
-
130
- // Protected routes
131
- app.use('/api/*', authMiddleware)
132
-
133
- // Mount routes
134
- app.route('/api/users', users)
135
- app.route('/api/posts', posts)
136
-
137
- // Health check
138
- app.get('/health', (c) => c.json({ status: 'ok' }))
139
-
140
- export default app
141
-
142
- // Export type for RPC client
143
- export type AppType = typeof app
144
- ```
145
-
146
- ### RPC Client Setup
147
-
148
- ```typescript
149
- // client.ts
150
- import { hc } from 'hono/client'
151
- import type { AppType } from './index'
152
-
153
- const client = hc<AppType>('http://localhost:8787')
154
-
155
- // Type-safe API calls
156
- const res = await client.api.users.$get()
157
- const users = await res.json()
158
- ```
159
-
160
- ## Deliverables
161
-
162
- Provide a comprehensive architecture document:
163
-
164
- 1. **Route Structure**
165
- - All endpoints with HTTP methods
166
- - Request/response formats
167
- - Authentication requirements
168
-
169
- 2. **Type Definitions**
170
- - Env bindings type
171
- - API request/response types
172
- - Zod validation schemas
173
-
174
- 3. **Middleware Stack**
175
- - Authentication strategy
176
- - Logging and monitoring
177
- - Error handling
178
-
179
- 4. **Database Design** (if using D1)
180
- - Table schemas
181
- - Indexes
182
- - Migrations approach
183
-
184
- 5. **Caching Strategy** (if using KV)
185
- - Cache keys
186
- - TTL policies
187
- - Invalidation approach
188
-
189
- 6. **File Storage** (if using R2)
190
- - Bucket organization
191
- - Access patterns
192
- - URL generation
193
-
194
- ## Code Examples
195
-
196
- Provide example code showing:
197
-
198
- ```typescript
199
- // Example: Complete route with validation
200
- import { Hono } from 'hono'
201
- import { zValidator } from '@hono/zod-validator'
202
- import { z } from 'zod'
203
- import type { Env } from '../types/bindings'
204
-
205
- const createUserSchema = z.object({
206
- email: z.string().email(),
207
- name: z.string().min(1).max(100),
208
- })
209
-
210
- const users = new Hono<Env>()
211
-
212
- users.post('/',
213
- zValidator('json', createUserSchema),
214
- async (c) => {
215
- const { email, name } = c.req.valid('json')
216
- const db = c.env.DB
217
-
218
- const result = await db
219
- .prepare('INSERT INTO users (email, name) VALUES (?, ?)')
220
- .bind(email, name)
221
- .run()
222
-
223
- return c.json({ id: result.meta.last_row_id, email, name }, 201)
224
- }
225
- )
226
- ```
227
-
228
- ## Architecture Checklist
229
-
230
- Before completing:
231
- - [ ] All routes defined with HTTP methods
232
- - [ ] Env type includes all bindings
233
- - [ ] Zod schemas for all inputs
234
- - [ ] Middleware stack planned
235
- - [ ] Error handling strategy
236
- - [ ] RPC client type exported
237
- - [ ] Performance considerations noted
238
- - [ ] Security measures identified
239
-
240
- Now analyze the user's request and provide architectural guidance.