.agents/skills/ef-core-database/SKILL.md
Sử dụng kỹ năng này khi có yêu cầu liên quan đến Cơ sở dữ liệu (Database), thiết kế Entity Models, hoặc viết các câu truy vấn LINQ bằng Entity Framework Core. Kỹ năng này đảm bảo việc thực thi các tác vụ CRUD được tối ưu hiệu suất, tránh lỗi N+1 query, và xử lý quan hệ dữ liệu chuẩn xác.
npx skillsauth add Namhahaha1110/WebTrangSuc ef-core-databaseInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Khi làm việc với DbContext, Models, hoặc viết các câu truy vấn LINQ, hãy áp dụng các nguyên tắc tối ưu hiệu suất sau:
[Required], [MaxLength]) hoặc Fluent API trong OnModelCreating để định nghĩa cấu trúc bảng chính xác.Products, Categories)..Include() và .ThenInclude(). Đừng để EF Core tự động Lazy Load từng dòng trong vòng lặp..AsNoTracking() vào chuỗi LINQ để giải phóng bộ nhớ, giúp web chạy nhanh hơn..Select(p => new { p.Name, p.Price }) hoặc map thẳng ra DTO thay vì kéo toàn bộ cột trong bảng về..ToListAsync(), .FirstOrDefaultAsync(), .SaveChangesAsync(). Không bao giờ dùng .ToList() hoặc .FirstOrDefault() trong các hàm xử lý dữ liệu web.using Microsoft.EntityFrameworkCore;
public async Task<PagedResult<ProductViewModel>> GetPagedProductsAsync(int pageIndex, int pageSize)
{
var query = _context.Products
.Include(p => p.Category) // Giải quyết N+1 query
.AsNoTracking() // Tối ưu hiệu suất chỉ đọc
.Where(p => p.IsActive); // Bộ lọc cơ bản
var totalRecords = await query.CountAsync();
var items = await query
.OrderByDescending(p => p.CreatedDate)
.Skip((pageIndex - 1) * pageSize)
.Take(pageSize)
.Select(p => new ProductViewModel
{
Id = p.Id,
Name = p.Name,
Price = p.Price,
CategoryName = p.Category.Name
})
.ToListAsync();
return new PagedResult<ProductViewModel>(items, totalRecords, pageIndex, pageSize);
}
development
Optimize website and web application performance including loading speed, Core Web Vitals, bundle size, caching strategies, and runtime performance
tools
UI/UX design intelligence for web and mobile. Includes 50+ styles, 161 color palettes, 57 font pairings, 161 product types, 99 UX guidelines, and 25 chart types across 10 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, and HTML/CSS). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, and check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, and mobile app. Elements: button, modal, navbar, sidebar, card, table, form, and chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, and flat design. Topics: color systems, accessibility, animation, layout, typography, font pairing, spacing, interaction states, shadow, and gradient. Integrations: shadcn/ui MCP for component search and examples.
development
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.
development
Sử dụng kỹ năng này khi có lỗi xảy ra trong quá trình biên dịch (build errors), lỗi runtime, màn hình vàng (Yellow Screen of Death) của ASP.NET, hoặc khi người dùng yêu cầu "hãy fix lỗi này giúp tôi". Chuyên gia này rành rẽ về Entity Framework, cú pháp Razor, và vòng đời của .NET Core.