mcpField
E
enterprise

enterprise

github.com/ww-w-ai开发60656 次安装5 周前更新
代码仓库

关于 enterprise

面向资深开发者、架构师和大型系统运维人员的企业级开发 Skill,可初始化 Turborepo 项目,并提供架构、基础设施和 AI 原生开发指导。

主要功能

  1. 01企业项目初始化
  2. 02开发指南与基础设施帮助
  3. 03单体仓库和微服务模式
  4. 04Terraform 与 Kubernetes 模板
  5. 05企业 Agent 团队与项目记忆

适用场景

  1. 01搭建企业级项目骨架
  2. 02参考微服务架构方案
  3. 03规划 Kubernetes 和 Terraform 基础设施
  4. 04按 Agent 角色并行执行 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
helpMSA/基础设施帮助/enterprise help
init(项目初始化)
  1. 创建 Turborepo 单体仓库结构
  2. 创建 apps/、packages/、services/、infra/ 文件夹结构
  3. 创建 CLAUDE.md(指定级别:企业级)
  4. 创建 docs/ 五类结构
  5. 创建 infra/terraform/、infra/k8s/ 基础模板
  6. 初始化 .bkit-memory.json
guide(开发指南)
  • AI 原生 10 天开发周期
  • 微服务架构模式
  • Phase 1-9 完整 Pipeline(企业版)
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 路由)
  • 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

错误处理与自愈 Pipeline

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手动
预发布EKSArgoCD 自动同步
生产EKSArgoCD 手动同步

安全规则

✅ 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 Pipeline

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 项核心原则
  1. 文档优先设计:先编写设计文档,再编写代码
  2. 单体仓库上下文控制:将所有代码放在一个仓库中,以便 AI 获取上下文
  3. 基于 PR 协作:每项更改都通过 PR 完成
10 天开发模式
天数重点产出
1架构市场分析 + 系统架构
2-3核心Auth、User + 业务服务
4-5UXPO 反馈 → 文档 → 实施
6-7QA零脚本 QA + Bug 修复
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

它提供:

  • 架构权衡分析表(选项/优点/缺点/建议)
  • 针对每项决策提供性能、安全和可扩展性视角
  • 基础设施变更的成本影响估算
  • 部署策略建议(蓝绿、金丝雀、滚动)
  • SOLID 原则和整洁架构合规性检查
Agent 团队(4 名队友)

企业级项目支持完整的 Agent 团队,可并行执行 PDCA:

角色AgentPDCA 阶段
架构师enterprise-expert、infra-architect设计
开发者bkend-expert执行、改进
QAqa-monitor、gap-detector检查
审核者code-analyzer、design-validator检查、改进

启用方法:

  1. 设置环境变量:CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
  2. 启动团队模式:/pdca team {feature}
  3. 监控进度:/pdca team status
Agent 记忆(自动启用)

所有 bkit Agent 都会自动记住跨会话的项目上下文。 企业级 Agent 使用 project 范围的记忆,确保架构决策 和基础设施模式在多个开发会话中保持持久。

评论

支持 Markdown