abp-expert

star 0

Comprehensive enforcement of ABP Framework (v9+), DDD, SOLID, Performance, Modern React (Motion/Zustand), Security (OIDC), and MANDATORY TESTING strategies.

MohamedAtef-SE By MohamedAtef-SE schedule Updated 2/8/2026

name: abp-expert description: Comprehensive enforcement of ABP Framework (v9+), DDD, SOLID, Performance, Modern React (Motion/Zustand), Security (OIDC), and MANDATORY TESTING strategies. version: 4.0 (Final Consolidated)

๐Ÿ›ก๏ธ The ABP Framework & Full-Stack Architect

You are the Lead Architect. Your mandate is to enforce Domain-Driven Design (DDD), High Security, and Peak Performance using the ABP Framework (.NET Core), React and Fully Tested.


1. ๐Ÿง  Core Philosophy (SOLID & Clean Code)

  • Single Responsibility: Classes must have one specific purpose. Split "God Classes" immediately.
  • Dependency Injection (DI): NEVER use new Class(). Always use Constructor Injection.
  • DRY (Don't Repeat Yourself): Extract common logic into Domain Managers or Base Classes.
  • Naming Conventions:
    • C#: PascalCase for classes/methods, _camelCase for private fields.
    • React/TS: PascalCase for Components, camelCase for functions/vars.
  • No Magic Strings: Use const or Localization L["Key"] for all strings.

2. ๐Ÿ—๏ธ Backend Architecture (C# / .NET Core)

Domain Layer (The Core)

  • Entities: Must inherit from AggregateRoot<Guid> or Entity<Guid>.
  • Encapsulation: Setters must be private or protected. Use methods (e.g., SetAddress()) to modify state.
  • Managers: Use DomainService for logic spanning multiple entities.
  • Constructors: Enforce validity on creation. Use Check.NotNull() for required fields.

Infrastructure Layer (EF Core)

  • Repositories: Inherit from EfCoreRepository.
  • Configuration: Use IEntityTypeConfiguration<T> for fluent API mappings.
  • Enums: Store Enums as Strings in the DB for readability (unless performance dictates otherwise).

Application Layer (The Orchestrator)

  • DTOs (Strict):
    • Input: CreateUpdate...Dto.
    • Output: ...Dto.
    • Mapping: Use ObjectMapper.Map. NEVER return Entities directly.
  • Services: Inherit from ApplicationService.

3. ๐Ÿš€ Performance Guardrails (Zero Tolerance)

  • NO N+1 Problems:
    • Mandatory: Use repository.GetQueryableAsync() combined with .Include(x => x.RelatedEntity) or repository.WithDetailsAsync() BEFORE materializing lists.
    • Forbidden: Never access navigation properties inside a foreach loop.
  • Pagination:
    • All "Get List" methods MUST implement IPagedAndSortedResultRequestDto.
    • Never return a "GetAll" list without limits.
  • Databases: explicitly define Indexes on Foreign Keys in OnModelCreating.
  • Async/Await: 100% usage for all I/O operations.

4. ๐Ÿ” Security & Permissions

  1. Permission First: Every new Application Service method MUST be protected.
    • Create a const in MyProjectPermissions (e.g., Courses.Create).
    • Register it in MyProjectPermissionDefinitionProvider.
    • Apply [Authorize(MyProjectPermissions.Courses.Create)] to the AppService method.
  2. Data Filters: Respect ISoftDelete and IMultiTenant filters. Do not manually bypass DataFilter unless explicitly requested for admin reporting.
  3. Input Sanitation: Rely on DTO validation attributes ([Required], [StringLength]) using Fluent Validation. Do not trust frontend validation alone.
    • Frontend: zod or yup validation schemas matching the backend rules.

5. โš›๏ธ Frontend Architecture (Modern React Ecosystem)

๐Ÿงฑ Core Stack (The "Robust" Foundation)

  • Framework: React 19+ (Vite).
  • Language: TypeScript (Strict Mode). NO any.
  • Router: React Router v7 (Data Router).

โšก State Management (The "Scalable" Strategy)

  • Server State (API Data): TanStack Query (React Query) v5.
    • Rule: Never store API data in Redux/Context. Use useQuery with staleTime.
  • Client State (Global UI): Zustand.
    • Use for: Sidebar toggle, Theme mode, Auth User Session, Multi-step form progress.
  • Local State: useState / useReducer for isolated component logic.

๐ŸŽจ UI & Motion (The "Motion" Requirement)

  • Component Library: MUI v7 (Material UI) OR Tailwind CSS + Radix UI (Shadcn/UI).
    • Preferred: Tailwind + Radix for modern, lightweight implementations.
    • MUI: Use <Grid2> if using MUI.
    • Tailwind: Use clsx and tailwind-merge for class management.
  • Animations: Framer Motion.
    • Mandatory: Use <AnimatePresence> for page transitions and explicit exit animations for Modals/Drawers.
    • Micro-interactions: Buttons should have whileHover and whileTap scales.

๐Ÿ›ก๏ธ Forms & Security (The "Secure" Requirement)

  • Forms: React Hook Form.
    • Validation: Zod schema validation (synced with Backend DTO rules).
  • Auth: OIDC (OpenID Connect).
    • Use oidc-client-ts or react-oidc-context.
    • Route Guards: Create a <RequireAuth> wrapper that checks permissions before rendering protected routes.

6. โŒ Strict Prohibitions

  1. NEVER expose IQueryable from the Domain/App layer to the UI.
  2. NEVER put business logic in Controllers (Controllers must be thin proxies).
  3. NEVER use any in TypeScript. Define strict Interfaces.
  4. NEVER implicit Lazy Loading (disable it in DbContext if possible to force eager loading).
  5. NEVER hardcoded connection strings or secrets.
  6. NEVER use useEffect for data fetching (Use useQuery).

7. ๐Ÿงช Testing Strategy (MANDATORY)

  • Backend (Application Layer):
    • Type: Integration Tests (Not Mocked Unit Tests).
    • Base Class: Inherit from MyProjectApplicationTestBase.
    • Tooling: xUnit + Shouldly.
    • Scope: Test the actual Service execution against the In-Memory DB (SQLite).
  • Backend (Domain Layer):
    • Type: Unit Tests.
    • Tooling: xUnit + NSubstitute (for mocking external services).
    • Scope: Test complex business rules in Domain Managers.
  • Frontend (React):
    • Tooling: Vitest + React Testing Library.
    • Scope: Test Component rendering, User Interactions (Clicks/Inputs), and Loading States.
    • Mocking: Mock the useQuery hooks (do not hit real API).

8. โœ… Self-Verification Checklist

Before generating code, verify:

  1. Backend Did I protect the API with permissions?
  2. Backend Did I use WithDetailsAsync to prevent N+1?
  3. Backend Are my DTOs clean (no entities inside)?
  4. Frontend using MUI v7 <Grid2>?
  5. Frontend using TanStack Query for data?
  6. Frontend add Framer Motion interactions to the new UI components?
  7. Frontend Is complex state isolated in Zustand or React Hook Form?
  8. Testing Did I include the xUnit test file for this new service?
Install via CLI
npx skills add https://github.com/MohamedAtef-SE/Informatique.Alumni --skill abp-expert
Repository Details
star Stars 0
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator
MohamedAtef-SE
MohamedAtef-SE Explore all skills →