backend-microservice-development

13
2
Source

后端微服务开发规范,涵盖目录结构、分层架构(API/Service/DAO)、依赖注入、配置管理、Spring Boot 最佳实践。当用户进行后端开发、创建新微服务、编写 Kotlin/Java 代码或设计服务架构时使用。

Install

mkdir -p .claude/skills/backend-microservice-development && curl -L -o skill.zip "https://mcp.directory/api/skills/download/2078" && unzip -o skill.zip -d .claude/skills/backend-microservice-development && rm skill.zip

Installs to .claude/skills/backend-microservice-development

About this skill

后端微服务开发

Quick Reference

核心服务:process(流水线) | project(项目) | repository(代码库) | auth(权限)
四层架构:api-{service}(接口) → biz-{service}(业务+DAO) → boot-{service}(启动) → model-{service}(数据模型)
包命名:com.tencent.devops.<module>
Resource 前缀:User*(Web) | Service*(内部) | Build*(Agent) | Open*(外部)

最简示例

// Resource 接口定义
@Tag(name = "USER_PIPELINE", description = "用户-流水线资源")
@Path("/user/pipelines")
@Produces(MediaType.APPLICATION_JSON)
interface UserPipelineResource {
    @GET
    @Operation(summary = "获取流水线列表")
    fun list(@HeaderParam(AUTH_HEADER_USER_ID) userId: String): Result<List<PipelineInfo>>
}

// Resource 实现(构造器注入)
@RestResource
class UserPipelineResourceImpl @Autowired constructor(
    private val pipelineService: PipelineService
) : UserPipelineResource

When to Use

  • 创建新微服务或添加新 Resource
  • 编写 Kotlin/Java 后端代码
  • 设计服务间调用架构
  • 需要了解项目分层规范

When NOT to Use

  • 前端 Vue 开发 → 使用 04-frontend-vue-development
  • Agent Go 开发 → 使用 05-go-agent-development
  • 数据库 DDL 编写 → 使用 database-design

四层分层架构

core/{service}/
├── api-{service}/      # API接口定义层 - 对外暴露服务契约
├── biz-{service}/      # 业务逻辑层 - 包含 Service、DAO
├── boot-{service}/     # Spring Boot启动层 - 独立部署单元
└── model-{service}/    # 数据模型层 - JOOQ 生成的数据库访问对象

16 个核心微服务

服务职责
project项目管理(所有模块基础依赖)
process流水线编排与调度(核心服务)
repository代码库管理
artifactory制品库(对接 COS/S3)
store研发商店(插件、模板)
environment构建机/环境管理
dispatch构建调度分发
auth权限认证(RBAC)
ticket凭证管理
log构建日志
quality质量红线
notify通知服务
openapi对外 API
metrics度量服务
websocketWebSocket 服务
misc杂项服务

Resource 命名规范

前缀用途路径前缀示例
User*Resource用户 Web 交互/user/UserPipelineResource
Service*Resource服务间内部调用/service/ServiceBuildResource
Build*Resource构建过程 Agent/Worker/build/BuildArtifactoryResource
BuildAgent*Resource第三方 Agent 专用/buildAgent/BuildAgentCredentialResource
Open*Resource对外开放(OpenAPI)/open/OpenPipelineTaskResource
Op*Resource运营管理接口/op/OpProjectResource

注解使用标准

API 定义

@RestResource              // REST 资源实现类
@Path("/user/artifactories")
@GET / @POST / @PUT / @DELETE
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)

Swagger 文档

@Tag(name = "USER_ARTIFACTORY", description = "版本仓库-仓库资源")
@Operation(summary = "根据元数据获取文件")
@Parameter(description = "用户ID", required = true)

参数校验

@BkField(minLength = 1, maxLength = 128)
@BkField(patternStyle = BkStyleEnum.CODE_STYLE)

方法命名约定

操作命名前缀
查询get*, query*, list*, search*
创建create*, upload*, archive*
修改update*, modify*
删除delete*, clear*, remove*

强制规则

  • ✅ 服务间通过 API 接口通信,禁止直接访问其他服务的数据库
  • ✅ 依赖关系在 build.gradle.kts 中明确声明
  • ❌ 禁止循环依赖
  • ❌ 禁止手写 SQL,使用 JOOQ

Checklist

开发后端功能前确认:

  • 功能归属到合理的现有服务
  • Resource 命名符合前缀规范
  • 使用构造器注入依赖
  • 返回值使用 Result<T> 包装
  • 添加 Swagger 注解生成文档

project-module-architecture

TencentBlueKing

Project 项目管理模块架构指南,涵盖项目 CRUD、成员管理、项目配置、标签管理、项目迁移。当用户开发项目管理功能、处理项目成员、配置项目属性或实现项目相关逻辑时使用。

126

microservice-infrastructure

TencentBlueKing

微服务基础设施指南,涵盖条件配置、事件驱动架构、服务间通信、国际化与日志等微服务架构的核心基础设施。当用户实现服务间调用、配置多环境、实现异步通信、处理国际化或规范日志输出时使用。

114

artifactory-module-architecture

TencentBlueKing

Artifactory 制品库模块架构指南,涵盖制品上传下载、存储后端适配、制品元数据、清理策略、权限控制。当用户开发制品库功能、处理制品存储、配置清理策略或实现制品管理时使用。

193

supporting-modules-architecture

TencentBlueKing

BK-CI 支撑模块架构指南,涵盖凭证管理(Ticket)、构建机环境(Environment)、通知服务(Notify)、构建日志(Log)、质量红线(Quality)、开放接口(OpenAPI)等支撑性服务模块。当用户开发这些模块功能或需要理解支撑服务架构时使用。

132

managing-devops-pipeline

TencentBlueKing

管理蓝盾流水线的构建操作,包括查询构建历史、获取启动参数、查看构建状态、启动构建。当用户提及流水线、构建、部署、CI/CD、蓝盾或需要触发构建任务时使用。

102

go-agent-development

TencentBlueKing

Go Agent 开发指南,涵盖 Agent 架构设计、心跳机制、任务执行、日志上报、升级流程、与 Dispatch 模块交互。当用户开发构建机 Agent、实现任务执行逻辑、处理 Agent 通信或进行 Go 语言开发时使用。

12

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

1,6851,428

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

1,2671,333

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

1,5381,147

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

1,356809

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

1,264728

pdf-to-markdown

aliceisjustplaying

Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.

1,489684