ai-devx 1.0.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/LICENSE +21 -0
- package/README.md +325 -0
- package/bin/cli.js +65 -0
- package/package.json +63 -0
- package/src/commands/init.js +86 -0
- package/src/commands/status.js +60 -0
- package/src/commands/update.js +77 -0
- package/src/config.js +72 -0
- package/src/utils/fileSystem.js +64 -0
- package/src/utils/logger.js +18 -0
- package/templates/.agent/.gitignore +6 -0
- package/templates/.agent/agents/backend-specialist.md +147 -0
- package/templates/.agent/agents/database-architect.md +164 -0
- package/templates/.agent/agents/debugger.md +128 -0
- package/templates/.agent/agents/devops-engineer.md +185 -0
- package/templates/.agent/agents/frontend-specialist.md +122 -0
- package/templates/.agent/agents/orchestrator.md +137 -0
- package/templates/.agent/agents/project-planner.md +127 -0
- package/templates/.agent/agents/security-auditor.md +122 -0
- package/templates/.agent/agents/test-engineer.md +176 -0
- package/templates/.agent/scripts/checklist.js +260 -0
- package/templates/.agent/scripts/security_scan.js +251 -0
- package/templates/.agent/skills/api-patterns/SKILL.md +236 -0
- package/templates/.agent/skills/database-design/SKILL.md +303 -0
- package/templates/.agent/skills/docker-expert/SKILL.md +286 -0
- package/templates/.agent/skills/react-best-practices/SKILL.md +246 -0
- package/templates/.agent/skills/testing-patterns/SKILL.md +262 -0
- package/templates/.agent/workflows/create.md +131 -0
- package/templates/.agent/workflows/debug.md +138 -0
- package/templates/.agent/workflows/deploy.md +163 -0
- package/templates/.agent/workflows/plan.md +153 -0
- package/templates/.agent/workflows/security.md +181 -0
- package/templates/.agent/workflows/test.md +165 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testing-patterns
|
|
3
|
+
description: Comprehensive testing strategies for unit, integration, and E2E tests
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
requires: []
|
|
6
|
+
related:
|
|
7
|
+
- react-best-practices
|
|
8
|
+
- backend-specialist
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Testing Patterns Skill
|
|
12
|
+
|
|
13
|
+
## Testing Pyramid
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/\
|
|
17
|
+
/ \ E2E Tests
|
|
18
|
+
/____\ (Slow, Expensive)
|
|
19
|
+
/ \
|
|
20
|
+
/________\ Integration Tests
|
|
21
|
+
(Medium Speed)
|
|
22
|
+
____________
|
|
23
|
+
Unit Tests
|
|
24
|
+
(Fast, Cheap)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Unit Testing
|
|
28
|
+
|
|
29
|
+
### AAA Pattern
|
|
30
|
+
```typescript
|
|
31
|
+
// Arrange
|
|
32
|
+
const user = { name: 'John', age: 30 };
|
|
33
|
+
|
|
34
|
+
// Act
|
|
35
|
+
const result = calculateAgeGroup(user);
|
|
36
|
+
|
|
37
|
+
// Assert
|
|
38
|
+
expect(result).toBe('adult');
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Test Naming
|
|
42
|
+
```typescript
|
|
43
|
+
describe('calculateAgeGroup', () => {
|
|
44
|
+
it('should return "child" when age is less than 13', () => {
|
|
45
|
+
// test
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should return "teen" when age is between 13 and 19', () => {
|
|
49
|
+
// test
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should return "adult" when age is 20 or greater', () => {
|
|
53
|
+
// test
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### React Component Testing
|
|
59
|
+
```tsx
|
|
60
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
61
|
+
import userEvent from '@testing-library/user-event';
|
|
62
|
+
|
|
63
|
+
describe('Button', () => {
|
|
64
|
+
it('should render button with text', () => {
|
|
65
|
+
render(<Button>Click me</Button>);
|
|
66
|
+
expect(screen.getByText('Click me')).toBeInTheDocument();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should call onClick when clicked', async () => {
|
|
70
|
+
const handleClick = jest.fn();
|
|
71
|
+
render(<Button onClick={handleClick}>Click me</Button>);
|
|
72
|
+
|
|
73
|
+
await userEvent.click(screen.getByText('Click me'));
|
|
74
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should be disabled when disabled prop is true', () => {
|
|
78
|
+
render(<Button disabled>Click me</Button>);
|
|
79
|
+
expect(screen.getByText('Click me')).toBeDisabled();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Mocking
|
|
85
|
+
```typescript
|
|
86
|
+
// Mock modules
|
|
87
|
+
jest.mock('./api', () => ({
|
|
88
|
+
fetchUser: jest.fn()
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
// Mock return value
|
|
92
|
+
(fetchUser as jest.Mock).mockResolvedValue({ id: 1, name: 'John' });
|
|
93
|
+
|
|
94
|
+
// Mock with implementation
|
|
95
|
+
jest.mock('./logger', () => ({
|
|
96
|
+
log: jest.fn(),
|
|
97
|
+
error: jest.fn()
|
|
98
|
+
}));
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Integration Testing
|
|
102
|
+
|
|
103
|
+
### API Testing
|
|
104
|
+
```typescript
|
|
105
|
+
import request from 'supertest';
|
|
106
|
+
import { app } from './app';
|
|
107
|
+
|
|
108
|
+
describe('Users API', () => {
|
|
109
|
+
it('should create a new user', async () => {
|
|
110
|
+
const response = await request(app)
|
|
111
|
+
.post('/users')
|
|
112
|
+
.send({ name: 'John', email: 'john@example.com' })
|
|
113
|
+
.expect(201);
|
|
114
|
+
|
|
115
|
+
expect(response.body.data.name).toBe('John');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('should return 400 for invalid data', async () => {
|
|
119
|
+
await request(app)
|
|
120
|
+
.post('/users')
|
|
121
|
+
.send({ name: '' })
|
|
122
|
+
.expect(400);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Database Testing
|
|
128
|
+
```typescript
|
|
129
|
+
import { prisma } from './db';
|
|
130
|
+
|
|
131
|
+
describe('User Repository', () => {
|
|
132
|
+
beforeEach(async () => {
|
|
133
|
+
await prisma.user.deleteMany();
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should create user in database', async () => {
|
|
137
|
+
const user = await prisma.user.create({
|
|
138
|
+
data: { email: 'test@example.com', name: 'Test' }
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
expect(user.email).toBe('test@example.com');
|
|
142
|
+
|
|
143
|
+
const found = await prisma.user.findUnique({
|
|
144
|
+
where: { id: user.id }
|
|
145
|
+
});
|
|
146
|
+
expect(found).toBeTruthy();
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## E2E Testing
|
|
152
|
+
|
|
153
|
+
### Playwright Example
|
|
154
|
+
```typescript
|
|
155
|
+
import { test, expect } from '@playwright/test';
|
|
156
|
+
|
|
157
|
+
test('user can login', async ({ page }) => {
|
|
158
|
+
await page.goto('/login');
|
|
159
|
+
|
|
160
|
+
await page.fill('[name="email"]', 'user@example.com');
|
|
161
|
+
await page.fill('[name="password"]', 'password123');
|
|
162
|
+
await page.click('button[type="submit"]');
|
|
163
|
+
|
|
164
|
+
await expect(page).toHaveURL('/dashboard');
|
|
165
|
+
await expect(page.locator('h1')).toContainText('Welcome');
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test('user can complete purchase flow', async ({ page }) => {
|
|
169
|
+
// Browse products
|
|
170
|
+
await page.goto('/products');
|
|
171
|
+
await page.click('text=Add to Cart');
|
|
172
|
+
|
|
173
|
+
// Go to cart
|
|
174
|
+
await page.click('text=Cart');
|
|
175
|
+
await page.click('text=Checkout');
|
|
176
|
+
|
|
177
|
+
// Fill checkout form
|
|
178
|
+
await page.fill('[name="address"]', '123 Main St');
|
|
179
|
+
await page.click('text=Place Order');
|
|
180
|
+
|
|
181
|
+
// Verify success
|
|
182
|
+
await expect(page.locator('.success-message')).toBeVisible();
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Test Coverage
|
|
187
|
+
|
|
188
|
+
### Coverage Thresholds
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"coverageThreshold": {
|
|
192
|
+
"global": {
|
|
193
|
+
"branches": 80,
|
|
194
|
+
"functions": 80,
|
|
195
|
+
"lines": 80,
|
|
196
|
+
"statements": 80
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### What to Test
|
|
203
|
+
|
|
204
|
+
**Always Test:**
|
|
205
|
+
- Business logic
|
|
206
|
+
- Edge cases
|
|
207
|
+
- Error handling
|
|
208
|
+
- User interactions
|
|
209
|
+
- API contracts
|
|
210
|
+
|
|
211
|
+
**Don't Test:**
|
|
212
|
+
- Third-party libraries
|
|
213
|
+
- Simple getters/setters
|
|
214
|
+
- Implementation details
|
|
215
|
+
- CSS/styling
|
|
216
|
+
|
|
217
|
+
## TDD Workflow
|
|
218
|
+
|
|
219
|
+
1. **Red**: Write failing test
|
|
220
|
+
```typescript
|
|
221
|
+
it('should add two numbers', () => {
|
|
222
|
+
expect(add(1, 2)).toBe(3);
|
|
223
|
+
});
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
2. **Green**: Write minimal code
|
|
227
|
+
```typescript
|
|
228
|
+
function add(a: number, b: number) {
|
|
229
|
+
return a + b;
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
3. **Refactor**: Improve code
|
|
234
|
+
```typescript
|
|
235
|
+
// Add input validation
|
|
236
|
+
function add(a: number, b: number) {
|
|
237
|
+
if (typeof a !== 'number' || typeof b !== 'number') {
|
|
238
|
+
throw new Error('Inputs must be numbers');
|
|
239
|
+
}
|
|
240
|
+
return a + b;
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Testing Checklist
|
|
245
|
+
|
|
246
|
+
### Before Writing Tests
|
|
247
|
+
- [ ] Understand requirements
|
|
248
|
+
- [ ] Identify edge cases
|
|
249
|
+
- [ ] Plan test scenarios
|
|
250
|
+
|
|
251
|
+
### While Writing Tests
|
|
252
|
+
- [ ] Test happy path
|
|
253
|
+
- [ ] Test error cases
|
|
254
|
+
- [ ] Test boundary conditions
|
|
255
|
+
- [ ] Use descriptive names
|
|
256
|
+
- [ ] One concept per test
|
|
257
|
+
|
|
258
|
+
### After Writing Tests
|
|
259
|
+
- [ ] All tests pass
|
|
260
|
+
- [ ] Coverage meets thresholds
|
|
261
|
+
- [ ] Tests are maintainable
|
|
262
|
+
- [ ] No test interdependencies
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
command: /create
|
|
3
|
+
description: Create new features, components, or applications
|
|
4
|
+
agent: orchestrator
|
|
5
|
+
skills:
|
|
6
|
+
- react-best-practices
|
|
7
|
+
- api-patterns
|
|
8
|
+
- database-design
|
|
9
|
+
- frontend-design
|
|
10
|
+
mode: build
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# /create Workflow
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
Build new features, components, or applications from scratch with best practices.
|
|
17
|
+
|
|
18
|
+
## Trigger
|
|
19
|
+
User types: `/create <description>`
|
|
20
|
+
|
|
21
|
+
## Execution Steps
|
|
22
|
+
|
|
23
|
+
### Step 1: Requirement Analysis
|
|
24
|
+
- Parse user request
|
|
25
|
+
- Determine scope (component, feature, app)
|
|
26
|
+
- Identify tech stack from context
|
|
27
|
+
- Check existing patterns in codebase
|
|
28
|
+
|
|
29
|
+
### Step 2: Architecture Decision
|
|
30
|
+
Based on request, determine:
|
|
31
|
+
- **Frontend**: Component, page, or full UI
|
|
32
|
+
- **Backend**: API endpoint, service, or microservice
|
|
33
|
+
- **Database**: Schema changes, migrations
|
|
34
|
+
- **Full-stack**: All of the above
|
|
35
|
+
|
|
36
|
+
### Step 3: Multi-Agent Coordination (if needed)
|
|
37
|
+
For full-stack features:
|
|
38
|
+
1. **Database Architect** → Schema first
|
|
39
|
+
2. **Backend Specialist** → API layer
|
|
40
|
+
3. **Frontend Specialist** → UI components
|
|
41
|
+
4. **Test Engineer** → Tests
|
|
42
|
+
|
|
43
|
+
### Step 4: Implementation
|
|
44
|
+
|
|
45
|
+
**For Components:**
|
|
46
|
+
```typescript
|
|
47
|
+
// Follow existing patterns
|
|
48
|
+
// Use TypeScript
|
|
49
|
+
// Include Prop types
|
|
50
|
+
// Add basic tests
|
|
51
|
+
// Export from index
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**For APIs:**
|
|
55
|
+
```typescript
|
|
56
|
+
// REST or GraphQL
|
|
57
|
+
// Input validation
|
|
58
|
+
// Error handling
|
|
59
|
+
// Authentication check
|
|
60
|
+
// Rate limiting
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**For Features:**
|
|
64
|
+
```
|
|
65
|
+
1. Database migration
|
|
66
|
+
2. Backend endpoints
|
|
67
|
+
3. Frontend integration
|
|
68
|
+
4. Tests (unit, integration, E2E)
|
|
69
|
+
5. Documentation
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Step 5: Validation
|
|
73
|
+
Run validation checks:
|
|
74
|
+
- [ ] Code follows project conventions
|
|
75
|
+
- [ ] TypeScript compiles
|
|
76
|
+
- [ ] Linting passes
|
|
77
|
+
- [ ] Tests pass
|
|
78
|
+
- [ ] Security review (if auth/data involved)
|
|
79
|
+
|
|
80
|
+
### Step 6: Documentation
|
|
81
|
+
- Add JSDoc comments
|
|
82
|
+
- Update README if needed
|
|
83
|
+
- Include usage examples
|
|
84
|
+
|
|
85
|
+
## Response Format
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
⚡ Executing /create
|
|
89
|
+
|
|
90
|
+
🤖 Applying @frontend-specialist...
|
|
91
|
+
|
|
92
|
+
[Code implementation]
|
|
93
|
+
|
|
94
|
+
✅ Created: [File path]
|
|
95
|
+
✅ Type-safe: [Yes/No]
|
|
96
|
+
✅ Tested: [Yes/No]
|
|
97
|
+
|
|
98
|
+
### Usage
|
|
99
|
+
[How to use the created feature]
|
|
100
|
+
|
|
101
|
+
### Next Steps
|
|
102
|
+
- [ ] Review implementation
|
|
103
|
+
- [ ] Run tests: npm test
|
|
104
|
+
- [ ] Manual testing
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
### Create Component
|
|
110
|
+
**User**: `/create Button component with loading state`
|
|
111
|
+
|
|
112
|
+
### Create API
|
|
113
|
+
**User**: `/create GET /api/users endpoint with pagination`
|
|
114
|
+
|
|
115
|
+
### Create Feature
|
|
116
|
+
**User**: `/create user profile page with avatar upload`
|
|
117
|
+
|
|
118
|
+
## Best Practices Applied
|
|
119
|
+
- TypeScript strict mode
|
|
120
|
+
- Component composition
|
|
121
|
+
- Error boundaries
|
|
122
|
+
- Loading states
|
|
123
|
+
- Form validation
|
|
124
|
+
- Accessibility
|
|
125
|
+
|
|
126
|
+
## Success Criteria
|
|
127
|
+
- Feature is complete and functional
|
|
128
|
+
- Follows project conventions
|
|
129
|
+
- Includes error handling
|
|
130
|
+
- Has test coverage
|
|
131
|
+
- Documentation provided
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
command: /debug
|
|
3
|
+
description: Systematic debugging and root cause analysis
|
|
4
|
+
agent: debugger
|
|
5
|
+
skills:
|
|
6
|
+
- systematic-debugging
|
|
7
|
+
- error-analysis
|
|
8
|
+
- performance-profiling
|
|
9
|
+
mode: analytical
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# /debug Workflow
|
|
13
|
+
|
|
14
|
+
## Purpose
|
|
15
|
+
Systematically analyze and fix bugs, errors, and unexpected behavior.
|
|
16
|
+
|
|
17
|
+
## Trigger
|
|
18
|
+
User types: `/debug <problem description>`
|
|
19
|
+
|
|
20
|
+
## Execution Steps
|
|
21
|
+
|
|
22
|
+
### Step 1: Information Gathering
|
|
23
|
+
Collect details:
|
|
24
|
+
- Error messages and stack traces
|
|
25
|
+
- When did it start occurring?
|
|
26
|
+
- Recent code changes
|
|
27
|
+
- Steps to reproduce
|
|
28
|
+
- Environment (browser, OS, versions)
|
|
29
|
+
- Frequency (always, sometimes, random)
|
|
30
|
+
|
|
31
|
+
### Step 2: Problem Classification
|
|
32
|
+
Determine type:
|
|
33
|
+
- **Runtime Error**: Exception, crash
|
|
34
|
+
- **Logic Error**: Wrong output, unexpected behavior
|
|
35
|
+
- **Performance Issue**: Slow, memory leak
|
|
36
|
+
- **UI Issue**: Visual problems, layout
|
|
37
|
+
- **Integration Issue**: API failure, auth problem
|
|
38
|
+
|
|
39
|
+
### Step 3: Hypothesis Formation
|
|
40
|
+
List possible causes:
|
|
41
|
+
1. Recent code changes
|
|
42
|
+
2. Dependency updates
|
|
43
|
+
3. Environment changes
|
|
44
|
+
4. Data issues
|
|
45
|
+
5. Race conditions
|
|
46
|
+
6. Configuration problems
|
|
47
|
+
|
|
48
|
+
### Step 4: Investigation
|
|
49
|
+
**For Frontend Errors:**
|
|
50
|
+
- Check browser console
|
|
51
|
+
- Inspect network requests
|
|
52
|
+
- Review React/Vue devtools
|
|
53
|
+
- Check state management
|
|
54
|
+
|
|
55
|
+
**For Backend Errors:**
|
|
56
|
+
- Review logs
|
|
57
|
+
- Check error stack traces
|
|
58
|
+
- Verify database connections
|
|
59
|
+
- Test API endpoints
|
|
60
|
+
|
|
61
|
+
**For Performance Issues:**
|
|
62
|
+
- Profile execution
|
|
63
|
+
- Check memory usage
|
|
64
|
+
- Analyze network calls
|
|
65
|
+
- Review bundle size
|
|
66
|
+
|
|
67
|
+
### Step 5: Root Cause Identification
|
|
68
|
+
- Narrow down to specific cause
|
|
69
|
+
- Create minimal reproduction
|
|
70
|
+
- Verify hypothesis
|
|
71
|
+
|
|
72
|
+
### Step 6: Solution Implementation
|
|
73
|
+
- Fix root cause (not symptoms)
|
|
74
|
+
- Add regression tests
|
|
75
|
+
- Update documentation if needed
|
|
76
|
+
|
|
77
|
+
### Step 7: Verification
|
|
78
|
+
- Confirm fix works
|
|
79
|
+
- Check for side effects
|
|
80
|
+
- Run test suite
|
|
81
|
+
- Deploy to staging
|
|
82
|
+
|
|
83
|
+
## Response Format
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
⚡ Executing /debug
|
|
87
|
+
|
|
88
|
+
🤖 Applying @debugger for systematic analysis...
|
|
89
|
+
|
|
90
|
+
## Issue Summary
|
|
91
|
+
[Brief description of the problem]
|
|
92
|
+
|
|
93
|
+
## Investigation
|
|
94
|
+
### Step 1: Information Gathering
|
|
95
|
+
[Details collected]
|
|
96
|
+
|
|
97
|
+
### Step 2: Root Cause Analysis
|
|
98
|
+
[Analysis process]
|
|
99
|
+
|
|
100
|
+
**Root Cause**: [What's causing the issue]
|
|
101
|
+
|
|
102
|
+
## Solution
|
|
103
|
+
|
|
104
|
+
### Fix
|
|
105
|
+
```code
|
|
106
|
+
[The fix with explanation]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Regression Test
|
|
110
|
+
```typescript
|
|
111
|
+
[Test to prevent recurrence]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Verification Steps
|
|
115
|
+
1. [Step 1 to verify fix]
|
|
116
|
+
2. [Step 2 to verify fix]
|
|
117
|
+
3. [Step 3 to verify fix]
|
|
118
|
+
|
|
119
|
+
## Prevention
|
|
120
|
+
[How to avoid this in the future]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Examples
|
|
124
|
+
|
|
125
|
+
**User**: `/debug Login button not working`
|
|
126
|
+
**User**: `/debug API returns 500 error`
|
|
127
|
+
**User**: `/debug Page loads slowly`
|
|
128
|
+
**User**: `/debug Memory leak in dashboard`
|
|
129
|
+
|
|
130
|
+
## Debugging Checklist
|
|
131
|
+
- [ ] Collected all error information
|
|
132
|
+
- [ ] Identified recent changes
|
|
133
|
+
- [ ] Reproduced the issue
|
|
134
|
+
- [ ] Found root cause
|
|
135
|
+
- [ ] Implemented fix
|
|
136
|
+
- [ ] Added regression test
|
|
137
|
+
- [ ] Verified solution
|
|
138
|
+
- [ ] Documented fix
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
command: /deploy
|
|
3
|
+
description: Deploy application to production or staging
|
|
4
|
+
agent: devops-engineer
|
|
5
|
+
skills:
|
|
6
|
+
- docker-expert
|
|
7
|
+
- deployment-procedures
|
|
8
|
+
- ci-cd
|
|
9
|
+
mode: operational
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# /deploy Workflow
|
|
13
|
+
|
|
14
|
+
## Purpose
|
|
15
|
+
Deploy application to production, staging, or development environments.
|
|
16
|
+
|
|
17
|
+
## Trigger
|
|
18
|
+
User types: `/deploy [environment]`
|
|
19
|
+
|
|
20
|
+
## Execution Steps
|
|
21
|
+
|
|
22
|
+
### Step 1: Pre-deployment Checks
|
|
23
|
+
Verify:
|
|
24
|
+
- [ ] All tests passing
|
|
25
|
+
- [ ] Code reviewed
|
|
26
|
+
- [ ] Version bumped
|
|
27
|
+
- [ ] Changelog updated
|
|
28
|
+
- [ ] No sensitive data in code
|
|
29
|
+
|
|
30
|
+
### Step 2: Environment Detection
|
|
31
|
+
Determine target:
|
|
32
|
+
- Production
|
|
33
|
+
- Staging
|
|
34
|
+
- Development
|
|
35
|
+
|
|
36
|
+
### Step 3: Build Process
|
|
37
|
+
```bash
|
|
38
|
+
# Install dependencies
|
|
39
|
+
npm ci
|
|
40
|
+
|
|
41
|
+
# Run tests
|
|
42
|
+
npm test
|
|
43
|
+
|
|
44
|
+
# Build application
|
|
45
|
+
npm run build
|
|
46
|
+
|
|
47
|
+
# Check build output
|
|
48
|
+
ls -la dist/
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Step 4: Deployment Strategy
|
|
52
|
+
|
|
53
|
+
**Vercel/Netlify:**
|
|
54
|
+
```bash
|
|
55
|
+
vercel --prod
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Docker:**
|
|
59
|
+
```bash
|
|
60
|
+
docker build -t myapp:v1.0.0 .
|
|
61
|
+
docker push myapp:v1.0.0
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**AWS/GCP/Azure:**
|
|
65
|
+
- Use CI/CD pipeline
|
|
66
|
+
- Deploy to ECS/Kubernetes
|
|
67
|
+
- Blue-green or rolling deployment
|
|
68
|
+
|
|
69
|
+
### Step 5: Post-deployment Verification
|
|
70
|
+
- [ ] Health checks passing
|
|
71
|
+
- [ ] Smoke tests passing
|
|
72
|
+
- [ ] Logs showing no errors
|
|
73
|
+
- [ ] Monitoring dashboards green
|
|
74
|
+
- [ ] SSL certificates valid
|
|
75
|
+
|
|
76
|
+
### Step 6: Rollback Plan
|
|
77
|
+
Have rollback ready:
|
|
78
|
+
- Previous version tagged
|
|
79
|
+
- Database migrations reversible
|
|
80
|
+
- Quick rollback procedure
|
|
81
|
+
|
|
82
|
+
## Response Format
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
⚡ Executing /deploy
|
|
86
|
+
|
|
87
|
+
🤖 Applying @devops-engineer...
|
|
88
|
+
|
|
89
|
+
## Pre-deployment Checklist
|
|
90
|
+
✅ Tests passing
|
|
91
|
+
✅ Code reviewed
|
|
92
|
+
✅ Version bumped to v1.2.0
|
|
93
|
+
|
|
94
|
+
## Deployment Steps
|
|
95
|
+
1. Building application...
|
|
96
|
+
✅ Build successful (45s)
|
|
97
|
+
|
|
98
|
+
2. Running tests...
|
|
99
|
+
✅ All tests passed (128 tests)
|
|
100
|
+
|
|
101
|
+
3. Deploying to production...
|
|
102
|
+
✅ Deployed successfully
|
|
103
|
+
|
|
104
|
+
## Post-deployment
|
|
105
|
+
🌐 URL: https://myapp.com
|
|
106
|
+
📊 Health: https://myapp.com/health
|
|
107
|
+
|
|
108
|
+
### Verification
|
|
109
|
+
✅ Health check: 200 OK
|
|
110
|
+
✅ Response time: < 100ms
|
|
111
|
+
✅ SSL: Valid
|
|
112
|
+
|
|
113
|
+
## Rollback
|
|
114
|
+
If needed: `vercel --rollback`
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Deployment Checklist
|
|
118
|
+
|
|
119
|
+
### Before Deploy
|
|
120
|
+
- [ ] Tests passing (unit, integration, E2E)
|
|
121
|
+
- [ ] Code reviewed and approved
|
|
122
|
+
- [ ] Security scan clean
|
|
123
|
+
- [ ] Performance benchmarks met
|
|
124
|
+
- [ ] Database migrations prepared
|
|
125
|
+
- [ ] Environment variables set
|
|
126
|
+
- [ ] Rollback plan ready
|
|
127
|
+
|
|
128
|
+
### During Deploy
|
|
129
|
+
- [ ] Build successful
|
|
130
|
+
- [ ] No build warnings
|
|
131
|
+
- [ ] Assets uploaded
|
|
132
|
+
- [ ] Database migrations run
|
|
133
|
+
- [ ] Services restarted
|
|
134
|
+
|
|
135
|
+
### After Deploy
|
|
136
|
+
- [ ] Health checks pass
|
|
137
|
+
- [ ] Smoke tests pass
|
|
138
|
+
- [ ] Error logs clean
|
|
139
|
+
- [ ] Performance normal
|
|
140
|
+
- [ ] Monitoring alerts silent
|
|
141
|
+
|
|
142
|
+
## Common Commands
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Vercel
|
|
146
|
+
vercel --prod
|
|
147
|
+
|
|
148
|
+
# Netlify
|
|
149
|
+
netlify deploy --prod
|
|
150
|
+
|
|
151
|
+
# Docker
|
|
152
|
+
kubectl set image deployment/myapp myapp=myapp:v1.0.0
|
|
153
|
+
|
|
154
|
+
# AWS
|
|
155
|
+
aws elasticbeanstalk update-environment
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Success Criteria
|
|
159
|
+
- Zero-downtime deployment
|
|
160
|
+
- All health checks passing
|
|
161
|
+
- Performance maintained
|
|
162
|
+
- Rollback plan ready
|
|
163
|
+
- Team notified
|