Claude-skill-registry effect-ts-7layer-architecture
7-layer Effect-TS architecture for Holochain applications. Use when implementing domains, validating architecture, or creating stores with standardized patterns.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/effect-ts-7layer-architecture" ~/.claude/skills/majiayu000-claude-skill-registry-effect-ts-7layer-architecture && rm -rf "$T"
skills/data/effect-ts-7layer-architecture/SKILL.mdEffect-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
- Domain Implementation: Create new domains following the 7-layer pattern
- Architecture Validation: Ensure consistency with automated validation tools
- Template Generation: Use proven templates for rapid development
- 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
- Service Layer - Effect-TS services with Context.Tag dependency injection
- Store Layer - Reactive state management with 9 standardized helper functions
- Schema Layer - Effect Schema validation at service boundaries
- Error Handling Layer - Domain-specific tagged errors with meaningful contexts
- Composables Layer - Reusable logic compositions
- Components Layer - UI components with proper store integration
- Testing Layer - Tryorama multi-agent testing scenarios
9 Standardized Helper Functions
Every store should implement these helper functions for consistency:
- Transform raw data to UI-ready entitiescreateUIEntity
- Batch transformation of recordsmapRecordsToUIEntities
- Cache synchronization utilitiescreateCacheSyncHelper
- Status-based event emissioncreateStatusAwareEventEmitters
- Data fetching with loading statescreateEntitiesFetcher
- Loading state wrapperwithLoadingState
- Record creation utilitiescreateRecordCreationHelper
- Status workflow managementcreateStatusTransitionHelper
- Batch record processingprocessMultipleRecordCollections
Best Practices
- Use Context.Tag for service dependency injection
- Implement all 9 helper functions in every store for consistency
- Use Effect Schema at service boundaries for validation
- Create domain-specific tagged errors with meaningful contexts
- 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
- Author: happenings-community
- Repository: https://github.com/happenings-community/requests-and-offers
- Source: https://skillsmp.com/skills/happenings-community-requests-and-offers-claude-skills-effect-ts-7layer-architecture-skill-md