enterprise について
大規模システムに取り組むシニア開発者、アーキテクト、運用担当者向けのエンタープライズ開発スキルです。Turborepoを中心としたプロジェクトを初期化し、アーキテクチャやインフラ、AIネイティブ開発を案内します。
主な機能
- 01エンタープライズプロジェクトの初期化
- 02開発ガイドとインフラ支援
- 03モノレポとマイクロサービスのパターン
- 04TerraformとKubernetesのテンプレート
- 05エンタープライズ向けAgentチームとプロジェクトメモリ
活用シーン
- 01エンタープライズプロジェクトの雛形作成
- 02マイクロサービス設計方針の検討
- 03KubernetesとTerraformのインフラ計画
- 04Agentの役割分担によるPDCAの並行実行
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ ww-w-ai/ bkit-claude-code --skill enterpriseインストール後、Claude Code で/enterpriseを入力して読み込まれたか確認します。
詳細
高度な(エンタープライズ)スキル
アクション
| アクション | 説明 | 例 |
|---|---|---|
init | プロジェクトの初期化(/init-enterprise 機能) | /enterprise init my-platform |
guide | 開発ガイドを表示 | /enterprise guide |
help | MSA/インフラストラクチャに関するヘルプ | /enterprise help |
init(プロジェクトの初期化)
- Turborepo モノレポの構造を作成
- apps/、packages/、services/、infra/ のフォルダー構造を作成
- CLAUDE.md を作成(レベル:エンタープライズ指定)
- docs/ の5カテゴリ構造を作成
- infra/terraform/、infra/k8s/ の基本テンプレートを作成
- .bkit-memory.json を初期化
guide(開発ガイド)
- AI ネイティブな10日間の開発サイクル
- マイクロサービスのアーキテクチャパターン
- フェーズ1〜9の完全なパイプライン(エンタープライズ版)
help(インフラストラクチャに関するヘルプ)
- Kubernetes の基本概念
- Terraform の IaC パターン
- AWS EKS、RDS の設定ガイド
対象ユーザー
- シニア開発者
- CTO/アーキテクト
- 大規模システムの運用担当者
技術スタック
Frontend:
- Next.js 14+ (Turborepo monorepo)
- TypeScript
- Tailwind CSS
- TanStack Query
- Zustand
- Sentry Browser SDK (@sentry/nextjs) — Error tracking + Session Replay
Backend:
- Python FastAPI (microservices) — default
- PostgreSQL (schema separation)
- Redis (cache, Pub/Sub)
- RabbitMQ / SQS (message queue)
- Sentry Server SDK (sentry-sdk[fastapi]) — Error tracking + APM
Infrastructure:
- AWS (EKS, RDS, S3, CloudFront)
- Kubernetes (Kustomize)
- Terraform (IaC)
- ArgoCD (GitOps)
- ALB + NGINX Ingress Controller (L7 load balancing)
- CORS: Ingress annotation으로 처리
nginx.ingress.kubernetes.io/enable-cors: "true"
- NLB(L4)는 gRPC/WebSocket 전용 서비스에만 사용
CI/CD:
- GitHub Actions
- Docker
- Semgrep (SAST) + Trivy (Container Scan)
Monitoring & Error Tracking:
- Sentry — Error tracking, grouping, regression detection
- Prometheus + Grafana — Metrics & dashboards
- Loki + Promtail — Log aggregation
- Tempo + OpenTelemetry — Distributed tracing
- Alertmanager → PagerDuty (critical) / Slack (warning)
Self-Healing Pipeline:
- Sentry Webhook → Self-Healing Agent trigger
- 4-Layer Living Context (Scenarios, Invariants, Impact, Incidents)
- Auto-fix (max 5 iterations) → Auto PR → Canary Deploy
- Auto-Rollback on error rate spike
言語ティアのガイダンス(v1.3.0)
サポート対象:すべてのティア
エンタープライズレベルでは、レガシーシステムとの統合を含む複雑な要件に対応します。
| ティア | 用途 | ガイダンス |
|---|---|---|
| Tier 1 | 主要サービス | 新規開発、コア機能 |
| Tier 2 | システム/クラウド | Go(K8s)、Rust(パフォーマンスが重要な処理) |
| Tier 3 | プラットフォームネイティブ | iOS(Swift)、Android(Kotlin)、レガシー Java |
| Tier 4 | レガシー統合 | 移行計画が必要 |
移行パス:
- PHP → TypeScript(Next.js API routes)
- Ruby → Python(FastAPI)
- Java → Kotlin または Go
プロジェクト構成
project/
├── apps/ # Frontend apps (Turborepo)
│ ├── web/ # Main web app
│ ├── admin/ # Admin
│ └── docs/ # Documentation site
│
├── packages/ # Shared packages
│ ├── ui/ # UI components
│ ├── api-client/ # API client
│ └── config/ # Shared config
│
├── services/ # Backend microservices
│ ├── auth/ # Auth service
│ ├── user/ # User service
│ ├── {domain}/ # Domain-specific services
│ └── shared/ # Shared modules
│
├── infra/ # Infrastructure code
│ ├── terraform/
│ │ ├── modules/ # Reusable modules
│ │ └── environments/ # Environment-specific config
│ └── k8s/
│ ├── base/ # Common manifests
│ └── overlays/ # Environment-specific patches
│
├── docs/ # PDCA documents
│ ├── 00-requirement/
│ ├── 01-development/ # Design documents (multiple)
│ ├── 02-scenario/
│ ├── 03-refactoring/
│ └── 04-operation/
│
├── scripts/ # Utility scripts
├── .github/workflows/ # CI/CD
├── docker-compose.yml
├── turbo.json
└── pnpm-workspace.yaml
クリーンアーキテクチャ(4層)
┌─────────────────────────────────────────────────────────┐
│ API Layer │
│ - FastAPI routers │
│ - Request/Response DTOs │
│ - Auth/authz middleware │
├─────────────────────────────────────────────────────────┤
│ Application Layer │
│ - Service classes │
│ - Use Case implementation │
│ - Transaction management │
├─────────────────────────────────────────────────────────┤
│ Domain Layer │
│ - Entity classes (pure Python) │
│ - Repository interfaces (ABC) │
│ - Business rules │
├─────────────────────────────────────────────────────────┤
│ Infrastructure Layer │
│ - Repository implementations (SQLAlchemy) │
│ - External API clients │
│ - Cache, messaging │
│ - Sentry SDK integration (error capture) │
└─────────────────────────────────────────────────────────┘
Dependency direction: Top → Bottom
Domain Layer depends on nothing
エラー処理と自己修復パイプライン
Exception 발생 (Frontend/Backend)
↓
Sentry SDK 자동 캡처 (stack trace + breadcrumbs + user context)
↓
Sentry Alert Rule (new issue / regression / spike)
↓
Webhook → Self-Healing Agent trigger
↓
Living Context 4-Layer 로딩
├── Scenario Matrix: 테스트 시나리오
├── Invariants: 불변 조건 (critical = 수정 차단)
├── Impact Map: blast radius 계산
└── Incident Memory: 과거 장애 교훈
↓
Claude Code Fix (max 5 iterations)
↓
4중 검증 (scenarios + invariants + impact + anti-patterns)
↓
Pass → Auto PR → Human Review → Canary Deploy (10%→25%→50%→100%)
Fail → Escalation → PagerDuty + Slack + Auto-Rollback
↓
Post-deploy: Sentry에서 issue resolved 확인 + error_rate 모니터링
ロードバランサー戦略
ALB + NGINX Ingress Controller (기본, 권장)
─────────────────────────────────────
- L7 로드밸런싱 (HTTP/HTTPS/gRPC)
- CORS: Ingress annotation으로 처리 (앱 코드 불필요)
- Path-based routing (/api/auth/*, /api/users/*)
- AWS Certificate Manager (ACM) TLS 연동
- WAF 연동 가능
NLB (특수 케이스만)
─────────────────────────────────────
- L4 로드밸런싱 (TCP/UDP)
- 극도의 저지연 필요 시 (< 1ms)
- WebSocket/gRPC 전용 서비스
- CORS 처리 불가 → 앱단에서 직접 처리 필요
コアパターン
リポジトリパターン
# domain/repositories/user_repository.py (interface)
from abc import ABC, abstractmethod
class UserRepository(ABC):
@abstractmethod
async def find_by_id(self, id: str) -> User | None:
pass
@abstractmethod
async def save(self, user: User) -> User:
pass
# infrastructure/repositories/user_repository_impl.py (implementation)
class UserRepositoryImpl(UserRepository):
def __init__(self, db: AsyncSession):
self.db = db
async def find_by_id(self, id: str) -> User | None:
result = await self.db.execute(
select(UserModel).where(UserModel.id == id)
)
return result.scalar_one_or_none()
サービス間通信
# Synchronous (Internal API)
async def get_user_info(user_id: str) -> dict:
async with httpx.AsyncClient() as client:
response = await client.get(
f"{USER_SERVICE_URL}/internal/users/{user_id}",
headers={"X-Internal-Token": INTERNAL_TOKEN}
)
return response.json()
# Asynchronous (message queue)
await message_queue.publish(
topic="user.created",
message={"user_id": user.id, "email": user.email}
)
Terraform モジュール
# modules/eks/main.tf
resource "aws_eks_cluster" "this" {
name = "${var.environment}-${var.project_name}-eks"
role_arn = aws_iam_role.cluster.arn
version = var.kubernetes_version
vpc_config {
subnet_ids = var.subnet_ids
}
tags = merge(var.tags, {
Environment = var.environment
})
}
Kubernetes デプロイ
# k8s/base/backend/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: user-service
spec:
replicas: 2
template:
spec:
containers:
- name: user-service
image: ${ECR_REGISTRY}/user-service:${TAG}
resources:
requests:
cpu: "100m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "512Mi"
livenessProbe:
httpGet:
path: /health
port: 8000
環境設定
| 環境 | インフラストラクチャ | デプロイ方法 |
|---|---|---|
| ローカル | Docker Compose | 手動 |
| ステージング | EKS | ArgoCD 自動同期 |
| 本番環境 | EKS | ArgoCD 手動同期 |
セキュリティルール
✅ Allowed
- Retrieve secrets from Secrets Manager
- IAM role-based access
- VPC internal communication
- mTLS (inter-service)
❌ Prohibited
- Hardcoded secrets
- DB in public subnet
- Using root account
- Excessive IAM permissions
CI/CD パイプライン
Push to feature/*
↓
GitHub Actions (CI)
- Lint
- Test
- Build Docker image
- Push to ECR
↓
PR to staging
↓
ArgoCD Auto Sync (Staging)
↓
PR to main
↓
ArgoCD Manual Sync (Production)
SoR の優先順位
1st Priority: Codebase
- scripts/init-db.sql (source of truth for DB schema)
- services/{service}/app/ (each service implementation)
2nd Priority: CLAUDE.md / Convention docs
- services/CLAUDE.md
- frontend/CLAUDE.md
- infra/CLAUDE.md
3rd Priority: docs/ design documents
- For understanding design intent
- If different from code, code is correct
AI ネイティブ開発
3つのコア原則
- ドキュメントファースト設計:コードを書く前に設計ドキュメントを作成
- モノレポによるコンテキスト制御:AI のコンテキストを保つため、すべてのコードを1つのリポジトリに集約
- PR ベースのコラボレーション:すべての変更を PR 経由で行う
10日間の開発パターン
| 日 | 重点項目 | 成果物 |
|---|---|---|
| 1 | アーキテクチャ | 市場分析+システムアーキテクチャ |
| 2-3 | コア | 認証、ユーザー+ビジネスサービス |
| 4-5 | UX | PO のフィードバック → ドキュメント → 実装 |
| 6-7 | QA | ゼロスクリプト QA+バグ修正 |
| 8 | インフラ | Terraform+GitOps |
| 9-10 | 本番環境 | セキュリティレビュー+デプロイ |
AI にとってのモノレポのメリット
Mono-repo:
└─ project/
├─ frontend/ ──────┐
├─ services/ ──────┤ AI reads completely
├─ infra/ ─────────┤ Context unified
└─ packages/ ──────┘
✅ AI understands full context
✅ Single source of truth for types
✅ Atomic commits across layers
✅ Consistent patterns enforced
CLAUDE.md の階層
project/
├── CLAUDE.md # Project-wide context
├── frontend/CLAUDE.md # Frontend conventions
├── services/CLAUDE.md # Backend conventions
└── infra/CLAUDE.md # Infra conventions
ルール:領域固有の CLAUDE.md はプロジェクトレベルのルールを上書きします
エンタープライズレベル向け bkit の機能(v1.5.1)
出力スタイル:bkit-enterprise(推奨)
CTO レベルのアーキテクチャ視点を得るには、エンタープライズスタイルを有効にします。
/output-style bkit-enterprise
以下を提供します:
- アーキテクチャのトレードオフ分析テーブル(オプション/メリット/デメリット/推奨事項)
- あらゆる判断におけるパフォーマンス、セキュリティ、スケーラビリティの視点
- インフラストラクチャ変更によるコストへの影響の見積もり
- デプロイ戦略の推奨事項(Blue/Green、Canary、Rolling)
- SOLID 原則とクリーンアーキテクチャへの準拠チェック
エージェントチーム(4人のチームメイト)
エンタープライズプロジェクトでは、並行してPDCAを実行するための完全なエージェントチームをサポートしています。
| 役割 | エージェント | PDCAフェーズ |
|---|---|---|
| アーキテクト | enterprise-expert、infra-architect | 設計 |
| 開発者 | bkend-expert | 実行、改善 |
| QA | qa-monitor、gap-detector | 評価 |
| レビュアー | code-analyzer、design-validator | 評価、改善 |
有効にする方法:
- 環境変数を設定します:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - チームモードを開始します:
/pdca team {feature} - 進捗を確認します:
/pdca team status
エージェントメモリ(自動有効)
すべてのbkitエージェントは、セッションをまたいでプロジェクトのコンテキストを自動的に記憶します。
エンタープライズエージェントはprojectスコープのメモリを使用し、アーキテクチャの決定事項や
インフラストラクチャのパターンを開発セッション間で保持します。
コメント
Markdown 対応