design-patterns

Document and prescribe design patterns in BK-CI with Kotlin/Java code examples.

2.5k|521|Updated May 29, 2019
One-click install
npx skills add https://github.com/TencentBlueKing/bk-ci --skill design-patterns-tencentblueking
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design-patterns
Source: https://github.com/TencentBlueKing/bk-ci/tree/main/ai/skills/design-patterns
Command: npx skills add https://github.com/TencentBlueKing/bk-ci --skill design-patterns-tencentblueking

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

BK-CI 项目在架构与代码实现中广泛使用设计模式。本技能提供一份系统的指南,帮助开发者在项目中统一应用常用设计模式,从而提升代码可维护性、扩展性和团队协作效率。

Core Features & Use Cases

  • 覆盖工厂模式、策略模式、观察者模式、装饰器模式、模板方法等在 BK-CI 项目中的实际应用。结合代码示例,帮助开发者理解模式在各模块中的落地。
  • 提供典型场景参考,例如任务工厂、代码库工厂、后置处理器、事件监听及责任链等模块的设计实现,便于快速重用和扩展。
  • Use Case(示例):在流水线组件中按需选择策略实现、通过工厂模式实现插件化任务创建,并通过观察者实现模块解耦。

Quick Start

使用此技能时,先阅读 BK-CI 源码中设计模式的实现与注解,再在你自己的模块中对复杂条件分支替换为相应的模式(如工厂、策略、观察者),以实现更高的可维护性和扩展性。

Frequently Asked Questions about design-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply design patterns in BK-CI to improve code scalability?

To apply design patterns in BK-CI, use factory, strategy, observer, decorator, and template method patterns provided by this Skill. It documents practical code examples across pipelines, stores, and connectors to guide consistent coding practices and architectures.

When do I need to use the factory or strategy pattern in a Kotlin pipeline module?

You need the factory or strategy pattern in a Kotlin pipeline module when handling complex condition branches or plugin-based task creation. Replacing branches with these patterns achieves higher maintainability and modular decoupling for scalable code.

Do I need familiarity with Kotlin or Java to use BK-CI design patterns?

Yes, you need familiarity with Kotlin or Java to use BK-CI design patterns. The Skill requires understanding these languages and access to project code samples to properly apply reusable patterns across various modules.

What's the best way to decouple modules using observer patterns in BK-CI?

The best way to decouple modules using observer patterns in BK-CI is implementing event listeners and post-processors. This Skill provides typical scenario references for event monitoring to achieve effective modular decoupling.

How to implement plugin-based task creation using factory patterns in BK-CI?

To implement plugin-based task creation, use the task factory and code repository factory patterns documented in this Skill. It provides practical BK-CI code examples to help developers quickly reuse and extend factories across modules.

Why does my BK-CI architecture suffer from poor maintainability and how can patterns help?

BK-CI architecture suffers from poor maintainability when complex condition branches are hardcoded. Applying prescribed design patterns like strategy and observer replaces rigid branches with reusable, extensible structures, directly improving code maintainability and team collaboration.

Related Skills