Back to list
dupipcom

the-optimizer

by dupipcom

Dupip Monorepo

0🍴 0📅 Jan 24, 2026

SKILL.md


name: the-optimizer description: Identifies and fixes performance bottlenecks in the application. license: HPL3-ECO-NC-ND-A 2026

Task: Analyze and optimize application performance, focusing on database queries, bundle size, and runtime efficiency.

Role: You're a performance engineer optimizing the application for speed and efficiency.

Performance Analysis

1. Database Query Analysis

# Find potentially slow queries (missing select)
grep -r "findMany\|findFirst\|findUnique" --include="*.ts" src/app/api/ | grep -v "select:"

# Find N+1 query patterns
grep -r "for.*await.*prisma\|forEach.*await.*prisma" --include="*.ts" src/

2. Bundle Analysis

# Analyze bundle size
npm run build
# Check .next/analyze if configured

# Find large imports
grep -r "import.*from" --include="*.tsx" src/components/ | grep -v "^//"

3. API Response Times

Check slow endpoints in production logs or add timing:

const start = Date.now()
// ... operation
console.log(`Operation took ${Date.now() - start}ms`)

Optimization Techniques

Database Queries

// BAD: Fetches all fields
const users = await prisma.user.findMany()

// GOOD: Select only needed fields
const users = await prisma.user.findMany({
  select: {
    id: true,
    profiles: {
      select: { data: true }
    }
  }
})

Pagination

// Always paginate large datasets
const items = await prisma.item.findMany({
  take: limit,
  skip: (page - 1) * limit,
  orderBy: { createdAt: 'desc' }
})

Batch Queries

// BAD: N+1 queries
for (const id of ids) {
  const item = await prisma.item.findUnique({ where: { id } })
}

// GOOD: Single batch query
const items = await prisma.item.findMany({
  where: { id: { in: ids } }
})

Parallel Queries

// Fetch independent data in parallel
const [users, items, stats] = await Promise.all([
  prisma.user.findMany(),
  prisma.item.findMany(),
  prisma.stat.aggregate()
])

Indexes

// Add indexes for frequently queried fields
model Item {
  userId    String @db.ObjectId
  status    String
  createdAt DateTime

  @@index([userId, status])
  @@index([createdAt])
}

Frontend Optimization

Code Splitting

// Lazy load heavy components
const HeavyComponent = dynamic(() => import('./HeavyComponent'), {
  loading: () => <Skeleton />,
  ssr: false
})

Image Optimization

// Use next/image
import Image from 'next/image'

<Image
  src={url}
  width={200}
  height={200}
  loading="lazy"
  placeholder="blur"
/>

Memoization

// Memoize expensive calculations
const memoizedValue = useMemo(() => expensiveCalculation(data), [data])

// Memoize callbacks
const handleClick = useCallback(() => { ... }, [dependency])

Performance Targets

MetricTarget
API response time< 500ms
Page load (initial)< 3s
Page navigation< 1s
Database query< 100ms
Bundle size (main)< 200KB

Monitoring Checklist

  • No queries without select
  • No N+1 query patterns
  • Large datasets paginated
  • Images optimized with next/image
  • Heavy components lazy-loaded
  • Database indexes for common queries

Output

Report optimization findings:

  1. Current performance metrics
  2. Identified bottlenecks
  3. Applied optimizations
  4. Performance improvement achieved

Score

Total Score

50/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

0/5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon