Skip to content
cccskills
FreePublished on GitHub

code-review-standards

Enforces project coding standards during code review: naming conventions (PascalCase for classes, camelCase for methods/variables, UPPER_SNAKE_CASE for constants, kebab-case for files), standard file structure, anti-magic-number policy, file size limits (500/800 lines), security patterns, and design patterns. Use when reviewing code, writing new code, or checking adherence to project conventions.

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md4.9 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

コードレビュー基準

プロジェクトのコーディング規約に基づいてコードレビューを実施するためのスキル。 PATTERNS.md および MASTER.md で定義された基準を適用する。

1. 命名規則

要素パターン例
クラスPascalCaseUserService
インターフェースPascalCase + I prefixIUserRepository
メソッドcamelCasegetUserById()
変数camelCaseuserName
定数UPPER_SNAKE_CASEMAX_RETRY_COUNT
ファイルkebab-caseuser-service.ts

2. ファイル構造の標準パターン

すべてのファイルは以下の順序で構成すること:

// 1. imports
import { Injectable } from "@nestjs/common";

// 2. constants
const MAX_RETRY_COUNT = 3;

// 3. types/interfaces
interface UserData {
  id: string;
  name: string;
}

// 4. main class/function
@Injectable()
export class UserService {
  // implementation
}

// 5. exports
export { UserService, UserData };

3. マジックナンバー禁止(必須)

すべての意味のある数値・文字列は名前付き定数に抽出すること。これはプロジェクトの必須ルール。

// ❌ 禁止: マジックナンバー
if (retryCount > 3) {
  throw new Error("Max retries exceeded");
}
setTimeout(callback, 30000);

// ✅ 正しい: 名前付き定数
const MAX_RETRY_COUNT = 3;
if (retryCount > MAX_RETRY_COUNT) {
  throw new Error("Max retries exceeded");
}

const API_CONFIG = {
  TIMEOUT_MS: 30000,
  MAX_RETRIES: 3,
  RATE_LIMIT: 100,
} as const;
setTimeout(callback, API_CONFIG.TIMEOUT_MS);

定数は用途別にグループ化し、as const で型安全性を確保する。

4. ファイルサイズ制限

基準行数アクション
ソフトリミット500行分割を検討
ハードリミット800行分割を実施(生成コード・スキーマは例外)

800行を超えるファイルは、責務の分離を基準に複数ファイルに分割する。

5. セキュリティパターン

レビュー時に以下を確認すること:

  • 入力サニタイゼーション: ユーザー入力は必ずサニタイズ(HTML エスケープ、特殊文字除去)
  • パラメタライズドクエリ: SQL は文字列結合ではなくプレースホルダーを使用
  • 認証ミドルウェア: JWT トークンの検証は専用ミドルウェアで実施
  • 認可チェック: ロールベースのアクセス制御をデコレーターまたはガードで実装
// ✅ パラメタライズドクエリ
const data = await db.query("SELECT * FROM users WHERE id = ?", [id]);

// ❌ 文字列結合(SQLインジェクション脆弱性)
const data = await db.query(`SELECT * FROM users WHERE id = '${id}'`);

6. デザインパターン

プロジェクトで推奨されるデザインパターン:

パターン用途
Repositoryデータアクセスの抽象化(インターフェース経由)
Factory型に基づくオブジェクト生成の一元化
Singleton設定マネージャー等の単一インスタンス管理
Decoratorキャッシング、認証、ロール検証の横断的関心事

7. 禁止事項チェックリスト

コードレビュー時に以下が含まれていないか確認する:

  • any 型の使用(型安全性の喪失)
  • console.log の本番コードへの残存(構造化ログを使用)
  • マジックナンバー・ハードコード値
  • 未使用の import 文
  • サイレントなエラー握りつぶし(空の catch ブロック)
  • 文字列結合による SQL クエリ構築
  • 非 null アサーション(!)の無条件使用
  • テストのない新規ビジネスロジック

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

プロジェクトガイドラインへの準拠をチェックし、バグ、スタイル違反、コード品質問題を検出する。PRレビュー時に使用。

The English summary is being prepared. Showing the original description.

feel-flow/ai-spec-driven-development7Updated Oct 18, 2026

機能を保持したまま不要な複雑性を排除し、コードの簡潔性と可読性を向上させる。30行超の関数や3段以上のネスト検出時に使用。

The English summary is being prepared. Showing the original description.

feel-flow/ai-spec-driven-development7Updated Oct 18, 2026

コードコメントの正確性、完全性、長期的な保守性を分析する。JSDoc、コメント、README等のドキュメントが変更された場合に使用。

The English summary is being prepared. Showing the original description.

feel-flow/ai-spec-driven-development7Updated Oct 18, 2026

サイレント失敗を検出し、堅牢なエラーハンドリングを確保する。PRレビューでのエラーハンドリング検査時に使用。

The English summary is being prepared. Showing the original description.

feel-flow/ai-spec-driven-development7Updated Oct 18, 2026

Enforces error handling standards: silent error prohibition, custom error class hierarchy (AppError base with category never-fallback / transient / permanent, cause preservation, ValidationError / UnauthorizedError / UpstreamError etc. — canonical definitions in ERRORS.md), external-boundary normalization (normalizeExternalError), Result pattern (Result.ok/Result.fail), proper try-catch with error type checking, structured error logging with a single Logger contract, fallback prohibition categories (isNeverFallback), and HTTP status code mapping. Use when implementing error handling, reviewing catch blocks, or designing error responses.

The English summary is being prepared. Showing the original description.

feel-flow/ai-spec-driven-development7Updated Oct 18, 2026

Creates and reviews agent skills safely by enforcing deletion-prevention harness rules: no fixed absolute temp paths, no cwd-dependent cleanup, no wildcard deletes, no workspace-external file operations, no silent cleanup failures, and mandatory temp-root validation before any destructive command. Use when creating a new skill, updating an existing SKILL.md, or reviewing prompts/runbooks that include temp files, extraction, cleanup, PowerShell, bash, rm, del, Remove-Item, or archive expansion.

The English summary is being prepared. Showing the original description.

feel-flow/ai-spec-driven-development7Updated Oct 18, 2026

See all skills by feel-flow

Report a problem with this skill