budget-tracker-patterns
Backend budget tracking patterns for AI generation. Awareness-based tracking (not blocking), tool timeouts, per-tool rate limits, token estimates, context window management, truncation strategies, search quality detection. Triggers on "budget", "tool timeout", "rate limit", "token estimate", "truncation", "context window", "search quality", "diminishing returns".
npx skills add majiayu000/claude-skill-registry --skill budget-tracker-patterns --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Budget Tracker Patterns Awareness-based tracking for AI generation tool calls. Tracks context consumption, detects runaway patterns, provides visibility. Does NOT block tool calls - existing step limits handle that. ## BudgetState Interface Core state tracked during generation: ```typescript // From packages/backend/convex/lib/budgetTracker.ts export interface BudgetState { maxTokens: number; usedTokens: number; toolCallCount: number; searchHistory: Array<{ query: string; resultCount: number; topScore: number; }>; toolCallCounts: Record<string, number>; // Per-tool counts for rate limiting } ``` Initialize: ```typescript const budget = createBudgetState(maxTokens); ``` Update immutably: ```typescript budget = recordUsage(budget, tokens); budget = recordToolCall(budget, toolName); budget = recordSearch(budget, query, resultCount, topScore); ``` ## Tool Timeout Pattern Wall-clock timeout wrapper prevents stuck tools: ```typescript // From packages/backend/convex/lib/budgetTracker.ts export async function withTimeout<T>( promise: Promise<T>, timeoutMs: number, operation: string, ): Promise<T> { let timeoutId: ReturnType<typeof setTimeout>; const timeoutPromise = new Promise<never>((
- BudgetState Interface
- Tool Timeout Pattern
- Per-Tool Rate Limits
- Token Estimation
- Context Getting Full Detection
- Truncation Strategy
- Search Quality Detection
- Key Files
- BuildTools Integration
- Avoid
What does the budget-tracker-patterns skill do?
Backend budget tracking patterns for AI generation. Awareness-based tracking (not blocking), tool timeouts, per-tool rate limits, token estimates, context window management, truncation strategies, search quality detection. Triggers on "budget", "tool timeout", "rate limit", "token estimate", "truncation", "context window", "search quality", "diminishing returns".
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill budget-tracker-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
