@thunder-so/thunder 1.1.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.
@@ -0,0 +1,543 @@
1
+ # Claude Skills Implementation Plan for Thunder
2
+
3
+ ## Overview
4
+
5
+ This document outlines the comprehensive plan for implementing Claude Code skills in the Thunder AWS CDK library to enable intelligent stack selection and configuration generation.
6
+
7
+ ---
8
+
9
+ ## Current State Analysis
10
+
11
+ ### Project: `@thunder-so/thunder`
12
+ A unified AWS CDK library for deploying web applications with multiple deployment patterns.
13
+
14
+ ### Available Stacks
15
+
16
+ | Stack | Purpose | Resources |
17
+ |-------|---------|-----------|
18
+ | **Static** | Static SPA hosting | S3 + CloudFront + Route53 |
19
+ | **Lambda** | Serverless functions | Lambda + API Gateway + ECR |
20
+ | **Fargate** | Container orchestration | ECS Fargate + ALB + VPC |
21
+ | **EC2** | Single container hosting | EC2 + Elastic IP + Docker |
22
+ | **Template** | Coolify one-click templates | EC2 + Docker Compose |
23
+ | **Nuxt** | Full-stack Nuxt.js | Lambda SSR + S3 + CloudFront |
24
+ | **Astro** | Full-stack Astro SSR | Lambda SSR + S3 + CloudFront + Edge |
25
+ | **VPC** | Shared infrastructure | VPC with public/private subnets |
26
+
27
+ ### Current CLI
28
+ - `th init` - Initialize project
29
+ - `th deploy` - Deploy services
30
+ - `th destroy` - Remove resources
31
+
32
+ ### Missing Infrastructure
33
+ - No `.claude/` directory
34
+ - No intelligent stack selection
35
+ - No automated configuration generation
36
+
37
+ ---
38
+
39
+ ## Recommended Architecture
40
+
41
+ ### Option A: Project-Level Skills (Immediate Use)
42
+ **Location**: `.claude/skills/` within repo
43
+ - Automatically available in project
44
+ - Version-controlled with code
45
+ - No installation required
46
+ - Best for team collaboration
47
+
48
+ ### Option B: Plugin Distribution (Global Distribution)
49
+ **Location**: `thunder-claude-plugin/` directory
50
+ - Install once, use everywhere
51
+ - Distributed via marketplace
52
+ - Namespaced: `/thunder:select-stack`
53
+ - Best for community distribution
54
+
55
+ **Recommendation**: Start with Option A, package as Option B later.
56
+
57
+ ---
58
+
59
+ ## Skill System Design
60
+
61
+ ### 1. Master Stack Selector Skill (`select-stack`)
62
+
63
+ **Purpose**: Primary entry point for "deploy on AWS" requests
64
+
65
+ **Detection Logic**:
66
+ ```
67
+ Framework Detection:
68
+ ├── Nuxt.js → NuxtStack
69
+ ├── Astro → AstroStack
70
+ ├── Next.js (SSG) → StaticStack
71
+ ├── React/Vue/Svelte SPA → StaticStack
72
+
73
+ Container Detection:
74
+ ├── Dockerfile exists → Fargate/EC2
75
+ ├── docker-compose.yml → TemplateStack
76
+
77
+ Architecture Analysis:
78
+ ├── Simple API → LambdaStack
79
+ ├── Long-running service → FargateStack
80
+ ├── Single container → EC2Stack
81
+ └── Pre-built template → TemplateStack
82
+ ```
83
+
84
+ **User Flow**:
85
+ 1. Analyze project structure (package.json, configs, Docker files)
86
+ 2. Detect framework and architecture patterns
87
+ 3. Ask clarifying questions if ambiguous
88
+ 4. Present 1-2 recommendations with rationale
89
+ 5. Generate configuration files upon confirmation
90
+
91
+ ### 2. Individual Stack Skills
92
+
93
+ Each stack has a dedicated skill for:
94
+ - Generating stack-specific configuration
95
+ - Creating bin/*.ts entry points
96
+ - Setting up thunder.config.ts
97
+ - Providing best practice guidance
98
+ - Troubleshooting common issues
99
+
100
+ **Skills Required**:
101
+ - `/select-stack` - Master selector
102
+ - `/static` - Static SPA deployment
103
+ - `/lambda` - Serverless functions
104
+ - `/fargate` - Container orchestration
105
+ - `/ec2` - Single EC2 container
106
+ - `/template` - Coolify templates
107
+ - `/nuxt` - Nuxt.js full-stack
108
+ - `/astro` - Astro full-stack
109
+ - `/vpc` - VPC infrastructure
110
+ - `/troubleshoot` - Issue resolution
111
+
112
+ ### 3. Utility Skills
113
+
114
+ - `/config` - Manage thunder.config.ts
115
+ - `/deploy-guide` - Deployment walkthrough
116
+ - `/teardown` - Safe resource cleanup
117
+
118
+ ---
119
+
120
+ ## File Structure
121
+
122
+ ```
123
+ .claude/
124
+ ├── CLAUDE.md # Project context
125
+ └── skills/
126
+ ├── select-stack/
127
+ │ ├── SKILL.md # Skill definition
128
+ │ ├── decision-matrix.md # Selection criteria
129
+ │ └── examples/
130
+ │ ├── react-spa.md
131
+ │ ├── nuxt-app.md
132
+ │ └── api-service.md
133
+
134
+ ├── static/
135
+ │ ├── SKILL.md
136
+ │ └── templates/
137
+ │ ├── bin-static.ts
138
+ │ └── thunder.config.static.ts
139
+
140
+ ├── lambda/
141
+ │ ├── SKILL.md
142
+ │ └── templates/
143
+ │ ├── bin-lambda.ts
144
+ │ └── thunder.config.lambda.ts
145
+
146
+ ├── fargate/
147
+ │ ├── SKILL.md
148
+ │ └── templates/
149
+ │ ├── bin-fargate.ts
150
+ │ └── thunder.config.fargate.ts
151
+
152
+ ├── ec2/
153
+ │ ├── SKILL.md
154
+ │ └── templates/
155
+ │ ├── bin-ec2.ts
156
+ │ └── thunder.config.ec2.ts
157
+
158
+ ├── nuxt/
159
+ │ ├── SKILL.md
160
+ │ └── templates/
161
+ │ ├── bin-nuxt.ts
162
+ │ └── thunder.config.nuxt.ts
163
+
164
+ ├── astro/
165
+ │ ├── SKILL.md
166
+ │ └── templates/
167
+ │ ├── bin-astro.ts
168
+ │ └── thunder.config.astro.ts
169
+
170
+ ├── template/
171
+ │ ├── SKILL.md
172
+ │ └── templates/
173
+ │ ├── bin-template.ts
174
+ │ └── thunder.config.template.ts
175
+
176
+ ├── vpc/
177
+ │ ├── SKILL.md
178
+ │ └── templates/
179
+ │ └── bin-vpc.ts
180
+
181
+ └── troubleshoot/
182
+ ├── SKILL.md
183
+ └── common-issues.md
184
+ ```
185
+
186
+ ---
187
+
188
+ ## Stack Selection Matrix
189
+
190
+ | Use Case | Detection Signals | Primary Stack | Alternative |
191
+ |----------|-------------------|---------------|-------------|
192
+ | React/Vue/Angular SPA | `react`, `vue` in deps | **Static** | - |
193
+ | SSG Framework (Next.js, Gatsby) | `next`, `gatsby` in deps | **Static** | - |
194
+ | Nuxt.js Application | `nuxt` in deps | **Nuxt** | Fargate |
195
+ | Astro Application | `astro` in deps | **Astro** | Static |
196
+ | API-only Backend | No frontend deps | **Lambda** | Fargate |
197
+ | Container w/ Dockerfile | `Dockerfile` present | **Fargate** | EC2 |
198
+ | Simple Container | Single container | **EC2** | Fargate |
199
+ | Coolify Template | `docker-compose.yml` | **Template** | EC2 |
200
+ | Multi-service App | Multiple services | **Fargate** | Multiple stacks |
201
+ | Background Workers | Queue/scheduling needs | **Lambda** | Fargate |
202
+ | Microservices | Service architecture | **Fargate** + VPC | Multiple stacks |
203
+
204
+ ---
205
+
206
+ ## Skill Content Structure
207
+
208
+ ### SKILL.md Format
209
+
210
+ ```yaml
211
+ ---
212
+ name: thunder:select-stack
213
+ description: |
214
+ Analyzes project and recommends appropriate Thunder AWS deployment stack.
215
+ Use when user asks to deploy on AWS, setup infrastructure, or wants to
216
+ create a new deployment.
217
+ argument-hint: [optional project description or specific stack name]
218
+ disable-model-invocation: false
219
+ allowed-tools: Read, Grep, Glob, Bash
220
+ ---
221
+
222
+ ## Context
223
+ When a user wants to deploy on AWS, follow this process:
224
+
225
+ ### Step 1: Project Analysis
226
+ 1. Read package.json to detect frameworks
227
+ 2. Check for existing configuration files (thunder.config.ts, bin/*.ts)
228
+ 3. Look for Dockerfile or docker-compose.yml
229
+ 4. Identify build scripts and entry points
230
+
231
+ ### Step 2: Framework Detection
232
+ Common patterns:
233
+ - React/Vue/Svelte SPA → Static stack
234
+ - Nuxt.js → Nuxt stack
235
+ - Astro → Astro stack
236
+ - Next.js (with export) → Static stack
237
+ - Next.js (with server) → Fargate stack
238
+ - Express/Fastify API → Lambda or Fargate
239
+ - Docker container → Fargate or EC2
240
+
241
+ ### Step 3: Ask Clarifying Questions
242
+ If multiple options apply:
243
+ - "Do you need server-side rendering (SSR)?"
244
+ - "Do you have a backend API?"
245
+ - "Is this a static site or dynamic application?"
246
+ - "Do you need WebSocket support?"
247
+ - "Do you have a Dockerfile?"
248
+
249
+ ### Step 4: Recommendation
250
+ Present best option with:
251
+ - Why this stack fits
252
+ - Key features provided
253
+ - Cost considerations
254
+ - Alternative if applicable
255
+
256
+ ### Step 5: Configuration Generation
257
+ Upon confirmation:
258
+ 1. Create bin/<stack>.ts entry point
259
+ 2. Create/update thunder.config.ts
260
+ 3. Add deployment scripts to package.json
261
+ 4. Provide next steps
262
+
263
+ ## Templates
264
+ Reference files in ./templates/ directory for code generation.
265
+ ```
266
+
267
+ ---
268
+
269
+ ## User Interaction Examples
270
+
271
+ ### Example 1: React SPA
272
+
273
+ **User**: "Deploy my React app to AWS"
274
+
275
+ **Claude Analysis**:
276
+ - Detects React in package.json
277
+ - Finds build script (likely `npm run build`)
278
+ - No SSR indicators
279
+ - No Dockerfile
280
+
281
+ **Claude Response**:
282
+ "I see you have a React application. The **Static** stack is perfect for this:
283
+
284
+ **What it provides:**
285
+ - S3 bucket for your built files
286
+ - CloudFront CDN for fast global access
287
+ - SSL certificate and custom domain support
288
+ - Automatic cache invalidation on deploy
289
+ - CI/CD pipeline integration
290
+
291
+ **Next steps:**
292
+ 1. Build your app: `npm run build`
293
+ 2. Configure output directory (default: `dist` or `build`)
294
+ 3. Deploy with `th deploy`
295
+
296
+ Shall I set up the Static stack configuration?"
297
+
298
+ ### Example 2: Nuxt.js Full-Stack
299
+
300
+ **User**: "How do I deploy my Nuxt app?"
301
+
302
+ **Claude Analysis**:
303
+ - Detects Nuxt dependency
304
+ - Finds nuxt.config.ts
305
+ - Likely needs SSR support
306
+
307
+ **Claude Response**:
308
+ "I found your Nuxt.js project. For full-stack Nuxt apps, I recommend the **Nuxt** stack:
309
+
310
+ **Architecture:**
311
+ - Lambda functions for server-side rendering (SSR)
312
+ - S3 bucket for static assets (JS, CSS, images)
313
+ - CloudFront distribution with dual origins
314
+ - API routes supported via API Gateway
315
+ - Edge-optimized for global performance
316
+
317
+ **Alternative:** If you need WebSocket support or long-running processes, consider the **Fargate** stack instead.
318
+
319
+ Would you like me to configure the Nuxt stack?"
320
+
321
+ ### Example 3: Ambiguous Project
322
+
323
+ **User**: "Deploy my app to AWS"
324
+
325
+ **Claude Analysis**:
326
+ - Limited context, no clear framework detected
327
+ - Need to ask questions
328
+
329
+ **Claude Response**:
330
+ "I'd be happy to help you deploy to AWS! To recommend the best stack, I need to understand your application better:
331
+
332
+ 1. **What framework are you using?** (React, Vue, Nuxt, Astro, Express, etc.)
333
+ 2. **Does your app need server-side rendering (SSR)?**
334
+ 3. **Do you have a backend API?**
335
+ 4. **Is this a static site or dynamic application?**
336
+ 5. **Do you have a Dockerfile?**
337
+
338
+ Or you can tell me more about your app and I'll analyze your project files."
339
+
340
+ ---
341
+
342
+ ## Configuration Templates
343
+
344
+ ### thunder.config.ts Template
345
+
346
+ ```typescript
347
+ export default {
348
+ application: '${application}',
349
+ service: '${service}',
350
+ environment: '${environment}',
351
+ env: {
352
+ account: process.env.CDK_DEFAULT_ACCOUNT,
353
+ region: process.env.CDK_DEFAULT_REGION || 'us-east-1',
354
+ },
355
+
356
+ // Stack-specific configuration
357
+ $STACK_CONFIG
358
+ };
359
+ ```
360
+
361
+ ### bin/<stack>.ts Template
362
+
363
+ ```typescript
364
+ #!/usr/bin/env -S npx tsx
365
+ import { App } from 'aws-cdk-lib';
366
+ import { $StackName } from '@thunder-so/thunder';
367
+ import config from '../thunder.config.ts';
368
+
369
+ const app = new App();
370
+
371
+ new $StackName(app, '$StackName', {
372
+ ...config,
373
+ $SPECIFIC_PROPS
374
+ });
375
+
376
+ app.synth();
377
+ ```
378
+
379
+ ---
380
+
381
+ ## Implementation Phases
382
+
383
+ ### Phase 1: Foundation (Week 1)
384
+ - [ ] Create `.claude/` directory structure
385
+ - [ ] Write CLAUDE.md project context
386
+ - [ ] Implement `select-stack` skill with framework detection
387
+ - [ ] Implement `static` skill (most common use case)
388
+ - [ ] Create templates for Static stack
389
+ - [ ] Test with sample React project
390
+
391
+ ### Phase 2: Core Stacks (Week 2)
392
+ - [ ] Implement `lambda` skill
393
+ - [ ] Implement `fargate` skill
394
+ - [ ] Implement `ec2` skill
395
+ - [ ] Create templates for each
396
+ - [ ] Add stack-specific configuration examples
397
+
398
+ ### Phase 3: Framework-Specific (Week 3)
399
+ - [ ] Implement `nuxt` skill
400
+ - [ ] Implement `astro` skill
401
+ - [ ] Implement `template` skill
402
+ - [ ] Create framework detection helpers
403
+ - [ ] Add SSR vs SSG detection logic
404
+
405
+ ### Phase 4: Utilities & Polish (Week 4)
406
+ - [ ] Implement `troubleshoot` skill
407
+ - [ ] Implement `config` skill
408
+ - [ ] Add comprehensive examples
409
+ - [ ] Write skill documentation
410
+ - [ ] Test with real projects
411
+
412
+ ### Phase 5: Plugin Packaging (Week 5)
413
+ - [ ] Create `thunder-claude-plugin` directory
414
+ - [ ] Write plugin.json manifest
415
+ - [ ] Package skills for distribution
416
+ - [ ] Write installation documentation
417
+ - [ ] Publish to marketplace
418
+
419
+ ---
420
+
421
+ ## Key Design Decisions
422
+
423
+ ### 1. Detection Strategy
424
+ - **Automated detection** for clear cases (framework in package.json)
425
+ - **Interactive questions** for ambiguous cases
426
+ - **Confidence scoring** to determine when to ask
427
+
428
+ ### 2. Configuration Approach
429
+ - Generate minimal viable configuration
430
+ - Include helpful comments explaining options
431
+ - Reference external docs for advanced settings
432
+ - Allow user customization after generation
433
+
434
+ ### 3. Error Handling
435
+ - Validate AWS credentials before generation
436
+ - Check for existing configurations
437
+ - Provide clear error messages with solutions
438
+ - Offer rollback options
439
+
440
+ ### 4. Documentation Integration
441
+ - Link to existing `.agents/` documentation
442
+ - Include inline comments in generated code
443
+ - Reference PRD and CLI docs
444
+ - Provide external resource links
445
+
446
+ ---
447
+
448
+ ## Testing Strategy
449
+
450
+ ### Test Scenarios
451
+ 1. **React SPA** → Static stack
452
+ 2. **Nuxt SSR app** → Nuxt stack
453
+ 3. **Express API** → Lambda or Fargate
454
+ 4. **Docker app** → Fargate or EC2
455
+ 5. **Multi-service app** → Multiple stacks
456
+ 6. **Ambiguous project** → Interactive flow
457
+
458
+ ### Validation Checklist
459
+ - [ ] Skill triggers on appropriate prompts
460
+ - [ ] Correct stack recommended for project type
461
+ - [ ] Generated files are syntactically correct
462
+ - [ ] Configuration matches project structure
463
+ - [ ] User questions are relevant and helpful
464
+ - [ ] Error messages are clear and actionable
465
+
466
+ ---
467
+
468
+ ## Future Enhancements
469
+
470
+ ### Advanced Features
471
+ - **Multi-stack recommendations** for microservices
472
+ - **Migration skills** (Static → Fargate, etc.)
473
+ - **Cost estimation** before deployment
474
+ - **Performance optimization** suggestions
475
+ - **Security best practices** enforcement
476
+
477
+ ### Framework Support
478
+ - TanStack Start
479
+ - Angular AnalogJS
480
+ - SvelteKit
481
+ - React Router v7
482
+ - SolidStart
483
+
484
+ ### Integration Points
485
+ - CI/CD pipeline generation
486
+ - Database setup assistance
487
+ - Secrets management
488
+ - Monitoring configuration
489
+ - Custom domain setup
490
+
491
+ ---
492
+
493
+ ## Success Metrics
494
+
495
+ ### User Experience
496
+ - Time to first deployment reduced by 50%
497
+ - Stack selection accuracy >90%
498
+ - User satisfaction with recommendations
499
+ - Reduced support questions
500
+
501
+ ### Technical
502
+ - All major framework types covered
503
+ - Generated configs deploy successfully
504
+ - Skills trigger appropriately
505
+ - No false positives in detection
506
+
507
+ ### Adoption
508
+ - Skills used in X% of new projects
509
+ - Plugin installations (if distributed)
510
+ - Community contributions
511
+ - Documentation engagement
512
+
513
+ ---
514
+
515
+ ## Resources
516
+
517
+ ### Documentation
518
+ - [Claude Code Skills Documentation](https://docs.anthropic.com/en/docs/claude-code/skills)
519
+ - [Claude Code Plugins](https://docs.anthropic.com/en/docs/claude-code/plugins)
520
+ - [Thunder PRD](./PRD.md)
521
+ - [Thunder CLI Scope](./CLI.md)
522
+
523
+ ### References
524
+ - Agent Skills standard: https://agentskills.io
525
+ - AWS CDK patterns: https://docs.aws.amazon.com/cdk/
526
+ - Framework detection: package.json analysis
527
+
528
+ ---
529
+
530
+ ## Notes
531
+
532
+ - Keep SKILL.md files under 500 lines
533
+ - Use frontmatter for metadata
534
+ - Include examples in separate files
535
+ - Test with real projects before finalizing
536
+ - Document edge cases and limitations
537
+ - Consider monorepo scenarios
538
+ - Support both TypeScript and JavaScript projects
539
+
540
+ ---
541
+
542
+ **Last Updated**: 2026-03-08
543
+ **Status**: Planning Complete - Ready for Implementation