GEMINI.md
npm/ng-packs/packages/schematics/src/commands/ai-config/files/gemini/.gemini/GEMINI.mdGEMINI.md
Quality
76/100
Scores the file, not the repository.Length
1,001 words
24 headings · 1 code blocksRepository
14k
— · pushed 0 days agoLast changed
2 days ago
First indexed 2 days ago.1# 💻 ABP Full-Stack Development Rules2_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_34You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**.5You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**.67---89## 🧩 1. General Principles10- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers.11- Follow **modular architecture** — each layer or feature should be independently testable and reusable.12- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**.13- Prioritize **readability, maintainability, and performance**.14- Write **idiomatic** and **self-documenting** code.1516---1718## ⚙️ 2. ABP / .NET Development Rules1920### Code Style and Structure21- Follow ABP’s standard folder structure:22 - `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi`23- Write concise, idiomatic C# code using modern language features.24- Apply **modular and layered design** (Domain, Application, Infrastructure, UI).25- Prefer **LINQ** and **lambda expressions** for collection operations.26- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`).2728### Naming Conventions29- **PascalCase** → Classes, Methods, Properties30- **camelCase** → Local variables and private fields31- **UPPER_CASE** → Constants32- Prefix interfaces with **`I`** (e.g., `IUserRepository`).3334### C# and .NET Usage35- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment).36- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging).37- Integrate **Entity Framework Core** with ABP’s repository abstractions.3839### Syntax and Formatting40- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions).41- Use `var` when the type is clear.42- Use `string interpolation` and null-conditional operators.43- Keep code consistent and well-formatted.4445### Error Handling and Validation46- Use exceptions only for exceptional cases.47- Log errors via ABP’s built-in logging or a compatible provider.48- Validate models with **DataAnnotations** or **FluentValidation**.49- Rely on ABP’s global exception middleware for unified responses.50- Return consistent HTTP status codes and error DTOs.5152### API Design53- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**.54- Use **attribute-based routing** and versioning when needed.55- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization).5657### Performance Optimization58- Use `async/await` for I/O operations.59- Use `IDistributedCache` over `IMemoryCache`.60- Avoid N+1 queries — include relations explicitly.61- Implement pagination with `PagedResultDto`.6263### Key Conventions64- Use **Dependency Injection** via ABP’s DI system.65- Apply **repository pattern** or EF Core directly as needed.66- Use **AutoMapper** or ABP object mapping for DTOs.67- Implement **background jobs** with ABP’s job system or `IHostedService`.68- Follow **domain-driven design (DDD)** principles:69 - Business rules in Domain layer.70 - Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc.71- Avoid unnecessary dependencies between layers.7273### Testing74- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing.75- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`).76- Mock dependencies properly and use ABP’s test base classes.7778### Security79- Use **OpenIddict** for authentication & authorization.80- Implement permission checks through ABP’s infrastructure.81- Enforce **HTTPS** and properly configure **CORS**.8283### API Documentation84- Use **Swagger / OpenAPI** (Swashbuckle or NSwag).85- Add XML comments to controllers and DTOs.86- Follow ABP’s documentation conventions for module APIs.8788**Reference Best Practices:**89- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services)90- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories)91- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities)92- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services)93- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects)94- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration)9596---9798## 🌐 3. Angular / TypeScript Development Rules99100### TypeScript Best Practices101- Enable **strict type checking** in `tsconfig.json`.102- Use **type inference** when the type is obvious.103- Avoid `any`; use `unknown` or generics instead.104- Use interfaces and types for clarity and structure.105106### Angular Best Practices107- Prefer **standalone components** (no `NgModules`).108- Do **NOT** set `standalone: true` manually — it’s default.109- Use **signals** for state management.110- Implement **lazy loading** for feature routes.111- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators.112- Use **`NgOptimizedImage`** for static images (not base64).113114### Components115- Keep components small, focused, and reusable.116- Use `input()` and `output()` functions instead of decorators.117- Use `computed()` for derived state.118- Always set `changeDetection: ChangeDetectionStrategy.OnPush`.119- Use **inline templates** for small components.120- Prefer **Reactive Forms** over template-driven forms.121- Avoid `ngClass` → use `[class]` bindings.122- Avoid `ngStyle` → use `[style]` bindings.123124### State Management125- Manage **local component state** with signals.126- Use **`computed()`** for derived data.127- Keep state transformations **pure and predictable**.128- Avoid `mutate()` on signals — use `update()` or `set()`.129130### Templates131- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives.132- Keep templates minimal and declarative.133- Use the **async pipe** for observable bindings.134135### Services136- Design services for **single responsibility**.137- Provide services using `providedIn: 'root'`.138- Use the **`inject()` function** instead of constructor injection.139140### Component Replacement141ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`:142143**Key Features:**144- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations145- Replace layouts (Application, Account, Empty)146- Replace UI elements (Logo, Routes, NavItems)147148**Basic Usage:**149```typescript150import { ReplaceableComponentsService } from '@abp/ng.core';151import { eIdentityComponents } from '@abp/ng.identity';152153constructor(private replaceableComponents: ReplaceableComponentsService) {154 this.replaceableComponents.add({155 component: YourCustomComponent,156 key: eIdentityComponents.Roles,157 });158}159```160161**Important Notes:**162- Component templates must include `<router-outlet></router-outlet>` for layouts163- Use the second parameter as `true` for runtime replacement (refreshes route)164- Runtime replacement clears component state and re-runs initialization logic165166**📚 Full Documentation:**167For detailed examples, layout replacement, and advanced scenarios:168[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface)169170---171172## 🔒 4. Combined Full-Stack Practices173- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**.174- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation).175- Version APIs carefully and handle changes in Angular clients.176- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration.177- Apply **global error handling** and consistent response wrappers in both layers.178- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**.179180---181182## ✅ Summary183This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring:184- Code is **modular**, **performant**, and **maintainable**.185- Teams follow **consistent conventions** across backend and frontend.186- Every layer (Domain, Application, UI) is **clean, testable, and scalable**.187
Also in abpframework/abp
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| abpframework/abp.cursorrules · 14k | .cursorrules | teststylegitsecurity+3 | 55/100 | 2 days ago | |
| abpframework/abp.github/copilot-instructions.md · 14k | Copilot instructions | teststyletypesgit+4 | 61/100 | 2 days ago | |
| abpframework/abpnpm/ng-packs/packages/schematics/src/commands/ai-config/files/claude/.claude/CLAUDE.md · 14k | CLAUDE.md | testlint-formatstylearch+8 | 76/100 | 2 days ago | |
| abpframework/abpnpm/ng-packs/packages/schematics/src/commands/ai-config/files/copilot/.github/copilot-instructions.md · 14k | Copilot instructions | testlint-formatstylearch+8 | 76/100 | 2 days ago | |
| abpframework/abpnpm/ng-packs/packages/schematics/src/commands/ai-config/files/cursor/.cursor/rules/cursor.mdc · 14k | Cursor rules | testlint-formatstylearch+8 | 76/100 | 2 days ago | |
| abpframework/abpnpm/ng-packs/packages/schematics/src/commands/ai-config/files/windsurf/.windsurf/rules/guidelines.md · 14k | Windsurf rules | testlint-formatstylearch+8 | 76/100 | 2 days ago |
Diff against .cursorrules Diff against .github/copilot-instructions.md Diff against npm/ng-packs/packages/schematics/src/commands/ai-config/files/claude/.claude/CLAUDE.md Diff against npm/ng-packs/packages/schematics/src/commands/ai-config/files/copilot/.github/copilot-instructions.md Diff against npm/ng-packs/packages/schematics/src/commands/ai-config/files/cursor/.cursor/rules/cursor.mdc Diff against npm/ng-packs/packages/schematics/src/commands/ai-config/files/windsurf/.windsurf/rules/guidelines.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| nodejs/nodedeps/v8/GEMINI.md · 119k | GEMINI.md | buildteststylearch+4 | 77/100 | 3 days ago | |
| angular/angularadev/src/context/GEMINI.md · 101k | GEMINI.md | lint-formatstyletypes | 62/100 | 3 days ago |
