environment-setup-guide
Guide developers through setting up development environments with proper tools, dependencies, and configurations
guidewire-rate-limits
Manage Guidewire Cloud API rate limits, quotas, and throttling. Use when encountering 429 errors, optimizing API call patterns, or implementing rate limit handling strategies. Trigger with phrases like "guidewire rate limit", "api quota", "429 error", "throttling", "api limits guidewire".
Full skill instructions
Understand and manage Guidewire Cloud API rate limits, implement proper throttling, and optimize API usage patterns.
| Limit Type | Default Value | Scope |
|---|---|---|
| Requests per second | 50 | Per tenant |
| Requests per minute | 1,000 | Per tenant |
| Requests per hour | 30,000 | Per tenant |
| Concurrent requests | 25 | Per application |
| Payload size | 10 MB | Per request |
| Query result limit | 1,000 | Per request |
HTTP/1.1 200 OK
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 847
X-RateLimit-Reset: 1706312400
X-RateLimit-Scope: tenant
Retry-After: 60
// Track rate limits from response headers
interface RateLimitInfo {
limit: number;
remaining: number;
resetTime: Date;
scope: string;
}
class RateLimitTracker {
private current: RateLimitInfo | null = null;
updateFromResponse(response: AxiosResponse): void {
const headers = response.headers;
this.current = {
limit: parseInt(headers['x-ratelimit-limit'] || '1000'),
remaining: parseInt(headers['x-ratelimit-remaining'] || '1000'),
resetTime: new Date(parseInt(headers['x-ratelimit-reset'] || '0') * 1000),
scope: headers['x-ratelimit-scope'] || 'tenant'
};
// Warn if approaching limit
if (this.current.remaining < this.current.limit * 0.1) {
console.warn(`Rate limit warning: ${this.current.remaining}/${this.current.limit} remaining`);
}
}
canMakeRequest(): boolean {
if (!this.current) return true;
return this.current.remaining > 0 || new Date() > this.current.resetTime;
}
getWaitTime(): number {
if (!this.current || this.current.remaining > 0) return 0;
return Math.max(0, this.current.resetTime.getTime() - Date.now());
}
}
// Exponential backoff with jitter
interface BackoffConfig {
initialDelayMs: number;
maxDelayMs: number;
multiplier: number;
jitterFactor: number;
}
class ExponentialBackoff {
private attempt: number = 0;
private config: BackoffConfig;
constructor(config: Partial<BackoffConfig> = {}) {
this.config = {
initialDelayMs: config.initialDelayMs || 1000,
maxDelayMs: config.maxDelayMs || 60000,
multiplier: config.multiplier || 2,
jitterFactor: config.jitterFactor || 0.1
};
}
getNextDelay(): number {
const baseDelay = Math.min(
this.config.initialDelayMs * Math.pow(this.config.multiplier, this.attempt),
this.config.maxDelayMs
);
// Add jitter to prevent thundering herd
const jitter = baseDelay * this.config.jitterFactor * (Math.random() * 2 - 1);
this.attempt++;
return Math.round(baseDelay + jitter);
}
reset(): void {
this.attempt = 0;
}
}
// Usage in API client
async function makeRequestWithBackoff<T>(
request: () => Promise<T>,
maxRetries: number = 5
): Promise<T> {
const backoff = new ExponentialBackoff();
for (let attempt = 0; attempt < maxRetries; attempt++) {
try {
const result = await request();
backoff.reset();
return result;
} catch (error) {
if (error.response?.status === 429) {
const retryAfter = parseInt(error.response.headers['retry-after'] || '0') * 1000;
const delay = Math.max(retryAfter, backoff.getNextDelay());
console.log(`Rate limited, waiting ${delay}ms before retry ${attempt + 1}/${maxRetries}`);
await sleep(delay);
continue;
}
throw error;
}
}
throw new Error(`Request failed after ${maxRetries} retries due to rate limiting`);
}
// Queue requests to stay under rate limits
import PQueue from 'p-queue';
class RateLimitedClient {
private queue: PQueue;
private rateLimiter: RateLimitTracker;
constructor(requestsPerSecond: number = 40) {
this.queue = new PQueue({
concurrency: 10,
interval: 1000,
intervalCap: requestsPerSecond
});
this.rateLimiter = new RateLimitTracker();
}
async request<T>(config: AxiosRequestConfig): Promise<T> {
return this.queue.add(async () => {
// Wait if rate limited
const waitTime = this.rateLimiter.getWaitTime();
if (waitTime > 0) {
console.log(`Waiting ${waitTime}ms due to rate limit`);
await sleep(waitTime);
}
const response = await axios.request<T>(config);
this.rateLimiter.updateFromResponse(response);
return response.data;
});
}
// Batch requests efficiently
async batchRequest<T, R>(
items: T[],
requestFn: (item: T) => Promise<R>,
options: { batchSize?: number; delayBetweenBatches?: number } = {}
): Promise<R[]> {
const { batchSize = 10, delayBetweenBatches = 100 } = options;
const results: R[] = [];
for (let i = 0; i < items.length; i += batchSize) {
const batch = items.slice(i, i + batchSize);
const batchResults = await Promise.all(batch.map(item => this.request(requestFn(item))));
results.push(...batchResults);
if (i + batchSize < items.length) {
await sleep(delayBetweenBatches);
}
}
return results;
}
}
// Use includes to reduce API calls
// BAD: Multiple API calls
async function getAccountWithPoliciesBad(accountId: string): Promise<any> {
const account = await client.get(`/account/v1/accounts/${accountId}`);
const policies = await client.get(`/account/v1/accounts/${accountId}/policies`);
const contacts = await client.get(`/account/v1/accounts/${accountId}/contacts`);
return { account, policies, contacts };
}
// GOOD: Single call with includes
async function getAccountWithPoliciesGood(accountId: string): Promise<any> {
return client.get(`/account/v1/accounts/${accountId}?include=policies,contacts`);
}
// Use filtering to reduce response size
// BAD: Get all, filter client-side
async function getActivePoliciesBad(accountId: string): Promise<Policy[]> {
const response = await client.get(`/account/v1/accounts/${accountId}/policies`);
return response.data.filter((p: Policy) => p.status.code === 'InForce');
}
// GOOD: Server-side filtering
async function getActivePoliciesGood(accountId: string): Promise<Policy[]> {
const response = await client.get(
`/account/v1/accounts/${accountId}/policies?filter=status:eq:InForce`
);
return response.data;
}
// Use pagination efficiently
async function getAllPolicies(accountId: string): Promise<Policy[]> {
const policies: Policy[] = [];
let cursor: string | undefined;
do {
const response = await client.get(
`/account/v1/accounts/${accountId}/policies`,
{ params: { pageSize: 100, cursor } }
);
policies.push(...response.data);
cursor = response.links?.next;
} while (cursor);
return policies;
}
// Circuit breaker for rate limit protection
enum CircuitState {
CLOSED = 'CLOSED',
OPEN = 'OPEN',
HALF_OPEN = 'HALF_OPEN'
}
class CircuitBreaker {
private state: CircuitState = CircuitState.CLOSED;
private failures: number = 0;
private lastFailureTime: Date | null = null;
private successCount: number = 0;
constructor(
private failureThreshold: number = 5,
private resetTimeoutMs: number = 60000,
private halfOpenSuccessThreshold: number = 3
) {}
async execute<T>(operation: () => Promise<T>): Promise<T> {
if (this.state === CircuitState.OPEN) {
if (this.shouldAttemptReset()) {
this.state = CircuitState.HALF_OPEN;
this.successCount = 0;
} else {
throw new Error('Circuit breaker is open');
}
}
try {
const result = await operation();
this.onSuccess();
return result;
} catch (error) {
this.onFailure(error);
throw error;
}
}
private onSuccess(): void {
this.failures = 0;
if (this.state === CircuitState.HALF_OPEN) {
this.successCount++;
if (this.successCount >= this.halfOpenSuccessThreshold) {
this.state = CircuitState.CLOSED;
console.log('Circuit breaker closed');
}
}
}
private onFailure(error: any): void {
if (error.response?.status === 429) {
this.failures++;
this.lastFailureTime = new Date();
if (this.failures >= this.failureThreshold) {
this.state = CircuitState.OPEN;
console.warn('Circuit breaker opened due to rate limiting');
}
}
}
private shouldAttemptReset(): boolean {
if (!this.lastFailureTime) return true;
return Date.now() - this.lastFailureTime.getTime() >= this.resetTimeoutMs;
}
}
// Gosu implementation of rate limit handling
package gw.integration.ratelimit
uses gw.api.util.Logger
uses java.util.concurrent.Semaphore
uses java.util.concurrent.TimeUnit
class RateLimiter {
private static final var LOG = Logger.forCategory("RateLimiter")
private var _permits : Semaphore
private var _lastRefill : long
private var _refillInterval : long
private var _maxPermits : int
construct(maxRequestsPerSecond : int) {
_maxPermits = maxRequestsPerSecond
_permits = new Semaphore(maxRequestsPerSecond)
_lastRefill = System.currentTimeMillis()
_refillInterval = 1000
}
function acquire() : boolean {
refillPermits()
return _permits.tryAcquire(5, TimeUnit.SECONDS)
}
private function refillPermits() {
var now = System.currentTimeMillis()
var elapsed = now - _lastRefill
if (elapsed >= _refillInterval) {
var periods = (elapsed / _refillInterval) as int
var permitsToAdd = Math.min(periods * _maxPermits, _maxPermits - _permits.availablePermits())
_permits.release(permitsToAdd)
_lastRefill = now
}
}
function executeWithRateLimit<T>(operation() : T) : T {
if (!acquire()) {
LOG.warn("Rate limit exceeded, request blocked")
throw new RateLimitException("Rate limit exceeded")
}
try {
return operation()
} finally {
// Permit is consumed, will be refilled later
}
}
}
// Export metrics for monitoring
interface RateLimitMetrics {
totalRequests: number;
rateLimitedRequests: number;
avgResponseTime: number;
currentUsage: number;
limit: number;
}
class RateLimitMonitor {
private metrics: RateLimitMetrics = {
totalRequests: 0,
rateLimitedRequests: 0,
avgResponseTime: 0,
currentUsage: 0,
limit: 1000
};
recordRequest(duration: number, rateLimited: boolean): void {
this.metrics.totalRequests++;
if (rateLimited) {
this.metrics.rateLimitedRequests++;
}
this.metrics.avgResponseTime =
(this.metrics.avgResponseTime * (this.metrics.totalRequests - 1) + duration) /
this.metrics.totalRequests;
}
updateUsage(remaining: number, limit: number): void {
this.metrics.currentUsage = limit - remaining;
this.metrics.limit = limit;
}
getMetrics(): RateLimitMetrics {
return { ...this.metrics };
}
toPrometheus(): string {
return `
# HELP guidewire_requests_total Total API requests
# TYPE guidewire_requests_total counter
guidewire_requests_total ${this.metrics.totalRequests}
# HELP guidewire_rate_limited_total Rate limited requests
# TYPE guidewire_rate_limited_total counter
guidewire_rate_limited_total ${this.metrics.rateLimitedRequests}
# HELP guidewire_rate_limit_usage Current rate limit usage
# TYPE guidewire_rate_limit_usage gauge
guidewire_rate_limit_usage ${this.metrics.currentUsage}
`.trim();
}
}
| Error | Cause | Solution |
|---|---|---|
429 Too Many Requests | Exceeded rate limit | Implement backoff, check headers |
503 Service Unavailable | Temporary overload | Retry with backoff |
| Circuit breaker open | Repeated failures | Wait for reset timeout |
| Queue timeout | Backpressure | Increase queue capacity |
For security implementation, see guidewire-security-basics.
Guide developers through setting up development environments with proper tools, dependencies, and configurations
Implement Exa lint rules, policy enforcement, and automated guardrails. Use when setting up code quality rules for Exa integrations, implementing pre-commit hooks, or configuring CI policy checks for Exa best practices. Trigger with phrases like "exa policy", "exa lint", "exa guardrails", "exa be...
Configure CI/CD pipelines for Documenso integrations. Use when setting up automated testing, deployment pipelines, or continuous integration for Documenso projects. Trigger with phrases like "documenso CI", "documenso GitHub Actions", "documenso pipeline", "documenso automated testing".
Build check model availability and implement fallback chains. Use when building resilient systems or handling model outages. Trigger with phrases like 'openrouter availability', 'openrouter fallback', 'openrouter model down', 'openrouter health check'.
Configure Langfuse enterprise organization management and access control. Use when implementing team access controls, configuring organization settings, or setting up role-based permissions for Langfuse projects. Trigger with phrases like "langfuse RBAC", "langfuse teams", "langfuse organization"...
Execute compliance and security auditing for Cursor usage. Triggers on "cursor compliance", "cursor audit", "cursor security review", "cursor soc2", "cursor gdpr". Use when analyzing or auditing cursor compliance audit. Trigger with phrases like "cursor compliance audit", "cursor audit", "cursor".
Configure Apollo.io CI/CD integration. Use when setting up automated testing, continuous integration, or deployment pipelines for Apollo integrations. Trigger with phrases like "apollo ci", "apollo github actions", "apollo pipeline", "apollo ci/cd", "apollo automated tests".
Create robust Python automation with full logging and safety checks. Use when tasks need complex data processing, authenticated API work, conditional file operations, or error handling beyond simple shell commands.
Configure PostHog across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific PostHog configurations. Trigger with phrases like "posthog environments", "posthog staging", "po...
Expert in designing and building autonomous AI agents. Masters tool use, memory systems, planning strategies, and multi-agent orchestration. Use when: build agent, AI agent, autonomous agent, tool use, function calling.
Validate insecure deserialization checker operations. Auto-activating skill for Security Fundamentals. Triggers on: insecure deserialization checker, insecure deserialization checker Part of the Security Fundamentals skill category. Use when working with insecure deserialization checker functiona...
Manage path traversal finder operations. Auto-activating skill for Security Fundamentals. Triggers on: path traversal finder, path traversal finder Part of the Security Fundamentals skill category. Use when working with path traversal finder functionality. Trigger with phrases like "path traversa...
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience