📖 About JavaScript
JavaScript is the most widely-used programming language in the world. It powers interactive web pages, server-side applications with Node.js, mobile apps, desktop applications, and more. With its event-driven, non-blocking I/O model, JavaScript excels at building scalable network applications.
🎯 Best For
- Frontend web development
- Backend with Node.js
- Full-stack JavaScript applications
- Mobile apps (React Native)
- Real-time applications
🔧 Key Features
- Dynamic typing with optional JSDoc
- First-class functions and closures
- Prototypal inheritance
- Async/await for asynchronous code
- Rich ecosystem (npm)
- Event-driven architecture
🛠️ Development Tools
Build
npm run build
Test
jest
Coverage
jest --coverage
Run
node
📄 Package Contents (7 files)
AGENTS_RULES.md
Complete AI agent rules (universal)
- JAVASCRIPT-specific best practices
- TDD workflow (Red-Green-Refactor)
- DDD principles and patterns
- Git workflow and commit format
- Code quality principles
.cursorrules
Quick reference for Cursor IDE
- Essential rules summary
- Links to full documentation
- Optimized for quick loading
.gitignore
Git exclusions
- JAVASCRIPT-specific patterns
- Build artifacts
- IDE configuration files
- Dependency directories
AGENTS.md
Quick reference guide
- Common patterns
- Best practices summary
- Quick troubleshooting
README.md
Project template with examples
- Setup instructions
- Sample code and structure
- Testing examples
- Build and run commands
CODE_QUALITY_PRINCIPLES.md
Quality principles and best practices
- Avoid default values (fail-fast)
- Consistency across code paths
- Extract reusable functions
- JAVASCRIPT-specific examples
CONTRIBUTING.md
Contribution guidelines
- TDD workflow (Red-Green-Refactor)
- Git commit format
- Code review process
- Testing requirements (90% coverage)
💻 Code Examples
Modern JavaScript with Async/Await
async function fetchUser(id) {
try {
const response = await fetch(`/api/users/${id}`);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return await response.json();
} catch (error) {
console.error('Error fetching user:', error);
return null;
}
}
Functional Programming
const users = [
{ name: 'John', age: 30 },
{ name: 'Jane', age: 25 }
];
const adults = users
.filter(user => user.age >= 18)
.map(user => ({ ...user, isAdult: true }))
.sort((a, b) => a.age - b.age);
Classes and Modules
class User {
constructor(name, email) {
this.id = crypto.randomUUID();
this.name = name;
this.email = email;
}
isValid() {
return this.name && this.email.includes('@');
}
}
export { User };