package-extraction-strategy
Package Extraction Strategy
Core principle: Don't extract until a second consumer exists. But always structure for extraction.
Decision Gate
Before extracting code to a shared package, all four conditions must be met:
- Second consumer exists — another app or service needs this exact logic today, not hypothetically.
- Interface is stable — the API surface has been proven through real usage in the first consumer.
- Zero framework coupling — the code to extract has no imports from NestJS, Prisma, React, TanStack, or any app-specific module.
- Clear ownership — someone will maintain the package, handle version bumps, and review PRs.
If any condition fails, do not extract. Instead, use the extraction-readiness pattern below.
Extraction-Readiness Pattern
Structure feature code so that future extraction is a file move, not a rewrite.
More from allenlin90/eridu-services
service-pattern-nestjs
Comprehensive NestJS service implementation patterns. This skill should be used when implementing Model Services, Orchestration Services, or business logic with NestJS decorators.
8erify-authorization
Patterns for implementing authorization in erify_api with current StudioMembership + AdminGuard behavior, plus planned RBAC references
6data-validation
Provides comprehensive guidance for input validation, data serialization, and ID management in backend APIs. This skill should be used when designing validation schemas, transforming request/response data, mapping database IDs to external identifiers, and ensuring type safety across API boundaries.
6code-quality
Provides general code quality and best practices guidance applicable across languages and frameworks. Focuses on linting, testing, and type safety.
6repository-pattern-nestjs
Comprehensive Prisma repository implementation patterns for NestJS. This skill should be used when implementing repositories that extend BaseRepository or use Prisma delegates.
6task-template-builder
Provides guidelines for the Task Template Builder architecture, including Schema alignment, Draft storage, Drag-and-Drop, and Validation logic.
6