Starter code is the code that we provide to users when they start a challenge. It’s the code that they’ll be building on top of.

Here’s an example.

Required Files

At the minimum, starter code is expected to have the following files:

    • A README file that explains how to run the starter code & submit code to CodeCrafters.
  • codecrafters.yml
    • A YAML file with the keys language_pack and debug.
    • The name of this files depends on the challenge. for Docker, for Git etc.
  • An executable script that runs the starter code.
  • Skeleton code that the user will build upon.
    • This code must also include a section that can be uncommented to pass the first stage.
  • Any configuration files commonly required by the language / package managers.
    • For example, requirements.txt for Python, package.json for JavaScript etc.
  • .gitignore
    • A .gitignore file that ignores files commonly ignored by the language.
  • .gitattributes
    • A .gitattributes file that sets the text=auto for all files (to avoid issues with line endings on Windows).

First stage solution

To make it easier for users to get started, we automatically generate a solution to the first stage of the challenge. This is done by uncommenting lines in the starter code.


Stage 1 solution, auto-generated from starter code

The way this works is that course-sdk will look for markers like this in the starter code:

# Uncomment this to pass the first stage

These markers will be deleted and any code after them will be uncommented to generate the solution.

The full logic for this is here.


Since starter code for different languages are likely to have a lot of similar code, we use templates to create these.