Goal
Implement working solutions and hints for specified base stages of a programming language that already has Stage 1 support in the course.
Procedure
1. Environment Setup
Ensure all necessary tools are installed before proceeding:
- Bun: Check if Bun is installed. If not, run
curl -fsSL https://bun.sh/install | bash and source the shell configuration (e.g., source ~/.bashrc).
- Docker: Ensure Docker is installed. Start and verify the daemon:
sudo service docker start
sudo docker info
- course-sdk: Check if
course-sdk is installed. If not, run bun install and make install in the repository root to compile the SDK.
2. Gather Context
Before writing any code, understand what you're building:
- Identify the target language and stages from the user's request (e.g., "Add solutions for base stages 2-5 in Rust").
- Read the stage descriptions (
stage_descriptions/base-<stage-number>-<stage-slug>.md or equivalent) to understand what each requested stage expects — inputs, expected outputs, and behavior.
- Read existing solutions in 2-3 reference languages (e.g.,
solutions/python/, solutions/go/, solutions/rust/) for each requested stage. Pay close attention to:
- The code diff or progression from one stage to the next.
- The
/code/config.yml structure — how hints are written for each stage.
- Any stage-specific patterns (e.g., new files introduced, dependency changes).
- Read the previous stage's solution for the target language at
solutions/<LANGUAGE>/<previous-stage>/code/ — this is the baseline code you'll build on.
3. Implement Solutions Stage-by-Stage
For each requested stage, in order:
- Verify that
solutions/<LANGUAGE>/ exists and contains the solution for the stage immediately before the first requested stage (e.g., if implementing stage 3, confirm stage 2's solution is present).
- Create the stage directory following the naming convention from reference languages (e.g.,
solutions/<LANGUAGE>/<NN>-<stage-slug>/code/).
- Constraint: Always verify the exact directory naming convention by inspecting an existing language's
solutions/ folder. Stage directories typically follow a pattern like 01-<slug>/, 02-<slug>/, etc.
- Copy the previous stage's solution as the starting point:
- Copy from
solutions/<LANGUAGE>/<previous-stage>/code/ into the new stage's code/ directory.
- Read the reference implementations for this specific stage in other languages to understand the expected logic.
- Implement the solution for this stage only — the minimal code change needed to pass this stage's tests.
- Constraint: Each stage's solution should be an incremental diff from the previous stage. Do NOT include logic for future stages.
- Constraint: Match the code style and complexity of reference implementations. Keep it minimal.
- Constraint: Use the same SDKs/dependencies established in the language's previous stage implementation.
- Constraint: Do NOT manually edit files in any directory other than
solutions/<LANGUAGE>/.
- Contraint: Do NOT manually create
solutions/<LANGUAGE>/diff directory, the compile command handles that.
4. Write Hints
For each requested stage, add hints to solutions/<LANGUAGE>/<stage-number>-<stage-slug>/code/config.yml:
- Study the hints written for the same stages in reference languages'
config.yml files.
- Write hints that follow the same structure, tone, and level of detail as the reference hints.
- Match the formatting convention (e.g., markdown in YAML strings, number of hints per stage).
- Tailor hints to the target language's idioms, standard library, and SDK usage.
- Ensure the
config.yml is valid YAML — watch for indentation, multiline strings, and special characters.
5. The Iteration Loop (Compile & Test)
For each stage, repeat until tests pass:
- Compile: Run
sudo -E course-sdk compile <LANGUAGE>.
- If it fails: Read the error output, fix the issue in the solution code, and retry.
- Test: Run
sudo -E course-sdk test <LANGUAGE>.
- If the current stage fails: Compare expected vs. actual output. Cross-reference with how reference languages handle the test case. Adjust and retry.
- Contraint: The previous stage solutions are guaranteed to not be the problem so do not change them.
- Move to the next stage only after the current stage passes.
6. Final Verification
Once all requested stages pass:
- Run a full
sudo -E course-sdk test <LANGUAGE> to confirm all implemented stages pass together.
- Review each stage's solution to ensure:
- Each stage is an incremental, minimal change from the previous one.
- No future-stage logic leaked into earlier stages.
- Code style is clean and consistent with reference implementations.
- No unnecessary files were created.
- Review
config.yml to ensure:
- Hints exist for every requested stage.
- YAML is valid and properly formatted.
- Hint content is helpful, accurate, and matches the tone of reference languages.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: add-stage-hints-and-solutions-23description: Creates solutions and hints for specific base stages of a Codecrafters course in a given language. Use this skill when the user wants to implement solutions for stages beyond Stage 1 (e.g., 'Add solutions for base stages 2-5 in Rust').4---56# Goal7Implement working solutions and hints for specified base stages of a programming language that already has Stage 1 support in the course.89# Procedure1011## 1. Environment Setup12Ensure all necessary tools are installed before proceeding:131. **Bun:** Check if Bun is installed. If not, run `curl -fsSL https://bun.sh/install | bash` and source the shell configuration (e.g., `source ~/.bashrc`).142. **Docker:** Ensure Docker is installed. Start and verify the daemon:15 - `sudo service docker start`16 - `sudo docker info`173. **course-sdk:** Check if `course-sdk` is installed. If not, run `bun install` and `make install` in the repository root to compile the SDK.1819## 2. Gather Context20Before writing any code, understand what you're building:211. **Identify the target language and stages** from the user's request (e.g., "Add solutions for base stages 2-5 in Rust").222. **Read the stage descriptions** (`stage_descriptions/base-<stage-number>-<stage-slug>.md` or equivalent) to understand what each requested stage expects — inputs, expected outputs, and behavior.233. **Read existing solutions in 2-3 reference languages** (e.g., `solutions/python/`, `solutions/go/`, `solutions/rust/`) for each requested stage. Pay close attention to:24 - The code diff or progression from one stage to the next.25 - The `/code/config.yml` structure — how `hints` are written for each stage.26 - Any stage-specific patterns (e.g., new files introduced, dependency changes).274. **Read the previous stage's solution for the target language** at `solutions/<LANGUAGE>/<previous-stage>/code/` — this is the baseline code you'll build on.2829## 3. Implement Solutions Stage-by-Stage30For each requested stage, in order:31321. **Verify that `solutions/<LANGUAGE>/` exists** and contains the solution for the stage immediately before the first requested stage (e.g., if implementing stage 3, confirm stage 2's solution is present).332. **Create the stage directory** following the naming convention from reference languages (e.g., `solutions/<LANGUAGE>/<NN>-<stage-slug>/code/`).34 - *Constraint:* Always verify the exact directory naming convention by inspecting an existing language's `solutions/` folder. Stage directories typically follow a pattern like `01-<slug>/`, `02-<slug>/`, etc.353. **Copy the previous stage's solution** as the starting point:36 - Copy from `solutions/<LANGUAGE>/<previous-stage>/code/` into the new stage's `code/` directory.374. **Read the reference implementations** for this specific stage in other languages to understand the expected logic.385. **Implement the solution** for this stage only — the minimal code change needed to pass this stage's tests.39 - *Constraint:* Each stage's solution should be an incremental diff from the previous stage. Do NOT include logic for future stages.40 - *Constraint:* Match the code style and complexity of reference implementations. Keep it minimal.41 - *Constraint:* Use the same SDKs/dependencies established in the language's previous stage implementation.42 - *Constraint:* Do NOT manually edit files in any directory other than `solutions/<LANGUAGE>/`.43 - *Contraint*: Do NOT manually create `solutions/<LANGUAGE>/diff` directory, the compile command handles that.4445## 4. Write Hints46For each requested stage, add hints to `solutions/<LANGUAGE>/<stage-number>-<stage-slug>/code/config.yml`:471. **Study the hints** written for the same stages in reference languages' `config.yml` files.482. **Write hints** that follow the same structure, tone, and level of detail as the reference hints.49 - Match the formatting convention (e.g., markdown in YAML strings, number of hints per stage).50 - Tailor hints to the target language's idioms, standard library, and SDK usage.513. **Ensure the `config.yml` is valid YAML** — watch for indentation, multiline strings, and special characters.5253## 5. The Iteration Loop (Compile & Test)54For each stage, repeat until tests pass:55561. **Compile**: Run `sudo -E course-sdk compile <LANGUAGE>`.57 - *If it fails:* Read the error output, fix the issue in the solution code, and retry.582. **Test**: Run `sudo -E course-sdk test <LANGUAGE>`.59 - *If the current stage fails:* Compare expected vs. actual output. Cross-reference with how reference languages handle the test case. Adjust and retry.60 - **Contraint**: The previous stage solutions are guaranteed to not be the problem so do not change them.613. **Move to the next stage** only after the current stage passes.6263## 6. Final Verification64Once all requested stages pass:651. Run a full `sudo -E course-sdk test <LANGUAGE>` to confirm all implemented stages pass together.662. **Review each stage's solution** to ensure:67 - Each stage is an incremental, minimal change from the previous one.68 - No future-stage logic leaked into earlier stages.69 - Code style is clean and consistent with reference implementations.70 - No unnecessary files were created.713. **Review `config.yml`** to ensure:72 - Hints exist for every requested stage.73 - YAML is valid and properly formatted.74 - Hint content is helpful, accurate, and matches the tone of reference languages.7576---77> Converted and distributed by [TomeVault](https://tomevault.io/claim/codecrafters-io) — claim your Tome and manage your conversions.78<!-- tomevault:4.0:skill_md:2026-04-13 -->