Catalogue / ankhorage-project-structure
ankhorage-project-structure
MITSignedDefine, review, or implement the standard source structure of Ankhorage repositories. Use for feature ownership, CLI layout, hexagonal boundaries, source-module naming, Contracts ownership, type ownership, utilities, or package entrypoints.--- name: ankhorage-project-structure description: > Define, review, or implement the standard source structure of Ankhorage repositories. Use for feature ownership, CLI layout, hexagonal boundaries, source-module naming, Contracts ownership, type ownership, utilities, or package entrypoints. ---
Ankhorage Project Structure
Applicability
This skill applies to every Ankhorage repository.
Contracts repository profile
If the current repository is ankhorage/contracts, apply only this profile:
- The repository may contain only portable, serializable contracts expressed as interfaces and
types. Every field must be serializable and reconstructable without executable behavior or repository-local runtime objects. Do not add call signatures, function-valued properties, functions, classes, constants, enums, mutable state, adapters, framework objects, or implementation helpers.
- A contract belongs in this repository only when it is required across multiple repositories. A
current or coordinated change MUST identify at least two consuming repositories. Keep single-repository types with their owning repository; anticipated reuse alone is not sufficient.
- Consumers import contracts through published public subpaths and declared dependencies, never
sibling source files or duplicated local declarations.
After enforcing this profile, stop before the remaining source-layout, implementation, utility, and migration rules; they do not apply to ankhorage/contracts.
Architecture reference
Before authorized structural work outside ankhorage/contracts, read the repository AGENTS.md, inspect its source tree and public exports, and consult references/hexagonal-architecture.md relative to this skill.
This unmodified vendor document is reference material, not an independently selectable Agent Skill. Its examples do not authorize additional refactoring, migrations, dependencies, or tests.
Architecture profiles and source layout
Do not impose one folder tree on every repository. Select the smallest profile that matches the repository's real responsibility, then enforce that profile's vocabulary and dependency direction. Read references/architecture-profiles.md and references/hexagonal-invariants.md before creating or moving architectural directories.
Valid profiles include:
- simple/value/contracts library;
- reusable UI or design-system library;
- application, engine, or hybrid package;
- provider or platform adapter package;
- tooling package;
- generated standalone application;
- an explicitly documented repository-specific profile such as Studio.
Implementation-owning Ankhorage packages are feature-first. Product, domain, and package capabilities belong below src/features/<feature>/; do not place feature implementation modules directly below src/. Keep only deliberate public facades and genuinely package-wide ownership such as src/types/, src/constants/, and src/utils/ at the source root. Contracts-only, reusable UI/design-system, generated-application, and explicitly documented repository-specific profiles may use their dedicated taxonomy instead of inventing fake features.
Inside each feature, introduce domain/, application/, ports/, adapters/, or composition/ only when those names communicate a real architectural role. Do not create empty hexagonal layers for symmetry. Once a vocabulary is introduced, its combinations must be coherent:
domain/may stand alone and must remain independent from outer mechanisms;application/coordinates use cases and may depend inward on domain policy and required ports;ports/define capabilities required by inner policy; they do not implement provider technology;adapters/translate or implement a port at an external edge and therefore require an inward
capability boundary to adapt to;
composition/is outer wiring and exists only when concrete implementations need selection;features/is feature-first organization, not a generic bucket. Each feature owns a coherent
slice and may introduce only the role directories it actually needs;
core/is allowed only when the repository defines it narrowly as stable inner policy. It must
never become a miscellaneous dumping ground.
Dependency direction is the invariant. Inner policy must not import outer mechanisms. A domain or core module must not depend on application orchestration, adapters, composition, CLI, host, platform, framework, database, or provider implementation details. Application/use-case code must not import concrete adapters or composition roots. Adapters may depend inward on ports/application/ domain contracts. Composition may depend on all pieces it wires.
Do not create empty layers for symmetry. A small package with no domain orchestration does not need hexagonal ceremony. UI libraries use component/foundation dependency direction rather than fake application ports. Contracts libraries remain portable and side-effect free.
Repository-root examples/ contains complete user-facing examples. Each example lives in a named subdirectory. Test-only fixtures remain test-owned.
Package-level delivery edges such as src/cli/, src/host/, src/app/, or src/platform/ remain thin adapters/composition boundaries outside feature ownership. Every public Ankh command implementation must live below src/cli/commands/, and that filesystem mirrors the public command path after the package prefix. For example, ankh rules config validate maps to src/cli/commands/config/validate.ts. CLI provider/index modules register and compose commands; they must not contain the command's application or domain behavior. Command modules parse input, invoke the owning feature boundary, and render output.
Keep only deliberate public facades directly under src/. Public package subpaths must map to explicit package exports; generic barrels are not an excuse to bypass ownership.
General Taxonomy
Siblings always represent the same kind of entity. A folder cannot be an unrelated catch-all beside peer entities. For example, this is invalid because other/ is not a color:
colors/ red/ green/ blue/ other/
Resolve the ownership of other and move it to the appropriate taxonomy. Use domain names for features, not framework, transport, database, or generic technical names.
Implementation modules
Each production implementation module has exactly one exported runtime declaration. It is the first declaration after imports and module documentation, and its name matches the filename exactly. This rule does not split types into one-file-per-type modules. Type ownership follows the separate rules below. Deliberate public facades may group explicit named exports; they are not internal convenience barrels and must not expose private implementation details.
myFunction.tsexportsmyFunction.myFunctionAsync.tsexportsmyFunctionAsync.- A public operation that is asynchronous or returns a
Promiseuses theAsyncsuffix in both its filename and exported name.
Keep private helpers below that exported declaration when they are used only by that module. Decide the owner of a reused function using the utility rules below, before creating another file.
Type ownership
Choose type ownership by its production consumers, not by the number of textual references or whether a barrel happens to re-export it:
- Used by one implementation module: keep the type directly below the function that owns it, without
export. Its private helpers can use the same local type. A test does not justify exporting an implementation-private type; test through the function boundary. - Reused within the repository: put related types together in
src/types/<topic>.tsand use type-only imports. Name the file for a cohesive topic, not for each individual type. Such a file may export multiple related types/interfaces and contains no runtime implementation. Do not mix type-only files among feature functions orutils/, and do not create one global catch-all file. - Shared across repositories and serializable: when at least two repositories require the same portable data declaration, it belongs in
@ankhorage/contractsat the owning topic's public subpath. Consumers import that contract through a declared dependency, not another repository's source or a duplicated local declaration. Keep non-serializable API types with their implementation-owning package and consume them through that package's public API. Keep framework-specific adapters separate from the portable shared contract.
Inspect published API declarations and real consumer imports before privatizing or relocating a type. A public boundary type is not private just because only one implementation uses it locally. Coordinate its Contracts change and consumer migration; do not silently remove a public type, invent an unreleased dependency version, or retain a compatibility re-export as the final design. When the required package change or release is outside the approved scope, state the dependency explicitly instead of claiming the migration is complete.
For example, selectRoute.ts can own a non-exported SelectRouteInput directly below selectRoute. Types used by several local navigation operations belong together in src/types/navigation.ts. A navigation binding exchanged by Studio and Navigator belongs in @ankhorage/contracts/navigator.
Constant ownership
Constants are static declarations, not utility implementations. Do not create one exported constant per constant-named file under utils/.
- Used by one implementation module: keep the constant private in the module that owns it.
- Reused only inside a feature: group related constants in that feature's
constants/<topic>.ts. - Shared across features in one package: group related package metadata, static policy values, and other constants in
src/constants/<topic>.ts.
A constants/<topic>.ts module may export multiple related constants. Keep it cohesive by ownership and purpose; it is not a package-wide catch-all. Split constants when they have different owners, not merely to create one file per export.
For example, Navigator's `src/utils/NAVIGATOR_PACKAGE_METADATA.ts` and `src/utils/NAVIGATOR_ROUTER_POLICY.ts` belong together in ankhorage/navigator/src/constants/navigator.ts.
Utilities
utils/ is the only utility directory name. Do not create shared/, helper/, helpers/, common/, or equivalent catch-all folders. It is not a destination for every pure function or type.
Apply reuse before implementation and shared by default before choosing a local owner.
Treat the second equivalent generic implementation as the duplication threshold. When the same general-purpose regex, parser pattern, formatter, validator, algorithm, or static policy appears in two places, stop copying it and resolve its canonical shared owner. For runtime-neutral reusable behavior or patterns, inspect and extend @ankhorage/utility first. Do not wait for a third copy, and do not create repo-local aliases around the shared implementation. For every function that could reasonably be reused across repositories, you MUST first inspect the published @ankhorage/utility public API and its owning topic. Reuse the existing export when its semantics match. If the function is missing and is generic without product, manifest, or framework policy, report the missing canonical Utility API. If resolving it requires changing another repository or adding an unapproved dependency, STOP and obtain explicit user authorization. Do not duplicate the implementation locally or add a forwarding wrapper.
Preview shortened. The full SKILL.md is in the pack.
| File | Size | SHA-256 |
|---|---|---|
| SKILL.md | 13.9 kB | 7042f80b9903 |
| SKILVAULT_SOURCE.json | 1.6 kB | 875fa4f839b8 |
| THIRD_PARTY_NOTICES.md | 1.1 kB | acf563a75d98 |
| agents/openai.yaml | 278 B | 31c7daf632ab |
| references/architecture-profiles.md | 4.7 kB | 3d477baa9785 |
| references/hexagonal-architecture.md | 11.9 kB | f3c314000561 |
| references/hexagonal-invariants.md | 3.6 kB | c18af5db73e8 |
Published verbatim from the pinned commit. Nothing is rewritten.
| Version | Pinned commit | Signed | |
|---|---|---|---|
| 0.1.0 Current | 06d10d0914f5 | 2 Dec 2026 |
Locking a skill to one version needs Pro.