B
backend-latency-profiler-helper
About backend-latency-profiler-helper
A skill for locating and addressing API latency bottlenecks in backend services. It outlines endpoint measurement, log-based analysis, cause assessment, and a prioritized fix roadmap.
Key features
- 01Measure request latency
- 02Rank slow endpoints from logs
- 03Assess likely bottleneck causes
- 04Create a prioritized fix roadmap
- 05Configure performance monitoring
Use cases
- 01Find endpoints exceeding a latency threshold
- 02Use request logs to compare endpoint performance
- 03Plan fixes for database indexes and N+1 queries
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ patricio0312rev/ skills --skill backend-latency-profiler-helperAfter installing, type/backend-latency-profiler-helperin Claude Code to confirm it loaded.
Details
From the project READMEBackend Latency Profiler Helper
Find and fix API performance bottlenecks.
Slow Endpoint Detection
// Middleware to track latency
app.use((req, res, next) => {
const start = Date.now();
res.on("finish", () => {
const duration = Date.now() - start;
if (duration > 1000) {
logger.warn(
{
endpoint: req.path,
method: req.method,
duration_ms: duration,
userId: req.user?.id,
},
"Slow request detected"
);
}
});
next();
});
Top Slow Endpoints
-- Query from logs
SELECT
endpoint,
AVG(duration_ms) as avg_ms,
MAX(duration_ms) as max_ms,
COUNT(*) as requests
FROM request_logs
WHERE created_at > NOW() - INTERVAL '1 day'
GROUP BY endpoint
HAVING AVG(duration_ms) > 500
ORDER BY avg_ms DESC
LIMIT 10;
Suspected Causes
interface PerformanceBottleneck {
endpoint: string;
avgLatency: number;
suspectedCauses: string[];
fixPriority: "high" | "medium" | "low";
}
const bottlenecks: PerformanceBottleneck[] = [
{
endpoint: "GET /api/users/:id",
avgLatency: 2500,
suspectedCauses: [
"N+1 query fetching user orders",
"No database index on user_id",
"Expensive JSON serialization",
],
fixPriority: "high",
},
];
Fix Roadmap
# Performance Fix Roadmap
## Week 1: Quick Wins
- [ ] Add database indexes
- [ ] Enable response caching
- [ ] Fix N+1 queries
## Week 2: Medium Effort
- [ ] Optimize slow database queries
- [ ] Implement Redis caching
- [ ] Add connection pooling
## Week 3: Long-term
- [ ] Database query optimization
- [ ] Service decomposition
- [ ] CDN integration
Output Checklist
- Slow endpoints identified
- Causes analyzed
- Fix roadmap created
- Monitoring configured ENDFILE
Comments
Markdown supported