@jwdobeutechsolutions/dobeutech-claude-code-custom 1.0.0 → 1.0.2
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/commands/docs-arch.md +55 -0
- package/commands/login.md +82 -0
- package/commands/migrate-db.md +53 -0
- package/commands/test-integration.md +54 -0
- package/package.json +2 -2
- package/scripts/install.js +20 -0
- package/skills/api-design-patterns.md +145 -0
- package/skills/database-patterns.md +140 -0
- package/skills/memory-management.md +102 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate architecture documentation and diagrams
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Architecture Documentation Command
|
|
6
|
+
|
|
7
|
+
Generate comprehensive architecture documentation including diagrams, component descriptions, and system design.
|
|
8
|
+
|
|
9
|
+
## Process
|
|
10
|
+
|
|
11
|
+
1. **Analyze System Architecture**
|
|
12
|
+
- Identify components
|
|
13
|
+
- Map dependencies
|
|
14
|
+
- Document data flows
|
|
15
|
+
- Identify integration points
|
|
16
|
+
|
|
17
|
+
2. **Create Architecture Diagrams**
|
|
18
|
+
- System overview diagram
|
|
19
|
+
- Component diagrams
|
|
20
|
+
- Sequence diagrams
|
|
21
|
+
- Deployment diagrams
|
|
22
|
+
|
|
23
|
+
3. **Document Components**
|
|
24
|
+
- Component descriptions
|
|
25
|
+
- API contracts
|
|
26
|
+
- Data models
|
|
27
|
+
- Technology stack
|
|
28
|
+
|
|
29
|
+
4. **Document Patterns and Decisions**
|
|
30
|
+
- Architectural patterns used
|
|
31
|
+
- Design decisions
|
|
32
|
+
- Trade-offs considered
|
|
33
|
+
- Future improvements
|
|
34
|
+
|
|
35
|
+
5. **Generate Documentation**
|
|
36
|
+
- Architecture overview document
|
|
37
|
+
- Component documentation
|
|
38
|
+
- Diagram files (Mermaid, PlantUML, etc.)
|
|
39
|
+
- README updates
|
|
40
|
+
|
|
41
|
+
## Output
|
|
42
|
+
|
|
43
|
+
- Architecture documentation
|
|
44
|
+
- System diagrams
|
|
45
|
+
- Component documentation
|
|
46
|
+
- Design decision records
|
|
47
|
+
|
|
48
|
+
## Related Agents
|
|
49
|
+
|
|
50
|
+
- `fullstack-architect` - Architecture specialist
|
|
51
|
+
|
|
52
|
+
## Related Skills
|
|
53
|
+
|
|
54
|
+
- `architecture-diagrams` - Architecture visualization patterns
|
|
55
|
+
- `technical-writing` - Technical documentation patterns
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Authenticate with services (GitHub, MCP servers, APIs)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Login & Authentication Helper
|
|
6
|
+
|
|
7
|
+
This command helps you authenticate with various services used in Claude Code workflows.
|
|
8
|
+
|
|
9
|
+
## Available Authentication Options
|
|
10
|
+
|
|
11
|
+
Please specify what you'd like to authenticate with:
|
|
12
|
+
|
|
13
|
+
1. **GitHub CLI (gh)**
|
|
14
|
+
- Repository access
|
|
15
|
+
- PR creation and management
|
|
16
|
+
- Issues and actions
|
|
17
|
+
|
|
18
|
+
2. **MCP Servers**
|
|
19
|
+
- Context7 (code documentation)
|
|
20
|
+
- Tavily (web search)
|
|
21
|
+
- GitHub MCP
|
|
22
|
+
- Linear, Notion, etc.
|
|
23
|
+
|
|
24
|
+
3. **Cloud Providers**
|
|
25
|
+
- AWS credentials
|
|
26
|
+
- Azure authentication
|
|
27
|
+
- GCP authentication
|
|
28
|
+
|
|
29
|
+
4. **API Keys**
|
|
30
|
+
- OpenAI API
|
|
31
|
+
- Anthropic API
|
|
32
|
+
- Other service APIs
|
|
33
|
+
|
|
34
|
+
## GitHub Authentication
|
|
35
|
+
|
|
36
|
+
To authenticate with GitHub:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Check if already logged in
|
|
40
|
+
gh auth status
|
|
41
|
+
|
|
42
|
+
# Login with browser
|
|
43
|
+
gh auth login
|
|
44
|
+
|
|
45
|
+
# Or use token
|
|
46
|
+
gh auth login --with-token < token.txt
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## MCP Server Configuration
|
|
50
|
+
|
|
51
|
+
MCP servers are configured in `~/.claude.json`. To set up:
|
|
52
|
+
|
|
53
|
+
1. Check current MCP status:
|
|
54
|
+
```bash
|
|
55
|
+
claude-mcp status
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
2. Add API keys to environment variables in `~/.env-mcp`:
|
|
59
|
+
```bash
|
|
60
|
+
export CONTEXT7_API_KEY="your_key_here"
|
|
61
|
+
export TAVILY_API_KEY="your_key_here"
|
|
62
|
+
export GITHUB_TOKEN="your_token_here"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
3. Restart MCP servers:
|
|
66
|
+
```bash
|
|
67
|
+
claude-mcp restart
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Verification Steps
|
|
71
|
+
|
|
72
|
+
After authentication, verify:
|
|
73
|
+
|
|
74
|
+
- **GitHub**: `gh auth status`
|
|
75
|
+
- **MCP**: `claude-mcp status`
|
|
76
|
+
- **AWS**: `aws sts get-caller-identity`
|
|
77
|
+
- **Azure**: `az account show`
|
|
78
|
+
- **GCP**: `gcloud auth list`
|
|
79
|
+
|
|
80
|
+
## What would you like to authenticate?
|
|
81
|
+
|
|
82
|
+
Please respond with the service name (e.g., "GitHub", "MCP servers", "AWS") or ask for help with a specific authentication scenario.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Plan and execute database migrations safely
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Database Migration Command
|
|
6
|
+
|
|
7
|
+
Plan and execute safe database migrations with rollback support.
|
|
8
|
+
|
|
9
|
+
## Process
|
|
10
|
+
|
|
11
|
+
1. **Analyze Current Schema**
|
|
12
|
+
- Review existing database structure
|
|
13
|
+
- Identify tables, indexes, constraints
|
|
14
|
+
- Document current state
|
|
15
|
+
|
|
16
|
+
2. **Design Migration**
|
|
17
|
+
- Create migration script
|
|
18
|
+
- Ensure backward compatibility
|
|
19
|
+
- Plan rollback strategy
|
|
20
|
+
- Consider data migration needs
|
|
21
|
+
|
|
22
|
+
3. **Test Migration**
|
|
23
|
+
- Run on development database
|
|
24
|
+
- Verify data integrity
|
|
25
|
+
- Test rollback procedure
|
|
26
|
+
- Check performance impact
|
|
27
|
+
|
|
28
|
+
4. **Execute Migration**
|
|
29
|
+
- Backup database
|
|
30
|
+
- Run migration script
|
|
31
|
+
- Verify schema changes
|
|
32
|
+
- Update application code if needed
|
|
33
|
+
|
|
34
|
+
5. **Post-Migration**
|
|
35
|
+
- Verify data integrity
|
|
36
|
+
- Update documentation
|
|
37
|
+
- Monitor for issues
|
|
38
|
+
- Clean up old migrations if safe
|
|
39
|
+
|
|
40
|
+
## Output
|
|
41
|
+
|
|
42
|
+
- Migration script (SQL or ORM migration)
|
|
43
|
+
- Rollback script
|
|
44
|
+
- Data migration scripts if needed
|
|
45
|
+
- Documentation of changes
|
|
46
|
+
|
|
47
|
+
## Related Agents
|
|
48
|
+
|
|
49
|
+
- `database-migrator` - Database migration specialist
|
|
50
|
+
|
|
51
|
+
## Related Skills
|
|
52
|
+
|
|
53
|
+
- `database-patterns` - Database patterns and best practices
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate and run integration tests for API endpoints and services
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Integration Test Command
|
|
6
|
+
|
|
7
|
+
Generate comprehensive integration tests for APIs, services, and database interactions.
|
|
8
|
+
|
|
9
|
+
## Process
|
|
10
|
+
|
|
11
|
+
1. **Identify Integration Points**
|
|
12
|
+
- API endpoints
|
|
13
|
+
- Service interactions
|
|
14
|
+
- Database operations
|
|
15
|
+
- External service calls
|
|
16
|
+
|
|
17
|
+
2. **Design Test Scenarios**
|
|
18
|
+
- Happy path tests
|
|
19
|
+
- Error handling tests
|
|
20
|
+
- Edge cases
|
|
21
|
+
- Performance tests
|
|
22
|
+
|
|
23
|
+
3. **Set Up Test Environment**
|
|
24
|
+
- Test database setup
|
|
25
|
+
- Mock external services
|
|
26
|
+
- Configure test fixtures
|
|
27
|
+
- Set up test data
|
|
28
|
+
|
|
29
|
+
4. **Write Integration Tests**
|
|
30
|
+
- API endpoint tests
|
|
31
|
+
- Service integration tests
|
|
32
|
+
- Database integration tests
|
|
33
|
+
- End-to-end workflow tests
|
|
34
|
+
|
|
35
|
+
5. **Run and Verify**
|
|
36
|
+
- Execute test suite
|
|
37
|
+
- Verify all tests pass
|
|
38
|
+
- Check coverage
|
|
39
|
+
- Document results
|
|
40
|
+
|
|
41
|
+
## Output
|
|
42
|
+
|
|
43
|
+
- Integration test files
|
|
44
|
+
- Test fixtures and setup
|
|
45
|
+
- Mock configurations
|
|
46
|
+
- Test documentation
|
|
47
|
+
|
|
48
|
+
## Related Agents
|
|
49
|
+
|
|
50
|
+
- `integration-tester` - Integration testing specialist
|
|
51
|
+
|
|
52
|
+
## Related Skills
|
|
53
|
+
|
|
54
|
+
- `frontend-backend-integration` - Integration patterns
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jwdobeutechsolutions/dobeutech-claude-code-custom",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Comprehensive centralized repository of Claude Code configurations including agents, skills, commands, hooks, and MCP servers optimized for full-stack development",
|
|
5
5
|
"author": "jwdobeutechsolutions",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
],
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|
|
44
|
-
"url": "https://github.com/dobeutech/dobeutech-claude-code-custom.git"
|
|
44
|
+
"url": "git+https://github.com/dobeutech/dobeutech-claude-code-custom.git"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"registry": "https://registry.npmjs.org/",
|
package/scripts/install.js
CHANGED
|
@@ -63,6 +63,17 @@ function getTargetDir() {
|
|
|
63
63
|
|
|
64
64
|
// Get source directory (where package files are)
|
|
65
65
|
function getSourceDir() {
|
|
66
|
+
// Try to resolve the package location first (most reliable for npm installs)
|
|
67
|
+
try {
|
|
68
|
+
const packageJsonPath = require.resolve('@jwdobeutechsolutions/dobeutech-claude-code-custom/package.json');
|
|
69
|
+
const packageDir = path.dirname(packageJsonPath);
|
|
70
|
+
if (fs.existsSync(path.join(packageDir, 'agents'))) {
|
|
71
|
+
return packageDir;
|
|
72
|
+
}
|
|
73
|
+
} catch (err) {
|
|
74
|
+
// Package not found via require.resolve, try other methods
|
|
75
|
+
}
|
|
76
|
+
|
|
66
77
|
// When installed via npm, files are in node_modules/@jwdobeutechsolutions/dobeutech-claude-code-custom
|
|
67
78
|
// When running from source, files are in the repo root
|
|
68
79
|
const possiblePaths = [
|
|
@@ -71,6 +82,15 @@ function getSourceDir() {
|
|
|
71
82
|
path.join(process.cwd(), 'node_modules', 'dobeutech-claude-code-custom'),
|
|
72
83
|
];
|
|
73
84
|
|
|
85
|
+
// Also check global npm locations
|
|
86
|
+
const npmPrefix = process.env.npm_config_prefix || (process.platform === 'win32'
|
|
87
|
+
? path.join(os.homedir(), 'AppData', 'Roaming', 'npm')
|
|
88
|
+
: '/usr/local');
|
|
89
|
+
possiblePaths.push(
|
|
90
|
+
path.join(npmPrefix, 'lib', 'node_modules', '@jwdobeutechsolutions', 'dobeutech-claude-code-custom'),
|
|
91
|
+
path.join(npmPrefix, 'node_modules', '@jwdobeutechsolutions', 'dobeutech-claude-code-custom')
|
|
92
|
+
);
|
|
93
|
+
|
|
74
94
|
for (const possiblePath of possiblePaths) {
|
|
75
95
|
if (fs.existsSync(path.join(possiblePath, 'agents'))) {
|
|
76
96
|
return possiblePath;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-design-patterns
|
|
3
|
+
description: API design patterns for RESTful, GraphQL, and gRPC APIs including versioning, authentication, error handling, and documentation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API Design Patterns
|
|
7
|
+
|
|
8
|
+
Comprehensive patterns for designing robust, scalable APIs across different protocols.
|
|
9
|
+
|
|
10
|
+
## RESTful API Patterns
|
|
11
|
+
|
|
12
|
+
### Resource-Based Design
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
// ✅ Resource-based URLs
|
|
16
|
+
GET /api/users # List users
|
|
17
|
+
GET /api/users/:id # Get user
|
|
18
|
+
POST /api/users # Create user
|
|
19
|
+
PUT /api/users/:id # Replace user
|
|
20
|
+
PATCH /api/users/:id # Update user
|
|
21
|
+
DELETE /api/users/:id # Delete user
|
|
22
|
+
|
|
23
|
+
// ✅ Nested resources
|
|
24
|
+
GET /api/users/:id/posts # User's posts
|
|
25
|
+
POST /api/users/:id/posts # Create post for user
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Query Parameters
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// ✅ Filtering, sorting, pagination
|
|
32
|
+
GET /api/users?status=active&sort=created_at&limit=20&offset=0
|
|
33
|
+
GET /api/users?fields=id,name,email # Field selection
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## GraphQL Patterns
|
|
37
|
+
|
|
38
|
+
### Schema Design
|
|
39
|
+
|
|
40
|
+
```graphql
|
|
41
|
+
type User {
|
|
42
|
+
id: ID!
|
|
43
|
+
name: String!
|
|
44
|
+
email: String!
|
|
45
|
+
posts: [Post!]!
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type Query {
|
|
49
|
+
user(id: ID!): User
|
|
50
|
+
users(filter: UserFilter): [User!]!
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
type Mutation {
|
|
54
|
+
createUser(input: CreateUserInput!): User!
|
|
55
|
+
updateUser(id: ID!, input: UpdateUserInput!): User!
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Resolver Patterns
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// ✅ DataLoader for N+1 query prevention
|
|
63
|
+
const userLoader = new DataLoader(async (ids) => {
|
|
64
|
+
const users = await db.users.findByIds(ids);
|
|
65
|
+
return ids.map(id => users.find(u => u.id === id));
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## gRPC Patterns
|
|
70
|
+
|
|
71
|
+
### Service Definition
|
|
72
|
+
|
|
73
|
+
```protobuf
|
|
74
|
+
service UserService {
|
|
75
|
+
rpc GetUser(GetUserRequest) returns (User);
|
|
76
|
+
rpc ListUsers(ListUsersRequest) returns (stream User);
|
|
77
|
+
rpc CreateUser(CreateUserRequest) returns (User);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## API Versioning
|
|
82
|
+
|
|
83
|
+
### URL Versioning
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// ✅ Version in URL path
|
|
87
|
+
/api/v1/users
|
|
88
|
+
/api/v2/users
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Header Versioning
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// ✅ Version in Accept header
|
|
95
|
+
Accept: application/vnd.api+json;version=2
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Authentication Patterns
|
|
99
|
+
|
|
100
|
+
### JWT Tokens
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
// ✅ Stateless authentication
|
|
104
|
+
Authorization: Bearer <token>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### API Keys
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
// ✅ Key-based authentication
|
|
111
|
+
X-API-Key: <api-key>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Error Handling
|
|
115
|
+
|
|
116
|
+
### Standardized Error Responses
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
{
|
|
120
|
+
"error": {
|
|
121
|
+
"code": "VALIDATION_ERROR",
|
|
122
|
+
"message": "Invalid input",
|
|
123
|
+
"details": [
|
|
124
|
+
{ "field": "email", "message": "Invalid email format" }
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Rate Limiting
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// ✅ Rate limit headers
|
|
134
|
+
X-RateLimit-Limit: 1000
|
|
135
|
+
X-RateLimit-Remaining: 999
|
|
136
|
+
X-RateLimit-Reset: 1640995200
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Related Commands
|
|
140
|
+
|
|
141
|
+
- `/api-design` - Generate API specifications
|
|
142
|
+
|
|
143
|
+
## Related Agents
|
|
144
|
+
|
|
145
|
+
- `api-designer` - API design specialist
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: database-patterns
|
|
3
|
+
description: Database design patterns, ORM usage, query optimization, migration strategies, and data modeling best practices
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Database Patterns
|
|
7
|
+
|
|
8
|
+
Comprehensive patterns for database design, optimization, and management.
|
|
9
|
+
|
|
10
|
+
## ORM Patterns
|
|
11
|
+
|
|
12
|
+
### Active Record Pattern
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
// ✅ Model-based operations
|
|
16
|
+
const user = await User.findById(id);
|
|
17
|
+
user.name = 'New Name';
|
|
18
|
+
await user.save();
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Repository Pattern
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// ✅ Abstract data access
|
|
25
|
+
class UserRepository {
|
|
26
|
+
async findById(id: string): Promise<User | null> {
|
|
27
|
+
return db.users.findOne({ where: { id } });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async create(data: CreateUserData): Promise<User> {
|
|
31
|
+
return db.users.create(data);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Query Optimization
|
|
37
|
+
|
|
38
|
+
### Indexing Strategy
|
|
39
|
+
|
|
40
|
+
```sql
|
|
41
|
+
-- ✅ Index frequently queried columns
|
|
42
|
+
CREATE INDEX idx_users_email ON users(email);
|
|
43
|
+
CREATE INDEX idx_posts_user_id ON posts(user_id);
|
|
44
|
+
|
|
45
|
+
-- ✅ Composite indexes for multi-column queries
|
|
46
|
+
CREATE INDEX idx_posts_user_status ON posts(user_id, status);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Query Patterns
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
// ✅ Use select to limit fields
|
|
53
|
+
await db.users.findAll({
|
|
54
|
+
attributes: ['id', 'name', 'email'],
|
|
55
|
+
where: { status: 'active' }
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// ✅ Eager loading to prevent N+1
|
|
59
|
+
await db.users.findAll({
|
|
60
|
+
include: [{ model: Post, as: 'posts' }]
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Migration Patterns
|
|
65
|
+
|
|
66
|
+
### Safe Migrations
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// ✅ Additive changes first
|
|
70
|
+
export async function up(queryInterface) {
|
|
71
|
+
await queryInterface.addColumn('users', 'phone', {
|
|
72
|
+
type: DataTypes.STRING,
|
|
73
|
+
allowNull: true // Allow null initially
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ✅ Populate data
|
|
78
|
+
export async function up(queryInterface) {
|
|
79
|
+
await queryInterface.addColumn('users', 'phone', {
|
|
80
|
+
type: DataTypes.STRING,
|
|
81
|
+
allowNull: true
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Populate existing records
|
|
85
|
+
await queryInterface.sequelize.query(
|
|
86
|
+
`UPDATE users SET phone = '' WHERE phone IS NULL`
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
// Make required
|
|
90
|
+
await queryInterface.changeColumn('users', 'phone', {
|
|
91
|
+
type: DataTypes.STRING,
|
|
92
|
+
allowNull: false
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Rollback Strategy
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
// ✅ Always provide rollback
|
|
101
|
+
export async function down(queryInterface) {
|
|
102
|
+
await queryInterface.removeColumn('users', 'phone');
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Data Modeling
|
|
107
|
+
|
|
108
|
+
### Normalization
|
|
109
|
+
|
|
110
|
+
```sql
|
|
111
|
+
-- ✅ Normalized design
|
|
112
|
+
users (id, name, email)
|
|
113
|
+
posts (id, user_id, title, content)
|
|
114
|
+
comments (id, post_id, user_id, content)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Denormalization for Performance
|
|
118
|
+
|
|
119
|
+
```sql
|
|
120
|
+
-- ✅ Denormalize for read performance
|
|
121
|
+
posts (id, user_id, user_name, title, content, comment_count)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Transaction Patterns
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
// ✅ Use transactions for atomic operations
|
|
128
|
+
await db.transaction(async (t) => {
|
|
129
|
+
const user = await User.create(data, { transaction: t });
|
|
130
|
+
await Profile.create({ userId: user.id }, { transaction: t });
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Related Commands
|
|
135
|
+
|
|
136
|
+
- `/migrate-db` - Plan and execute migrations
|
|
137
|
+
|
|
138
|
+
## Related Agents
|
|
139
|
+
|
|
140
|
+
- `database-migrator` - Database migration specialist
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memory-management
|
|
3
|
+
description: Patterns for managing persistent memory in Claude Code using mem0 and other memory systems for context retention across sessions
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Memory Management Patterns
|
|
7
|
+
|
|
8
|
+
Patterns for managing persistent memory and context retention in Claude Code.
|
|
9
|
+
|
|
10
|
+
## mem0 Integration
|
|
11
|
+
|
|
12
|
+
### Memory Storage
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
// ✅ Store important context
|
|
16
|
+
await mem0.store({
|
|
17
|
+
key: 'user_preferences',
|
|
18
|
+
value: {
|
|
19
|
+
language: 'TypeScript',
|
|
20
|
+
framework: 'React',
|
|
21
|
+
style: 'functional'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Memory Retrieval
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
// ✅ Retrieve context
|
|
30
|
+
const preferences = await mem0.get('user_preferences');
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Context Patterns
|
|
34
|
+
|
|
35
|
+
### Session Context
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// ✅ Maintain session context
|
|
39
|
+
const sessionContext = {
|
|
40
|
+
project: 'my-app',
|
|
41
|
+
currentFeature: 'authentication',
|
|
42
|
+
lastAction: 'created login component'
|
|
43
|
+
};
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Project Context
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// ✅ Store project-wide context
|
|
50
|
+
const projectContext = {
|
|
51
|
+
techStack: ['React', 'TypeScript', 'Node.js'],
|
|
52
|
+
patterns: ['component-based', 'functional'],
|
|
53
|
+
conventions: ['PascalCase for components']
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Memory Strategies
|
|
58
|
+
|
|
59
|
+
### Important Information
|
|
60
|
+
|
|
61
|
+
Store:
|
|
62
|
+
- User preferences
|
|
63
|
+
- Project conventions
|
|
64
|
+
- API patterns
|
|
65
|
+
- Architecture decisions
|
|
66
|
+
- ID mappings
|
|
67
|
+
|
|
68
|
+
Don't Store:
|
|
69
|
+
- Temporary status
|
|
70
|
+
- Ephemeral data
|
|
71
|
+
- One-time actions
|
|
72
|
+
- Log entries
|
|
73
|
+
|
|
74
|
+
### Memory Format
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// ✅ Descriptive memory entries
|
|
78
|
+
{
|
|
79
|
+
"slack": [
|
|
80
|
+
"The main team channel has ID C1234567 and is called #general"
|
|
81
|
+
],
|
|
82
|
+
"github": [
|
|
83
|
+
"The main repository is owned by 'teamlead' with ID 98765"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Related MCP Servers
|
|
89
|
+
|
|
90
|
+
- `mem0` - Memory management server
|
|
91
|
+
|
|
92
|
+
## Related Agents
|
|
93
|
+
|
|
94
|
+
- Any agent that needs context retention
|
|
95
|
+
|
|
96
|
+
## Best Practices
|
|
97
|
+
|
|
98
|
+
1. Store stable, reusable information
|
|
99
|
+
2. Use descriptive memory entries
|
|
100
|
+
3. Update memory when context changes
|
|
101
|
+
4. Clean up outdated memories
|
|
102
|
+
5. Use memory for cross-session continuity
|