Programming Katas with Anki

Last year I was confronted with the fact that some of my technical skills have grown stale - at the point at which they were good enough to get the job done it seemed that all progress stopped.   I hadn't stopped learning - just stopped learning about certain technologies and products.   There were benefits to being in this rut like having extra time to spend on the needs of my organization and opportunities within my industry.   But all justifications aside the bottom line was that my productivity was being whittled away through small and continuous inefficiencies in my development methods.   I was using vim like a glorified notepad, I was using the mouse rather than keyboard short cuts on Firefox and Terminator, my use of Python was stuck in the 2.4 days, and I was consulting help on the find command far too often.

So, I settled on a strategy that I used many years ago - to learn one thing every day.   Which mostly worked.   Where it failed is in the specifics of the meaning of 'learn':  I was forgetting some things almost as quickly as I was learning them.   Certain items really required practice and repetition.

But why stop with just learning something well enough to do it slowly and painfully?   Ideally, I would know my tools so well that most common tasks don't require conscious thought at all.  This would eliminate unnecessary distractions and free me up to think about the harder problems at hand.   I want more of my development time to be in a mental state of flow.


Katas turned out to be the perfect model for practicing many of these tasks: I could arrange them into a specific sequence, then perform that sequence of tasks daily until it became automatic.  

So far I've defined five katas for vim, terminator, and firefox.   Firefox and terminator are pretty simple, but I could probably add a hundred katas for vim and its plugins.   Next up is tmux, regular expressions, find, awk, and maybe Python.

Here's a very simple Firefox sample "Run like ferret between browser tabs":

Open Firefox
Ctrl+t          - create new tab, moves focus to this tab
Ctrl+t          - create new tab, moves focus to this tab
Ctrl+t          - create new tab, moves focus to this tab
Ctrl+PgUp       - move focus to prior tab (3rd)
Ctrl+PgUp       - move focus to prior tab (2nd)
Ctrl+PgUp       - move focus to prior tab (1st)
Ctrl+PgDn       - move focus to next tab (2nd)
Ctrl+PgDn       - move focus to next tab (3rd)
Ctrl+PgDn       - move focus to next tab (4th)
Ctrl+Shift+Tab  - move focus to prior tab (3rd)
Ctrl+Shift+Tab  - move focus to prior tab (2nd)
Ctrl+Shift+Tab  - move focus to prior tab (1st)
Ctrl+Tab        - move focus to prior tab (2nd)
Ctrl+Tab        - move focus to prior tab (3rd)
Ctrl+Tab        - move focus to prior tab (4th)
Alt+1           - move focus to 1st tab
Alt+4           - move focus to 4th tab
Alt+2           - move focus to 2nd tab
Alt+4           - move focus to 4th tab
Alt+3           - move focus to 3rd tab
Alt+4           - move focus to 4th tab
Ctrl+w          - close tab (4th)
Ctrl+w          - close tab (3rd)
Ctrl+w          - close (2nd)

All we're doing here is opening up four tabs in firefox, using three different methods to navigate between them, then closing them all.   It's quick, simple, and when repeated daily effectively hammers in the commands to the point where they don't take any thought at all.  They aren't just known or understood - they're memorized to the point of being performed without thought.   Side note - this kata works the same in Chrome.

Kata management with flash cards and Anki

I discovered a few things in my initial kata effort:
  • It takes time to develop the katas - it's a rich learning opportunity, so there's some upsides to it.  But it definitely slows down the initial progress.
  • The number of katas can grow to be very large - while Firefox might only need a few, vim alone could involve a hundred katas.  Once the number grows this large, documenting, tracking progress, and working with them might be cumbersome.
  • Collaboration might be key - the best way to cut down on the initial development effort and get the highest-quality katas is to involve others.  

Ryan at PySprings provided some valuable feedback - in particular insights about electronic flashcard systems in general and Anki in particular.   This tool offers quite a few advantages over paper cards, including:
  • Collaboration - AnkiWeb allows users to share flashcard decks.  Alternatively, they can be exported and stored and shared through other means such as github.
  • Multi-media - Support for audio, video, and images to augment the cards.   While most of the command-line skills I'm looking to enhance can be concisely described as lists of commands, the occasional diagram, animation or narration are helpful.
  • Minimizes practice-time - since it allows the user to provide feed-back about how well the task was performed Anki can diminish the frequency of mastered-katas.

Anki is a fairly complex tool, so it'll take some time to really put it through its paces.   My findings so far:

  • Usability - seems poor, with non-conventional menu structures, difficult to find options, and odd independent windows.
  • Card Formatting Options - are limited to very simple and easy options or LaTex for more power.   Unfortunately, few people know LaTeX and the simple alternatives are insufficient  for long sequences of commands or including reference info.   
  • Data Exchange - Anki can import and export data.  However, exports lose formatting.  This means that trying to complementing poor card formatting with exported and printed documents requires additional work.  On the other hand, there's a large number of pre-built Anki decks available to be easily imported, and exporting your deck to another Anki user is easy.
More research to go - especially on collaboration.  Meanwhile, the katas are already working, and my vim-fu is quickly progressing.

Updates after 30 days 

So, after using this for a month, I've come to the following conclusions:
  • Anki's usability sucks.   It's unintuitive, inconsistent with common desktop standards, and missing obvious features necessary to make use easier.   Some of these are navigational, others are modal, others are card text formatting.   In spite of this I'm limping along, and steadily improving.  I'm convinced the upsides outweigh the downsides.   I clearly need to spend some time formally learning the tool I've settled on to improve my formal learning.   My next step is to try out Alex Vermeer's Anki Essentials.   It's $39, but the first 20 pages are free.
  • Anki's flashcards don't take the place of a reference document:  although I'd like to create one resource that could do both, that's not ideal.   I like keeping reference info in GVim, and using folds to automatically hide indented sections.   This allows me to quickly and easily scan a large reference doc.   Anki's flashcards can be used for reference, but they're not so easily searched and navigated.
  • Mastering muscle memory takes different practice than memorization:   an Anki flash-card with a simple question ("which letter moves you back one word in vim?") can work fine for memorization - but not training your hands to immediately perform the task. That's where the katas come in.  However, the frequency with which Anki shows the decks is not the ideal frequency for training your hands.   The two are not incompatible - but I think I need to repeat kata cards several times if I'm not excellent at them.

Also, I've now come across others doing the same or similar things:
  • Learning VIM with Spaced Repetition - great short article, with great links to helpful info.  I'm including some of these links below as well.
  • Wired Article - Want to Remember Everything You'll Ever Learn? - great article about Spaced Repetition and why this is such an effective learning technique.  Not much on katas though.
  • Alf Mikula's Spaced Repetition and VIM Page - great testimonial for this approach.  No katas though.
  • Alf Mikula's VIM Anki deck - rather than a kata consisting of a sequence of commands this deck consists of a single command per card.  I don't think it will be as good as a kata at memorizing hand movements, but still useful.
  • JAnki - using spaced repetition systems to learn and retain technical knowledge - detailed step-by-step approach to applying this to learning topics like programming languages.
  • Web Development Flashcards - This 5439 card set is huge.  And it covers some technologies I'm not interested in learning at this time.  Nonetheless it can be modified, and the page gives great tips on usage and modifications.
  • Anki decks by the lesswrong users - while not about vim or even technical subjects these are good decks and there's interesting commentary here.   For example:  "People who learn about spaced repetition are always tempted to look for existing decks to memorize, but I think this is a false efficiency. In order to memorize a deck of material, you are going to be dedicating a non-trivial portion of your life to memorizing its content. The time spent actually creating the cards is substantially less than the time spent quizzing for almost any material. I'm not completely against pre-existing decks, but I think people just need to keep perspective."
  • 20 Rules of Formulating Knowledge  - excellent tips on how to learn from the SuperMemo author.


  1. Regarding your second conclusion (need for a reference document), I have had success with keeping such a document in Markdown, converting it to JSON, and serving it on a locally-running webserver which Anki cards fetch data from. This works since Anki's cards are just Qt web views, and Anki lets you embed Javascript in them and style them with CSS. I prefer keeping the source material in Markdown for viewing/editing than using Anki's awful deck browser/editor. Pretty baroque alas, and does limit the potential for sharing with other Anki users, but it has a lot of flexibility and makes it more shareable with non-Anki users.

    An alternative approach would be to write a Anki add-on that reads the Markdown document or JSON file and updates the appropriate Anki deck's list of facts, but I am grossed out every time I see "To find available hooks, grep for runHook and runFilter in the source code" (https://github.com/dae/anki/blob/master/anki/hooks.py#L9). Agile software this isn't.

  2. This comment has been removed by a blog administrator.

  3. this concept is new to me and i got more information from your concept it is really impressive thus it was very much interesting and it was nice and informative.

    Salesforce Training in Chennai Adyar

  4. I do agree with all the ideas you have presented in your post. They’re really convincing and will certainly work. Still, the posts are very short for newbies. Could you please extend them a little from next time? Thanks for the post..

    Web development company in Chennai

  5. Thanks for this blog. provided great information. All the details are explained clearly with the great explanation. Thanks for this wonderful blog. Step by step processes execution are given clearly.Know the details about different thing
    Digital Marketing Company in India

  6. Thank you for this valuable information. I have got some important suggestions from it. I'm working in Brave Technologies Private Limited. We provides lowest price of ERP Software for our clients. Contact us on info@bravetechnologies.in erp in chennai | erp for automotive industry chennai