generalize presets into mosaic profiles with runtime overlays

This commit is contained in:
Jason Woltje
2026-02-17 11:46:12 -06:00
parent 4eac2c76e6
commit 33bbf60bad
15 changed files with 1868 additions and 0 deletions

View File

@@ -0,0 +1,154 @@
{
"name": "NestJS Backend",
"description": "NestJS backend with TypeORM, PostgreSQL, and comprehensive testing",
"filePatterns": ["*.ts", "*.js"],
"excludePatterns": ["*.spec.ts", "*.test.ts", "*.d.ts"],
"techStack": {
"framework": "NestJS",
"language": "TypeScript",
"database": "TypeORM + PostgreSQL",
"validation": "class-validator + class-transformer",
"testing": "Jest + Supertest",
"documentation": "Swagger/OpenAPI",
"caching": "Redis + cache-manager",
"queues": "Bull + Redis"
},
"conventions": {
"naming": {
"variables": "camelCase",
"functions": "camelCase",
"classes": "PascalCase",
"interfaces": "PascalCase with I prefix",
"types": "PascalCase with T prefix",
"enums": "PascalCase",
"constants": "UPPER_SNAKE_CASE"
},
"fileStructure": {
"modules": "Feature-based modules in src/{feature}/",
"controllers": "{feature}.controller.ts",
"services": "{feature}.service.ts",
"entities": "{feature}.entity.ts",
"dtos": "dto/{feature}.dto.ts",
"tests": "{feature}.controller.spec.ts, {feature}.service.spec.ts"
},
"imports": {
"style": "Absolute imports with @ prefix when available",
"grouping": "Third-party, @nestjs, internal, relative",
"sorting": "Alphabetical within groups"
}
},
"qualityChecks": {
"lint": {
"command": "npx eslint --fix",
"config": "Google TypeScript ESLint config",
"autoFix": true
},
"format": {
"command": "npx prettier --write",
"config": "80 character line limit",
"autoFix": true
},
"build": {
"command": "npm run build",
"checkTypes": true,
"failOnError": true
},
"test": {
"unit": "npm run test:unit",
"integration": "npm run test:integration",
"coverage": "npm run test:cov",
"minimumCoverage": 40
}
},
"codePatterns": {
"controller": {
"decorators": ["@Controller", "@ApiTags", "@UseGuards"],
"methods": ["@Get", "@Post", "@Put", "@Delete", "@Patch"],
"responses": ["@ApiResponse", "@ApiOperation"],
"validation": ["@Body", "@Param", "@Query with DTOs"],
"errorHandling": "Use HttpException and custom exception filters"
},
"service": {
"injection": "Constructor dependency injection with @Injectable",
"methods": "Async methods with proper error handling",
"database": "Use TypeORM repository pattern",
"transactions": "@Transaction decorator for data consistency"
},
"entity": {
"decorators": ["@Entity", "@PrimaryGeneratedColumn", "@Column"],
"relationships": ["@ManyToOne", "@OneToMany", "@ManyToMany"],
"validation": "class-validator decorators on fields",
"timestamps": "Include createdAt, updatedAt with @CreateDateColumn"
},
"dto": {
"validation": "class-validator decorators (@IsString, @IsOptional)",
"transformation": "class-transformer decorators (@Transform, @Type)",
"swagger": "Swagger decorators (@ApiProperty, @ApiPropertyOptional)",
"inheritance": "Use PartialType, PickType for variations"
},
"testing": {
"unit": "Test services and controllers independently with mocks",
"integration": "Test complete request/response cycles",
"mocking": "Use jest.mock for dependencies",
"coverage": "Focus on business logic and edge cases"
}
},
"context7Libraries": [
"@nestjs/common",
"@nestjs/core",
"@nestjs/typeorm",
"@nestjs/swagger",
"@nestjs/jwt",
"@nestjs/passport",
"@nestjs/cache-manager",
"@nestjs/throttler",
"typeorm",
"class-validator",
"class-transformer",
"jest"
],
"commonImports": {
"controller": [
"import { Controller, Get, Post, Put, Delete, Patch, Body, Param, Query, UseGuards, HttpException, HttpStatus } from '@nestjs/common';",
"import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';"
],
"service": [
"import { Injectable } from '@nestjs/common';",
"import { InjectRepository } from '@nestjs/typeorm';",
"import { Repository } from 'typeorm';"
],
"entity": [
"import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';",
"import { IsString, IsOptional, IsNumber, IsBoolean, IsDate } from 'class-validator';"
],
"dto": [
"import { IsString, IsOptional, IsNumber, IsBoolean, IsEmail, IsArray } from 'class-validator';",
"import { Transform, Type } from 'class-transformer';",
"import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';"
]
},
"bestPractices": [
"Use dependency injection for all services and repositories",
"Validate all input data using DTOs with class-validator",
"Document all API endpoints with Swagger decorators",
"Implement proper error handling with custom exception filters",
"Use TypeORM repositories for database operations",
"Write unit tests for all services and integration tests for controllers",
"Use environment variables for configuration",
"Implement rate limiting and security guards",
"Use transactions for operations affecting multiple entities",
"Follow REST API conventions for endpoint naming"
],
"securityConsiderations": [
"Validate and sanitize all inputs",
"Use JWT authentication with proper token validation",
"Implement role-based access control (RBAC)",
"Use HTTPS in production environments",
"Implement rate limiting to prevent abuse",
"Hash passwords using bcrypt",
"Use parameterized queries to prevent SQL injection",
"Implement proper CORS configuration",
"Log security-relevant events for auditing",
"Use environment variables for sensitive configuration"
]
}

View File

@@ -0,0 +1,171 @@
{
"name": "Next.js Fullstack",
"description": "Next.js 14+ with App Router, TypeScript, Tailwind CSS, and modern fullstack development",
"filePatterns": ["*.tsx", "*.ts", "*.jsx", "*.js"],
"excludePatterns": ["*.test.tsx", "*.test.ts", "*.spec.tsx", "*.spec.ts", "*.d.ts"],
"techStack": {
"framework": "Next.js 14+ with App Router",
"language": "TypeScript",
"styling": "Tailwind CSS",
"database": "Prisma + PostgreSQL",
"authentication": "NextAuth.js",
"stateManagement": "Zustand + React Query",
"testing": "Jest + React Testing Library",
"deployment": "Vercel",
"api": "Next.js API Routes / Server Actions"
},
"conventions": {
"naming": {
"components": "PascalCase (UserProfile.tsx)",
"pages": "lowercase with hyphens (user-profile/page.tsx)",
"apiRoutes": "lowercase with hyphens (api/user-profile/route.ts)",
"hooks": "camelCase with use prefix (useAuth.ts)",
"utilities": "camelCase (formatDate.ts)",
"constants": "UPPER_SNAKE_CASE",
"types": "PascalCase with T prefix"
},
"fileStructure": {
"appRouter": "app/{route}/page.tsx, layout.tsx",
"apiRoutes": "app/api/{endpoint}/route.ts",
"components": "components/{feature}/{ComponentName}.tsx",
"hooks": "hooks/use{HookName}.ts",
"libs": "lib/{utility}.ts",
"types": "types/{feature}.types.ts",
"prisma": "prisma/schema.prisma, prisma/migrations/",
"tests": "__tests__/{ComponentName}.test.tsx"
},
"imports": {
"style": "Absolute imports with @ prefix",
"grouping": "React/Next, third-party, internal, relative",
"sorting": "Alphabetical within groups"
}
},
"qualityChecks": {
"lint": {
"command": "npx eslint --fix",
"config": "Next.js ESLint + TypeScript",
"autoFix": true
},
"format": {
"command": "npx prettier --write",
"config": "80 character line limit",
"autoFix": true
},
"build": {
"command": "npm run build",
"checkTypes": true,
"failOnError": true
},
"test": {
"unit": "npm test",
"coverage": "npm run test:coverage",
"minimumCoverage": 75
}
},
"codePatterns": {
"page": {
"structure": "Default export function with metadata",
"metadata": "Use generateMetadata for dynamic SEO",
"loading": "Create loading.tsx for loading states",
"error": "Create error.tsx for error boundaries",
"notFound": "Create not-found.tsx for 404 handling"
},
"layout": {
"structure": "Root layout with html and body tags",
"metadata": "Define default metadata and viewport",
"providers": "Wrap children with necessary providers",
"fonts": "Use next/font for font optimization"
},
"component": {
"client": "Use 'use client' directive for client components",
"server": "Default to server components when possible",
"props": "Define TypeScript interfaces for props",
"memo": "Use React.memo for performance when needed"
},
"apiRoute": {
"structure": "Export named functions (GET, POST, etc.)",
"params": "Use typed params and searchParams",
"responses": "Return NextResponse with proper status codes",
"middleware": "Use middleware for auth and validation"
},
"serverActions": {
"directive": "Use 'use server' directive",
"validation": "Validate input data with zod",
"revalidation": "Use revalidatePath/revalidateTag",
"errors": "Handle errors gracefully"
},
"database": {
"prisma": "Use Prisma Client for database operations",
"transactions": "Use Prisma transactions for complex operations",
"migrations": "Use Prisma migrate for schema changes",
"seeding": "Create seed scripts for development data"
}
},
"context7Libraries": [
"next",
"react",
"@next/font",
"next-auth",
"@prisma/client",
"prisma",
"tailwindcss",
"zustand",
"@tanstack/react-query",
"zod"
],
"commonImports": {
"page": [
"import { Metadata } from 'next';",
"import { notFound } from 'next/navigation';"
],
"component": [
"import React from 'react';",
"import Link from 'next/link';",
"import Image from 'next/image';"
],
"apiRoute": [
"import { NextRequest, NextResponse } from 'next/server';",
"import { getServerSession } from 'next-auth';"
],
"serverAction": [
"import { revalidatePath } from 'next/cache';",
"import { redirect } from 'next/navigation';"
]
},
"bestPractices": [
"Use App Router instead of Pages Router for new projects",
"Default to Server Components, use Client Components only when needed",
"Use Next.js Image component for optimized images",
"Implement proper SEO with metadata API",
"Use Server Actions for form handling and mutations",
"Implement proper error handling with error boundaries",
"Use Prisma for type-safe database operations",
"Implement proper authentication with NextAuth.js",
"Use Tailwind CSS for styling with design system approach",
"Implement proper loading states and skeleton screens"
],
"seoOptimization": [
"Use generateMetadata for dynamic meta tags",
"Implement proper Open Graph and Twitter Card tags",
"Use structured data (JSON-LD) where appropriate",
"Implement proper canonical URLs",
"Use Next.js Image component with alt text",
"Implement proper heading hierarchy",
"Use semantic HTML elements",
"Generate sitemap.xml and robots.txt",
"Implement proper internal linking",
"Optimize Core Web Vitals"
],
"performanceOptimizations": [
"Use Next.js Image component with proper sizing",
"Implement code splitting with dynamic imports",
"Use React.lazy and Suspense for component lazy loading",
"Optimize fonts with next/font",
"Use streaming with loading.tsx files",
"Implement proper caching strategies",
"Use ISR (Incremental Static Regeneration) when appropriate",
"Optimize bundle size with proper imports",
"Use web workers for heavy computations",
"Implement proper database query optimization"
]
}

View File

@@ -0,0 +1,168 @@
{
"name": "Python FastAPI",
"description": "FastAPI with SQLAlchemy, Pydantic, and modern Python development practices",
"filePatterns": ["*.py"],
"excludePatterns": ["*_test.py", "*test*.py", "__pycache__/*"],
"techStack": {
"framework": "FastAPI",
"language": "Python 3.9+",
"database": "SQLAlchemy + PostgreSQL",
"validation": "Pydantic",
"testing": "Pytest + httpx",
"documentation": "OpenAPI/Swagger (auto-generated)",
"async": "asyncio + asyncpg",
"serialization": "Pydantic models"
},
"conventions": {
"naming": {
"variables": "snake_case",
"functions": "snake_case",
"classes": "PascalCase",
"constants": "UPPER_SNAKE_CASE",
"modules": "lowercase_with_underscores",
"packages": "lowercase"
},
"fileStructure": {
"routers": "app/routers/{feature}.py",
"models": "app/models/{feature}.py",
"schemas": "app/schemas/{feature}.py",
"services": "app/services/{feature}.py",
"database": "app/database.py",
"tests": "tests/test_{feature}.py"
},
"imports": {
"style": "Absolute imports from project root",
"grouping": "Standard library, third-party, local",
"sorting": "Alphabetical within groups"
}
},
"qualityChecks": {
"lint": {
"command": "flake8 .",
"config": "PEP 8 compliance",
"autoFix": false
},
"format": {
"command": "black .",
"config": "88 character line limit",
"autoFix": true
},
"typeCheck": {
"command": "mypy .",
"config": "Strict type checking",
"autoFix": false
},
"build": {
"command": "python -m compileall .",
"checkSyntax": true,
"failOnError": true
},
"test": {
"unit": "pytest tests/",
"coverage": "pytest --cov=app tests/",
"minimumCoverage": 80
}
},
"codePatterns": {
"router": {
"structure": "Use APIRouter with proper prefixes and tags",
"endpoints": "Async functions with proper HTTP methods",
"dependencies": "Use Depends() for dependency injection",
"responses": "Type-annotated response models",
"errors": "Use HTTPException for error handling"
},
"model": {
"sqlalchemy": "Use SQLAlchemy declarative base",
"relationships": "Properly define foreign keys and relationships",
"validation": "Include proper field constraints",
"timestamps": "Include created_at, updated_at fields"
},
"schema": {
"pydantic": "Use Pydantic BaseModel for request/response schemas",
"validation": "Include proper field validation",
"serialization": "Configure proper serialization options",
"inheritance": "Use inheritance for variations (Create, Update, Response)"
},
"service": {
"async": "Use async/await for database operations",
"transactions": "Implement proper transaction handling",
"error_handling": "Comprehensive error handling with custom exceptions",
"logging": "Structured logging for debugging and monitoring"
},
"testing": {
"fixtures": "Use pytest fixtures for test setup",
"client": "Use TestClient for endpoint testing",
"database": "Use separate test database",
"mocking": "Mock external dependencies and services"
}
},
"context7Libraries": [
"fastapi",
"sqlalchemy",
"pydantic",
"pytest",
"httpx",
"asyncpg",
"uvicorn",
"alembic"
],
"commonImports": {
"router": [
"from fastapi import APIRouter, Depends, HTTPException, status",
"from sqlalchemy.orm import Session",
"from app.database import get_db"
],
"model": [
"from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Boolean",
"from sqlalchemy.ext.declarative import declarative_base",
"from sqlalchemy.orm import relationship",
"from datetime import datetime"
],
"schema": [
"from pydantic import BaseModel, EmailStr, validator",
"from typing import Optional, List",
"from datetime import datetime"
],
"service": [
"from sqlalchemy.orm import Session",
"from sqlalchemy.exc import IntegrityError",
"from fastapi import HTTPException, status"
]
},
"bestPractices": [
"Use async/await for I/O operations",
"Implement proper dependency injection with Depends()",
"Use Pydantic models for request/response validation",
"Follow PEP 8 style guidelines",
"Use type hints for all functions and variables",
"Implement proper error handling with HTTP status codes",
"Use SQLAlchemy for database operations with proper relationships",
"Write comprehensive tests with pytest",
"Use environment variables for configuration",
"Implement proper logging for debugging and monitoring"
],
"securityConsiderations": [
"Validate and sanitize all input data using Pydantic",
"Use proper authentication and authorization mechanisms",
"Hash passwords using secure algorithms (bcrypt)",
"Implement rate limiting to prevent abuse",
"Use HTTPS in production environments",
"Validate JWT tokens properly",
"Use parameterized queries to prevent SQL injection",
"Implement proper CORS configuration",
"Log security-relevant events for auditing",
"Use environment variables for sensitive configuration"
],
"asyncPatterns": [
"Use async def for route handlers that perform I/O",
"Use asyncio.gather() for concurrent operations",
"Implement proper connection pooling for database",
"Use async context managers for resource management",
"Handle exceptions properly in async functions",
"Use asyncio.create_task() for background tasks",
"Implement proper shutdown handling for async resources",
"Use async generators for streaming responses",
"Avoid blocking operations in async functions",
"Use proper async testing patterns with pytest-asyncio"
]
}

View File

@@ -0,0 +1,161 @@
{
"name": "React Frontend",
"description": "React 18+ with TypeScript, Tailwind CSS, and modern development practices",
"filePatterns": ["*.tsx", "*.ts", "*.jsx", "*.js"],
"excludePatterns": ["*.test.tsx", "*.test.ts", "*.spec.tsx", "*.spec.ts", "*.d.ts"],
"techStack": {
"framework": "React 18+",
"language": "TypeScript",
"styling": "Tailwind CSS",
"stateManagement": "React Query + Context API",
"routing": "React Router",
"testing": "React Testing Library + Jest",
"bundler": "Create React App / Vite",
"icons": "Heroicons + Lucide React",
"charts": "Chart.js + react-chartjs-2"
},
"conventions": {
"naming": {
"components": "PascalCase (UserProfile.tsx)",
"hooks": "camelCase with use prefix (useAuth.ts)",
"utilities": "camelCase (formatDate.ts)",
"constants": "UPPER_SNAKE_CASE",
"types": "PascalCase with T prefix",
"interfaces": "PascalCase with I prefix"
},
"fileStructure": {
"components": "src/components/{feature}/{ComponentName}.tsx",
"hooks": "src/hooks/use{HookName}.ts",
"services": "src/services/{feature}.service.ts",
"types": "src/types/{feature}.types.ts",
"contexts": "src/contexts/{Feature}Context.tsx",
"pages": "src/pages/{PageName}.tsx",
"tests": "src/components/{feature}/__tests__/{ComponentName}.test.tsx"
},
"imports": {
"style": "Absolute imports with @ prefix when available",
"grouping": "React, third-party, internal, relative",
"sorting": "Alphabetical within groups"
}
},
"qualityChecks": {
"lint": {
"command": "npx eslint --fix",
"config": "ESLint React + TypeScript + a11y",
"autoFix": true
},
"format": {
"command": "npx prettier --write",
"config": "80 character line limit, single quotes",
"autoFix": true
},
"build": {
"command": "npm run build",
"checkTypes": true,
"failOnError": true
},
"test": {
"unit": "npm test",
"coverage": "npm run test:coverage",
"minimumCoverage": 70
}
},
"codePatterns": {
"component": {
"structure": "Functional components with TypeScript interfaces",
"props": "Define interface for component props",
"state": "Use useState, useReducer for local state",
"effects": "Use useEffect with proper cleanup",
"memo": "Use React.memo for performance optimization when needed",
"forwardRef": "Use forwardRef for components that need ref access"
},
"hooks": {
"custom": "Extract reusable logic into custom hooks",
"naming": "Always start with 'use' prefix",
"dependencies": "Properly declare useEffect dependencies",
"cleanup": "Return cleanup functions from useEffect when needed"
},
"styling": {
"tailwind": "Use Tailwind utility classes",
"responsive": "Mobile-first responsive design",
"darkMode": "Support dark mode with Tailwind dark: prefix",
"accessibility": "Include proper ARIA labels and keyboard navigation"
},
"stateManagement": {
"local": "useState for component-local state",
"global": "Context API for app-wide state",
"server": "React Query for server state management",
"forms": "Controlled components with validation"
},
"testing": {
"render": "Use @testing-library/react render method",
"queries": "Use semantic queries (getByRole, getByLabelText)",
"userEvents": "Use @testing-library/user-event for interactions",
"mocking": "Mock external dependencies and API calls",
"accessibility": "Test with screen reader and keyboard navigation"
}
},
"context7Libraries": [
"react",
"react-dom",
"react-router-dom",
"@tanstack/react-query",
"tailwindcss",
"@testing-library/react",
"@testing-library/user-event",
"@heroicons/react",
"lucide-react",
"chart.js"
],
"commonImports": {
"component": [
"import React, { useState, useEffect, useCallback, useMemo } from 'react';",
"import { useNavigate, useParams } from 'react-router-dom';"
],
"hook": [
"import { useState, useEffect, useCallback, useContext } from 'react';",
"import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';"
],
"test": [
"import { render, screen, fireEvent, waitFor } from '@testing-library/react';",
"import userEvent from '@testing-library/user-event';",
"import { BrowserRouter } from 'react-router-dom';"
]
},
"bestPractices": [
"Use functional components with hooks instead of class components",
"Extract custom hooks for reusable stateful logic",
"Use React.memo for performance optimization when appropriate",
"Implement proper error boundaries for error handling",
"Use React Query for server state management",
"Follow accessibility guidelines (WCAG 2.1)",
"Implement responsive design with mobile-first approach",
"Use TypeScript for type safety",
"Write comprehensive tests for components and hooks",
"Optimize bundle size with code splitting and lazy loading"
],
"accessibilityRequirements": [
"Provide meaningful alt text for images",
"Use semantic HTML elements",
"Ensure proper heading hierarchy (h1, h2, h3)",
"Include ARIA labels for interactive elements",
"Support keyboard navigation for all interactive elements",
"Maintain sufficient color contrast ratios",
"Provide focus indicators for keyboard users",
"Use role attributes when semantic HTML is insufficient",
"Test with screen readers",
"Ensure form fields have associated labels"
],
"performanceOptimizations": [
"Use React.lazy for code splitting",
"Implement virtualization for long lists",
"Use useMemo and useCallback to prevent unnecessary re-renders",
"Optimize images with proper formats and sizes",
"Use React.memo for components that receive stable props",
"Implement proper error boundaries",
"Use React Query for efficient data fetching and caching",
"Minimize bundle size by importing only needed modules",
"Use web workers for heavy computations",
"Implement proper loading states and skeleton screens"
]
}