Getting Started with uber-polya
A zero-to-hero tutorial. By the end, you will have modeled, solved, and interpreted a mathematical problem entirely through Claude Code slash commands.
Prerequisites
- 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 dowhy
For PDF report generation (optional):
$ pip install jinja2 fpdf2 matplotlib
Install uber-polya
$ git clone https://github.com/agtm1199/uber-polya.git
$ cd uber-polya
$ bash install.sh
Where would you like to install the skills?
1) Global (~/.claude/skills/) — available in all projects
2) 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.
Your First Problem
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: {A,B}, {A,C}, {B,D}, {C,D}.
That's it — one command. /uber-polya handles the entire pipeline automatically. Here's what happens:
Phase 1 — Understand & Model
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
Phase 2 — Solve & Verify
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.
Phase 3 — Interpret & Recommend
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.
Phase 4 — PDF Report (optional)
If you chose the LaTeX/PDF or Both output format at the start, uber-polya generates a branded PDF report. Representative output:
Generating PDF report...
Wrote: report/report.tex
Wrote: report/report.pdf
Wrote: report/polya.sty
Report contents:
1. Problem Formulation
2. Solution
3. Interpretation
4. Appendix
The PDF is generated using fpdf2 (pure Python) — no system LaTeX installation is required. The .tex source is always saved alongside for optional higher-quality compilation with pdflatex.
What Just Happened?
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 |
| D Report |
Renders all artifacts into a branded PDF report (if PDF output selected) |
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.
PDF Output
When you invoke /uber-polya, you'll be asked to choose an output format:
| Format | What you get |
| Python (default) | Solver script + console output + solution.json |
| LaTeX/PDF | Professional .pdf report with equations, tables, and figures |
| Both | Full Python output AND compiled PDF report |
You can also generate reports from any of the 36 existing examples:
$ python utils/render_example.py examples/team-assignment/
Wrote: examples/team-assignment/report/report.tex
Wrote: examples/team-assignment/report/report.pdf
Done.
All 36 worked examples ship with pre-generated reports in their report/ subdirectories.
Next Steps
Try the worked examples. The examples/ directory contains 36 fully solved problems with runnable code, organized in two categories:
Everyday Problems 11
Technical Showcases 25
Milking Cows
Interval merging, O(N log N) sort-and-sweep, brute-force verification
Sort + sweep
Inspector Assignment
Capacitated bipartite ILP, LP relaxation, sensitivity analysis
ILP + LP relaxation
Portfolio Optimization
Markowitz QP with cvxpy, efficient frontier, risk-return trade-off
Convex QP (cvxpy)
Tournament Hamiltonian
Proof by induction with Z3 computational verification
Induction + Z3
A/B Testing
z-test, Bayesian, bootstrap, power analysis
z-test + Bayesian + bootstrap
Cafe Tips
Full Polya cycle: t-test, Mann-Whitney, permutation, bootstrap, Bayesian
t-test + Mann-Whitney + bootstrap
Traffic Flow
Solve traffic network flow with Gaussian elimination
numpy
Water Tank
Optimize tank dimensions with symbolic calculus
SymPy
Land Survey
Compute area with Shoelace formula and convex hull
shapely
Mortgage Analysis
Compare mortgage options with NPV and amortization
numpy-financial
Nash Equilibrium
Find mixed-strategy equilibria for 2-player games
nashpy
Vendor Selection
Multi-criteria decision analysis with AHP + TOPSIS
AHP + TOPSIS
Pareto Optimization
Multi-objective optimization with Pareto frontier
pymoo
Sales Forecast
Time series forecasting with SARIMA + Holt-Winters
statsmodels
Anomaly Detection
Z-score + PELT change point detection in time series
ruptures
Customer Survival
Kaplan-Meier + Cox PH survival analysis
lifelines
Customer Churn Classification
Random Forest + Gradient Boosting classification
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 model + 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.