Back to skills
extension
Category: Content & MediaNo API key required

Anti-Bloat Checklist

Checklist for detecting and removing bloat in context, prompts, and responses to reduce token cost and improve signal-to-noise ratio

personAuthor: jakexiaohubgithub

Anti-Bloat Checklist

Skill Profile

  • [ ] DevOps
  • [ ] Backend
  • [ ] Frontend
  • [x] AI-RAG
  • [ ] Security Critical

Overview

Checklist for verifying that context/prompt/response contains "bloat" - unnecessary information, redundancies, or token usage that doesn't add value.

Why This Matters

  • Token cost: Every token has a cost
  • Context limit: Window is limited, use it wisely
  • Signal-to-noise: Bloat makes AI lose focus
  • Speed: Fewer tokens = faster response

Core Concepts & Rules

1. Filler Words

❌ Bloat:
"Basically, I think we should essentially try to implement this feature"

✅ Clean:
"Implement this feature"

Common fillers:
- basically, essentially, actually
- just, simply, really
- kind of, sort of
- very, quite, rather

2. Redundancy

❌ Bloat:
"The API endpoint returns a JSON response in JSON format"

✅ Clean:
"The API returns JSON"

Redundant patterns:
- "JSON response in JSON format"
- "database DB"
- "API endpoint API"
- Repeating same info in multiple places

3. Unnecessary Context

❌ Bloat:
Including entire file when only need 10 lines

✅ Clean:
Include only relevant snippet with line numbers

Example:
"See lines 45-55 in auth.ts for implementation"

Inputs / Outputs / Contracts

Inputs

  • Prompts and instructions
  • Context and documentation
  • Code and configuration
  • Responses and outputs
  • Token usage metrics

Outputs

  • Optimized prompts
  • Trimmed context
  • Concise responses
  • Token savings
  • Cost reduction

Contracts

  • Input Validation: All inputs must be valid text/code
  • Output Format: Outputs follow anti-bloat checklist standards
  • Token Budget: Outputs respect configured token limits
  • Quality Guarantee: Optimized content maintains semantic meaning
  • Cost Tracking: Token savings are measurable and reportable

Skill Composition

Quick Start

Quick Wins

1. Remove Filler Words

Find and replace:
- "basically" → ""
- "essentially" → ""
- "just" → ""
- "simply" → ""
- "really" → ""

Typical savings: 5-10%

2. Use Imperative Mood

❌ "Could you please write..."
✅ "Write..."

❌ "I would like you to..."
✅ "Create..."

Savings: 30-50% in prompts

3. Snippets Over Full Files

❌ Include entire 500-line file
✅ Include 20-line relevant function

Savings: 90%+ per file

Assumptions

  • AI models have token limits
  • Token usage has cost implications
  • Bloat reduces AI performance
  • Context needs optimization
  • Responses should be concise

Compatibility

  • AI Models: GPT-4, Claude, etc.
  • Token Counters: tiktoken, etc.
  • Languages: All languages supported
  • Context Types: Code, docs, prompts

Test Scenario Matrix

| Scenario | Input | Expected Output | Verification | |----------|-------|-----------------|--------------| | Remove filler | Prompt with fillers | Clean prompt | Token count reduced | | Use imperative | Passive voice prompt | Active voice prompt | Token count reduced | | Snippet vs file | Full file | Relevant snippet | Token count reduced | | Output limit | Long response | Constrained response | Length constraint met |

Technical Guardrails

Prompt Requirements

  • All prompts MUST use imperative mood
  • All prompts MUST avoid filler words
  • All prompts MUST specify output format
  • All prompts MUST include constraints

Context Requirements

  • All context MUST be relevant to task
  • All context MUST be current and accurate
  • All context MUST use snippets over full files
  • All context MUST avoid redundancy

Response Requirements

  • All responses MUST be concise
  • All responses MUST avoid preamble
  • All responses MUST follow format constraints
  • All responses MUST avoid repetition

Security Threat Model

Threats Addressed

  • Token waste: Bloat detection and removal
  • Cost overruns: Token budgeting
  • Context overflow: Context limits enforced
  • Quality degradation: Signal-to-noise monitoring

Mitigation Strategies

  • Implement token budgets
  • Use automated bloat detection
  • Monitor token usage
  • Enforce context limits

Domain-Specific Modules

Token Counter Module

import { encode } from "gpt-tokenizer";

export function countTokens(text: string): number {
  return encode(text).length;
}

export function estimateCost(tokens: number, model: string = "gpt-4"): number {
  const pricing = {
    "gpt-4": 0.03 / 1000,
    "gpt-3.5-turbo": 0.002 / 1000,
  };
  return tokens * pricing[model];
}

Bloat Analyzer Module

export interface BloatAnalysis {
  fillerWords: number;
  redundantPhrases: number;
  unnecessaryContext: number;
  totalBloatTokens: number;
  bloatPercentage: number;
}

export function analyzeBloat(text: string): BloatAnalysis {
  const fillerWords = ["basically", "essentially", "just", "simply", "really"];
  const fillerCount = text.split(/\s+/).filter(word =>
    fillerWords.some(filler => word.toLowerCase().includes(filler))
  ).length;

  return {
    fillerWords: fillerCount,
    redundantPhrases: 0,
    unnecessaryContext: 0,
    totalBloatTokens: fillerCount * 2,
    bloatPercentage: 0,
  };
}

Token Budget Module

export interface TokenBudget {
  systemPrompt: number;
  userPrompt: number;
  contextPerFile: number;
  totalContext: number;
  maxResponse: number;
}

export const TOKEN_BUDGETS: TokenBudget = {
  systemPrompt: 200,
  userPrompt: 150,
  contextPerFile: 500,
  totalContext: 4000,
  maxResponse: 1000,
};

export function checkBudget(content: string, type: keyof TokenBudget): boolean {
  const tokens = countTokens(content);
  const budget = TOKEN_BUDGETS[type];
  return tokens <= budget;
}

Release, Rollback & Ops Notes

Release Process

  1. Define bloat detection rules
  2. Implement token counting
  3. Create checklists
  4. Test with sample prompts
  5. Deploy to production
  6. Monitor token usage
  7. Adjust thresholds

Rollback Procedure

  1. Revert bloat detection rules
  2. Restore original prompts
  3. Monitor quality
  4. Roll back if quality degrades

Operational Procedures

  • Token monitoring: Track token usage
  • Bloat detection: Run automated checks
  • Cost tracking: Monitor AI costs
  • Quality monitoring: Ensure quality maintained

Code Quality & Documentation

Bloat Detection Standards

  • Use automated token counting
  • Define clear bloat patterns
  • Create actionable checklists
  • Track token savings
  • Monitor quality impact

Documentation Requirements

  • Document all bloat patterns
  • Provide examples of bloat
  • Include quick wins
  • Document token budgets
  • Track cost savings

Agent Directives & Error Recovery

Agent Behavior Rules

  1. Always use imperative mood in prompts
  2. Always remove filler words
  3. Always use snippets over full files
  4. Always specify output constraints
  5. Always track token usage

Error Recovery Patterns

| Error Type | Detection | Recovery | |------------|-----------|----------| | Token limit exceeded | API error | Reduce context, retry | | Quality degraded | Poor response | Add back necessary context | | Cost over budget | Cost alert | Implement stricter limits |

Agent Prompt Pack

Bloat Detection Prompts

"Analyze this prompt for bloat:
- Identify filler words
- Find redundant phrases
- Check for unnecessary context
- Calculate token savings
- Suggest optimizations"

Prompt Optimization Prompts

"Optimize this prompt to reduce tokens:
- Use imperative mood
- Remove filler words
- Specify output format
- Add length constraints
- Maintain quality"

Context Optimization Prompts

"Optimize this context for AI:
- Use snippets over full files
- Remove irrelevant information
- Eliminate redundancy
- Focus on task-relevant content
- Track token savings"

Definition of Done

Bloat optimization is complete when:

  • [ ] All prompts use imperative mood
  • [ ] All prompts avoid filler words
  • [ ] All context uses snippets over full files
  • [ ] All responses are concise
  • [ ] Token budgets defined and followed
  • [ ] Bloat metrics tracked
  • [ ] Cost savings measured
  • [ ] Quality maintained or improved
  • [ ] Checklists applied consistently

Anti-patterns

  1. Verbose instructions: Long, wordy prompts
  2. Filler words: Unnecessary words
  3. Redundancy: Repeating information
  4. Full files: Including entire files when snippets suffice
  5. No constraints: Unlimited output length
  6. Preambles: "Here's what I did:" in responses
  7. Obvious comments: Comments stating the obvious
  8. Dead code: Commented-out code instead of deletion

Reference Links

Versioning & Changelog

v1.0.0 (2025-02-15)

  • Initial release of Anti-Bloat Checklist skill
  • Common bloat types (filler words, redundancy, unnecessary context)
  • Prompt bloat detection
  • Context bloat detection
  • Response bloat prevention
  • Documentation bloat
  • Code comment bloat
  • Configuration bloat
  • Measurement and tracking
  • Anti-bloat checklist
  • Bloat audit process
  • Token budget guidelines
  • Quick wins