add-plan-based-featureslisted
Install: claude install-skill brabos-ai/code-addiction
# Plan-Based Features
## Overview
This template uses a **3-layer feature system** stored in JSONB. Features are managed via Manager app and validated via `IPlanService`. **DO NOT create new guards, schemas, or feature systems - use the existing pattern.**
## When to Use
- Adding a new boolean feature (flag) gated by plan
- Adding a new numeric limit (workspaces, users, projects)
- Validating feature access in a controller/service
- Modifying which plans have access to a feature
## When NOT to Use
- Non-plan-gated authentication or session checks
- Role-based access control (RBAC) unrelated to subscription tier
- Generic feature flags (A/B tests, experiments) unrelated to billing
- Per-user preferences or workspace settings stored outside plans
## The 3-Layer Structure
| Layer | Purpose | Example |
|-------|---------|---------|
| `limits` | Numeric caps | `workspaces:3, usersPerWorkspace:5` |
| `flags` | Boolean toggles | `reportsExport:true, apiAccess:false` |
| `display` | UI display | `badge, ctaText, displayFeatures[]` |
```typescript
// libs/domain/src/types/PlanFeatures.ts
interface PlanFeatures {
limits: PlanLimits; // Quantitative constraints
flags: PlanFlags; // Boolean toggles
display: PlanDisplay; // UI/marketing info
}
```
## Key Files (DO NOT RECREATE)
| File | Purpose |
|------|---------|
| `libs/domain/src/types/PlanFeatures.ts` | Type definitions |
| `libs/backend/src/billing/IPlanService.ts` | Validation interface |
| `apps/backend/src/a