JavaScript/Node.js(CLAUDE-MD-JavaScript)
Modern JS development
Claude Code Configuration for JavaScript Projects
๐จ CRITICAL: JAVASCRIPT PARALLEL EXECUTION PATTERNS
MANDATORY RULE: JavaScript projects require Node.js ecosystem coordination with npm/yarn parallel operations.
๐จ CRITICAL: CONCURRENT EXECUTION FOR ALL JAVASCRIPT OPERATIONS
ABSOLUTE RULE: ALL JavaScript operations MUST be concurrent/parallel in a single message:
๐ด MANDATORY CONCURRENT PATTERNS FOR JAVASCRIPT:
- Package Management: ALWAYS batch ALL npm/yarn commands in ONE message
- File Operations: ALWAYS batch ALL JS/JSON file operations together
- Testing: ALWAYS run ALL test suites in parallel
- Build Operations: ALWAYS batch ALL build/bundle/deploy operations
- Development Server: ALWAYS start dev server WITH other operations
โก JAVASCRIPT GOLDEN RULE: "1 MESSAGE = ALL NODE.JS OPERATIONS"
Examples of CORRECT JavaScript concurrent execution:
// โ
CORRECT: Everything in ONE message
[Single Message]:
- TodoWrite { todos: [10+ todos with all Node.js tasks] }
- Task("You are Node.js architect. Coordinate via hooks for API design...")
- Task("You are Frontend developer. Coordinate via hooks for UI components...")
- Task("You are DevOps engineer. Coordinate via hooks for deployment...")
- Bash("npm init -y")
- Bash("npm install express mongoose cors helmet")
- Bash("npm install --save-dev jest supertest nodemon eslint")
- Write("package.json", packageContent)
- Write("server.js", serverContent)
- Write("routes/api.js", routesContent)
- Write("middleware/auth.js", authContent)
- Write("tests/api.test.js", testContent)
- Write(".eslintrc.js", eslintConfig)
- Write(".gitignore", gitignoreContent)
๐ฏ JAVASCRIPT-SPECIFIC SWARM PATTERNS
๐ฆ Node.js Package Management Coordination
Package Installation Strategy:
# Always batch dependency installations
npm install express mongoose cors helmet jsonwebtoken bcryptjs
npm install --save-dev jest supertest nodemon eslint prettier husky
npm install --global pm2 # for production
Parallel Development Setup:
// โ
CORRECT: All setup in ONE message
[BatchTool]:
- Bash("npm init -y")
- Bash("npm install express mongoose cors helmet dotenv")
- Bash("npm install --save-dev jest nodemon eslint prettier")
- Write("package.json", updatedPackageJson)
- Write("server.js", expressServer)
- Write(".env.example", envTemplate)
- Write("nodemon.json", nodemonConfig)
- Write(".eslintrc.js", eslintConfig)
- Bash("npm run dev & npm run test")
๐๏ธ JavaScript Agent Specialization
Agent Types for JavaScript Projects:
- Backend API Agent - Express.js, FastAPI, database integration
- Frontend Logic Agent - Vanilla JS, DOM manipulation, async patterns
- Testing Agent - Jest, Mocha, integration testing
- Build Agent - Webpack, Rollup, Vite configuration
- DevOps Agent - PM2, Docker, deployment automation
๐งช JavaScript Testing Coordination
Parallel Testing Strategy:
// Test coordination pattern
[BatchTool]:
- Write("tests/unit/auth.test.js", unitTests)
- Write("tests/integration/api.test.js", integrationTests)
- Write("tests/e2e/user-flow.test.js", e2eTests)
- Write("jest.config.js", jestConfig)
- Bash("npm test -- --coverage --watchAll=false")
- Bash("npm run test:integration")
- Bash("npm run test:e2e")
โก Performance Optimization Patterns
JavaScript Performance Coordination:
// Performance optimization batch
[BatchTool]:
- Write("middleware/compression.js", compressionMiddleware)
- Write("utils/cache.js", cacheUtilities)
- Write("config/database.js", dbOptimization)
- Bash("npm install compression redis cluster")
- Bash("npm run build:production")
- Bash("npm run analyze:bundle")
๐ JAVASCRIPT PROJECT TEMPLATES
๐ Express.js API Template
Swarm Initialization for Express API:
// Initialize Express API swarm
mcp__claude-flow__swarm_init({
topology: "hierarchical",
maxAgents: 6,
strategy: "parallel"
})
// Spawn specialized agents
mcp__claude-flow__agent_spawn({ type: "architect", name: "API Designer" })
mcp__claude-flow__agent_spawn({ type: "coder", name: "Express Developer" })
mcp__claude-flow__agent_spawn({ type: "coder", name: "Database Expert" })
mcp__claude-flow__agent_spawn({ type: "tester", name: "API Tester" })
mcp__claude-flow__agent_spawn({ type: "reviewer", name: "Security Auditor" })
mcp__claude-flow__agent_spawn({ type: "coordinator", name: "DevOps Lead" })
Express.js Project Structure:
project/
โโโ src/
โ โโโ controllers/
โ โโโ middleware/
โ โโโ models/
โ โโโ routes/
โ โโโ services/
โ โโโ utils/
โโโ tests/
โ โโโ unit/
โ โโโ integration/
โ โโโ e2e/
โโโ config/
โโโ docs/
โโโ scripts/
๐จ Frontend JavaScript Template
Frontend Development Coordination:
// Frontend-focused swarm
[BatchTool]:
- Write("src/js/main.js", mainAppLogic)
- Write("src/js/components/header.js", headerComponent)
- Write("src/js/services/api.js", apiService)
- Write("src/js/utils/helpers.js", utilityFunctions)
- Write("src/css/styles.css", mainStyles)
- Write("index.html", htmlTemplate)
- Bash("npm install webpack webpack-cli webpack-dev-server")
- Bash("npm run build && npm run dev")
๐ง JAVASCRIPT BUILD TOOLS COORDINATION
๐ฆ Webpack Configuration
Webpack Swarm Pattern:
// Webpack build optimization
[BatchTool]:
- Write("webpack.config.js", webpackConfig)
- Write("webpack.prod.js", productionConfig)
- Write("webpack.dev.js", developmentConfig)
- Bash("npm install webpack-bundle-analyzer terser-webpack-plugin")
- Bash("npm run build:analyze")
- Bash("npm run build:production")
๐ฏ Modern JavaScript (ES6+) Patterns
ES6+ Development Coordination:
// Modern JavaScript features batch
[BatchTool]:
- Write("src/modules/async-operations.js", asyncAwaitPatterns)
- Write("src/modules/destructuring.js", destructuringExamples)
- Write("src/modules/classes.js", classDefinitions)
- Write("src/modules/modules.js", esModulePatterns)
- Write("babel.config.js", babelConfiguration)
- Bash("npm install @babel/core @babel/preset-env")
๐ JAVASCRIPT SECURITY BEST PRACTICES
๐ก๏ธ Security Coordination Patterns
Security Implementation Batch:
[BatchTool]:
- Write("middleware/security.js", securityMiddleware)
- Write("utils/validation.js", inputValidation)
- Write("utils/sanitization.js", dataSanitization)
- Bash("npm install helmet joi bcryptjs jsonwebtoken")
- Bash("npm install --save-dev eslint-plugin-security")
- Bash("npm audit fix")
Security Checklist for JavaScript:
- Input validation and sanitization
- SQL injection prevention
- XSS protection
- CSRF tokens
- Rate limiting
- Secure headers (Helmet.js)
- Environment variable protection
- Dependency vulnerability scanning
๐ JAVASCRIPT MONITORING AND LOGGING
๐ Performance Monitoring
Monitoring Setup Coordination:
[BatchTool]:
- Write("utils/logger.js", winstonLogger)
- Write("middleware/metrics.js", performanceMetrics)
- Write("config/monitoring.js", monitoringConfig)
- Bash("npm install winston pino express-rate-limit")
- Bash("npm install --save-dev clinic autocannon")
๐ JAVASCRIPT DEPLOYMENT PATTERNS
โ๏ธ Production Deployment
Deployment Coordination:
[BatchTool]:
- Write("Dockerfile", dockerConfiguration)
- Write("docker-compose.yml", dockerCompose)
- Write("ecosystem.config.js", pm2Config)
- Write("scripts/deploy.sh", deploymentScript)
- Bash("npm run build:production")
- Bash("docker build -t app:latest .")
- Bash("npm run test:production")
๐ JAVASCRIPT CI/CD COORDINATION
๐๏ธ GitHub Actions for JavaScript
CI/CD Pipeline Batch:
[BatchTool]:
- Write(".github/workflows/ci.yml", githubActions)
- Write(".github/workflows/deploy.yml", deploymentWorkflow)
- Write("scripts/test.sh", testScript)
- Write("scripts/build.sh", buildScript)
- Bash("npm run lint && npm run test && npm run build")
๐ก JAVASCRIPT BEST PRACTICES
๐ Code Quality Standards
- ESLint Configuration: Enforce consistent code style
- Prettier Integration: Automatic code formatting
- Husky Hooks: Pre-commit quality checks
- Jest Testing: Comprehensive test coverage
- JSDoc Comments: Proper code documentation
- Error Handling: Robust error management patterns
๐ฏ Performance Optimization
- Async/Await: Proper asynchronous programming
- Lazy Loading: Dynamic imports and code splitting
- Caching Strategies: Redis, memory caching
- Database Optimization: Connection pooling, indexing
- Bundle Optimization: Tree shaking, minification
- Memory Management: Avoiding memory leaks
๐ JAVASCRIPT LEARNING RESOURCES
๐ Recommended Topics
- Modern JavaScript: ES6+, async programming, modules
- Node.js: Server-side development, npm ecosystem
- Express.js: Web framework, middleware, routing
- Database Integration: MongoDB, PostgreSQL, Redis
- Testing: Jest, Mocha, integration testing
- DevOps: Docker, PM2, deployment strategies
Remember: JavaScript swarms excel with parallel npm operations, concurrent testing, and coordinated build processes. Always batch package management and leverage Node.js ecosystem tools for optimal performance.
Explore More
Related Templates
Related Guides
ClaudeCode Best Practices & Pro Tips
Master ClaudeCode with expert tips, proven workflows, and best practices. Learn how to maximize productivity and get the most out of AI-powered development.
Claude Code Checkpoints & Rewind Feature - Undo AI Code Changes
Learn how to use Claude Code's checkpoints and rewind feature to safely undo AI-generated code changes. Use Esc+Esc or /rewind to rollback mistakes and maintain control over your codebase.