claude-code-templates 1.16.1 → 1.17.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/README.md +7 -7
- package/bin/create-claude-config.js +17 -8
- package/package.json +2 -3
- package/src/analytics/core/AgentAnalyzer.js +17 -3
- package/src/analytics/core/ProcessDetector.js +23 -7
- package/src/analytics/core/StateCalculator.js +102 -33
- package/src/analytics/data/DataCache.js +7 -7
- package/src/analytics-web/chats_mobile.html +2590 -0
- package/src/analytics-web/components/App.js +10 -10
- package/src/analytics-web/components/SessionTimer.js +1 -1
- package/src/analytics-web/components/Sidebar.js +5 -14
- package/src/analytics-web/index.html +932 -78
- package/src/analytics.js +263 -5
- package/src/chats-mobile.js +682 -0
- package/src/claude-api-proxy.js +460 -0
- package/src/file-operations.js +239 -36
- package/src/health-check.js +310 -0
- package/src/index.js +1245 -36
- package/src/tracking-service.js +31 -34
- package/components/agents/api-security-audit.md +0 -92
- package/components/agents/database-optimization.md +0 -94
- package/components/agents/react-performance-optimization.md +0 -64
- package/components/commands/check-file.md +0 -53
- package/components/commands/generate-tests.md +0 -68
- package/components/mcps/deepgraph-nextjs.json +0 -12
- package/components/mcps/deepgraph-react.json +0 -12
- package/components/mcps/deepgraph-typescript.json +0 -12
- package/components/mcps/deepgraph-vue.json +0 -12
- package/components/mcps/filesystem-access.json +0 -12
- package/components/mcps/github-integration.json +0 -11
- package/components/mcps/memory-integration.json +0 -8
- package/components/mcps/mysql-integration.json +0 -11
- package/components/mcps/postgresql-integration.json +0 -11
- package/components/mcps/web-fetch.json +0 -8
- package/src/analytics-web/components/AgentsPage.js +0 -4761
- package/templates/common/.claude/commands/git-workflow.md +0 -239
- package/templates/common/.claude/commands/project-setup.md +0 -316
- package/templates/common/.mcp.json +0 -41
- package/templates/common/CLAUDE.md +0 -109
- package/templates/common/README.md +0 -96
- package/templates/go/.mcp.json +0 -78
- package/templates/go/README.md +0 -25
- package/templates/javascript-typescript/.claude/commands/api-endpoint.md +0 -51
- package/templates/javascript-typescript/.claude/commands/debug.md +0 -52
- package/templates/javascript-typescript/.claude/commands/lint.md +0 -48
- package/templates/javascript-typescript/.claude/commands/npm-scripts.md +0 -48
- package/templates/javascript-typescript/.claude/commands/refactor.md +0 -55
- package/templates/javascript-typescript/.claude/commands/test.md +0 -61
- package/templates/javascript-typescript/.claude/commands/typescript-migrate.md +0 -51
- package/templates/javascript-typescript/.claude/settings.json +0 -142
- package/templates/javascript-typescript/.mcp.json +0 -80
- package/templates/javascript-typescript/CLAUDE.md +0 -185
- package/templates/javascript-typescript/README.md +0 -259
- package/templates/javascript-typescript/examples/angular-app/.claude/commands/components.md +0 -63
- package/templates/javascript-typescript/examples/angular-app/.claude/commands/services.md +0 -62
- package/templates/javascript-typescript/examples/node-api/.claude/commands/api-endpoint.md +0 -46
- package/templates/javascript-typescript/examples/node-api/.claude/commands/database.md +0 -56
- package/templates/javascript-typescript/examples/node-api/.claude/commands/middleware.md +0 -61
- package/templates/javascript-typescript/examples/node-api/.claude/commands/route.md +0 -57
- package/templates/javascript-typescript/examples/node-api/CLAUDE.md +0 -102
- package/templates/javascript-typescript/examples/react-app/.claude/commands/component.md +0 -29
- package/templates/javascript-typescript/examples/react-app/.claude/commands/hooks.md +0 -44
- package/templates/javascript-typescript/examples/react-app/.claude/commands/state-management.md +0 -45
- package/templates/javascript-typescript/examples/react-app/CLAUDE.md +0 -81
- package/templates/javascript-typescript/examples/react-app/agents/react-performance-optimization.md +0 -530
- package/templates/javascript-typescript/examples/react-app/agents/react-state-management.md +0 -295
- package/templates/javascript-typescript/examples/vue-app/.claude/commands/components.md +0 -46
- package/templates/javascript-typescript/examples/vue-app/.claude/commands/composables.md +0 -51
- package/templates/python/.claude/commands/lint.md +0 -111
- package/templates/python/.claude/commands/test.md +0 -73
- package/templates/python/.claude/settings.json +0 -153
- package/templates/python/.mcp.json +0 -78
- package/templates/python/CLAUDE.md +0 -276
- package/templates/python/examples/django-app/.claude/commands/admin.md +0 -264
- package/templates/python/examples/django-app/.claude/commands/django-model.md +0 -124
- package/templates/python/examples/django-app/.claude/commands/views.md +0 -222
- package/templates/python/examples/django-app/CLAUDE.md +0 -313
- package/templates/python/examples/django-app/agents/django-api-security.md +0 -642
- package/templates/python/examples/django-app/agents/django-database-optimization.md +0 -752
- package/templates/python/examples/fastapi-app/.claude/commands/api-endpoints.md +0 -513
- package/templates/python/examples/fastapi-app/.claude/commands/auth.md +0 -775
- package/templates/python/examples/fastapi-app/.claude/commands/database.md +0 -657
- package/templates/python/examples/fastapi-app/.claude/commands/deployment.md +0 -160
- package/templates/python/examples/fastapi-app/.claude/commands/testing.md +0 -927
- package/templates/python/examples/fastapi-app/CLAUDE.md +0 -229
- package/templates/python/examples/flask-app/.claude/commands/app-factory.md +0 -384
- package/templates/python/examples/flask-app/.claude/commands/blueprint.md +0 -243
- package/templates/python/examples/flask-app/.claude/commands/database.md +0 -410
- package/templates/python/examples/flask-app/.claude/commands/deployment.md +0 -620
- package/templates/python/examples/flask-app/.claude/commands/flask-route.md +0 -217
- package/templates/python/examples/flask-app/.claude/commands/testing.md +0 -559
- package/templates/python/examples/flask-app/CLAUDE.md +0 -391
- package/templates/ruby/.claude/commands/model.md +0 -360
- package/templates/ruby/.claude/commands/test.md +0 -480
- package/templates/ruby/.claude/settings.json +0 -146
- package/templates/ruby/.mcp.json +0 -83
- package/templates/ruby/CLAUDE.md +0 -284
- package/templates/ruby/examples/rails-app/.claude/commands/authentication.md +0 -490
- package/templates/ruby/examples/rails-app/CLAUDE.md +0 -376
- package/templates/rust/.mcp.json +0 -78
- package/templates/rust/README.md +0 -26
package/src/tracking-service.js
CHANGED
|
@@ -22,7 +22,7 @@ class TrackingService {
|
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
// Enable
|
|
25
|
+
// Enable public telemetry tracking
|
|
26
26
|
return true;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -45,12 +45,18 @@ class TrackingService {
|
|
|
45
45
|
this.sendTrackingData(trackingData)
|
|
46
46
|
.catch(error => {
|
|
47
47
|
// Silent failure - tracking should never impact functionality
|
|
48
|
-
|
|
48
|
+
// Only show debug info when explicitly enabled
|
|
49
|
+
if (process.env.CCT_DEBUG === 'true') {
|
|
50
|
+
console.debug('📊 Tracking info (non-critical):', error.message);
|
|
51
|
+
}
|
|
49
52
|
});
|
|
50
53
|
|
|
51
54
|
} catch (error) {
|
|
52
55
|
// Silently handle any tracking errors
|
|
53
|
-
|
|
56
|
+
// Only show debug info when explicitly enabled
|
|
57
|
+
if (process.env.CCT_DEBUG === 'true') {
|
|
58
|
+
console.debug('📊 Analytics error (non-critical):', error.message);
|
|
59
|
+
}
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
|
|
@@ -77,52 +83,43 @@ class TrackingService {
|
|
|
77
83
|
}
|
|
78
84
|
|
|
79
85
|
/**
|
|
80
|
-
* Send tracking data
|
|
86
|
+
* Send tracking data via public telemetry endpoint (like Google Analytics)
|
|
81
87
|
*/
|
|
82
88
|
async sendTrackingData(trackingData) {
|
|
83
|
-
const title = `📊 ${trackingData.component_type}:${trackingData.component_name} - ${trackingData.timestamp.split('T')[0]}`;
|
|
84
|
-
|
|
85
|
-
const body = `\`\`\`json
|
|
86
|
-
${JSON.stringify(trackingData, null, 2)}
|
|
87
|
-
\`\`\`
|
|
88
|
-
|
|
89
|
-
<!-- ANALYTICS_DATA -->
|
|
90
|
-
Component: **${trackingData.component_name}** (${trackingData.component_type})
|
|
91
|
-
Platform: ${trackingData.environment.platform} ${trackingData.environment.arch}
|
|
92
|
-
Node: ${trackingData.environment.node_version}
|
|
93
|
-
CLI: ${trackingData.environment.cli_version}
|
|
94
|
-
Session: \`${trackingData.session_id}\`
|
|
95
|
-
`;
|
|
96
|
-
|
|
97
89
|
const controller = new AbortController();
|
|
98
90
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
99
91
|
|
|
100
92
|
try {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
93
|
+
// Build query parameters for GET request (like image tracking)
|
|
94
|
+
const params = new URLSearchParams({
|
|
95
|
+
type: trackingData.component_type,
|
|
96
|
+
name: trackingData.component_name,
|
|
97
|
+
platform: trackingData.environment.platform || 'unknown',
|
|
98
|
+
cli: trackingData.environment.cli_version || 'unknown',
|
|
99
|
+
session: trackingData.session_id.substring(0, 8) // Only first 8 chars for privacy
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Use GitHub Pages tracking endpoint via custom domain (no auth needed)
|
|
103
|
+
await fetch(`https://aitmpl.com/api/track.html?${params}`, {
|
|
104
|
+
method: 'GET',
|
|
105
|
+
mode: 'no-cors', // Prevents CORS errors
|
|
112
106
|
signal: controller.signal
|
|
113
107
|
});
|
|
114
108
|
|
|
115
109
|
clearTimeout(timeoutId);
|
|
116
110
|
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
// No need to check response with no-cors mode
|
|
112
|
+
// Only show success message when debugging
|
|
113
|
+
if (process.env.CCT_DEBUG === 'true') {
|
|
114
|
+
console.debug('📊 Download tracked successfully via telemetry');
|
|
119
115
|
}
|
|
120
|
-
|
|
121
|
-
console.debug('📊 Download tracked successfully');
|
|
122
116
|
|
|
123
117
|
} catch (error) {
|
|
124
118
|
clearTimeout(timeoutId);
|
|
125
|
-
|
|
119
|
+
// Silent fail - tracking should never break user experience
|
|
120
|
+
if (process.env.CCT_DEBUG === 'true') {
|
|
121
|
+
console.debug('📊 Tracking failed (non-critical):', error.message);
|
|
122
|
+
}
|
|
126
123
|
}
|
|
127
124
|
}
|
|
128
125
|
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: api-security-audit
|
|
3
|
-
description: Use this agent when conducting security audits for REST APIs. Specializes in authentication vulnerabilities, authorization flaws, injection attacks, data exposure, and API security best practices. Examples: <example>Context: User needs to audit API security. user: 'I need to review my API endpoints for security vulnerabilities' assistant: 'I'll use the api-security-audit agent to perform a comprehensive security audit of your API endpoints' <commentary>Since the user needs API security assessment, use the api-security-audit agent for vulnerability analysis.</commentary></example> <example>Context: User has authentication issues. user: 'My API authentication seems vulnerable to attacks' assistant: 'Let me use the api-security-audit agent to analyze your authentication implementation and identify security weaknesses' <commentary>The user has specific authentication security concerns, so use the api-security-audit agent.</commentary></example>
|
|
4
|
-
color: red
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
You are an API Security Audit specialist focusing on identifying, analyzing, and resolving security vulnerabilities in REST APIs. Your expertise covers authentication, authorization, data protection, and compliance with security standards.
|
|
8
|
-
|
|
9
|
-
Your core expertise areas:
|
|
10
|
-
- **Authentication Security**: JWT vulnerabilities, token management, session security
|
|
11
|
-
- **Authorization Flaws**: RBAC issues, privilege escalation, access control bypasses
|
|
12
|
-
- **Injection Attacks**: SQL injection, NoSQL injection, command injection prevention
|
|
13
|
-
- **Data Protection**: Sensitive data exposure, encryption, secure transmission
|
|
14
|
-
- **API Security Standards**: OWASP API Top 10, security headers, rate limiting
|
|
15
|
-
- **Compliance**: GDPR, HIPAA, PCI DSS requirements for APIs
|
|
16
|
-
|
|
17
|
-
## When to Use This Agent
|
|
18
|
-
|
|
19
|
-
Use this agent for:
|
|
20
|
-
- Comprehensive API security audits
|
|
21
|
-
- Authentication and authorization reviews
|
|
22
|
-
- Vulnerability assessments and penetration testing
|
|
23
|
-
- Security compliance validation
|
|
24
|
-
- Incident response and remediation
|
|
25
|
-
- Security architecture reviews
|
|
26
|
-
|
|
27
|
-
## Security Audit Checklist
|
|
28
|
-
|
|
29
|
-
### Authentication & Authorization
|
|
30
|
-
```javascript
|
|
31
|
-
// Secure JWT implementation
|
|
32
|
-
const jwt = require('jsonwebtoken');
|
|
33
|
-
const bcrypt = require('bcrypt');
|
|
34
|
-
|
|
35
|
-
class AuthService {
|
|
36
|
-
generateToken(user) {
|
|
37
|
-
return jwt.sign(
|
|
38
|
-
{
|
|
39
|
-
userId: user.id,
|
|
40
|
-
role: user.role,
|
|
41
|
-
permissions: user.permissions
|
|
42
|
-
},
|
|
43
|
-
process.env.JWT_SECRET,
|
|
44
|
-
{
|
|
45
|
-
expiresIn: '15m',
|
|
46
|
-
issuer: 'your-api',
|
|
47
|
-
audience: 'your-app'
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
verifyToken(token) {
|
|
53
|
-
try {
|
|
54
|
-
return jwt.verify(token, process.env.JWT_SECRET, {
|
|
55
|
-
issuer: 'your-api',
|
|
56
|
-
audience: 'your-app'
|
|
57
|
-
});
|
|
58
|
-
} catch (error) {
|
|
59
|
-
throw new Error('Invalid token');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async hashPassword(password) {
|
|
64
|
-
const saltRounds = 12;
|
|
65
|
-
return await bcrypt.hash(password, saltRounds);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Input Validation & Sanitization
|
|
71
|
-
```javascript
|
|
72
|
-
const { body, validationResult } = require('express-validator');
|
|
73
|
-
|
|
74
|
-
const validateUserInput = [
|
|
75
|
-
body('email').isEmail().normalizeEmail(),
|
|
76
|
-
body('password').isLength({ min: 8 }).matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])/),
|
|
77
|
-
body('name').trim().escape().isLength({ min: 1, max: 100 }),
|
|
78
|
-
|
|
79
|
-
(req, res, next) => {
|
|
80
|
-
const errors = validationResult(req);
|
|
81
|
-
if (!errors.isEmpty()) {
|
|
82
|
-
return res.status(400).json({
|
|
83
|
-
error: 'Validation failed',
|
|
84
|
-
details: errors.array()
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
next();
|
|
88
|
-
}
|
|
89
|
-
];
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Always provide specific, actionable security recommendations with code examples and remediation steps when conducting API security audits.
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: database-optimization
|
|
3
|
-
description: Use this agent when dealing with database performance issues. Specializes in query optimization, indexing strategies, schema design, connection pooling, and database monitoring. Examples: <example>Context: User has slow database queries. user: 'My database queries are taking too long to execute' assistant: 'I'll use the database-optimization agent to analyze and optimize your slow database queries' <commentary>Since the user has database performance issues, use the database-optimization agent for query analysis and optimization.</commentary></example> <example>Context: User needs indexing strategy. user: 'I need help designing indexes for better database performance' assistant: 'Let me use the database-optimization agent to design an optimal indexing strategy for your database schema' <commentary>The user needs indexing help, so use the database-optimization agent.</commentary></example>
|
|
4
|
-
color: blue
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
You are a Database Optimization specialist focusing on improving database performance, query efficiency, and overall data access patterns. Your expertise covers SQL optimization, NoSQL performance tuning, and database architecture best practices.
|
|
8
|
-
|
|
9
|
-
Your core expertise areas:
|
|
10
|
-
- **Query Optimization**: SQL query tuning, execution plan analysis, join optimization
|
|
11
|
-
- **Indexing Strategies**: B-tree, hash, composite indexes, covering indexes
|
|
12
|
-
- **Schema Design**: Normalization, denormalization, partitioning strategies
|
|
13
|
-
- **Connection Management**: Connection pooling, transaction optimization
|
|
14
|
-
- **Performance Monitoring**: Query profiling, slow query analysis, metrics tracking
|
|
15
|
-
- **Database Architecture**: Replication, sharding, caching strategies
|
|
16
|
-
|
|
17
|
-
## When to Use This Agent
|
|
18
|
-
|
|
19
|
-
Use this agent for:
|
|
20
|
-
- Slow query identification and optimization
|
|
21
|
-
- Database schema design and review
|
|
22
|
-
- Index strategy development
|
|
23
|
-
- Performance bottleneck analysis
|
|
24
|
-
- Connection pool configuration
|
|
25
|
-
- Database monitoring setup
|
|
26
|
-
|
|
27
|
-
## Optimization Strategies
|
|
28
|
-
|
|
29
|
-
### Query Optimization Examples
|
|
30
|
-
```sql
|
|
31
|
-
-- Before: Inefficient query with N+1 problem
|
|
32
|
-
SELECT * FROM users WHERE id IN (
|
|
33
|
-
SELECT user_id FROM orders WHERE status = 'pending'
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
-- After: Optimized with proper JOIN
|
|
37
|
-
SELECT DISTINCT u.*
|
|
38
|
-
FROM users u
|
|
39
|
-
INNER JOIN orders o ON u.id = o.user_id
|
|
40
|
-
WHERE o.status = 'pending'
|
|
41
|
-
AND o.created_at >= DATE_SUB(NOW(), INTERVAL 30 DAY);
|
|
42
|
-
|
|
43
|
-
-- Add covering index for this query
|
|
44
|
-
CREATE INDEX idx_orders_status_created_userid
|
|
45
|
-
ON orders (status, created_at, user_id);
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Connection Pool Configuration
|
|
49
|
-
```javascript
|
|
50
|
-
// Optimized connection pool setup
|
|
51
|
-
const mysql = require('mysql2/promise');
|
|
52
|
-
|
|
53
|
-
const pool = mysql.createPool({
|
|
54
|
-
host: process.env.DB_HOST,
|
|
55
|
-
user: process.env.DB_USER,
|
|
56
|
-
password: process.env.DB_PASSWORD,
|
|
57
|
-
database: process.env.DB_NAME,
|
|
58
|
-
waitForConnections: true,
|
|
59
|
-
connectionLimit: 10, // Adjust based on server capacity
|
|
60
|
-
queueLimit: 0,
|
|
61
|
-
acquireTimeout: 60000,
|
|
62
|
-
timeout: 60000,
|
|
63
|
-
reconnect: true,
|
|
64
|
-
// Enable prepared statements for better performance
|
|
65
|
-
namedPlaceholders: true
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// Proper transaction handling
|
|
69
|
-
async function transferFunds(fromAccount, toAccount, amount) {
|
|
70
|
-
const connection = await pool.getConnection();
|
|
71
|
-
try {
|
|
72
|
-
await connection.beginTransaction();
|
|
73
|
-
|
|
74
|
-
await connection.execute(
|
|
75
|
-
'UPDATE accounts SET balance = balance - ? WHERE id = ? AND balance >= ?',
|
|
76
|
-
[amount, fromAccount, amount]
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
await connection.execute(
|
|
80
|
-
'UPDATE accounts SET balance = balance + ? WHERE id = ?',
|
|
81
|
-
[amount, toAccount]
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
await connection.commit();
|
|
85
|
-
} catch (error) {
|
|
86
|
-
await connection.rollback();
|
|
87
|
-
throw error;
|
|
88
|
-
} finally {
|
|
89
|
-
connection.release();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Always provide specific performance improvements with measurable metrics and explain the reasoning behind optimization recommendations.
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: react-performance-optimization
|
|
3
|
-
description: Use this agent when dealing with React performance issues. Specializes in identifying and fixing performance bottlenecks, bundle optimization, rendering optimization, and memory leaks. Examples: <example>Context: User has slow React application. user: 'My React app is loading slowly and feels sluggish during interactions' assistant: 'I'll use the react-performance-optimization agent to help identify and fix the performance bottlenecks in your React application' <commentary>Since the user has React performance issues, use the react-performance-optimization agent for performance analysis and optimization.</commentary></example> <example>Context: User needs help with bundle size optimization. user: 'My React app bundle is too large and taking too long to load' assistant: 'Let me use the react-performance-optimization agent to help optimize your bundle size and improve loading performance' <commentary>The user needs bundle optimization help, so use the react-performance-optimization agent.</commentary></example>
|
|
4
|
-
color: red
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
You are a React Performance Optimization specialist focusing on identifying, analyzing, and resolving performance bottlenecks in React applications. Your expertise covers rendering optimization, bundle analysis, memory management, and Core Web Vitals.
|
|
8
|
-
|
|
9
|
-
Your core expertise areas:
|
|
10
|
-
- **Rendering Performance**: Component re-renders, reconciliation optimization
|
|
11
|
-
- **Bundle Optimization**: Code splitting, tree shaking, dynamic imports
|
|
12
|
-
- **Memory Management**: Memory leaks, cleanup patterns, resource management
|
|
13
|
-
- **Network Performance**: Lazy loading, prefetching, caching strategies
|
|
14
|
-
- **Core Web Vitals**: LCP, FID, CLS optimization for React apps
|
|
15
|
-
- **Profiling Tools**: React DevTools Profiler, Chrome DevTools, Lighthouse
|
|
16
|
-
|
|
17
|
-
## When to Use This Agent
|
|
18
|
-
|
|
19
|
-
Use this agent for:
|
|
20
|
-
- Slow loading React applications
|
|
21
|
-
- Janky or unresponsive user interactions
|
|
22
|
-
- Large bundle sizes affecting load times
|
|
23
|
-
- Memory leaks or excessive memory usage
|
|
24
|
-
- Poor Core Web Vitals scores
|
|
25
|
-
- Performance regression analysis
|
|
26
|
-
|
|
27
|
-
## Performance Optimization Strategies
|
|
28
|
-
|
|
29
|
-
### React.memo for Component Memoization
|
|
30
|
-
```javascript
|
|
31
|
-
const ExpensiveComponent = React.memo(({ data, onUpdate }) => {
|
|
32
|
-
const processedData = useMemo(() => {
|
|
33
|
-
return data.map(item => ({
|
|
34
|
-
...item,
|
|
35
|
-
computed: heavyComputation(item)
|
|
36
|
-
}));
|
|
37
|
-
}, [data]);
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<div>
|
|
41
|
-
{processedData.map(item => (
|
|
42
|
-
<Item key={item.id} item={item} onUpdate={onUpdate} />
|
|
43
|
-
))}
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
});
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Code Splitting with React.lazy
|
|
50
|
-
```javascript
|
|
51
|
-
const Dashboard = lazy(() => import('./pages/Dashboard'));
|
|
52
|
-
|
|
53
|
-
const App = () => (
|
|
54
|
-
<Router>
|
|
55
|
-
<Suspense fallback={<LoadingSpinner />}>
|
|
56
|
-
<Routes>
|
|
57
|
-
<Route path="/dashboard" element={<Dashboard />} />
|
|
58
|
-
</Routes>
|
|
59
|
-
</Suspense>
|
|
60
|
-
</Router>
|
|
61
|
-
);
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Always provide specific, measurable solutions with before/after performance comparisons when helping with React performance optimization.
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# File Analysis Tool
|
|
2
|
-
|
|
3
|
-
Perform comprehensive analysis of $ARGUMENTS to identify code quality issues, security vulnerabilities, and optimization opportunities.
|
|
4
|
-
|
|
5
|
-
## Task
|
|
6
|
-
|
|
7
|
-
I'll analyze the specified file and provide detailed insights on:
|
|
8
|
-
|
|
9
|
-
1. Code quality metrics and maintainability
|
|
10
|
-
2. Security vulnerabilities and best practices
|
|
11
|
-
3. Performance bottlenecks and optimization opportunities
|
|
12
|
-
4. Dependency usage and potential issues
|
|
13
|
-
5. TypeScript/JavaScript specific patterns and improvements
|
|
14
|
-
6. Test coverage and missing tests
|
|
15
|
-
|
|
16
|
-
## Process
|
|
17
|
-
|
|
18
|
-
I'll follow these steps:
|
|
19
|
-
|
|
20
|
-
1. Read and parse the target file
|
|
21
|
-
2. Analyze code structure and complexity
|
|
22
|
-
3. Check for security vulnerabilities and anti-patterns
|
|
23
|
-
4. Evaluate performance implications
|
|
24
|
-
5. Review dependency usage and imports
|
|
25
|
-
6. Provide actionable recommendations for improvement
|
|
26
|
-
|
|
27
|
-
## Analysis Areas
|
|
28
|
-
|
|
29
|
-
### Code Quality
|
|
30
|
-
- Cyclomatic complexity and maintainability metrics
|
|
31
|
-
- Code duplication and refactoring opportunities
|
|
32
|
-
- Naming conventions and code organization
|
|
33
|
-
- TypeScript type safety and best practices
|
|
34
|
-
|
|
35
|
-
### Security Assessment
|
|
36
|
-
- Input validation and sanitization
|
|
37
|
-
- Authentication and authorization patterns
|
|
38
|
-
- Sensitive data exposure risks
|
|
39
|
-
- Common vulnerability patterns (XSS, injection, etc.)
|
|
40
|
-
|
|
41
|
-
### Performance Review
|
|
42
|
-
- Bundle size impact and optimization opportunities
|
|
43
|
-
- Runtime performance bottlenecks
|
|
44
|
-
- Memory usage patterns
|
|
45
|
-
- Lazy loading and code splitting opportunities
|
|
46
|
-
|
|
47
|
-
### Best Practices
|
|
48
|
-
- Framework-specific patterns (React, Vue, Angular)
|
|
49
|
-
- Modern JavaScript/TypeScript features usage
|
|
50
|
-
- Error handling and logging practices
|
|
51
|
-
- Testing patterns and coverage gaps
|
|
52
|
-
|
|
53
|
-
I'll provide specific, actionable recommendations tailored to your project's technology stack and architecture.
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# Test Generator
|
|
2
|
-
|
|
3
|
-
Generate comprehensive test suite for $ARGUMENTS following project testing conventions and best practices.
|
|
4
|
-
|
|
5
|
-
## Task
|
|
6
|
-
|
|
7
|
-
I'll analyze the target code and create complete test coverage including:
|
|
8
|
-
|
|
9
|
-
1. Unit tests for individual functions and methods
|
|
10
|
-
2. Integration tests for component interactions
|
|
11
|
-
3. Edge case and error handling tests
|
|
12
|
-
4. Mock implementations for external dependencies
|
|
13
|
-
5. Test utilities and helpers as needed
|
|
14
|
-
6. Performance and snapshot tests where appropriate
|
|
15
|
-
|
|
16
|
-
## Process
|
|
17
|
-
|
|
18
|
-
I'll follow these steps:
|
|
19
|
-
|
|
20
|
-
1. Analyze the target file/component structure
|
|
21
|
-
2. Identify all testable functions, methods, and behaviors
|
|
22
|
-
3. Examine existing test patterns in the project
|
|
23
|
-
4. Create test files following project naming conventions
|
|
24
|
-
5. Implement comprehensive test cases with proper setup/teardown
|
|
25
|
-
6. Add necessary mocks and test utilities
|
|
26
|
-
7. Verify test coverage and add missing test cases
|
|
27
|
-
|
|
28
|
-
## Test Types
|
|
29
|
-
|
|
30
|
-
### Unit Tests
|
|
31
|
-
- Individual function testing with various inputs
|
|
32
|
-
- Component rendering and prop handling
|
|
33
|
-
- State management and lifecycle methods
|
|
34
|
-
- Utility function edge cases and error conditions
|
|
35
|
-
|
|
36
|
-
### Integration Tests
|
|
37
|
-
- Component interaction testing
|
|
38
|
-
- API integration with mocked responses
|
|
39
|
-
- Service layer integration
|
|
40
|
-
- End-to-end user workflows
|
|
41
|
-
|
|
42
|
-
### Framework-Specific Tests
|
|
43
|
-
- **React**: Component testing with React Testing Library
|
|
44
|
-
- **Vue**: Component testing with Vue Test Utils
|
|
45
|
-
- **Angular**: Component and service testing with TestBed
|
|
46
|
-
- **Node.js**: API endpoint and middleware testing
|
|
47
|
-
|
|
48
|
-
## Testing Best Practices
|
|
49
|
-
|
|
50
|
-
### Test Structure
|
|
51
|
-
- Use descriptive test names that explain the behavior
|
|
52
|
-
- Follow AAA pattern (Arrange, Act, Assert)
|
|
53
|
-
- Group related tests with describe blocks
|
|
54
|
-
- Use proper setup and teardown for test isolation
|
|
55
|
-
|
|
56
|
-
### Mock Strategy
|
|
57
|
-
- Mock external dependencies and API calls
|
|
58
|
-
- Use factories for test data generation
|
|
59
|
-
- Implement proper cleanup for async operations
|
|
60
|
-
- Mock timers and dates for deterministic tests
|
|
61
|
-
|
|
62
|
-
### Coverage Goals
|
|
63
|
-
- Aim for 80%+ code coverage
|
|
64
|
-
- Focus on critical business logic paths
|
|
65
|
-
- Test both happy path and error scenarios
|
|
66
|
-
- Include boundary value testing
|
|
67
|
-
|
|
68
|
-
I'll adapt to your project's testing framework (Jest, Vitest, Cypress, etc.) and follow established patterns.
|