一键导入
go-clean-architecture
A comprehensive guide to implementing Clean Architecture in software projects, based on the boot-backend-go-clean template.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
A comprehensive guide to implementing Clean Architecture in software projects, based on the boot-backend-go-clean template.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
A collection of modern, opinionated starter templates for various frameworks and platforms by Kirk Lin.
Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines, creates packages, sets up monorepo, shares code between apps, runs changed/affected packages, debugs cache, or has apps/packages directories.
Apply VueUse composables where appropriate to build concise, maintainable Vue.js / Nuxt features.
Kirk Lin's opinionated tooling and conventions for JavaScript/TypeScript projects. Use when setting up new projects, configuring ESLint/Prettier alternatives, monorepos, library publishing, or when the user mentions Kirk Lin's preferences.
Nuxt full-stack Vue framework with SSR, auto-imports, and file-based routing. Use when working with Nuxt apps, server routes, useFetch, middleware, or hybrid rendering.
Pinia official Vue state management library, type-safe and extensible. Use when defining stores, working with state/getters/actions, or implementing store patterns in Vue apps.
| name | go-clean-architecture |
| description | A comprehensive guide to implementing Clean Architecture in software projects, based on the boot-backend-go-clean template. |
| license | MIT |
| metadata | {"author":"Kirk Lin","version":"1.0.0","source":"Based on boot-backend-go-clean"} |
Clean Architecture is a software design philosophy that separates the elements of a design into ring levels. The main rule of Clean Architecture is the Dependency Rule, which states that source code dependencies can only point inwards. Nothing in an inner circle can know anything at all about something in an outer circle.
The concentric circles represent different areas of software. In general, the further in you go, the higher level the software becomes. The outer circles are mechanisms. The inner circles are policies.
Source code dependencies must only point inward, towards higher-level policies.
Entities encapsulate enterprise-wide business rules. An entity can be an object with methods, or it can be a set of data structures and functions. It doesn't matter so long as the entities could be used by many different applications in the enterprise.
The software in this layer contains application-specific business rules. It encapsulates and implements all of the use cases of the system. These use cases orchestrate the flow of data to and from the entities, and direct those entities to use their enterprise wide business rules to achieve the goals of the use case.
The software in this layer is a set of adapters that convert data from the format most convenient for the use cases and entities, to the format most convenient for some external agency such as the Database or the Web. It is this layer, for example, that will wholly contain the MVC architecture of a GUI.
The outermost layer is generally composed of frameworks and tools such as the Database, the Web Framework, etc. Generally you don’t write much code in this layer other than glue code that communicates to the next circle inwards.
The project follows a standard Clean Architecture layout in Go, as demonstrated in boot-backend-go-clean.
.
├── cmd/
│ └── app/ # Application entry point (main.go)
├── internal/
│ ├── domain/ # Enterprise Logic (Entities) & Business Rules
│ │ ├── model/ # Core business objects
│ │ └── repository/ # Repository interfaces (ports)
│ ├── usecase/ # Application Logic (Use Cases)
│ │ └── [feature]/ # Feature-specific use cases
│ ├── interfaces/ # Interface Adapters
│ │ └── http/ # HTTP handlers/controllers
│ ├── infrastructure/ # Frameworks & Drivers
│ │ ├── database/ # Database implementations
│ │ └── config/ # Configuration handling
│ └── app/ # Application bootstrap/wiring
This structure is implemented in the boot-backend-go-clean template. Use this template as a starting point for new services.