Setting up Next.js Project
About
This Claude Skill automates Next.js project configuration by setting up ESLint and Prettier with recommended settings. It handles package installation, creates configuration files, and resolves conflicts between tools. Use it when initializing new Next.js projects or adding linting/formatting to existing ones.
Documentation
Setting up Next.js Project
Next.jsプロジェクトのセットアップ時に必要な設定を自動化するスキル。
いつ使うか
- Next.jsプロジェクトを新規作成する時
- 既存Next.jsプロジェクトにESLint/Prettierを追加する時
- コードフォーマット設定が必要な時
- ユーザーが「Next.jsセットアップ」について言及した時
セットアップ手順
1. ESLint + Prettier の必須インストール
Next.jsはESLintを自動インストールするが、Prettierも必ず追加:
pnpm add -D prettier eslint-config-prettier prettier-plugin-tailwindcss
パッケージの役割:
prettier: コードフォーマッターeslint-config-prettier: ESLintとPrettierの競合を防ぐprettier-plugin-tailwindcss: Tailwind CSSのクラス順序を整理(Tailwind使用時)
2. 設定ファイルの作成
.prettierrc.json
プロジェクトルートに作成:
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 2,
"useTabs": false,
"printWidth": 100,
"bracketSpacing": true,
"arrowParens": "always"
}
.eslintrc.json の更新
既存の設定に eslint-config-prettier を追加:
{
"extends": ["next/core-web-vitals", "prettier"]
}
3. package.json スクリプトの追加
{
"scripts": {
"format": "prettier --write .",
"format:check": "prettier --check ."
}
}
使い方:
pnpm run format: 全ファイルをフォーマットpnpm run format:check: フォーマットチェック(CI用)
4. VS Code 設定の推奨
.vscode/settings.json を作成(任意):
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
完全なセットアップフロー
新規プロジェクト
# 1. Next.jsプロジェクト作成
pnpm dlx create-next-app@latest my-app
# 2. ディレクトリ移動
cd my-app
# 3. Prettier追加
pnpm add -D prettier eslint-config-prettier prettier-plugin-tailwindcss
# 4. 設定ファイル作成
# (このスキルが自動で作成)
# 5. フォーマット実行
pnpm run format
既存プロジェクト
# 1. Prettier追加
pnpm add -D prettier eslint-config-prettier prettier-plugin-tailwindcss
# 2. 設定ファイル追加
# (このスキルが自動で作成)
# 3. ESLint設定更新
# (このスキルが自動で更新)
# 4. フォーマット実行
pnpm run format
設定ファイルテンプレート
詳細なテンプレートは templates/ を参照。
チェックリスト
セットアップ完了前に確認:
- Prettierがインストールされているか
-
.prettierrc.jsonが作成されているか -
.eslintrc.jsonにprettierが追加されているか - package.json に format スクリプトが追加されているか
-
pnpm run formatが正常に動作するか -
.vscode/settings.jsonの作成を検討したか
トラブルシューティング
フォーマットが効かない
- Prettier拡張がインストールされているか確認
.prettierrc.jsonの構文エラーを確認- ESLintとの競合を確認(
eslint-config-prettierが必要)
Tailwind CSSのクラス順序が整わない
prettier-plugin-tailwindcssがインストールされているか確認.prettierrc.jsonにプラグイン設定を追加
参考リンク
Quick Install
/plugin add https://github.com/camoneart/claude-code/tree/main/setting-up-nextjs-projectCopy and paste this command in Claude Code to install this skill
GitHub 仓库
Related Skills
subagent-driven-development
DevelopmentThis skill executes implementation plans by dispatching a fresh subagent for each independent task, with code review between tasks. It enables fast iteration while maintaining quality gates through this review process. Use it when working on mostly independent tasks within the same session to ensure continuous progress with built-in quality checks.
algorithmic-art
MetaThis Claude Skill creates original algorithmic art using p5.js with seeded randomness and interactive parameters. It generates .md files for algorithmic philosophies, plus .html and .js files for interactive generative art implementations. Use it when developers need to create flow fields, particle systems, or other computational art while avoiding copyright issues.
cost-optimization
OtherThis Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.
Git Commit Helper
MetaThis Claude Skill generates descriptive commit messages by analyzing git diffs. It automatically follows conventional commit format with proper types like feat, fix, and docs. Use it when you need help writing commit messages or reviewing staged changes in your repository.
