Skip to content
Back to skills

File Naming

ASecurity

File and directory naming conventions for TypeScript/JavaScript projects. Use when creating new files or directories.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added May 27, 2026
developmentjavascripttypescriptjavareactapi

Works with

  • api

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add ncaq/konoka --skill file-naming --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of File Naming?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for File Naming
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ncaq-file-naming/badge)](https://www.skillsdirectory.com/skills/ncaq-file-naming)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: file-naming
description: File and directory naming conventions for TypeScript/JavaScript projects. Use when creating new files or directories.
user-invocable: false
---

# ファイル名とディレクトリ名の規約

## 基本ルール

ディレクトリ名やファイル名はkebab-caseを使います。

```
src/
  api/
    customer-query.ts
```

kebab-caseを基本とする理由は以下の通りです。

URLやnpmパッケージ名などweb標準のエコシステムではkebab-caseが一般的です。
それに従ってTypeScript/JavaScriptのプロジェクトでもkebab-caseが広く採用されています。

ファイルシステムの大文字小文字の扱いがOS間で異なります。
macOSやWindowsはデフォルトでcase-insensitiveなので、
`UserList.tsx`と`userList.tsx`を区別できません。
kebab-caseならこの問題が発生しません。

## Reactコンポーネントファイル

Reactコンポーネントをエクスポートするファイルは、
同じ名前のPascalCaseを使っても構いません。

メインの利用目的と一致しているため、
対応関係が分かりやすくなります。

React公式もチュートリアルでそのような名前を使うこともあります。

```
src/
  components/
    SearchDialog.tsx    # SearchDialogコンポーネントをエクスポート
    UserList.tsx        # UserListコンポーネントをエクスポート
```

しかし全てをkebab-caseに統一するのも問題ありません。

## ReactのカスタムHooksファイル

単一のReactのカスタムHooksをexportするファイルは、
同じ名前のcamelCaseを使っても構いません。

関数名とファイル名が一致するため、
対応関係が分かりやすくなります。

React公式もチュートリアルで使っています。

eslint-plugin-react-hooksはファイル名ではなく関数名のuseプレフィックスでHooksを検出するので、
ファイル名は自由ですが、
一致させた方がわかりやすいでしょう。

```
src/
  hooks/
    useAuth.ts          # useAuth関数をエクスポート
    useLocalStorage.ts  # useLocalStorage関数をエクスポート
```

しかし全てをkebab-caseに統一するのも問題ありません。

## 通常のTypeScript/JavaScriptモジュール

kebab-caseを使うことを推奨します。

単一のexportのモジュールでも、
のちのち複数のexportが発生する可能性が割とあるので、
kebab-caseを使うことを推奨します。

## プロジェクト内での一貫性

プロジェクト内で既に採用されている規約がある場合はそちらに従ってください。

プロジェクト内で混在している場合は、
新規ファイルでは一貫した命名規則を採用して、
既存ファイルは変更のついでに徐々に統一していくのが現実的です。

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.