بنقرة واحدة
performance-profiling
Performance profiling principles. Measurement, analysis, and optimization techniques.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Performance profiling principles. Measurement, analysis, and optimization techniques.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Senior agent organizer with expertise in assembling and coordinating multi-agent teams. Your focus spans task analysis, agent capability mapping, workflow design, and team optimization.
AI agent design principles. Agent loops, tool calling, memory architectures, multi-agent coordination, human-in-the-loop gates, and guardrails. Use when building AI agents, autonomous workflows, or any system where an LLM plans and executes multi-step tasks.
API design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.
Main application building orchestrator. Creates full-stack applications from natural language requests. Determines project type, selects tech stack, coordinates agents.
Architectural decision-making framework. Requirements analysis, trade-off evaluation, ADR documentation. Use when making architecture decisions or analyzing system design.
Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.
| name | performance-profiling |
| description | Performance profiling principles. Measurement, analysis, and optimization techniques. |
| allowed-tools | Read, Write, Edit, Glob, Grep |
| version | 1.0.0 |
| last-updated | "2026-03-12T00:00:00.000Z" |
| applies-to-model | gemini-2.5-pro, claude-3-7-sonnet |
Never optimize code you haven't measured. The bottleneck is almost never where you expect it to be.
Every performance investigation follows the same sequence:
Measure → Identify hotspot → Form hypothesis → Change one thing → Measure again
Breaking this sequence — jumping straight to "fix" — wastes time and creates new problems.
| Metric | Tool | Target |
|---|---|---|
| Request throughput | ab, k6, wrk | Baseline + stress test |
| P50/P95/P99 latency | DataDog, Grafana, k6 | P99 < SLA threshold |
| Memory usage | process.memoryUsage(), heap snapshot | Stable under load (no growth) |
| CPU usage | clinic.js flame chart | Identify blocking operations |
| Database query time | Query logs, pg_stat_statements | No query > 100ms without index |
| Metric | Tool | Target (2025 Core Web Vitals) |
|---|---|---|
| LCP (Largest Contentful Paint) | Lighthouse, CrUX | < 2.5s |
| INP (Interaction to Next Paint) | Lighthouse, Web Vitals | < 200ms |
| CLS (Cumulative Layout Shift) | Lighthouse | < 0.1 |
| Bundle size (JS) | npm run build + analyzer | < 200kB initial JS |
// ❌ 1 + N queries
const posts = await db.post.findMany();
for (const post of posts) {
post.author = await db.user.findUnique({ where: { id: post.authorId } });
}
// ✅ 2 queries total
const posts = await db.post.findMany({ include: { author: true } });
Detection: Enable query logging. Repeated identical queries differing only by ID = N+1.
-- EXPLAIN ANALYZE tells you if a query is doing a sequential scan
EXPLAIN ANALYZE SELECT * FROM orders WHERE user_id = $1;
-- Sequential scan on large table → add index
CREATE INDEX idx_orders_user_id ON orders(user_id);
// ❌ Synchronous CPU work blocks all requests
const result = JSON.parse(fs.readFileSync('huge.json', 'utf8'));
// ✅ Non-blocking
const content = await fs.promises.readFile('huge.json', 'utf8');
const result = JSON.parse(content); // still sync but no disk I/O blocking
npx vite-bundle-visualizer or @next/bundle-analyzerdate-fns instead of moment)// ❌ Recalculates on every render
function ExpensiveList({ items }) {
const sorted = items.sort((a, b) => a.name.localeCompare(b.name));
return sorted.map(item => <Item key={item.id} item={item} />);
}
// ✅ Recalculates only when items change
function ExpensiveList({ items }) {
const sorted = useMemo(
() => [...items].sort((a, b) => a.name.localeCompare(b.name)),
[items]
);
return sorted.map(item => <Item key={item.id} item={item} />);
}
| Tool | Platform | Best For |
|---|---|---|
clinic.js (clinic doctor) | Node.js | CPU flame charts, memory leaks |
| Chrome DevTools → Performance | Browser | JS execution, paint, layout |
EXPLAIN ANALYZE | PostgreSQL | Query plan analysis |
| Lighthouse | Web | Full Core Web Vitals audit |
k6 | Backend load testing | Throughput and latency under load |
| Script | Purpose | Run With |
|---|---|---|
scripts/lighthouse_audit.py | Lighthouse performance audit | python scripts/lighthouse_audit.py <url> |
When this skill produces a recommendation or design decision, structure your output as:
━━━ Performance Profiling Recommendation ━━━━━━━━━━━━━━━━
Decision: [what was chosen / proposed]
Rationale: [why — one concise line]
Trade-offs: [what is consciously accepted]
Next action: [concrete next step for the user]
─────────────────────────────────────────────────
Pre-Flight: ✅ All checks passed
or ❌ [blocking item that must be resolved first]
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
// VERIFY or check package.json / requirements.txt.Slash command: /review or /tribunal-full
Active reviewers: logic-reviewer · security-auditor
// VERIFY: [reason].Review these questions before confirming output:
✅ Did I rely ONLY on real, verified tools and methods?
✅ Is this solution appropriately scoped to the user's constraints?
✅ Did I handle potential failure modes and edge cases?
✅ Have I avoided generic boilerplate that doesn't add value?
CRITICAL: You must follow a strict "evidence-based closeout" state machine.