AgentSkillsCN

project-structure

采用 KMP 与纯 JVM 模块结构,结合整洁架构 + 六边形(端口与适配器)分层设计。适用于在代码库中导航、决定新代码的归属位置、创建新模块,或解答有关模块布局与依赖关系的问题时使用。

SKILL.md
--- frontmatter
name: project-structure
description: KMP & plain JVM module structure with Clean Architecture + Hexagonal (Ports & Adapters) layers. Use when navigating the codebase, deciding where new code belongs, creating new modules, or answering questions about module layout and dependencies.
user-invocable: false
allowed-tools: Read, Glob, Grep

Project Structure

Read docs/project_structure.md for the full module layout documentation before answering questions about where code belongs or how modules are organized.

Quick reference

Application entry points

ModulePlatform
:composeAppDesktop (jvm), Web (js, wasmJs)
:androidAppAndroid
:iosAppiOS
:server:implBackend (Ktor)

Feature modules (feat/<feature>/)

Each feature follows hexagonal architecture with these layers:

  • business/ — Platform-agnostic domain models. Innermost core. Only depends on :lib:core.
  • be/ — Backend: app/ (use cases) > ports/ (interfaces) > driven/ (DB implementations) + driving/ (HTTP routes)
  • fe/ — Frontend: app/ (use cases) > ports/ (interfaces) > driven/ (HTTP/SQLite implementations) + driving/ (Compose screens)

Module splits

  • api/ or contract/ — Public interfaces (typical for app/ and driving/)
  • impl/ — Production implementations
  • test/ — Fake/in-memory implementations for unit tests
    • driven/test/ — Fakes for port interfaces (DB, API)
    • app/test/ — Fakes for use case interfaces (cross-feature testing)

Shared modules (feat/shared/)

  • shared/database/ — Shared database infrastructure
  • shared/rules/business/ — Cross-cutting business rules (api/ + impl/). Auto-wired to all feature modules.

Library modules (lib/)

Domain-agnostic reusable code used by driven and driving feature modules. core modules can be used anywhere.

Dependency direction

driving -> app -> ports -> model -> business driven -> app -> model -> business