Skip to content
effect-ts-7layer-architecture logo

Effect-TS 7-Layer Architecture Skill

effect-ts-7layer-architecture

7-layer Effect-TS architecture for Holochain applications. Use when implementing domains, validating architecture, or creating stores with standardized patterns.

SKILL.md

Full skill instructions

Effect-TS 7-Layer Architecture Skill

This skill provides the complete 7-layer Effect-TS architecture pattern used successfully across 8 domains in production Holochain applications.

Capabilities

Implement robust Holochain hApps with:

  • 7-Layer Architecture: Service Layer, Store Layer, Schema Validation, Error Handling, Composables, Components, Testing
  • Standardized Patterns: Consistent implementation across all domains with 9 helper functions
  • Effect-Native Services: Context.Tag dependency injection with composable error handling
  • Reactive Stores: Svelte 5 Runes with Effect integration and comprehensive state management
  • Type Safety: End-to-end TypeScript safety with Effect Schema validation

How to Use

  1. Domain Implementation: Create new domains following the 7-layer pattern
  2. Architecture Validation: Ensure consistency with automated validation tools
  3. Template Generation: Use proven templates for rapid development
  4. Best Practices: Apply established patterns for maintainable code

Quick Implementation

For New Domain:

// Service Layer (Layer 1)
export const MyDomainService = Context.GenericTag<MyDomainService>("MyDomainService");

// Store Layer (Layer 2) with 9 helper functions
export const createMyDomainStore = Effect.gen(function* () {
  // Implements: createUIEntity, mapRecordsToUIEntities, createCacheSyncHelper,
  // createStatusAwareEventEmitters, createEntitiesFetcher, withLoadingState,
  // createRecordCreationHelper, createStatusTransitionHelper, processMultipleRecordCollections
});

// Schema Layer (Layer 3)
export const CreateMyDomainSchema = Schema.Struct({
  name: Schema.String,
  // ... other fields
});

Example Usage

Concrete Examples of Skill Application:

  • Domain Implementation: "Create a new Reviews domain following our 7-layer architecture pattern"

    • Expected outcome: Complete domain with all 7 layers properly implemented
    • Validation: Architecture validator scores 95+ and passes consistency checks
  • Service Layer Generation: "Generate the service layer for a ResourceManagement domain with proper error handling"

    • Expected outcome: Effect-TS service with Context.Tag pattern and domain-specific errors
    • Validation: Service compiles and integrates properly with Holochain client
  • Architecture Validation: "Validate that our new domain follows all 7 architectural layers correctly"

    • Expected outcome: Detailed compliance report with specific improvement recommendations
    • Validation: All missing components identified and architectural score provided
  • Store Implementation: "Create a store with all 9 standardized helper functions for the Notifications domain"

    • Expected outcome: Complete reactive store with Svelte 5 runes integration
    • Validation: Store functions work correctly and maintain proper state management

The 7 Layers

  1. Service Layer - Effect-TS services with Context.Tag dependency injection
  2. Store Layer - Reactive state management with 9 standardized helper functions
  3. Schema Layer - Effect Schema validation at service boundaries
  4. Error Handling Layer - Domain-specific tagged errors with meaningful contexts
  5. Composables Layer - Reusable logic compositions
  6. Components Layer - UI components with proper store integration
  7. Testing Layer - Tryorama multi-agent testing scenarios

9 Standardized Helper Functions

Every store should implement these helper functions for consistency:

  1. createUIEntity - Transform raw data to UI-ready entities
  2. mapRecordsToUIEntities - Batch transformation of records
  3. createCacheSyncHelper - Cache synchronization utilities
  4. createStatusAwareEventEmitters - Status-based event emission
  5. createEntitiesFetcher - Data fetching with loading states
  6. withLoadingState - Loading state wrapper
  7. createRecordCreationHelper - Record creation utilities
  8. createStatusTransitionHelper - Status workflow management
  9. processMultipleRecordCollections - Batch record processing

Best Practices

  1. Use Context.Tag for service dependency injection
  2. Implement all 9 helper functions in every store for consistency
  3. Use Effect Schema at service boundaries for validation
  4. Create domain-specific tagged errors with meaningful contexts
  5. Test with Tryorama for multi-agent scenarios

Validation Results

The architecture validator provides:

  • Score from 0-100 for implementation completeness
  • Specific error messages for missing components
  • Recommendations for improvements
  • Consistency checks across all layers

Proven Results

This architecture has been battle-tested in production:

  • 8 fully implemented domains with 100% consistency
  • 268 passing unit tests with comprehensive coverage
  • 40-60% faster development through pattern reuse
  • 90% reduction in architectural drift across domains

Integration

Works seamlessly with:

  • Holochain Development Skill: For zome and DNA implementation
  • Effect-TS: Native integration for composable effects
  • Svelte 5: Runes and reactive state management
  • Tryorama: Multi-agent testing scenarios

Reference

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View