Tokenize Then Parse
For interpreters: separate lexing from parsing, token stream to AST, structured text processing in stages.
Error Ux
Principles and patterns for writing error messages that help users recover. Use when auditing, writing, or improving error messages in code. Triggers: error messages, user experience, error handling, exception messages, validation errors.
Fallback Compatibility
For cross-version support: try/except imports, optional dependencies, graceful degradation across Python versions.
Propagate Then Search
For constraint problems: eliminate impossibilities before guessing, reduce search space through inference, fail fast on contradictions.
Adversarial Patterns
Library of realistic adversarial attack vectors and anti-patterns to avoid. Contains examples of valid attacks and subtle gaming patterns to reject.
Solve Constraint Puzzle
For constraint satisfaction: Sudoku, scheduling, N-queens, logic puzzles, SAT-like problems, assignment problems. Uses propagate-then-search pattern.
Use Comprehension Chain
For data transformation: list/dict/set comprehensions, chained filtering and mapping, creating lookup structures concisely.
Match Stable Pairs
For two-sided matching: hospital-resident, stable marriage, college admissions. Gale-Shapley algorithm for stable matching with preferences.
Build Expression Tree
For symbolic computation: ASTs, mathematical expressions, code that manipulates code structure, expression transformations.
Benchmark Before Optimize
For performance work: measure before changing, profile to find bottlenecks, compare before and after.
Handle Edge Cases
For boundary conditions: empty collections, zero values, recursive base cases, null checks, prevent crashes at edges.
Dispatch On Structure
For heterogeneous data: pattern matching on type/structure, interpreter eval loops, handling different expression types.
Solve Grid Maze
For 2D grid problems: mazes, board games, tile maps, pixel grids, coordinate systems, cellular automata, flood fill. Uses dict-based Grid class pattern.
Generate Tree Structure
For tree/maze generation: spanning trees, random mazes, graph coverage. Uses frontier-based exploration with configurable traversal order.
Optimize Local Search
For NP-hard optimization: TSP, scheduling, assignment problems. Uses greedy construction + local improvement (2-opt, hill climbing).
Find Shortest Path
For pathfinding and search: shortest path, maze solving, game AI, route planning, graph traversal, BFS/DFS, Dijkstra, A* problems.
Documentation Testing
Provides heuristics for identifying incomplete or broken documentation. Use when validating README setup instructions, testing onboarding flows, or auditing documentation quality. Triggers: docs, readme, onboarding, setup validation, documentation audit.
Frontier Based Explore
For graph exploration: frontier collection with configurable pop order, BFS/DFS/random via strategy change.
Apply Decorator Wrap
For cross-cutting concerns: add behavior without modifying functions, caching, timing, logging, validation wrappers.
Count Combinations
For probability and counting: permutations, combinations, sample spaces, Monte Carlo simulation, brute-force enumeration, card/dice problems.
Test Structural Invariants
For data structure validation: test lengths, relationships, constraints that must hold, verify setup is correct.
Adversarial Analysis
Analyze code to identify explicit contracts, implicit usage patterns, and realistic boundary conditions. Contains concrete formulas for calculating input realism limits. Use before generating adversarial tests.
Format Statistics Table
For result reporting: tabular output, aligned columns, statistics summaries, human-readable reports.
Overload Operators Dsl
For domain-specific languages: operator overloading, make Python look like math/domain notation, expression builders.
Cache Recursive Calls
For dynamic programming: overlapping subproblems, recursive solutions with repeated computations, memoization to avoid redundant work.
Show Side By Side
For comparison: display before/after, multiple solutions, diffs side by side for visual comparison.
Parse Extract Input
For text processing: extract numbers, words, structured data from messy text using regex patterns, parsing utilities.
Test With Examples
For example-driven development: test cases as specifications, input/output pairs, documentation through examples.
Intern Symbols Identity
For fast comparison: ensure only one instance of each symbol, use 'is' instead of '==', symbol tables for interpreters.
Refactor Decompose Function
For long functions: break into smaller pieces, extract helper functions, reduce nesting, improve testability and readability.
Pass Function As Arg
For generic algorithms: strategy pattern, callbacks, configurable behavior. Pass functions as parameters to customize algorithm behavior.
Use Defaultdict Groups
For grouping and auto-initialization: adjacency lists, grouping by key, multi-maps, nested structures without KeyError handling.
Deep Research
Conducts iterative deep research on any topic using web search, progressive exploration, and structured synthesis. Use when asked for comprehensive research, deep investigation, thorough analysis, or multi-source exploration of any topic. Triggers: research, investigate, deep dive, comprehensive analysis, explore thoroughly, find everything about.
Stack Based Backtrack
For search with undo: explicit decision stack, backtracking when paths fail, depth-first exploration with state restoration.
Time And Report
For performance reporting: timing wrappers, throughput calculations, profiling summaries.
Use Counter Frequency
For counting and frequency: histograms, most common elements, vote tallying, neighbor counting, word frequencies, distribution analysis.
Find Convex Hull
For computational geometry: convex hull, point enclosure, polygon operations. Uses monotone chain algorithm with stack-based turn detection.
Return None For Failure
For graceful failure: return None or False instead of exceptions, let caller decide how to handle failure.
Local Llm
Manage local Ollama LLM models for development and testing. Use when: running local models, configuring Ollama, switching between fast/quality models, optimizing VRAM usage, troubleshooting model performance, creating Modelfiles, or integrating local LLMs with applications via OpenAI-compatible API. Triggers: ollama, local model, local LLM, VRAM, GPU memory, model speed, inference, Modelfile, lla…
Compose Small Helpers
For complex behavior: build from tiny functions, chain transformations, make code read like a pipeline of operations.
Define Domain Types
For new modules: define type aliases as vocabulary, make code self-documenting, create domain-specific language feel.
Use Class For State
For complex state: encapsulate multiple interacting variables, stateful algorithms, backtracking search state.
Catch Expected Errors
For iteration with errors: catch exceptions during exploration, skip invalid cases, continue to next attempt.
Precompute Relationships
For static relationships: graph structure, grid neighbors, constraint peers. Calculate once at module load, reference throughout program.
Display Grid State
For 2D debugging: visualize grid/board state, show puzzle progress, make algorithm behavior visible.
Capture State Closure
For persistent state: closures capture outer variables, alternative to classes for simple state, factory functions that remember context.
Iterate With Itertools
For combinatorial iteration: permutations, combinations, cartesian products, without storing all results in memory.
Cascade Type Conversion
For flexible parsing: try multiple type conversions in order, graceful fallback from specific to general types.
Build Priority Queue
For ordered processing: A* search, Dijkstra, event simulation, task scheduling. Efficient min/max extraction with heap-based queue.
Compile Once Call Many
For hot loop optimization: repeated formula evaluation, regex patterns, expression compilation. Transform string to callable once, call many times.