一键导入
linq-optimization-patterns
LINQ and EF Core query optimization for ABP Framework. N+1 prevention, eager loading, projections, pagination.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
LINQ and EF Core query optimization for ABP Framework. N+1 prevention, eager loading, projections, pagination.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Dynamic Playwright E2E testing assistant that adapts to any project type (React, Vue, Angular, Svelte, Next.js, Nuxt, or any web framework). Auto-detects build tools, routing, authentication, and provides tailored setup guidance. **CRITICAL: Never uses hardcoded credentials - always prompts user for valid URLs, environment, and real test credentials before generating login tests.** Use when: (1) setting up Playwright in a new project, (2) configuring Playwright for specific frameworks, (3) debugging framework-specific E2E testing issues, (4) optimizing selectors for React/Vue/Angular components, (5) handling authentication flows in tests (OIDC, JWT, sessions) with proper credential validation.
Generate optimized PostgreSQL queries for Entity Framework Core projects. Automatically discovers domain entities, relationships, and conventions to produce production-ready SQL. Use when: 1. You need complex PostgreSQL queries across multiple related entities 2. Working with ABP Framework and need multi-tenancy/soft delete patterns 3. Querying JSONB fields or need recursive CTEs 4. Building analytics/reporting queries with window functions 5. Optimizing existing queries with proper indexes and joins.
Converts requirements written as user stories (.md or .txt) into a structured API Specification document. Defines REST endpoints, request/response shapes, status codes, and permissions for each user story. Output is a .md api-spec file ready to feed into the api-spec-to-technical-plan skill. Use when you have user stories and want a clear API contract before any technical planning or code generation begins.
Generate ABP Framework data seeder contributors following project conventions. Auto-detects project structure, existing entities, namespaces, permission constants, and seeder patterns from the codebase — no manual configuration needed. Creates IDataSeedContributor implementations with proper dependency injection, logging, and tenant/feature awareness. Use when: (1) creating new seed data for entities, (2) adding initial/reference data, (3) scaffolding data initialization code, (4) maintaining data consistency across environments.
Checks requirements.md against the actual codebase to find ALL four types of gaps — requirements missing from code, requirements partially implemented, code logic not mentioned in requirements, and business rules in code that were never written into requirements. Automatically updates requirements.md in both directions — flags unimplemented requirements AND adds newly discovered code logic back into requirements. Use after code generation to keep requirements fully in sync with what was actually built.
Generate ABP ApplicationService, DTOs, interfaces, and API release documentation from Markdown or OpenAPI/Swagger API specifications. Works with ANY ABP project by auto-detecting existing patterns (response wrappers, error handling, validation, authorization). Use when the user provides an API spec and wants to scaffold services that match their project's conventions and generate release notes.
| name | linq-optimization-patterns |
| description | LINQ and EF Core query optimization for ABP Framework. N+1 prevention, eager loading, projections, pagination. |
| layer | 2 |
| tech_stack | ["dotnet","csharp","efcore","postgresql"] |
| topics | ["query-optimization","n-plus-one","eager-loading","projections","performance"] |
| depends_on | [] |
| complements | ["efcore-patterns","abp-framework-patterns"] |
| keywords | ["Include","ThenInclude","Select","AsNoTracking","AsSplitQuery","WhereIf","N+1","CountAsync"] |
Optimize LINQ queries and prevent performance anti-patterns in EF Core/ABP applications.
This skill covers efficient data access patterns for Entity Framework Core in ABP Framework applications. Focus areas: N+1 prevention, pagination, projections, and batch loading.
When to use: Reviewing queries, fixing slow endpoints, implementing list APIs.
| Concept | Description | Details |
|---|---|---|
| Eager Loading | Load related entities in single query via JOIN | [patterns/eager-loading.md] |
| Projection | Transform to DTO at database level | [patterns/projection.md] |
| Batch Loading | Load related data for multiple parents in one query | [patterns/batch-loading.md] |
| Pagination | Efficient paging with count optimization | [patterns/pagination.md] |
| Anti-Pattern | Severity | Detect | Impact | Details |
|---|---|---|---|---|
| N+1 Query | 🔴 HIGH | foreach.*await.*Repo | N+1 DB calls | [anti-patterns/n-plus-one.md] |
| Count After Pagination | 🔴 HIGH | Count.*after.*ToList | Double query | [anti-patterns/count-after-pagination.md] |
| Full Table Load | 🔴 HIGH | GetListAsync() then filter | Memory explosion | [anti-patterns/full-table-load.md] |
| In-Memory Join | 🔴 HIGH | Multiple ToListAsync | Cartesian in memory | [anti-patterns/in-memory-join.md] |
Need related data for display?
├─ Single entity ──────────► Include() → [patterns/eager-loading.md]
├─ List of entities ───────► Batch load → [patterns/batch-loading.md]
└─ Only specific fields ───► Projection → [patterns/projection.md]
Need paginated list with count?
└─ Always count FIRST ─────► CountAsync() → [patterns/pagination.md]
Loading data then filtering?
├─ Filter in query ────────► WhereIf() → ✅ Correct
└─ Filter after ToList ────► ❌ Anti-pattern → [anti-patterns/full-table-load.md]
Run these to find issues in your codebase:
# N+1: Query inside loop
grep -rn "foreach.*await.*Repository\|for.*await.*GetAsync" src/
# Count after pagination
grep -rn "\.Count().*ToList\|ToList.*\.Count()" src/
# Full table load
grep -rn "GetListAsync()" src/ | grep -v "Where\|Any\|First"
# In-memory filtering
grep -rn "ToListAsync().*\.Where\|GetListAsync.*\.Where" src/
| ID | Rule | Related |
|---|---|---|
| R001 | Execute CountAsync() before Skip/Take | [anti-patterns/count-after-pagination.md] |
| R002 | Apply Where clauses before ToListAsync() | [anti-patterns/full-table-load.md] |
| R003 | Load related entities via Include or batch, not in loops | [anti-patterns/n-plus-one.md] |
| R004 | Use Select() projection for DTO returns | [patterns/projection.md] |
| R005 | Use AsNoTracking() for read-only queries | [patterns/projection.md] |
| R006 | Use AsSplitQuery() for multiple collection includes | [patterns/eager-loading.md] |
Review checklist for LINQ queries:
foreach/for with await repository calls insideCountAsync() executed before Skip/TakeGetListAsync() followed by .Where() in memoryFirstOrDefault inside Select projectionsInclude or batch querySelect() projection used for DTO returnsAsNoTracking() used for read-only queriesAsSplitQuery()This skill is used by: