- Home
- Skills
- APIs & Backend
- Repair DNS, Discovery & Endpoint Failures
More screenshots
Works with the AI Agents you already use
Repair DNS, Discovery & Endpoint Failures
Repair DNS, Discovery & Endpoint Failures is a bounded ToolForge Labs workflow.
$1
Repair DNS, Discovery & Endpoint Failures
Example session with this skill installed
Our Node.js service is intermittently failing to connect to the internal database cluster after a pod restart. It seems like it's trying to hit old IP addresses. Here is our connection logic.
- Read your context and instructions
- Compiled the repair dns discovery
I have analyzed the connection logic and identified a stale endpoint caching issue within the application-level connection pool, which is ignoring the DNS TTL during pod reshuffles.
Repair for Stale Endpoint Resolution
The following fix introduces a TTL-aware resolver and forces the connection pool to refresh its internal cache when a connection is dropped or a threshold is met, ensuring it doesn't rely on OS-level caching that might be stale.
const dns = require('dns').promises;
const { Pool } = require('pg'); // Example using pg-pool
/**
* Enhanced resolver that respects TTL and handles address-family selection.
*/
class DiscoveryResolver {
constructor(hostname, ttl = 30000) {
this.hostname = hostname;
this.ttl = ttl;
this.cache = null;
this.lastLookup = 0;
}
async resolve() {
const now = Date.now();
if (this.cache && (now - this.lastLookup) < this.ttl) {
return this.cache;
}
// Resolve using address family 4 to avoid IPv6 stalls if not supported
const addresses = await dns.resolve4(this.hostname);
this.cache = addresses[Math.floor(Math.random() * addresses.length)];
this.lastLookup = now;
return this.cache;
}
}
// Invariant: Connection pool must refresh address if connection fails
const resolver = new DiscoveryResolver('db.internal.svc.cluster.local');
const pool = new Pool({
host: async () => await resolver.resolve(),
max: 20,
idleTimeoutMillis: 30000,
connectionTimeoutMillis: 2000
});
pool.on('error', (err, client) => {
console.error('Connection failure, invalidating cache');
resolver.lastLookup = 0; // Force refresh on next attempt
});
Deterministic Test Plan
| Test Case | Method | Expected Result |
|---|---|---|
| TTL Expiry | Inject Date.now mock | Resolver calls dns.resolve4 after 30s |
| Connection Error | Trigger pool.on('error') | lastLookup is reset to 0 immediately |
| Rotation | Mock multiple A records | Consecutive resolve() calls return different IPs |
Next steps
- Verify the
NDOTSsetting in yourresolv.confto ensure internal lookups aren't suffering from excessive search suffix traversals. - Check if the database client library supports dynamic host resolution; some libraries bind the IP at instantiation.
- Apply the
DiscoveryResolverpattern to your other internal microservices.
Connects securely to your tools. The creator never sees your data.
About this skill
Repair DNS, Discovery & Endpoint Failures is a bounded ToolForge Labs workflow. Repair DNS resolution, service discovery, stale endpoint caches, IPv4/IPv6 selection, endpoint rotation, and failover recovery. Works from repositories or partial logs/configuration. Produces bounded repair patterns and deterministic tests while preserving discovery policy, TTL semantics, routing boundaries, endpoint authorization, and public compatibility. It works from a full repository or partial evidence such as snippets, logs, configuration, traces, tickets, and architecture notes. The skill preserves existing product and security policy, separates verified facts from assumptions, avoids invented execution claims, and produces concrete repair or review steps with focused deterministic validation or traceable evidence.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.
Cannot verify production systems, external services, or facts that are not present in supplied evidence. With partial context it returns bounded diagnosis/review, explicit assumptions, and a deterministic validation plan rather than claiming successful execution.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 months ago
Permissions
Use a clean branch or a controlled review workspace. Supply repository files, logs, traces, configuration, or evidence needed for the task. Review all patches/findings before merge or operational action; keep production credentials and destructive production actions out of the workflow.