claude-mpm 4.17.0__py3-none-any.whl → 4.18.3__py3-none-any.whl
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.
Potentially problematic release.
This version of claude-mpm might be problematic. Click here for more details.
- claude_mpm/VERSION +1 -1
- claude_mpm/agents/BASE_ENGINEER.md +286 -0
- claude_mpm/agents/BASE_PM.md +48 -17
- claude_mpm/agents/agent_loader.py +4 -4
- claude_mpm/agents/templates/engineer.json +5 -1
- claude_mpm/agents/templates/svelte-engineer.json +225 -0
- claude_mpm/config/agent_config.py +2 -2
- claude_mpm/core/config.py +42 -0
- claude_mpm/core/factories.py +1 -1
- claude_mpm/core/optimized_agent_loader.py +3 -3
- claude_mpm/hooks/claude_hooks/response_tracking.py +35 -1
- claude_mpm/models/resume_log.py +340 -0
- claude_mpm/services/agents/auto_config_manager.py +1 -1
- claude_mpm/services/agents/deployment/agent_configuration_manager.py +1 -1
- claude_mpm/services/agents/deployment/agent_record_service.py +1 -1
- claude_mpm/services/agents/deployment/agent_validator.py +17 -1
- claude_mpm/services/agents/deployment/async_agent_deployment.py +1 -1
- claude_mpm/services/agents/deployment/local_template_deployment.py +1 -1
- claude_mpm/services/agents/local_template_manager.py +1 -1
- claude_mpm/services/cli/session_manager.py +87 -0
- claude_mpm/services/core/path_resolver.py +1 -1
- claude_mpm/services/infrastructure/resume_log_generator.py +439 -0
- claude_mpm/services/mcp_config_manager.py +2 -2
- claude_mpm/services/session_manager.py +205 -1
- claude_mpm/services/unified/deployment_strategies/local.py +1 -1
- claude_mpm/skills/bundled/api-documentation.md +393 -0
- claude_mpm/skills/bundled/async-testing.md +571 -0
- claude_mpm/skills/bundled/code-review.md +143 -0
- claude_mpm/skills/bundled/database-migration.md +199 -0
- claude_mpm/skills/bundled/docker-containerization.md +194 -0
- claude_mpm/skills/bundled/express-local-dev.md +1429 -0
- claude_mpm/skills/bundled/fastapi-local-dev.md +1199 -0
- claude_mpm/skills/bundled/git-workflow.md +414 -0
- claude_mpm/skills/bundled/imagemagick.md +204 -0
- claude_mpm/skills/bundled/json-data-handling.md +223 -0
- claude_mpm/skills/bundled/nextjs-local-dev.md +807 -0
- claude_mpm/skills/bundled/pdf.md +141 -0
- claude_mpm/skills/bundled/performance-profiling.md +567 -0
- claude_mpm/skills/bundled/refactoring-patterns.md +180 -0
- claude_mpm/skills/bundled/security-scanning.md +327 -0
- claude_mpm/skills/bundled/systematic-debugging.md +473 -0
- claude_mpm/skills/bundled/test-driven-development.md +378 -0
- claude_mpm/skills/bundled/vite-local-dev.md +1061 -0
- claude_mpm/skills/bundled/web-performance-optimization.md +2305 -0
- claude_mpm/skills/bundled/xlsx.md +157 -0
- claude_mpm/utils/agent_dependency_loader.py +2 -2
- {claude_mpm-4.17.0.dist-info → claude_mpm-4.18.3.dist-info}/METADATA +68 -1
- {claude_mpm-4.17.0.dist-info → claude_mpm-4.18.3.dist-info}/RECORD +52 -29
- {claude_mpm-4.17.0.dist-info → claude_mpm-4.18.3.dist-info}/WHEEL +0 -0
- {claude_mpm-4.17.0.dist-info → claude_mpm-4.18.3.dist-info}/entry_points.txt +0 -0
- {claude_mpm-4.17.0.dist-info → claude_mpm-4.18.3.dist-info}/licenses/LICENSE +0 -0
- {claude_mpm-4.17.0.dist-info → claude_mpm-4.18.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
---
|
|
2
|
+
skill_id: database-migration
|
|
3
|
+
skill_version: 0.1.0
|
|
4
|
+
description: Safe patterns for evolving database schemas in production.
|
|
5
|
+
updated_at: 2025-10-30T17:00:00Z
|
|
6
|
+
tags: [database, migration, schema, production]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Database Migration
|
|
10
|
+
|
|
11
|
+
Safe patterns for evolving database schemas in production.
|
|
12
|
+
|
|
13
|
+
## Migration Principles
|
|
14
|
+
|
|
15
|
+
1. **Backward compatible** - New code works with old schema
|
|
16
|
+
2. **Reversible** - Can rollback if needed
|
|
17
|
+
3. **Tested** - Verify on staging before production
|
|
18
|
+
4. **Incremental** - Small changes, not big-bang
|
|
19
|
+
5. **Zero downtime** - No service interruption
|
|
20
|
+
|
|
21
|
+
## Safe Migration Pattern
|
|
22
|
+
|
|
23
|
+
### Phase 1: Add New (Compatible)
|
|
24
|
+
```sql
|
|
25
|
+
-- Add new column (nullable initially)
|
|
26
|
+
ALTER TABLE users ADD COLUMN full_name VARCHAR(255) NULL;
|
|
27
|
+
|
|
28
|
+
-- Deploy new code that writes to both old and new
|
|
29
|
+
UPDATE users SET full_name = CONCAT(first_name, ' ', last_name);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Phase 2: Migrate Data
|
|
33
|
+
```sql
|
|
34
|
+
-- Backfill existing data
|
|
35
|
+
UPDATE users
|
|
36
|
+
SET full_name = CONCAT(first_name, ' ', last_name)
|
|
37
|
+
WHERE full_name IS NULL;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Phase 3: Make Required
|
|
41
|
+
```sql
|
|
42
|
+
-- Make column required
|
|
43
|
+
ALTER TABLE users ALTER COLUMN full_name SET NOT NULL;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Phase 4: Remove Old (After New Code Deployed)
|
|
47
|
+
```sql
|
|
48
|
+
-- Remove old columns
|
|
49
|
+
ALTER TABLE users DROP COLUMN first_name;
|
|
50
|
+
ALTER TABLE users DROP COLUMN last_name;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Common Migrations
|
|
54
|
+
|
|
55
|
+
### Adding Index
|
|
56
|
+
```sql
|
|
57
|
+
-- Create index concurrently (PostgreSQL)
|
|
58
|
+
CREATE INDEX CONCURRENTLY idx_users_email ON users(email);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Renaming Column
|
|
62
|
+
```sql
|
|
63
|
+
-- Phase 1: Add new column
|
|
64
|
+
ALTER TABLE users ADD COLUMN email_address VARCHAR(255);
|
|
65
|
+
|
|
66
|
+
-- Phase 2: Copy data
|
|
67
|
+
UPDATE users SET email_address = email;
|
|
68
|
+
|
|
69
|
+
-- Phase 3: Drop old column (after deploy)
|
|
70
|
+
ALTER TABLE users DROP COLUMN email;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Changing Column Type
|
|
74
|
+
```sql
|
|
75
|
+
-- Phase 1: Add new column with new type
|
|
76
|
+
ALTER TABLE products ADD COLUMN price_cents INTEGER;
|
|
77
|
+
|
|
78
|
+
-- Phase 2: Migrate data
|
|
79
|
+
UPDATE products SET price_cents = CAST(price * 100 AS INTEGER);
|
|
80
|
+
|
|
81
|
+
-- Phase 3: Drop old column
|
|
82
|
+
ALTER TABLE products DROP COLUMN price;
|
|
83
|
+
ALTER TABLE products RENAME COLUMN price_cents TO price;
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Adding Foreign Key
|
|
87
|
+
```sql
|
|
88
|
+
-- Add column first
|
|
89
|
+
ALTER TABLE orders ADD COLUMN user_id INTEGER NULL;
|
|
90
|
+
|
|
91
|
+
-- Populate data
|
|
92
|
+
UPDATE orders SET user_id = (
|
|
93
|
+
SELECT id FROM users WHERE users.email = orders.user_email
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
-- Add foreign key
|
|
97
|
+
ALTER TABLE orders
|
|
98
|
+
ADD CONSTRAINT fk_orders_users
|
|
99
|
+
FOREIGN KEY (user_id) REFERENCES users(id);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Migration Tools
|
|
103
|
+
|
|
104
|
+
### Python (Alembic)
|
|
105
|
+
```python
|
|
106
|
+
# Generate migration
|
|
107
|
+
alembic revision --autogenerate -m "add user full_name"
|
|
108
|
+
|
|
109
|
+
# Apply migration
|
|
110
|
+
alembic upgrade head
|
|
111
|
+
|
|
112
|
+
# Rollback
|
|
113
|
+
alembic downgrade -1
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### JavaScript (Knex)
|
|
117
|
+
```javascript
|
|
118
|
+
// Create migration
|
|
119
|
+
knex migrate:make add_full_name
|
|
120
|
+
|
|
121
|
+
// Apply migrations
|
|
122
|
+
knex migrate:latest
|
|
123
|
+
|
|
124
|
+
// Rollback
|
|
125
|
+
knex migrate:rollback
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Rails
|
|
129
|
+
```ruby
|
|
130
|
+
# Generate migration
|
|
131
|
+
rails generate migration AddFullNameToUsers full_name:string
|
|
132
|
+
|
|
133
|
+
# Run migrations
|
|
134
|
+
rails db:migrate
|
|
135
|
+
|
|
136
|
+
# Rollback
|
|
137
|
+
rails db:rollback
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Testing Migrations
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
def test_migration_forward_backward():
|
|
144
|
+
# Apply migration
|
|
145
|
+
apply_migration("add_full_name")
|
|
146
|
+
|
|
147
|
+
# Verify schema
|
|
148
|
+
assert column_exists("users", "full_name")
|
|
149
|
+
|
|
150
|
+
# Rollback
|
|
151
|
+
rollback_migration()
|
|
152
|
+
|
|
153
|
+
# Verify rollback
|
|
154
|
+
assert not column_exists("users", "full_name")
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Dangerous Operations
|
|
158
|
+
|
|
159
|
+
### ❌ Avoid in Production
|
|
160
|
+
```sql
|
|
161
|
+
-- Locks table for long time
|
|
162
|
+
ALTER TABLE users ADD COLUMN email VARCHAR(255) NOT NULL;
|
|
163
|
+
|
|
164
|
+
-- Can't rollback
|
|
165
|
+
DROP TABLE old_users;
|
|
166
|
+
|
|
167
|
+
-- Breaks existing code immediately
|
|
168
|
+
ALTER TABLE users DROP COLUMN email;
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### ✅ Safe Alternatives
|
|
172
|
+
```sql
|
|
173
|
+
-- Add as nullable first
|
|
174
|
+
ALTER TABLE users ADD COLUMN email VARCHAR(255) NULL;
|
|
175
|
+
|
|
176
|
+
-- Rename instead of drop
|
|
177
|
+
ALTER TABLE old_users RENAME TO archived_users;
|
|
178
|
+
|
|
179
|
+
-- Keep old column until new code deployed
|
|
180
|
+
-- (multi-phase approach)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Rollback Strategy
|
|
184
|
+
|
|
185
|
+
```sql
|
|
186
|
+
-- Every migration needs DOWN
|
|
187
|
+
-- UP
|
|
188
|
+
ALTER TABLE users ADD COLUMN full_name VARCHAR(255);
|
|
189
|
+
|
|
190
|
+
-- DOWN
|
|
191
|
+
ALTER TABLE users DROP COLUMN full_name;
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Remember
|
|
195
|
+
- Test migrations on copy of production data
|
|
196
|
+
- Have rollback plan ready
|
|
197
|
+
- Monitor during deployment
|
|
198
|
+
- Communicate with team about schema changes
|
|
199
|
+
- Keep migrations small and focused
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
skill_id: docker-containerization
|
|
3
|
+
skill_version: 0.1.0
|
|
4
|
+
description: Essential Docker patterns for containerizing applications.
|
|
5
|
+
updated_at: 2025-10-30T17:00:00Z
|
|
6
|
+
tags: [docker, containers, deployment, devops]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Docker Containerization
|
|
10
|
+
|
|
11
|
+
Essential Docker patterns for containerizing applications.
|
|
12
|
+
|
|
13
|
+
## Basic Dockerfile Structure
|
|
14
|
+
|
|
15
|
+
```dockerfile
|
|
16
|
+
# Use official base image
|
|
17
|
+
FROM python:3.11-slim
|
|
18
|
+
|
|
19
|
+
# Set working directory
|
|
20
|
+
WORKDIR /app
|
|
21
|
+
|
|
22
|
+
# Copy dependency files first (better caching)
|
|
23
|
+
COPY requirements.txt .
|
|
24
|
+
|
|
25
|
+
# Install dependencies
|
|
26
|
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
27
|
+
|
|
28
|
+
# Copy application code
|
|
29
|
+
COPY . .
|
|
30
|
+
|
|
31
|
+
# Expose port
|
|
32
|
+
EXPOSE 8000
|
|
33
|
+
|
|
34
|
+
# Run application
|
|
35
|
+
CMD ["python", "app.py"]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Multi-Stage Builds
|
|
39
|
+
|
|
40
|
+
```dockerfile
|
|
41
|
+
# Build stage
|
|
42
|
+
FROM node:18 AS builder
|
|
43
|
+
WORKDIR /app
|
|
44
|
+
COPY package*.json ./
|
|
45
|
+
RUN npm ci
|
|
46
|
+
COPY . .
|
|
47
|
+
RUN npm run build
|
|
48
|
+
|
|
49
|
+
# Production stage
|
|
50
|
+
FROM node:18-slim
|
|
51
|
+
WORKDIR /app
|
|
52
|
+
COPY --from=builder /app/dist ./dist
|
|
53
|
+
COPY package*.json ./
|
|
54
|
+
RUN npm ci --only=production
|
|
55
|
+
EXPOSE 3000
|
|
56
|
+
CMD ["node", "dist/server.js"]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Docker Compose
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
version: '3.8'
|
|
63
|
+
|
|
64
|
+
services:
|
|
65
|
+
web:
|
|
66
|
+
build: .
|
|
67
|
+
ports:
|
|
68
|
+
- "8000:8000"
|
|
69
|
+
environment:
|
|
70
|
+
- DATABASE_URL=postgresql://db:5432/myapp
|
|
71
|
+
depends_on:
|
|
72
|
+
- db
|
|
73
|
+
volumes:
|
|
74
|
+
- ./src:/app/src # Hot reload in dev
|
|
75
|
+
|
|
76
|
+
db:
|
|
77
|
+
image: postgres:15
|
|
78
|
+
environment:
|
|
79
|
+
- POSTGRES_DB=myapp
|
|
80
|
+
- POSTGRES_PASSWORD=secret
|
|
81
|
+
volumes:
|
|
82
|
+
- postgres_data:/var/lib/postgresql/data
|
|
83
|
+
|
|
84
|
+
volumes:
|
|
85
|
+
postgres_data:
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Best Practices
|
|
89
|
+
|
|
90
|
+
### ✅ DO
|
|
91
|
+
```dockerfile
|
|
92
|
+
# Use specific versions
|
|
93
|
+
FROM python:3.11-slim
|
|
94
|
+
|
|
95
|
+
# Non-root user
|
|
96
|
+
RUN useradd -m appuser
|
|
97
|
+
USER appuser
|
|
98
|
+
|
|
99
|
+
# Layer caching
|
|
100
|
+
COPY requirements.txt .
|
|
101
|
+
RUN pip install -r requirements.txt
|
|
102
|
+
COPY . .
|
|
103
|
+
|
|
104
|
+
# Health check
|
|
105
|
+
HEALTHCHECK --interval=30s CMD curl -f http://localhost:8000/health || exit 1
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### ❌ DON'T
|
|
109
|
+
```dockerfile
|
|
110
|
+
# Avoid latest tag
|
|
111
|
+
FROM python:latest
|
|
112
|
+
|
|
113
|
+
# Avoid running as root
|
|
114
|
+
USER root
|
|
115
|
+
|
|
116
|
+
# Don't copy unnecessary files
|
|
117
|
+
COPY . . # Includes .git, node_modules, etc.
|
|
118
|
+
|
|
119
|
+
# Use .dockerignore instead
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## .dockerignore
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
.git
|
|
126
|
+
.gitignore
|
|
127
|
+
node_modules
|
|
128
|
+
__pycache__
|
|
129
|
+
*.pyc
|
|
130
|
+
.env
|
|
131
|
+
.vscode
|
|
132
|
+
README.md
|
|
133
|
+
docker-compose.yml
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Common Commands
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Build image
|
|
140
|
+
docker build -t myapp:1.0 .
|
|
141
|
+
|
|
142
|
+
# Run container
|
|
143
|
+
docker run -p 8000:8000 myapp:1.0
|
|
144
|
+
|
|
145
|
+
# Run with environment variables
|
|
146
|
+
docker run -e DATABASE_URL=postgresql://... myapp:1.0
|
|
147
|
+
|
|
148
|
+
# Interactive shell
|
|
149
|
+
docker run -it myapp:1.0 /bin/bash
|
|
150
|
+
|
|
151
|
+
# View logs
|
|
152
|
+
docker logs container_id
|
|
153
|
+
|
|
154
|
+
# Stop container
|
|
155
|
+
docker stop container_id
|
|
156
|
+
|
|
157
|
+
# Remove container
|
|
158
|
+
docker rm container_id
|
|
159
|
+
|
|
160
|
+
# Remove image
|
|
161
|
+
docker rmi myapp:1.0
|
|
162
|
+
|
|
163
|
+
# Prune unused resources
|
|
164
|
+
docker system prune -a
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Docker Compose Commands
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Start services
|
|
171
|
+
docker-compose up
|
|
172
|
+
|
|
173
|
+
# Start in background
|
|
174
|
+
docker-compose up -d
|
|
175
|
+
|
|
176
|
+
# View logs
|
|
177
|
+
docker-compose logs -f
|
|
178
|
+
|
|
179
|
+
# Stop services
|
|
180
|
+
docker-compose down
|
|
181
|
+
|
|
182
|
+
# Rebuild
|
|
183
|
+
docker-compose build
|
|
184
|
+
|
|
185
|
+
# Run command in service
|
|
186
|
+
docker-compose exec web python manage.py migrate
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Remember
|
|
190
|
+
- Keep images small (use slim/alpine variants)
|
|
191
|
+
- Use specific version tags
|
|
192
|
+
- Leverage layer caching
|
|
193
|
+
- Don't include secrets in images
|
|
194
|
+
- Use .dockerignore to exclude files
|