Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

clean-architecture-golangclean 架构 Go

Agent Skill

clean-architecture-golang 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

285

周安装

12

GitHub Stars

公开资料未说明

下载量

78
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:clean-architecture-golang(clean 架构 Go)
来源仓库:https://github.com/gabihert/finance-tracker-e2e
仓库路径:skills/clean-architecture-golang
安装命令:
npx skills add https://github.com/gabihert/finance-tracker-e2e --skill clean-architecture-golang
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/gabihert/finance-tracker-e2e --skill clean-architecture-golang

简介

clean-architecture-golang 针对特定 Go 项目定制清洁架构模式,非标准 Uncle Bob 实现。

  • 适合使用此项目自定义模式的中大型 Go 服务开发者和技术负责人。
  • 通过 Integration→Application→Domain←Infrastructure 四层结构和 BDD 测试优先流程实施。
  • 需熟悉 context.Context 使用、BDD 规范和项目特定接口约定,建议配合 feature 文件开发。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Custom Clean Architecture Implementation Guide

Expert guidance for implementing features using this project's custom Clean Architecture pattern with Golang. This is NOT Uncle Bob's standard Clean Architecture - it's a specialized adaptation.

Architecture Overview

Four layers with strict dependency rules:

Integration → Application → Domain ← Infrastructure

Dependency Rule: Inner layers NEVER depend on outer layers.

🚨 Critical Rules

MUST DO

  • START with BDD feature file - Never skip test-first development
  • Integration adapters MUST implement usecase interfaces - Enable type casting
  • Use context.Context as first parameter - Always
  • Convert at boundaries - DTO↔Entity↔Model
  • Follow error code format - PREFIX-XXYYYY
  • Type cast repositories to usecases - In dependency injection

NEVER DO

  • Skip BDD test creation - Tests come first
  • Create adapters without usecase interfaces - Will break dependency injection
  • Put business logic in controllers/repositories - Only in services
  • Use DTOs in domain/application - Only in integration layer
  • Access database from services - Only through usecases
  • Create circular dependencies - Dependencies flow inward only

Implementation Workflow

Step 1: Create BDD Test (MANDATORY)

Start here ALWAYS. Location: /test/integration/features/

Feature: Create entity functionality
  Scenario: Create entity success
    When I call "POST" "/v1/entities" with payload
    Then status should be 201
    And db should contain entity

Step 2: Domain Layer

  1. Entity (/internal/domain/entity/)

- Simple structs, NO logic - Audit fields (CreatedAt, UpdatedAt)

  1. Errors (/internal/domain/error/)

- Format: PREFIX-XXYYYY - One error per file

  1. Enums (/internal/domain/enums/)

- String types - SCREAMING_SNAKE_CASE values

Step 3: Application Layer

  1. Adapter Interface (/internal/application/adapter/)

- Service contracts - Use domain entities

  1. UseCase Interfaces (/internal/application/usecase/)

- Atomic operations - FindX, SaveX, UpdateX, DeleteX

  1. Service Implementation (/internal/application/service/)

- Business logic HERE - Orchestrate usecases

Step 4: Integration Layer

  1. Adapter Interfaces (/internal/integration/adapter/) type Repository interface {usecase.Find // MUST embed usecase.Save // MUST embed}
  2. DTOs (/internal/integration/entrypoint/dto/)

- Request/Response structs - ToEntity() methods - Validation tags

  1. Controller (/internal/integration/entrypoint/controller/)

- Handle HTTP - DTO↔Entity conversion

  1. Model (/internal/integration/persistence/model/)

- GORM annotations - ToEntity() methods

  1. Repository (/internal/integration/persistence/)

- Implements usecase interfaces - Entity↔Model conversion

Step 5: Infrastructure Layer

  1. Dependency Injection (/internal/infra/dependency/injector.go) // Type cast repository to usecase usecase.Find(i.GetRepository())
  2. Router (/internal/infra/server/router/router.go)

- Add routes - Validation middleware

Step 6: Run Tests

make test-integration

Quick Patterns

Integration Adapter Pattern (CRITICAL)

// Application defines need
type FindProduct interface {
    FindById(ctx, id) (*entity, error)
}

// Integration MUST implement
type ProductRepository interface {
    usecase.FindProduct  // EMBED!
}

// Type cast in DI
usecase.FindProduct(repository)

Error Codes

  • CLI-01409 = Client conflict (409)
  • USR-01404 = User not found (404)
  • PRD-02500 = Product server error (500)

Conversion Flow

Request → DTO → Entity → Model → DB
Response ← DTO ← Entity ← Model ← DB

Reference Documentation

Detailed guides in references/:

Templates

Ready-to-use templates in assets/:

  • entity-template.go - Domain entity template
  • service-template.go - Application service template
  • repository-template.go - Repository template

Implementation Checklist

Before starting any feature:

  • BDD feature file exists
  • Domain entity defined
  • Domain errors created
  • Application adapter interface defined
  • Application usecases created
  • Application service implemented
  • Integration adapters created WITH usecase interfaces
  • DTOs with ToEntity() methods
  • Controller handling HTTP
  • Model with ToEntity() method
  • Repository implementing usecases
  • Dependencies wired in injector
  • Routes added to router
  • Tests passing

Common Mistakes to Avoid

  1. Forgetting usecase interfaces on adapters - Breaks type casting
  2. Business logic in wrong layer - Only in services
  3. Wrong dependency direction - Check imports
  4. Missing BDD test - Always start with test
  5. Wrong error code format - Use PREFIX-XXYYYY
  6. Not converting at boundaries - DTO↔Entity↔Model

Example Implementations

Study these existing implementations:

  • Client: /internal/{domain,application,integration}/*/client*.go
  • User: /internal/{domain,application,integration}/*/user*.go
  • Forest: /internal/{domain,application,integration}/*/forest*.go

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.78%
按下载量换算29

Claude

32.1%
按下载量换算25

Cursor

16.97%
按下载量换算13

Gemini CLI

8.57%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills