polya
Skill2 starsChanged 41 days agoMITView on GitHub
George Pólya's "How to Solve It" method for problems you are stuck on: understand the problem, devise a plan, carry it out, look back. Use when a bug, algorithm, query, or puzzle-like task has resisted a first attempt, when the agent keeps trying random fixes, or when the user says they are stuck. Triggers: "think like Polya", "how to solve it", "I'm stuck", "we've tried everything", "solve this step by step", "คิดแบบโพลยา", "ติดอยู่", "แก้ไม่ออก". Not for simple tasks with an obvious solution.
In this repository25 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
Devise a plan: Ask in this order and answer each in one line:
- Distinctive: line 38
Look back: Verify the result against the original condition, not only against the test that failed.
- Distinctive: line 46
Write in the user's language.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Think like Pólya
Mathematician whose 1945 book How to Solve It turned problem solving into a teachable sequence of questions. Its value for engineering work is that it stops the "try another fix" loop and forces you to understand what is actually being asked first.
When to use
- Two or more fixes have already failed
- The task is a real problem (algorithm, tricky query, concurrency bug), not routine work
- You notice yourself editing code without a hypothesis
Method
- Understand the problem. Write down: What is the unknown (what exactly must be true when we are done)? What are the data (inputs, constraints, environment)? What is the condition linking them? Is the condition sufficient, or contradictory? Draw a figure or a small table for the case at hand.
- Devise a plan. Ask in this order and answer each in one line:
- Have I seen the same unknown before? Is there a related, solved problem (in this codebase, in a library, in a known algorithm)?
- Can I solve a simpler or special version first (one item, no concurrency, smaller input)?
- Can I solve part of it (drop one condition and see what is left)?
- Can I work backwards from the desired result?
- Did I use all the data? If not, the unused data is probably the key.
- Carry out the plan, checking each step. For code: one change at a time, each with a reason you can state and a check you run.
- Look back. Verify the result against the original condition, not only against the test that failed. Ask: can the result be derived differently? Can this method solve other problems here (sibling bugs, shared helpers)?
Output
Unknown / Data / Condition:three short linesPlan:the chosen strategy and why (related problem, special case, working backwards, …)Steps:numbered, each with its check and resultLook back:how the result was verified, and where else the same insight applies- Write in the user's language.
Anti-patterns
- Changing code before the unknown is written down
- Trying a third fix without explaining why the first two failed
- Ignoring a piece of data because it seems irrelevant
- Declaring victory when the reported symptom disappears
Example (illustration)
User: Pagination returns duplicate rows on page 2 sometimes. We added DISTINCT and it didn't help.
Unknown: a page query that never repeats or skips a row. Data:
ORDER BY created_at LIMIT 20 OFFSET 20; many rows share the samecreated_at. Condition: each row appears in exactly one page.Plan: special case first. Take 3 rows with the same timestamp and page size 2. Postgres may return tied rows in any order on each query, so the same row can land on both pages.
Steps: reproduced with the 3-row case (duplicate appears) → add a unique tiebreaker
ORDER BY created_at, id→ 3-row case passes, then the full dataset passes.Look back: DISTINCT failed because the duplicate comes from two different queries, not one. Every other endpoint that sorts by a non-unique column has the same bug; two more found in
ordersandaudit_log.
Sources
- George Pólya, How to Solve It: A New Aspect of Mathematical Method (1945), Princeton University Press: https://press.princeton.edu/books/paperback/9780691164076/how-to-solve-it
- Pólya, Mathematics and Plausible Reasoning (1954)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

