> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codecrafters.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Writing stage instructions

> The following tips should help you write great stage instructions for your challenge.

<Note>
  The CodeCrafters challenge authors program is invite-only. Interested in
  building CodeCrafters challenge? Write to us at <b>[hello@codecrafters.io](mailto:hello@codecrafters.io)</b>.
</Note>

Stage instructions are the heart of a CodeCrafters challenge. Remember that most learners will be new to both
the CodeCrafters platform and your challenge itself, so it's important to write clear, concise and helpful stage instructions.

## Structure

We recommend following this structure when writing stage instructions:

1. **Hook**: A short sentence that describes what the user will do in this stage.
2. **Explanation**: A longer explanation of the concepts involved in this stage, and what the user needs to implement.
3. **Tests**: A clear description of how the user's program will be tested, and what the expected output/behaviour is.
4. **Notes** (optional): Any additional notes or tips that might be helpful for the user.

## Example

Here's an example from the Redis challenge:

> In this stage, you'll add support for the `TYPE` command.
>
> ### The TYPE command
>
> The [TYPE](https://redis.io/commands/type/) command returns the type of value stored at a given key.
>
> It returns one of the following types: string, list, set, zset, hash, and stream.
>
> Here's how it works:
>
> ```bash theme={null}
> $ redis-cli set some_key foo
> "OK"
> $ redis-cli type some_key
> "string"
> ```
>
> If a key doesn't exist, the return value will be "none".
>
> ```bash theme={null}
> $ redis-cli type missing_key
> "none"
> ```
>
> The return value is encoded as a [simple string](https://redis.io/docs/reference/protocol-spec/#simple-strings).
>
> ### Tests
>
> The tester will execute your program like this:
>
> ```bash theme={null}
> $ ./spawn_redis_server.sh
> ```
>
> It'll then send a `SET` command to your server.
>
> ```bash theme={null}
> $ redis-cli set some_key foo
> ```
>
> It'll then send a `TYPE` command to your server.
>
> ```bash theme={null}
> $ redis-cli type some_key
> ```
>
> Your server should respond with `+string\r\n`, which is `string` encoded as a [RESP simple string](https://redis.io/docs/reference/protocol-spec/#simple-strings).
>
> It'll then send another `TYPE` command with a missing key.
>
> ```bash theme={null}
> $ redis-cli type missing_key
> ```
>
> Your server should respond with `+none\r\n`, which is `none` encoded as a [RESP simple string](https://redis.io/docs/reference/protocol-spec/#simple-strings).
>
> ### Notes
>
> * For now, you only need to handle the "string" and "none" types. We'll add support for the "stream" type in the next stage.
