Back to Skills

Setting up Next.js Project

camoneart
Updated Yesterday
62 views
2
2
View on GitHub
Othergeneral

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.

Quick Install

Claude Code

Recommended
Plugin CommandRecommended
/plugin add https://github.com/camoneart/claude-code
Git CloneAlternative
git clone https://github.com/camoneart/claude-code.git ~/.claude/skills/Setting up Next.js Project

Copy and paste this command in Claude Code to install this skill

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.jsonprettier が追加されているか
  • package.json に format スクリプトが追加されているか
  • pnpm run format が正常に動作するか
  • .vscode/settings.json の作成を検討したか

トラブルシューティング

フォーマットが効かない

  1. Prettier拡張がインストールされているか確認
  2. .prettierrc.json の構文エラーを確認
  3. ESLintとの競合を確認(eslint-config-prettier が必要)

Tailwind CSSのクラス順序が整わない

  1. prettier-plugin-tailwindcss がインストールされているか確認
  2. .prettierrc.json にプラグイン設定を追加

参考リンク

GitHub Repository

camoneart/claude-code
Path: skills/setting-up-nextjs-project

Related Skills

subagent-driven-development

Development

This 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.

View skill

algorithmic-art

Meta

This 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.

View skill

executing-plans

Design

Use the executing-plans skill when you have a complete implementation plan to execute in controlled batches with review checkpoints. It loads and critically reviews the plan, then executes tasks in small batches (default 3 tasks) while reporting progress between each batch for architect review. This ensures systematic implementation with built-in quality control checkpoints.

View skill

cost-optimization

Other

This 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.

View skill