Agent skill · Backend & API

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".

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
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.

Facts
Files in the skill folder: 2
SKILL.md size: 9 KB
Bundled scripts: none
Path: skills/ai-llm/budget-tracker-patterns/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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>((

What's inside
Steps it walks through
  1. BudgetState Interface
  2. Tool Timeout Pattern
  3. Per-Tool Rate Limits
  4. Token Estimation
  5. Context Getting Full Detection
  6. Truncation Strategy
  7. Search Quality Detection
  8. Key Files
  9. BuildTools Integration
  10. Avoid
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
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.

Keep going