🛠️ 開発・MCP コミュニティ
web-build-deploy
Building and deploying React web applications. Use when configuring builds, deploying to Vercel/Netlify, setting up CI/CD, Docker, or managing environments.
⚡ おすすめ: コマンド1行でインストール(60秒)
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o web-build-deploy.zip https://jpskill.com/download/17866.zip && unzip -o web-build-deploy.zip && rm web-build-deploy.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17866.zip -OutFile "$d\web-build-deploy.zip"; Expand-Archive "$d\web-build-deploy.zip" -DestinationPath $d -Force; ri "$d\web-build-deploy.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
web-build-deploy.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
web-build-deployフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Web Build & Deploy (React)
Vercel Deployment
クイックデプロイ
# Vercel CLI をインストール
npm i -g vercel
# デプロイ
vercel
# 本番環境へデプロイ
vercel --prod
設定 (vercel.json)
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"framework": "vite",
"rewrites": [
{ "source": "/(.*)", "destination": "/" }
],
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "X-Content-Type-Options", "value": "nosniff" },
{ "key": "X-Frame-Options", "value": "DENY" }
]
}
]
}
環境変数
# CLI 経由で追加
vercel env add NEXT_PUBLIC_API_URL
# または Vercel ダッシュボード: Settings > Environment Variables
# コード内でアクセス
const apiUrl = process.env.NEXT_PUBLIC_API_URL;
プレビューデプロイメント
ブランチへのすべてのプッシュは、自動的にプレビュー URL を作成します。
https://project-git-branch-username.vercel.app
Netlify Deployment
クイックデプロイ
# Netlify CLI をインストール
npm i -g netlify-cli
# ログイン
netlify login
# プレビューをデプロイ
netlify deploy
# 本番環境へデプロイ
netlify deploy --prod
設定 (netlify.toml)
[build]
command = "npm run build"
publish = "dist"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
[build.environment]
NODE_VERSION = "18"
環境変数
# CLI 経由で追加
netlify env:set API_URL https://api.example.com
# または Netlify ダッシュボード: Site settings > Environment variables
Docker Deployment
Dockerfile (マルチステージビルド)
# ビルドステージ
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# 本番環境ステージ
FROM nginx:alpine
# ビルドされたファイルをコピー
COPY --from=builder /app/dist /usr/share/nginx/html
# SPA ルーティング用の nginx 設定をコピー
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
nginx.conf (SPA ルーティング)
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Gzip 圧縮
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
# 静的アセットをキャッシュ
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# SPA フォールバック
location / {
try_files $uri $uri/ /index.html;
}
# セキュリティヘッダー
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
}
Docker Compose
# docker-compose.yml
version: '3.8'
services:
web:
build: .
ports:
- "80:80"
environment:
- NODE_ENV=production
restart: unless-stopped
# バックエンドあり
api:
build: ./backend
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgresql://user:pass@db:5432/app
depends_on:
- db
db:
image: postgres:15-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=pass
- POSTGRES_DB=app
volumes:
postgres_data:
ビルド & 実行
# イメージをビルド
docker build -t myapp:latest .
# コンテナを実行
docker run -p 80:80 myapp:latest
# docker-compose を使用
docker-compose up -d
docker-compose down
GitHub Actions CI/CD
基本的なワークフロー
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build
run: npm run build
env:
VITE_API_URL: ${{ secrets.API_URL }}
- name: Deploy to Vercel
if: github.ref == 'refs/heads/main'
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel-args: '--prod'
プレビューデプロイメントあり
name: Preview
on: [pull_request]
jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy Preview
uses: amondnet/vercel-action@v25
id: deploy
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Comment PR
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🚀 Preview deployed to: ${{ steps.deploy.outputs.preview-url }}'
})
環境設定
Vite
// vite.config.ts
import { defineConfig, loadEnv } from 'vite';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
return {
define: {
'process.env.API_URL': JSON.stringify(env.VITE_API_URL),
},
};
});
# .env.development
VITE_API_URL=http://localhost:8000
# .env.production
VITE_API_URL=https://api.example.com
Next.js
# .env.local (コミットされない)
DATABASE_URL=postgresql://localhost:5432/dev
# .env.production
NEXT_PUBLIC_API_URL=https://api.example.com
// コード内でアクセス
// クライアントサイド (NEXT_PUBLIC_ で始まる必要あり)
const apiUrl = process.e 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Web Build & Deploy (React)
Vercel Deployment
Quick Deploy
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Deploy to production
vercel --prod
Configuration (vercel.json)
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"framework": "vite",
"rewrites": [
{ "source": "/(.*)", "destination": "/" }
],
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "X-Content-Type-Options", "value": "nosniff" },
{ "key": "X-Frame-Options", "value": "DENY" }
]
}
]
}
Environment Variables
# Add via CLI
vercel env add NEXT_PUBLIC_API_URL
# Or in Vercel dashboard: Settings > Environment Variables
# Access in code
const apiUrl = process.env.NEXT_PUBLIC_API_URL;
Preview Deployments
Every push to a branch creates a preview URL automatically:
https://project-git-branch-username.vercel.app
Netlify Deployment
Quick Deploy
# Install Netlify CLI
npm i -g netlify-cli
# Login
netlify login
# Deploy preview
netlify deploy
# Deploy to production
netlify deploy --prod
Configuration (netlify.toml)
[build]
command = "npm run build"
publish = "dist"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
[build.environment]
NODE_VERSION = "18"
Environment Variables
# Add via CLI
netlify env:set API_URL https://api.example.com
# Or in Netlify dashboard: Site settings > Environment variables
Docker Deployment
Dockerfile (Multi-stage build)
# Build stage
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Production stage
FROM nginx:alpine
# Copy built files
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy nginx config for SPA routing
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
nginx.conf (SPA routing)
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# SPA fallback
location / {
try_files $uri $uri/ /index.html;
}
# Security headers
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
}
Docker Compose
# docker-compose.yml
version: '3.8'
services:
web:
build: .
ports:
- "80:80"
environment:
- NODE_ENV=production
restart: unless-stopped
# With backend
api:
build: ./backend
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgresql://user:pass@db:5432/app
depends_on:
- db
db:
image: postgres:15-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=pass
- POSTGRES_DB=app
volumes:
postgres_data:
Build & Run
# Build image
docker build -t myapp:latest .
# Run container
docker run -p 80:80 myapp:latest
# With docker-compose
docker-compose up -d
docker-compose down
GitHub Actions CI/CD
Basic Workflow
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build
run: npm run build
env:
VITE_API_URL: ${{ secrets.API_URL }}
- name: Deploy to Vercel
if: github.ref == 'refs/heads/main'
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel-args: '--prod'
With Preview Deployments
name: Preview
on: [pull_request]
jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy Preview
uses: amondnet/vercel-action@v25
id: deploy
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Comment PR
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🚀 Preview deployed to: ${{ steps.deploy.outputs.preview-url }}'
})
Environment Configuration
Vite
// vite.config.ts
import { defineConfig, loadEnv } from 'vite';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
return {
define: {
'process.env.API_URL': JSON.stringify(env.VITE_API_URL),
},
};
});
# .env.development
VITE_API_URL=http://localhost:8000
# .env.production
VITE_API_URL=https://api.example.com
Next.js
# .env.local (not committed)
DATABASE_URL=postgresql://localhost:5432/dev
# .env.production
NEXT_PUBLIC_API_URL=https://api.example.com
// Access in code
// Client-side (must start with NEXT_PUBLIC_)
const apiUrl = process.env.NEXT_PUBLIC_API_URL;
// Server-side only
const dbUrl = process.env.DATABASE_URL;
Build Optimization
Vite Build Analysis
# Install analyzer
npm i -D rollup-plugin-visualizer
# Add to vite.config.ts
import { visualizer } from 'rollup-plugin-visualizer';
export default defineConfig({
plugins: [
visualizer({
filename: 'stats.html',
open: true,
}),
],
});
# Build and analyze
npm run build
Code Splitting
// Route-based splitting
const Dashboard = lazy(() => import('./pages/Dashboard'));
const Settings = lazy(() => import('./pages/Settings'));
// Component splitting
const HeavyChart = lazy(() => import('./components/HeavyChart'));
Caching Strategy
// vite.config.ts
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom'],
router: ['react-router-dom'],
ui: ['@radix-ui/react-dialog', '@radix-ui/react-dropdown-menu'],
},
},
},
},
});
Health Checks & Monitoring
Health Check Endpoint
// For Docker/Kubernetes
// api/health.ts (Next.js)
export async function GET() {
return Response.json({ status: 'healthy', timestamp: Date.now() });
}
Error Tracking (Sentry)
// sentry.client.config.ts
import * as Sentry from '@sentry/react';
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
environment: process.env.NODE_ENV,
tracesSampleRate: 0.1,
});
// Wrap app
const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes);
Common Issues
| Issue | Solution |
|---|---|
| 404 on refresh (SPA) | Configure server for SPA fallback |
| Environment vars undefined | Check prefix (VITE_, NEXTPUBLIC) |
| Build fails on CI | Check Node version, clear cache |
| Docker image too large | Use multi-stage build, alpine base |
| Slow builds | Enable caching, parallelize |
Deployment Checklist
Before deploying to production:
- [ ] Environment variables set
- [ ] Build succeeds locally
- [ ] Tests pass
- [ ] Security headers configured
- [ ] Error tracking enabled
- [ ] Performance optimized (bundle size, code splitting)
- [ ] SEO meta tags (if applicable)
- [ ] SSL/HTTPS enabled
- [ ] Custom domain configured
- [ ] Health check endpoint working