← スキル一覧に戻る

javascript-code-style
by iamyojimbo
⭐ 0🍴 0📅 2026年1月20日
SKILL.md
name: javascript-code-style description: This skill should be used when writing, editing, or reviewing any JavaScript code in the ECP codebase. It provides coding standards for error handling in Express API routes. Always apply these guidelines when working with JavaScript files (.js) in the api/ directory.
JavaScript Code Style
This skill provides JavaScript coding standards for the ECP codebase. After writing code, note the code rules applied, e.g. "Applied: 1.1 - Always wrap async route handlers in try-catch".
Rules
- Error Handling
- Always wrap async Express route handlers in try-catch blocks. The ECP API
has no global error middleware, so unhandled promise rejections cause
requests to hang indefinitely until timeout. Note: This does NOT apply to
database migrations (
api/migrations/) - migrate-mongo handles errors at the framework level. - Use
setErrorResponse(res, title, detail, status)from../lib/http.jsfor error responses. - Log errors with
console.error()before returning error response. - Return 400 for client errors (validation, bad input), 500 for server errors (database failures, unexpected exceptions).
- Example:
router.post('/endpoint', async (req, res) => { try { // ... route logic res.json(result); } catch (error) { console.error('Error in /endpoint:', error); return setErrorResponse(res, 'Operation failed', error.message, 500); } });
- Always wrap async Express route handlers in try-catch blocks. The ECP API
has no global error middleware, so unhandled promise rejections cause
requests to hang indefinitely until timeout. Note: This does NOT apply to
database migrations (
スコア
総合スコア
40/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
レビュー
💬
レビュー機能は近日公開予定です