- How you use it
- You ask for it
- What it can do
- installs software · writes files
- What's inside
The option
| Option | ASkill · v1.0.0polars skill (Polars team) |
|---|---|
| How you use it | You ask for it |
| What it can do | installs software · writes files |
| What's inside |
What this thread does
The problem
You ask an agent for Polars and it writes pandas, or it writes Polars with old names (groupby instead of group_by) or pandas-style detours. The Polars docs page on LLMs confirms models often return pandas or invalid Polars code.
What the Polars team measured
Thijs Nieuwdorp of Polars published "Fluent, not native: agents translating pandas to Polars" on 25 June 2026. Method as described: Claude Opus 4.8 translated 33 pandas cases (22 PDS-H benchmark queries and 11 exploratory data analysis cases), one shot each in a fresh session, with the outputs compared by assert_frame_equal. Results:
- Opus: 31 of 33 correct; the two failures were minor (a missing import, a wrong column reference). Sonnet 4.6 got 33 of 33 right but wrote more non-idiomatic code.
- Patterns models still get wrong: aggregate then join back instead of a window
.over()(3 of 33 cases); a mid-pipeline.item()that forces an earlycollect()(1 case); writingpl.col("x").sum()rather thanpl.sum("x")inside.agg()(48 times, style only). Sonnet used list-wrapped arguments in 21 of 33 cases. - With the official skill installed: Opus correct 31 to 32 of 33, join-back cases 3 to 1,
.item()1 to 0; Sonnet's wrong-pattern count fell from 80 to 23. - The author calls it directional: one run per case, one model family, and it comes from the vendor.
What to do
1. Install the skill. From the post: in Claude Code run /plugin marketplace add polars-inc/skills then /plugin install polars@polars, or copy the skill by hand. The repo (polars-inc/skills, MIT, last pushed 26 Oct 2026) is small; read it before installing. 2. Or add the docs MCP server: the Polars docs list https://mcp.pola.rs/mcp (the docs show an npx mcp-remote config and say to check your client's documentation for Claude Code steps). 3. Say it in the prompt: "Use Polars as the default dataframe library", ask for group_by not groupby, and include one short example from the official docs. The docs say web search helps but does not guarantee valid code. 4. Verify each translation: run the old and new code on the same input and compare with polars.testing.assert_frame_equal (convert the pandas result first). This is the post's first recommendation. 5. Review for the known habits: use .over() for per-group values, keep scalars inside expressions instead of .item(), pass positional arguments instead of lists, and swap map_elements dictionary lookups for replace_strict (the post measured about 19 times faster at 5M rows). Run with warnings visible; PolarsInefficientMapWarning names replacements.
Common mistakes
- Treating "it ran" as "it is equal": order, dtypes and null handling can differ. Compare frames.
- Skipping the review for pandas habits: the post found the working-but-unidiomatic patterns above, and a literal translation keeps them (my reading, not a measured slowdown).
Caveats
I have not run the skill myself. The numbers are one vendor test; the Polars docs page also notes that web search does not guarantee valid code. Pandera (see the validation thread) can also check Polars frames.
Started from a post by @Thijs Nieuwdorp, packaged by the editor. Original post
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.