javascript-typescript
SKILL.md
JavaScript & TypeScript
Best practices for JavaScript and TypeScript development.
When to Use
- Writing frontend or backend JavaScript/TypeScript code
- Setting up new Node.js or browser projects
- Code review and refactoring
TypeScript Guidelines
Strict Mode
Always enable strict mode in tsconfig.json:
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true
}
}
Type Best Practices
// Prefer interfaces for object shapes
interface User {
id: string;
name: string;
email: string;
}
// Use union types for alternatives
type Status = 'idle' | 'loading' | 'success' | 'error';
// Prefer readonly for immutable data
class Config {
readonly apiUrl: string;
}
JavaScript Patterns
Async/Await
// Prefer async/await over promise chains
async function fetchData(url) {
const response = await fetch(url);
return response.json();
}
Error Handling
try {
await operation();
} catch (error) {
logger.error('Operation failed', { error });
throw error; // Re-throw or handle
}
Resources
Weekly Installs
3
Repository
kinhluan/skillsGitHub Stars
1
First Seen
1 day ago
Security Audits
Installed on
amp3
cline3
opencode3
cursor3
kimi-cli3
codex3