network-request-inspector
Intercept all HTTP requests/responses with full headers, timing breakdown (DNS, connect, TLS, TTFB, download), status codes, payload sizes, CORS validation, and redirect chain analysis via CDP Network domain.
What this skill does
# Network Request Inspector
Capture the complete HTTP request/response lifecycle for every resource loaded
by a page. Uses CDP Network domain events to record headers, timing
breakdowns, redirect chains, and payload sizes. Cross-references with the
browser Performance API for server timing data, and independently verifies
CORS and security headers via curl.
## When to Use
- Debugging slow page loads by identifying which requests have high TTFB or DNS latency.
- Investigating failed requests (4xx/5xx) and their response bodies.
- Validating CORS headers are correctly configured for cross-origin fetches.
- Tracing redirect chains to detect unnecessary hops or open redirects.
- Auditing per-domain connection overhead (DNS, TLS handshake) to justify preconnect hints.
- Measuring total transfer size and identifying oversized payloads.
## Prerequisites
- **Playwright MCP server** connected and responding (all `mcp__playwright__browser_*` tools available).
- **Chromium-based browser** required for CDP Network domain timing data.
- Target page must be reachable from the browser instance.
## Workflow
### Phase 1: Install CDP Network Interceptor
Set up CDP session with listeners for the full request lifecycle. This must be
done **before** navigating to the target page so that all requests are captured.
```javascript
browser_run_code({
code: `async (page) => {
const client = await page.context().newCDPSession(page);
await client.send('Network.enable', {
maxTotalBufferSize: 10000000,
maxResourceBufferSize: 5000000
});
const requests = new Map();
const redirectChains = new Map();
client.on('Network.requestWillBeSent', (params) => {
const entry = {
url: params.request.url,
method: params.request.method,
requestHeaders: params.request.headers,
timestamp: params.timestamp,
wallTime: params.wallTime,
initiator: {
type: params.initiator.type,
url: params.initiator.url || null,
lineNumber: params.initiator.lineNumber || null
},
resourceType: params.type,
redirectChain: []
};
// Track redirect chains
if (params.redirectResponse) {
const prev = requests.get(params.requestId);
if (prev) {
const chainId = redirectChains.get(params.requestId) || params.requestId;
redirectChains.set(params.requestId, chainId);
entry.redirectChain = [
...(prev.redirectChain || []),
{
url: prev.url,
status: params.redirectResponse.status,
headers: params.redirectResponse.headers
}
];
}
}
requests.set(params.requestId, entry);
});
client.on('Network.responseReceived', (params) => {
const req = requests.get(params.requestId);
if (req) {
req.status = params.response.status;
req.statusText = params.response.statusText;
req.responseHeaders = params.response.headers;
req.mimeType = params.response.mimeType;
req.protocol = params.response.protocol;
req.remoteAddress = params.response.remoteIPAddress
? params.response.remoteIPAddress + ':' + params.response.remotePort
: null;
req.securityState = params.response.securityState;
// Detailed timing breakdown (milliseconds relative to request start)
const t = params.response.timing;
if (t) {
req.timing = {
dnsStart: t.dnsStart,
dnsEnd: t.dnsEnd,
dnsMs: t.dnsEnd > 0 ? Math.round(t.dnsEnd - t.dnsStart) : 0,
connectStart: t.connectStart,
connectEnd: t.connectEnd,
connectMs: t.connectEnd > 0 ? Math.round(t.connectEnd - t.connectStart) : 0,
sslStart: t.sslStart,
sslEnd: t.sslEnd,
sslMs: t.sslEnd > 0 ? Math.round(t.sslEnd - t.sslStart) : 0,
sendStart: t.sendStart,
sendEnd: t.sendEnd,
sendMs: Math.round(t.sendEnd - t.sendStart),
receiveHeadersEnd: t.receiveHeadersEnd,
ttfbMs: Math.round(t.receiveHeadersEnd - t.sendEnd),
workerStart: t.workerStart,
workerReady: t.workerReady
};
}
// CORS analysis for cross-origin requests
const origin = new URL(params.response.url).origin;
const pageOrigin = req._pageOrigin;
if (pageOrigin && origin !== pageOrigin) {
const h = params.response.headers;
req.cors = {
crossOrigin: true,
allowOrigin: h['access-control-allow-origin'] || h['Access-Control-Allow-Origin'] || null,
allowMethods: h['access-control-allow-methods'] || h['Access-Control-Allow-Methods'] || null,
allowHeaders: h['access-control-allow-headers'] || h['Access-Control-Allow-Headers'] || null,
allowCredentials: h['access-control-allow-credentials'] || h['Access-Control-Allow-Credentials'] || null,
exposeHeaders: h['access-control-expose-headers'] || h['Access-Control-Expose-Headers'] || null
};
}
}
});
client.on('Network.loadingFinished', (params) => {
const req = requests.get(params.requestId);
if (req) {
req.encodedDataLength = params.encodedDataLength;
req.finished = true;
req.endTimestamp = params.timestamp;
if (req.timestamp) {
req.totalTimeMs = Math.round((params.timestamp - req.timestamp) * 1000);
}
}
});
client.on('Network.loadingFailed', (params) => {
const req = requests.get(params.requestId);
if (req) {
req.failed = true;
req.errorText = params.errorText;
req.canceled = params.canceled || false;
req.blockedReason = params.blockedReason || null;
req.corsErrorStatus = params.corsErrorStatus || null;
}
});
globalThis.__networkInspector = { client, requests };
return 'Network inspector installed — navigate to target page now';
}`
})
```
### Phase 2: Navigate and Capture
Navigate to the target page and wait for the network to settle.
```
browser_navigate({ url: "<target_url>" })
```
```javascript
browser_evaluate({
function: `() => {
// Store the page origin for CORS analysis
if (globalThis.__networkInspector) {
for (const [, req] of globalThis.__networkInspector.requests) {
req._pageOrigin = window.location.origin;
}
}
return window.location.origin;
}`
})
```
Wait for late-loading resources (analytics, lazy images, deferred scripts):
```
browser_wait_for({ time: 5 })
```
### Phase 3: Collect Performance API Resource Entries
Supplement CDP data with the browser Performance API for server timing and
decoded body sizes.
```javascript
browser_evaluate({
function: `() => {
const entries = performance.getEntriesByType('resource').map(e => ({
name: e.name,
initiatorType: e.initiatorType,
transferSize: e.transferSize,
decodedBodySize: e.decodedBodySize,
encodedBodySize: e.encodedBodySize,
duration: Math.round(e.duration),
serverTiming: e.serverTiming ? e.serverTiming.map(st => ({
name: st.name,
duration: st.duration,
description: st.description
})) : []
}));
return { count: entries.length, entries };
}`
})
```
### Phase 4: Harvest CDP Data
Extract the collected request map for analysis.
```javascript
browser_run_code({
code: `async (page) => {
const inspector = globalThis.__networkInspector;
if (!inspector) return { error: 'Inspector not installed' };
const results = [];
for (const [id, req] of inspector.requests) {
// Strip internal fields
const { _pageOrigin, ...clean } = req;
results.push({ requestId: id, ...clean });
}
// Sort by start timestamp
results.sort((a, b) => (a.timestamp || 0) - (b.timestamp || 0));
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.