← スキル一覧に戻る

typescript-write
by nodays-off
Server hardware compatibility checker - instantly verify if parts work with your server
⭐ 0🍴 0📅 2025年11月23日
SKILL.md
name: typescript-write description: Write TypeScript and JavaScript code following best practices and coding standards. Use when developing or refactoring TypeScript/JavaScript code.
TypeScript/JavaScript Development Skill
Purpose
This skill guides the development of TypeScript and JavaScript code with attention to:
- Type safety and proper typing patterns
- Modern ES6+ features and patterns
- Code organization and maintainability
- Error handling and validation
- Performance considerations
TypeScript Best Practices
Type Safety
- Use strict TypeScript configuration
- Prefer
unknownoveranywhen type is truly unknown - Use discriminated unions for complex state
- Define explicit return types for functions
- Use generics for reusable type patterns
Code Organization
- Keep files focused and single-purpose
- Use barrel exports (index.ts) for clean imports
- Separate types/interfaces into dedicated files
- Use path aliases for clean imports (@/lib, @/components)
Modern Patterns
- Use async/await over raw Promises
- Prefer const and let over var
- Use destructuring for cleaner code
- Use optional chaining (?.) and nullish coalescing (??)
- Use template literals for string interpolation
Error Handling
- Use custom error classes for domain errors
- Always handle Promise rejections
- Validate inputs at boundaries (API routes, form handlers)
- Use Zod or similar for runtime validation
React/Next.js Patterns
- Use functional components with hooks
- Prefer server components where possible
- Use React Query for data fetching
- Implement proper loading and error states
- Use proper key props in lists
Commands Reference
Type Checking
# Full type check
npx tsc --noEmit
# Watch mode
npx tsc --noEmit --watch
# Check specific files
npx tsc --noEmit src/lib/*.ts
Linting
# Run ESLint
npm run lint
# Fix auto-fixable issues
npm run lint -- --fix
# Check specific files
npx eslint src/components/**/*.tsx
Testing
# Run all tests
npm test
# Watch mode
npm test -- --watch
# Coverage report
npm test -- --coverage
# Specific test file
npm test -- path/to/test.ts
Building
# Development build
npm run dev
# Production build
npm run build
# Analyze bundle
npm run build -- --analyze
Code Style Guidelines
Naming Conventions
- Variables/Functions: camelCase
- Types/Interfaces: PascalCase
- Constants: UPPER_SNAKE_CASE
- Files: kebab-case or PascalCase for components
- Boolean variables: use is/has/should prefix
Import Order
- External dependencies (react, next)
- Internal aliases (@/lib, @/components)
- Relative imports (./utils)
- Type imports (type { ... })
Function Style
// Prefer arrow functions for callbacks
const handleClick = () => { ... };
// Use function declaration for hoisting needs
function calculateTotal(items: Item[]): number {
return items.reduce((sum, item) => sum + item.price, 0);
}
// Use async/await
async function fetchData(): Promise<Data> {
const response = await fetch(url);
return response.json();
}
Type Definitions
// Use interfaces for objects
interface User {
id: string;
name: string;
email: string;
}
// Use types for unions/intersections
type Status = 'pending' | 'active' | 'completed';
// Use generics for reusable patterns
type ApiResponse<T> = {
success: boolean;
data?: T;
error?: string;
};
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です