Agent SkillsOpenAEV-Platform/openaev › review-performance

review-performance

GitHub

提供OpenAEV代码性能审查清单,涵盖N+1查询、获取策略、分页、索引及内存使用等检查项。用于PR审查或功能性能审计。

.github/skills/review-performance/SKILL.md OpenAEV-Platform/openaev

Trigger Scenarios

代码审查 性能审计

Install

npx skills add OpenAEV-Platform/openaev --skill review-performance -g -y
More Options

Non-standard path

npx skills add https://github.com/OpenAEV-Platform/openaev/tree/main/.github/skills/review-performance -g -y

Use without installing

npx skills use OpenAEV-Platform/openaev@review-performance

指定 Agent (Claude Code)

npx skills add OpenAEV-Platform/openaev --skill review-performance -a claude-code -g -y

安装 repo 全部 skill

npx skills add OpenAEV-Platform/openaev --all -g -y

预览 repo 内 skill

npx skills add OpenAEV-Platform/openaev --list

SKILL.md

Frontmatter
{
    "name": "review-performance",
    "description": "Performance review checklist for OpenAEV code: N+1 queries, fetch strategy, pagination, indexing, memory usage. Use when reviewing PRs or auditing performance of a feature."
}

Performance Review

Procedure

Step 1 — Check for N+1 queries

  • Search for loops that call the database:
    grep -rn "\.findById\|\.findAll\|\.existsById" openaev-api/src/main/java/ --include="*.java"
    
  • Verify that no findById() or findAll() is called inside a for / forEach / stream().map()
  • If a loop needs related entities, prefer findAllById() or a single @Query with IN clause
  • Check @ManyToMany / @OneToMany collections have @Fetch(FetchMode.SUBSELECT) to avoid N+1

Step 2 — Check fetch strategy

  • All associations should default to FetchType.LAZY
  • FetchType.EAGER is only acceptable for small, always-needed collections (e.g. capabilities)
  • Search for EAGER on potentially large collections:
    grep -rn "FetchType.EAGER" openaev-model/src/main/java/ --include="*.java"
    
  • Verify that LAZY collections are never accessed outside a transaction (causes LazyInitializationException)
  • For API endpoints returning IDs only: LAZY + subselect is preferred

Step 3 — Check pagination

  • All list/search REST endpoints MUST return Page<T>, not unbounded List<T>
  • Search for endpoints returning lists:
    grep -rn "List<.*>" openaev-api/src/main/java/io/openaev/api/ --include="*.java" | grep -i "public\|return"
    
  • Verify reasonable default page size (10-20) and max page size (100)
  • findAll() without pagination is only acceptable for small reference data tables

Step 4 — Check query efficiency

  • Search for findAll() that could be filtered at DB level:
    grep -rn "\.findAll()" openaev-api/src/main/java/ --include="*.java"
    
  • Verify existence checks use existsById() instead of findById().isPresent()
  • Verify bulk deletes use @Modifying @Query instead of loading + deleting one by one
  • Check that @Transactional(readOnly = true) is used on all read methods

Step 5 — Check database indexing

  • New columns used in WHERE / ORDER BY / JOIN should have indexes
  • FK columns in join tables should be indexed (composite PK covers one direction, check the other)
  • For new migrations, verify:
    grep -rn "CREATE TABLE\|CREATE INDEX\|ADD COLUMN" openaev-api/src/main/java/io/openaev/migration/ --include="*.java"
    

Step 6 — Check memory usage

  • No large byte[] or full file content loaded in memory — use streaming
  • No unbounded in-memory collections (e.g. findAll() result stored in a List)
  • Search for potential memory issues:
    grep -rn "byte\[\]\|ByteArrayOutputStream\|toByteArray" openaev-api/src/main/java/ --include="*.java"
    

Step 7 — Check transaction scope

  • Read-only operations use @Transactional(readOnly = true)
  • No long-running computation inside @Transactional (keep transactions short)
  • Check for MinIO / S3 / file I/O inside @Transactional: search for calls to fileService or uploadCatalogLogo inside methods annotated @Transactional — flag as blocking issue (DB connection held during network I/O). Required fix: split into initialise() (DB, transactional)
    • refreshAssets() (MinIO, non-transactional) called in sequence after the transaction commits.
  • Verify no @Transactional self-calls (Spring proxy bypass):
    grep -rn "this\." openaev-api/src/main/java/io/openaev/service/ --include="*.java" | grep -i "find\|get\|search\|create\|update\|delete"
    

Step 8 — Report

Document findings using conventional comments format:

  • issue (blocking): for performance bugs (N+1, missing pagination, unbounded queries)
  • suggestion (non-blocking): for optimizations (index, fetch strategy, caching)
  • note: for informational items (acceptable tradeoffs, future improvements)

Version History

  • 3.260818.1 Current 2026-08-20 12:00

Same Skill Collection

.github/skills/add-contract-output-type/SKILL.md
.github/skills/add-migration/SKILL.md
.github/skills/add-test/SKILL.md
.github/skills/create-feature-module/SKILL.md
.github/skills/reduce-tx-baseline/SKILL.md
.github/skills/review-code/SKILL.md
.github/skills/review-docs/SKILL.md
.github/skills/review-frontend/SKILL.md
.github/skills/review-migration/SKILL.md
.github/skills/review-multi-tenancy/SKILL.md
.github/skills/review-security/SKILL.md
.github/skills/activate-tenant-table/SKILL.md

Metadata

Files
0
Version
3.260818.1
Hash
cb2c3cfa
Indexed
2026-08-20 12:00

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 14:42
浙ICP备14020137号-1 $방문자$