microservices-knowledge

微服务架构知识库:为架构审计和生成提供服务分解、通信模式、API 网关、服务发现与数据管理方面的指导。

仓库最近推送
GitHub Stars
109
Forks
26
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "microservices-knowledge":https://skillpi.com/zh/skills/deepskill-a25364ba6288f884051c583ee667214343bc98ca906a9adc1077e7e1b2f85a20。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

微服务架构知识库:为架构审计和生成提供服务分解、通信模式、API 网关、服务发现与数据管理方面的指导。

0 下载

介绍来源: third_party · dykyi-roman · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: microservices-knowledge
description: Microservices Architecture knowledge base. Provides service decomposition, communication patterns, API gateway, service discovery, and data management guidelines for architecture audits and generation.

Microservices Architecture Knowledge Base

Quick reference for microservices architecture patterns and PHP implementation guidelines.

Core Principles

Architecture Overview

┌──────────────────────────────────────────────────────────────────────────┐
│                     MICROSERVICES ARCHITECTURE                           │
├──────────────────────────────────────────────────────────────────────────┤
│                                                                          │
│   ┌──────────┐     ┌──────────────────┐     ┌──────────────────┐        │
│   │  Client   │────▶│   API Gateway    │────▶│   Service A      │        │
│   │          │     │  (Routing/Auth)   │     │  (Own Database)  │        │
│   └──────────┘     └──────────────────┘     └──────────────────┘        │
│                           │                       │                      │
│                           │                       │ async                │
│                    ┌──────▼──────┐          ┌─────▼──────────┐          │
│                    │  Service B  │          │  Message Broker │          │
│                    │ (Own DB)    │◀─────────│  (Events/Cmds)  │          │
│                    └─────────────┘          └────────────────┘          │
│                                                                          │
├──────────────────────────────────────────────────────────────────────────┤
│                                                                          │
│   Decomposition Strategies:                                              │
│   • By Business Capability    - Align with bounded contexts             │
│   • By Subdomain (DDD)        - Core, Supporting, Generic               │
│   • Strangler Fig              - Incremental migration from monolith    │
│                                                                          │
│   Communication:                                                         │
│   • Synchronous  - REST, gRPC, GraphQL (request-response)              │
│   • Asynchronous - Message queues, event streaming                      │
│                                                                          │
└──────────────────────────────────────────────────────────────────────────┘

Service Communication Patterns

Pattern Type Use When Trade-off
REST Sync CRUD, simple queries Easy but coupling
gRPC Sync Internal service-to-service, performance-critical Fast but schema coupling
GraphQL Sync Client-driven queries, BFF Flexible but complex
Message Queue Async Reliable delivery, work distribution Decoupled but eventual consistency
Event Streaming Async Real-time, event sourcing, audit trails Scalable but complex ordering
Request-Reply Async Async request needing response Decoupled but higher latency

API Gateway Patterns

Pattern Description When to Use
Simple Proxy Routes requests to services Small number of services
Gateway Aggregation Combines multiple service calls Reduce client round-trips
BFF (Backend for Frontend) Gateway per client type Mobile vs Web vs API clients
Gateway Offloading Auth, rate limiting, TLS Cross-cutting concerns

Service Discovery

Approach How It Works Example
Client-side Client queries registry, selects instance Netflix Eureka
Server-side Load balancer queries registry AWS ALB, Kubernetes
DNS-based DNS SRV records resolve to instances Consul DNS, CoreDNS
Platform-native Container orchestrator handles routing Kubernetes Services

Data Management

Pattern Description Consistency
Database per Service Each service owns its data Strong (within service)
Shared Database Services share one database Strong (anti-pattern!)
Saga Distributed transaction via events Eventual
CQRS Separate read/write models Eventual
Event Sourcing Events as source of truth Eventual
API Composition Query multiple services, merge results Eventual

When to Use Microservices vs Monolith

Factor Monolith Microservices
Team size < 10 developers > 10, multiple teams
Domain complexity Simple/moderate Complex, many bounded contexts
Scalability needs Uniform scaling Independent scaling per component
Deployment frequency Infrequent, coordinated Frequent, independent
Technology diversity Single stack Polyglot needed
Organizational maturity Starting out DevOps culture, CI/CD mature

Detection Patterns

# Service boundary indicators
Grep: "HttpClient|GuzzleHttp|curl_init" --glob "**/Infrastructure/**/*.php"
Grep: "grpc|protobuf" --glob "**/*.php"

# API Gateway patterns
Grep: "X-Forwarded|X-Request-ID|X-Correlation" --glob "**/*.php"
Glob: **/Gateway/**/*.php

# Service discovery
Grep: "ServiceDiscovery|ServiceRegistry|consul|etcd" --glob "**/*.php"
Grep: "KUBERNETES_SERVICE|SERVICE_HOST" --glob "**/*.env*"

# Database per service
Grep: "DATABASE_URL|DB_CONNECTION" --glob "**/*.env*"
Grep: "DATABASE_HOST|DB_HOST" --glob "**/docker-compose*.yml"

# Inter-service communication
Grep: "AMQPChannel|RabbitMQ|Kafka|SQS" --glob "**/Infrastructure/**/*.php"
Grep: "EventPublisher|MessageBus" --glob "**/*.php"

Advanced Patterns

Strangler Fig Pattern

Incrementally migrate from monolith to microservices:

Phase 1: Proxy all traffic through gateway
Phase 2: Extract one feature to service, route via gateway
Phase 3: Repeat until monolith is empty shell
Phase 4: Decommission monolith

┌─────────┐     ┌──────────┐     ┌──────────────┐
│  Client  │────▶│ Gateway  │────▶│  New Service  │  (extracted)
│          │     │ (Router) │     └──────────────┘
│          │     │          │────▶┌──────────────┐
│          │     │          │     │  Monolith     │  (shrinking)
└─────────┘     └──────────┘     └──────────────┘

Migration Decision:

Factor Extract First Keep in Monolith
Change frequency High Low
Team ownership Dedicated team Shared
Scaling needs Independent scaling Uniform
Technology fit Different stack needed Same stack fine

API Gateway Aggregation Patterns

Pattern When Example
Simple proxy 1:1 route mapping /users → User Service
Aggregation Client needs data from N services Order + Customer + Payment
BFF Different clients need different data Mobile vs Web vs API
Offloading Cross-cutting concerns Auth, rate limiting, TLS

Database-Per-Service Trade-offs

Aspect Shared DB DB per Service
Consistency ACID transactions Saga/eventual
Querying JOIN across domains API composition
Independence Coupled deployments Independent
Complexity Low High
Schema changes Coordinated Independent

References

For detailed information, load these reference files:

  • references/patterns.md — Service mesh, API gateway implementations, service discovery details, data consistency, Strangler Fig, database-per-service
  • references/antipatterns.md — Distributed monolith, shared database, missing boundaries, chatty communication

当前收录版本

0.0.1

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 提供微服务架构核心知识库,涵盖服务分解、通信模式、API 网关、服务发现和数据管理等关键主题
  • 适用于架构审计与生成场景,具有明确的技术实用价值
  • 内容结构化为表格、图示和检测模式,便于开发者快速参考与应用
触发精准95/100

亮点

  • description 清晰准确,明确说明 Skill 用途为微服务架构知识库
  • 触发词完整,边界清晰,无歧义或重叠风险
结构规范95/100

亮点

  • 文档结构清晰,分章节组织,包含图示、表格和代码片段
  • frontmatter 完整,单文件长度适中(约 400 行),符合规范
执行可靠90/100

待提升项

  • 引用文件缺失 原报告严重程度:重大

    SKILL.md 引用了 references/patterns.md 和 references/antipatterns.md,但未传入 ZIP 包

    改进建议:请补充 references/patterns.md 和 references/antipatterns.md 文件,或移除引用以避免用户困惑

亮点

  • 内容为标准微服务架构知识,来源可靠,建议合理
  • 无实际执行流程,但知识准确,无误导性信息
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。