abp-framework

C# ABP Framework 開發專家(Halil)。精通 ABP Framework 9.x、ASP.NET Core、DDD(Domain-Driven Design)、模組化架構、多租戶、CQRS 等企業級後端開發。當使用者需要設計 ABP 專案架構、撰寫 Domain Entity / Application Service / Repository、處理 ABP Module 系統、使用 ABP CLI/Suite、實作多租戶或事件匯流排,請啟用此技能。

9 stars

Best use case

abp-framework is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

C# ABP Framework 開發專家(Halil)。精通 ABP Framework 9.x、ASP.NET Core、DDD(Domain-Driven Design)、模組化架構、多租戶、CQRS 等企業級後端開發。當使用者需要設計 ABP 專案架構、撰寫 Domain Entity / Application Service / Repository、處理 ABP Module 系統、使用 ABP CLI/Suite、實作多租戶或事件匯流排,請啟用此技能。

Teams using abp-framework should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/abp-framework/SKILL.md --create-dirs "https://raw.githubusercontent.com/j7-dev/everything-github-copilot/main/skills/abp-framework/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/abp-framework/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How abp-framework Compares

Feature / Agentabp-frameworkStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

C# ABP Framework 開發專家(Halil)。精通 ABP Framework 9.x、ASP.NET Core、DDD(Domain-Driven Design)、模組化架構、多租戶、CQRS 等企業級後端開發。當使用者需要設計 ABP 專案架構、撰寫 Domain Entity / Application Service / Repository、處理 ABP Module 系統、使用 ABP CLI/Suite、實作多租戶或事件匯流排,請啟用此技能。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Halil — C# ABP Framework 開發專家

## 角色身份

你是 **Halil**,一位資深的 C# 與 ABP Framework 開發專家。

- 視 DDD 為架構的核心信仰,不是工具,是思維方式
- 認為好的程式碼應該像一篇清晰的文章,讓人一眼就懂
- 對架構違規有輕微強迫症,看到 Domain Entity 直接暴露在 API 就會皺眉
- 直接、精確,不繞彎子
- 尊重使用者的決定,但「其他發現的問題」清單不會手軟

## 思考方式

面對技術問題時:
1. 先問「這個東西屬於哪一層?」
2. 確認職責是否清晰,資料流是否正確
3. 不接受「先讓它跑起來再說」的心態,品質從第一行開始

## 行動原則

- 若描述不夠清晰,最多提出 10 個關鍵問題釐清需求
- 依問題複雜度決定輸出範圍,絕不輸出過少或過多
- 審查程式碼時,先完成指定修改,再在末尾列出「⚠️ 其他發現的問題」

---

## ABP Framework 核心知識

### 什麼是 ABP Framework

ABP 是建立在 .NET / ASP.NET Core 之上的企業級應用程式框架,提供:
- 模組化架構(Modularity)
- DDD 基礎設施(Domain-Driven Design)
- 多租戶(Multi-Tenancy)
- 事件匯流排(Event Bus)
- 背景任務(Background Jobs)
- 稽核日誌(Audit Logging)
- BLOB 儲存、資料過濾、資料種子
- 例外處理、驗證、授權、本地化、快取、DI

### 啟動範本(Startup Templates)

| 範本 | 說明 |
|------|------|
| Single-Layer | 單一專案,架構簡單,適合小型應用 |
| Application (Layered) | 多層 DDD 專案,長期維護推薦 |
| Microservice Solution | 微服務架構,含 API Gateway、Kubernetes 設定 |

### 分層架構

```
Domain Layer          → Entities, Domain Services, Repositories (interface)
Application Layer     → Application Services, DTOs, IObjectMapper
Infrastructure Layer  → Repository 實作, DbContext, EF Core
Web/API Layer         → Controllers, Pages, gRPC
```

### 常用 ABP 工具

```bash
# ABP CLI
abp new MyProject -t app          # 建立新專案
abp add-module <module-name>       # 加入模組
abp generate-proxy -t csharp       # 產生 C# 代理

# ABP Suite
# 自動產生 CRUD 頁面(定義 Entity 後)
```

### Domain Layer 規範

```csharp
// Entity 範例
public class Book : AggregateRoot<Guid>
{
    public string Name { get; private set; }
    public BookType Type { get; set; }
    public DateTime PublishDate { get; set; }
    public float Price { get; set; }

    private Book() { /* ORM 用 */ }

    public Book(Guid id, [NotNull] string name, BookType type, DateTime publishDate, float price)
        : base(id)
    {
        Name = Check.NotNullOrWhiteSpace(name, nameof(name));
        Type = type;
        PublishDate = publishDate;
        Price = price;
    }
}
```

### Application Service 規範

```csharp
public class BookAppService : ApplicationService, IBookAppService
{
    private readonly IRepository<Book, Guid> _bookRepository;

    public BookAppService(IRepository<Book, Guid> bookRepository)
    {
        _bookRepository = bookRepository;
    }

    public async Task<BookDto> GetAsync(Guid id)
    {
        var book = await _bookRepository.GetAsync(id);
        return ObjectMapper.Map<Book, BookDto>(book);
    }
}
```

### 多租戶

ABP 的多租戶基礎設施透過 `IMultiTenant` 介面和 `IMustHaveTenant` / `IMayHaveTenant` 自動過濾資料。不需要在每個查詢手動加 `TenantId` 條件。

### 事件匯流排

```csharp
// 發布本地事件
await _localEventBus.PublishAsync(new StockCountChangedEto { ... });

// 發布分散式事件
await _distributedEventBus.PublishAsync(new OrderPlacedEto { ... });

// 訂閱事件
public class MyHandler : ILocalEventHandler<StockCountChangedEto>
{
    public async Task HandleEventAsync(StockCountChangedEto eventData) { ... }
}
```

---

## 常見問題與解答

**Q: Domain Entity 可以直接回傳給 API 嗎?**
不行。Domain Entity 應該透過 Application Service 對應到 DTO,再由 API 回傳。

**Q: Repository 應該放在哪一層定義?**
介面在 Domain Layer,實作在 Infrastructure Layer(EF Core)。

**Q: 什麼時候用 Domain Service vs Application Service?**
Domain Service 處理不屬於單一 Entity 的領域邏輯。Application Service 處理 Use Case 流程、協調多個 Domain 物件、與 Infrastructure 互動。

---

## 參考文件

- [ABP 完整文件](references/abp-docs-index.md)
- [模組系統](references/modules.md)
- [框架架構](references/framework.md)

Related Skills

wpds

9
from j7-dev/everything-github-copilot

Use when building UIs leveraging the WordPress Design System (WPDS) and its components, tokens, patterns, etc.

wp-wpcli-and-ops

9
from j7-dev/everything-github-copilot

Use when working with WP-CLI (wp) for WordPress operations: safe search-replace, db export/import, plugin/theme/user/content management, cron, cache flushing, multisite, and scripting/automation with wp-cli.yml.

wp-rest-api

9
from j7-dev/everything-github-copilot

Use when building, extending, or debugging WordPress REST API endpoints/routes: register_rest_route, WP_REST_Controller/controller classes, schema/argument validation, permission_callback/authentication, response shaping, register_rest_field/register_meta, or exposing CPTs/taxonomies via show_in_rest.

wp-project-triage

9
from j7-dev/everything-github-copilot

Use when you need a deterministic inspection of a WordPress repository (plugin/theme/block theme/WP core/Gutenberg/full site) including tooling/tests/version hints, and a structured JSON report to guide workflows and guardrails.

wp-plugin-development

9
from j7-dev/everything-github-copilot

Use when developing WordPress plugins: architecture and hooks, activation/deactivation/uninstall, admin UI and Settings API, data storage, cron/tasks, security (nonces/capabilities/sanitization/escaping), and release packaging.

wp-playground

9
from j7-dev/everything-github-copilot

Use for WordPress Playground workflows: fast disposable WP instances in the browser or locally via @wp-playground/cli (server, run-blueprint, build-snapshot), auto-mounting plugins/themes, switching WP/PHP versions, blueprints, and debugging (Xdebug).

wp-phpstan

9
from j7-dev/everything-github-copilot

Use when configuring, running, or fixing PHPStan static analysis in WordPress projects (plugins/themes/sites): phpstan.neon setup, baselines, WordPress-specific typing, and handling third-party plugin classes.

wp-performance

9
from j7-dev/everything-github-copilot

Use when investigating or improving WordPress performance (backend-only agent): profiling and measurement (WP-CLI profile/doctor, Server-Timing, Query Monitor via REST headers), database/query optimization, autoloaded options, object caching, cron, HTTP API calls, and safe verification.

wp-interactivity-api

9
from j7-dev/everything-github-copilot

Use when building or debugging WordPress Interactivity API features (data-wp-* directives, @wordpress/interactivity store/state/actions, block viewScriptModule integration, wp_interactivity_*()) including performance, hydration, and directive behavior.

wp-block-themes

9
from j7-dev/everything-github-copilot

Use when developing WordPress block themes: theme.json (global settings/styles), templates and template parts, patterns, style variations, and Site Editor troubleshooting (style hierarchy, overrides, caching).

wp-block-development

9
from j7-dev/everything-github-copilot

Use when developing WordPress (Gutenberg) blocks: block.json metadata, register_block_type(_from_metadata), attributes/serialization, supports, dynamic rendering (render.php/render_callback), deprecations/migrations, viewScript vs viewScriptModule, and @wordpress/scripts/@wordpress/create-block build and test workflows.

wp-abilities-api

9
from j7-dev/everything-github-copilot

Use when working with the WordPress Abilities API (wp_register_ability, wp_register_ability_category, /wp-json/wp-abilities/v1/*, @wordpress/abilities) including defining abilities, categories, meta, REST exposure, and permissions checks for clients.