A zero-to-hero tutorial. By the end, you will have modeled, solved, and interpreted a mathematical problem entirely through Claude Code slash commands.
- Claude Code -- Anthropic's CLI for Claude (installation guide)
- Python 3.10+ -- for running the solver code that uber-polya generates
Optional Python packages (installed automatically when needed):
pip install networkx pulp z3-solver sympy scipy matplotlib numpy cvxpy statsmodels shapely numpy-financial nashpy pymoo prophet arch ruptures lifelines scikit-learn xgboost umap-learn simpy dowhygit clone https://github.com/agtm1199/uber-polya.git
cd uber-polya
bash install.shThe installer asks where to put the four skills:
- Global (
~/.claude/skills/) -- available in every project - Local (
./.claude/skills/) -- current project only
That is it. No virtual environment, no build step. The skills are plain markdown files that Claude Code reads on demand.
Open Claude Code in any project directory and type:
/uber-polya I need to schedule 4 exams (A, B, C, D) into the fewest time
slots so that no student has two exams at the same time. Students are
enrolled in these pairs of courses: {A,B}, {A,C}, {B,D}, {C,D}.
That's it -- one command. /uber-polya handles the entire pipeline automatically. Here's what happens:
Claude walks through Polya's "Understanding" and "Planning" phases. It asks clarifying questions, then produces a formal model. Representative output:
Problem Type: Problem to Find (optimization) Unknown: Minimum number of time slots (colors) such that no two conflicting exams share a slot Structure: Graph coloring on a conflict graph G = (V, E)
- Vertices V = {A, B, C, D} (exams)
- Edges E = {(A,B), (A,C), (B,D), (C,D)} (student enrolled in both) Objective: Minimize k such that a proper k-coloring of G exists
Claude automatically classifies the problem, selects an algorithm, writes a solver script, runs it, and verifies the result. Representative output:
Named Problem: Graph Coloring (k-coloring) Complexity: NP-hard in general; O(V + E) for bipartite detection Instance Size: |V| = 4, |E| = 4 Algorithm: Bipartite 2-coloring via BFS
Answer: chromatic number = 2
- Slot 1: {A, D}
- Slot 2: {B, C}
Verification: All 4 edges checked -- no two adjacent vertices share a color. PASS.
Claude translates the math back into your world. Representative output:
Bottom line: You need exactly 2 time slots. No student has a conflict.
Schedule:
- Slot 1 (e.g., Monday 9 AM): Exams A and D
- Slot 2 (e.g., Monday 2 PM): Exams B and C
Sensitivity: If a student enrolls in both A and D, the chromatic number rises to 3 (the conflict graph gains an odd cycle). Monitor enrollment changes.
Modeling insight: Whenever you need to assign items to the fewest groups such that conflicting items are separated, model it as graph coloring on a conflict graph.
Note: Claude's exact wording, formatting, and level of detail will vary between runs. The outputs above are representative, not verbatim.
You typed one command and /uber-polya orchestrated the entire Polya problem-solving cycle:
| Polya Phase | What uber-polya does |
|---|---|
| 1-2: Understand & Plan | Translates your real-world problem into a formal mathematical model |
| 3: Execute | Classifies the problem, selects the right algorithm, solves it, verifies the answer |
| 4: Look Back | Translates the solution back into actionable insight with sensitivity analysis |
Under the hood, /uber-polya chains three internal skills (/uber-model, /uber-solve, /uber-interpret). You can also use these individually for finer control -- for example, /uber-solve accepts any well-specified math problem, and /uber-interpret can explain any solution you hand it.
Try the worked examples. The examples/ directory contains 36 fully solved problems with runnable code, organized in two categories:
Everyday Problems (11 examples):
- Shift Scheduling -- Schedule 8 nurses across 3 shifts over 7 days (ILP)
- Budget Optimization -- Select projects to maximize ROI under budget (Knapsack ILP)
- Fair Rent -- Split rent fairly among 3 roommates (Hungarian + envy-free)
- Route Planning -- Shortest delivery route across 8 stops (Held-Karp TSP)
- Project Prioritization -- Rank 8 features by weighted criteria (MCDA)
- Study Schedule -- Conflict-free timetable for 6 subjects (graph coloring)
- Meal Planning -- 7 dinners minimizing cost within nutrition targets (ILP)
- Team Assignment -- Assign 6 developers to 6 projects (Hungarian algorithm)
- Break-Even Analysis -- Find break-even quantity for product launch (SymPy)
- Event Seating -- Seat 12 wedding guests at 3 tables with constraints (ILP)
- Mortgage Comparison -- Compare 3 mortgage options with refinancing analysis (NPV)
Technical Showcases (25 examples):
- Milking Cows -- Interval merging, O(N log N) sort-and-sweep
- Inspector Assignment -- Capacitated bipartite ILP, LP relaxation, sensitivity analysis
- Portfolio Optimization -- Markowitz QP with cvxpy, efficient frontier
- Tournament Hamiltonian -- Proof by induction with Z3 verification
- A/B Testing -- z-test, Bayesian, bootstrap, power analysis
- Cafe Tips -- t-test, Mann-Whitney, permutation, bootstrap, Bayesian
- Traffic Flow -- Gaussian elimination for network flow (numpy)
- Water Tank -- Symbolic differentiation for optimization (SymPy)
- Land Survey -- Shoelace + convex hull area computation (shapely)
- Nash Equilibrium -- Support enumeration for 2-player games (nashpy)
- Vendor Selection -- AHP + TOPSIS multi-criteria analysis (numpy)
- Pareto Optimization -- Epsilon-constraint + Pareto filter (pymoo)
- Sales Forecast -- SARIMA + Holt-Winters time series (statsmodels)
- Anomaly Detection -- Z-score + PELT change point detection (ruptures)
- Customer Survival -- Kaplan-Meier + Cox PH survival analysis (lifelines)
- Customer Churn Classification -- Random Forest + Gradient Boosting (scikit-learn)
- Customer Segmentation -- K-Means + DBSCAN + GMM clustering (scikit-learn)
- Feature Importance -- PCA + Feature Selection + Model Comparison (scikit-learn)
- Call Center Queuing -- M/M/c queuing + DES verification (simpy)
- SIR Epidemic Model -- SIR ODE + vaccination analysis (scipy)
- Monte Carlo Project Risk -- MC risk simulation + convergence analysis (numpy)
- Root Finding & Interpolation -- Bisection + Newton + Brent + cubic spline (scipy)
- Causal Inference -- Propensity matching + DiD + doubly robust (scikit-learn)
- Inventory Optimization -- EOQ + newsvendor + safety stock (scipy)
- Bin Packing -- First Fit Decreasing + ILP optimal (PuLP)
Try your own problem. Good candidates for /uber-polya:
- Scheduling (exams, meetings, shifts) -- graph coloring or ILP
- Assignment (people to tasks, resources to jobs) -- bipartite matching or ILP
- Routing (deliveries, network paths) -- shortest path, flow, TSP
- Counting (arrangements, combinations, probabilities) -- combinatorics, inclusion-exclusion
- Feasibility ("Is it possible to...?") -- SAT, constraint satisfaction
- Optimization (minimize cost, maximize profit) -- continuous optimization, convex QP
- Comparing groups ("Is A better than B?") -- hypothesis testing, A/B tests
- Prediction (forecast outcomes from data) -- regression, Bayesian inference
- Time series (forecasting, anomaly detection) -- SARIMA, change point detection
- Survival analysis (churn, equipment failure) -- Kaplan-Meier, Cox PH
- Machine learning (classification, clustering, feature selection) -- Random Forest, K-Means, PCA
- Simulation (queuing, epidemics, Monte Carlo risk) -- DES, SIR ODE, MC sampling
- Causal inference (treatment effects, policy evaluation) -- propensity matching, DiD
- Operations research (inventory, bin packing, lot sizing) -- EOQ, newsvendor, first-fit decreasing
Start with /uber-polya <describe your problem in plain English> and let Claude handle the rest.