AgentStack
SKILL verified MIT Self-run

Angular Hexagonal

skill-cuongtl1992-vibe-skills-angular-hexagonal · by cuongtl1992

Hexagonal/clean architecture for Angular with domain layer (branded IDs, readonly interfaces, pure functions), application layer (QueryBase, UseCaseBase, DTOs, Mappers), infrastructure layer (API clients, repositories), and presentation layer. Use when structuring modules, understanding layer boundaries, working with Result<T>, branded types, or creating files in domain/application/infrastructure…

No reviews yet
0 installs
10 views
0.0% view→install

Install

$ agentstack add skill-cuongtl1992-vibe-skills-angular-hexagonal

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Angular Hexagonal? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Hexagonal Architecture for Angular

Four-layer architecture: Domain → Application → Infrastructure → Presentation.

Layer Dependency Rules

| Layer | Can Depend On | Contains | | -------------- | ------------------- | --------------------------------------------------------- | | Domain | Nothing | Branded IDs, interfaces, pure functions, repository ports | | Application | Domain | QueryBase, UseCaseBase, DTOs, Mappers | | Infrastructure | Domain, Application | API clients, repository impls, providers | | Presentation | Application | Pages, components, state services, routes |

Domain Layer — Plain Interfaces + Functions

// Branded Types for type-safe IDs
export type EntityId = number & { __brand: 'EntityId' };
export const EntityId = (value: number) => value as EntityId;

// Readonly Interface
export interface Entity {
  readonly id: EntityId;
  readonly name: string;
  readonly isActive: boolean;
}

// Factory Function → Result
export function createEntity(params: CreateEntityParams): Result {
  if (!params.name?.trim()) return Result.failure('Name is required');
  return Result.success({ id: EntityId(0), name: params.name.trim(), isActive: true });
}

// Pure Functions
export function canDeactivate(entity: Entity): boolean {
  return entity.isActive;
}

Application Layer — Deep Nesting

application/
├── queries//get-s/get-s.query.ts
├── usecases//create-/create-.usecase.ts
├── dtos/.dto.ts
└── mappers/.mapper.ts

QueryBase (reads) / UseCaseBase (writes)

@Injectable()
export class GetEntitiesQuery extends QueryBase> {
  private readonly repository = inject(ENTITY_REPOSITORY);

  async execute(params: FilterParams): Promise>> {
    return this.repository.find(params);
  }
}

Result Pattern

Result.success(value);
Result.success(value, message);
Result.failure(errorMessage);
result.isSuccess / result.isFailure;
result.value;
result.errorMessage / result.successMessage;

Mapper — Static Class

export class EntityMapper {
  static toDomain(dto: EntityDto): Entity { ... }
  static toCreateDto(params: CreateEntityParams): CreateEntityRequest { ... }
}

Never @Injectable(). No state. No DI.

Module File Structure

libs/features//src/lib/
├── domain/
│   ├── entities/.ts
│   ├── repositories/.repository.ts
│   └── index.ts
├── application/
│   ├── queries//get-s/
│   ├── usecases//create-/
│   ├── dtos/.dto.ts
│   ├── mappers/.mapper.ts
│   └── index.ts
├── infrastructure/
│   ├── api/-api.client.ts
│   ├── repositories/.repository.ts
│   ├── providers/index.ts
│   └── index.ts
└── presentation/
    ├── pages//
    ├── components/-form/
    ├── state/-list-state.service.ts
    ├── .routes.ts
    └── index.ts

Barrel Exports

Every directory has an index.ts that re-exports its contents.

For detailed layer patterns, see [references/layer-patterns.md](references/layer-patterns.md). For code generation workflow, see [references/code-generation.md](references/code-generation.md).

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.