A userscript that turns the Codewars kata trainer into a workbench: an AI tutor that hints instead of solving, kata descriptions translated in place, each language formatted by its own real formatter, and a trainer laid out for the code rather than the chrome.
Two pages are touched. The trainer — codewars.com/kata/<slug>/train/<language> — is
reshaped around the editors; the dashboard gains a practice history. Everywhere else the
script stays off, with one exception: a stylesheet scoped to the profile page, which fixes
the Rank Breakdown on narrow windows.
Install from Greasy Fork:
https://greasyfork.org/scripts/579184-kata-studio
A collapsible right sidebar backed by any OpenAI-compatible endpoint. It answers with hints, background knowledge and error explanations, and refuses to hand over a working solution.
Only that last part is rationed. Anything general — how a language feature behaves, what a library call guarantees, why an algorithm costs what it does — is answered at whatever length the question deserves, with examples on data unrelated to the kata. Being brief about general knowledge is not caution, only a worse answer. The kata is the vehicle; the language is what you keep.
Context is pointed at rather than configured:
- Select code in either editor, or text in the description, and an Ask button appears over the selection. It becomes a chip on the composer.
- The test output carries its own Ask button, so a failing run reaches the conversation without being retyped.
- Chips are removable, and travel with the next message only.
The kata description, the current code and the latest test output also go along as background. The description travels once; the code and the output are re-sent when they have changed, so the model always sees the current state and a follow-up question stays cheap.
Replies stream, and Esc stops one mid-flight. The panel opens with Alt+A, the edge
tab, or a swipe in from the right edge.
The conversation is kept per kata. Leave the trainer, close the tab, come back a week later, and the exchange is there to read and to carry on — the model is handed the same history it had, under the same kata brief. The panel header's new conversation button is what ends one for good. Ten kata are kept, for fourteen days.
The top solutions button fetches the kata's three highest-voted community solutions and turns the conversation to what they do differently — which language feature makes the short version possible, which of them is idiomatic rather than merely short. Codewars votes on two separate axes, best practices and clever, and they disagree often enough that both counts are carried through: the cleverest solution to a kata is regularly not the one worth imitating.
Codewars withholds a kata's solutions until you have solved it, and unlocking them early forfeits its honor and rank progress. The button reads that page and nothing else — it will never unlock anything on your behalf. On an unsolved kata it says so and stops.
The interface is English. The translate button in the panel header rewrites the kata description in place, with one press to switch back; code blocks, inline code and identifiers are left untouched, and translations are cached per kata. A sentence with a code span or a link in the middle of it is translated whole, and the markup is put back where the target language wants it rather than pinned to where English had it. The target language, which is also the language the tutor answers in, is a setting.
- Five languages are formatted by the tool their own community uses, compiled to
WebAssembly: C and C++ by clang-format in Google style, Python by Ruff,
Kotlin by ktfmt, Rust by rustfmt. Output matches what those tools produce
on the command line, including where they wrap long lines.
Runs on
Ctrl+SandAlt+Shift+F, once when entering a kata, and once before test, attempt and submit. Undo takes a format back in one step.Ctrl+Sformats and nothing else. Codewars' ownCtrl+Sran the tests — its editor bindssavetovalidate()— and theTESTbutton is unaffected, as areCtrl+'andCtrl+Alt+Enter. Saving is not what is lost: see below for what the script keeps.- The formatter is fetched the first time a language needs it — between 0.5 and 1.3 MB, from a version pinned for good. The dashboard pulls the ones for the languages you have a rank in ahead of time, so the trainer usually finds them already cached. A formatter that cannot load leaves the buffer untouched.
Taband the editor's own indentation follow whatever the formatter emits: two spaces for C, C++ and Kotlin, four for Python and Rust.- Any other language keeps CodeMirror's own indentation, which is what the same keys did before.
- Your code survives a refresh. Codewars only saves when you press TEST or ATTEMPT —
its own draft in the browser is wiped on the next load — so anything typed since the
last run is lost on a reload. The script keeps its own copy as you type and puts it back
when you return, but never on top of a solution that arrived from somewhere else.
Alt+Shift+Rgoes back to the version you last sent to the tests, after asking — and so does RESET, which now offers that version alongside Codewars' original stub instead of only the stub. Without a checkpoint to offer, RESET behaves as it always did. - Rainbow brackets. Six colours by nesting depth, an unmatched closing bracket underlined in red. The colouring reads the language mode's own tokens, so a brace in a string or a comment is neither coloured nor counted.
- Line wrapping, and tuned font size, line height, current line and horizontal overflow.
- Replaces CodeMirror's folded-code marker — a blue arrow under a purple glow, on a line
squashed to a third of its height — with a quiet
⋯in the editor's own colours. - Optional touch symbol bar for the characters a tablet soft keyboard buries.
Codewars keeps no practice history outside the completed list on your profile, and the dashboard is a suggested kata, two promotions and a forum feed. The script puts a history card above the suggested kata:
- A year of days as a wall of squares across the full width of the card, shaded by how much you did that day, so a gap is visible rather than inferred, plus the current streak.
- Unfinished — the kata you opened in the trainer and did not finish, with Resume to pick each one back up. Codewars records that a kata was completed, never that one was opened, so pressing TRAIN and then wandering off leaves no trace and no way back; the trainer page writes the trace, and the dashboard subtracts your completions from it.
- The last ten completions, grouped by day: rank, kata, the languages you solved it in, and Train to go straight back into the trainer in that language. Everything older is one link away, on Codewars' own page, which also has the solutions.
- A chip per language in the header: how many kata it accounts for, and the rank you hold in it.
- The allies box, the forum feed and the promotion blocks go, leaving the suggested kata.
Ranks and language marks are the site's own — the calendar is Codewars' red at four lightnesses, the badge colours are its rank colours, the language icons its icon font. The data comes from Codewars' public API, completions cached for ten minutes and ranks kept for good; the card refreshes itself, so there is no button for it. Both the card and the hiding can be turned off in the Tampermonkey menu.
- Folds the trainer's top strip away. The page title names the page you are already on, and the account bar is not something you open mid-kata, so the bar is moved into a menu behind your avatar — which sits with the VIM / EMACS / fullscreen controls it now matches in size. Moving the nodes rather than rebuilding the links keeps Codewars' own handlers working: the theme toggle, the notification drawer and the profile links all behave as before, just vertically and with labels. Your rank badge rides along next to the avatar; the honor total does not. The reclaimed strip goes to the editor panes.
- Gives the description card the height of the column, with a floor for a short window: a kata shorter than that fills the card rather than shrinking to the text, a longer one scrolls inside it, and the Output tab gets the same height instead of a 200px box with a grey band under it.
- Collapses that column to a strip, and gives the width to the editors. Instructions and Output are two tabs over one panel, so one toggle in the tab bar covers both; it stays collapsed across reloads.
- Collapses the sample tests to their own header the same way — they are read once and then in the way — and the solution editor takes the height they leave.
- Fixes the trainer's header controls on medium-width screens, and the profile's Rank Breakdown below 1000px.
- Hides promotion, partner, referral and house ad blocks.
- Uses local Maple Mono NF when available, falling back to the Maple Mono webfont.
- Adds small orange typing sparks and dark delete-annihilation particles.
Install a userscript manager such as Tampermonkey, Violentmonkey, or Greasemonkey, then install the script from Greasy Fork.
You can also install directly from this repository:
https://raw.githubusercontent.com/NihilDigit/kata-studio/main/kata-studio.user.js
Open the settings from the panel header, or from the userscript manager's "AI settings…" menu item.
| Field | Notes |
|---|---|
| Base URL | Any OpenAI-compatible endpoint, up to and including /v1 |
| API key | Stored in the userscript manager's own storage |
| Model | Model name as the provider spells it |
| Answer and translation language | What the tutor writes in, and what the description is translated into |
Endpoint shapes that work: https://api.openai.com/v1, https://api.deepseek.com/v1,
https://openrouter.ai/api/v1, and a local http://localhost:11434/v1.
Test checks the settings before you close the dialog.
The script requests @connect * because the endpoint is yours to choose. The key is
sent only to that endpoint, in the Authorization header. No temperature is sent;
several current models reject any non-default value.
The panel reads Codewars' own CSS custom properties rather than copying their values, so it follows the site's light and dark themes, including the way Codewars flips its primary button's foreground between them.
The panel takes its place beside the page whenever the solution editor is left wide enough, and opens itself when it does: it is a pane of the trainer, not something to summon. That is measured again on every layout change, so folding the description or the sample tests is enough to bring it alongside, and losing the room puts it away again rather than leaving it on top of the code. Where there is no room it is yours to open, and then it overlays and stays until you close it, with no backdrop: reading a hint and editing code is one back-and-forth motion, so the page underneath stays interactive.
Open your userscript manager's menu on Codewars. Kata Studio exposes menu items for:
- Hide promotions
- Maple Mono font
- CodeMirror polish
- Line wrapping
- AutoFormat
- Typing sparks
- Delete annihilation
- Rainbow brackets
- AI tutor
- Touch symbol bar
- Compact kata header
- Dashboard history
- Hide allies and forum feed
- Editor font size
- Editor line height
- AI settings
- Reset settings
MIT