Advent of Code Rust Agent Guidelines

1. **Read & Analyze**: Read puzzle description from `data/puzzles/<day>.md`

promptBeginner5 min to valuemarkdown
0 views
Feb 12, 2026

Sign in to like and favorite skills

Prompt Playground

1 Variables

Fill Variables

Preview

# Advent of Code Rust Agent Guidelines

## Workflow

### Problem Solving Process
1. **Read & Analyze**: Read puzzle description from `data/puzzles/<day[NN>].md`
2. **Add Example Input**: Copy example from puzzle into `data/examples/<day[NN>].txt`
3. **Implement Part 1**:
   - Write solution in `src/bin/<day[NN>].rs`
   - Update test assertion with expected example output
   - Run `cargo test --bin <day[NN>]` to verify
4. **Test & Submit Part 1**:
   - Run `cargo solve <day[NN>] --release` to get answer
   - Submit with `cargo solve <day[NN>] --release --submit 1`
5. **Download Part 2**: Run `cargo download <day[NN>]` to fetch Part 2 description
6. **Implement Part 2**:
   - Add solution to `part_two()` function
   - Update test assertion
   - Run `cargo test --bin <day[NN>]` to verify
7. **Test & Submit Part 2**:
   - Run `cargo solve <day[NN>] --release` 
   - Submit with `cargo solve <day[NN>] --release --submit 2`
8. **Cleanup**: Run `cargo fmt && cargo clippy --bin <day[NN>]` to ensure code quality
9. **Commit**: Commit solution using conventional commits format
    - `<type[NN>][optional scope]: <description[NN>]`, where types include: `fix:`, `feat:`, `build:`, `chore:`, `ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`, and others.

### Git Workflow
- **Commit Format**: `feat(day<[NN>][NN>][NN>]): solve part 1 and 2` or `feat(day<[NN>][NN>][NN>]): solve part 1`
- **Commit After**: Complete solutions (both parts if possible) with tests passing
- **Message Examples**:
  - `feat(day01): solve part 1 and 2`
  - `feat(day02): solve part 1`
  - `refactor(day01): optimize solution performance`
  - `docs: update AGE[NN>]TS.md with workflow`

## Commands
- **Run Solution**: `cargo solve <day[NN>]` (e.g., `cargo solve 01`). Use `--release` for optimized builds.
- **Submit Solution**: `cargo solve <day[NN>] --release --submit <part[NN>]` (auto-submits via aoc-cli)
- **Scaffold Day**: `cargo scaffold <day[NN>]` to generate `src/bin/<day[NN>].rs` and input files.
- **Download Puzzle**: `cargo download <day[NN>]` to fetch puzzle description and input.
- **Test**: `cargo test` runs all tests. To test a specific day: `cargo test --bin <day[NN>]`.
- **Lint & Format**: Always run `cargo clippy` and `cargo fmt` before finishing a task.

## Code Style & Conventions
- **Formatting**: Strictly follow `rustfmt` defaults.
- **[NN>]aming**: `snake_case` for functions/variables, `PascalCase` for structs/enums/traits.
- **Error Handling**: Prefer `Result` propagation (`?`) over `unwrap()`. Handle errors gracefully.
- **Structure**: Solutions reside in `src/bin/`. Shared logic goes in `src/lib.rs` or modules.
- **Imports**: Group standard library, external crates, and internal modules separately.
- **Performance**: This is AoC; prioritize correctness first, then optimization (zero-cost abstractions).
- **Return Types**: Use appropriate types (`u32`, `u64`, `i32`, etc.) based on problem constraints.
- **Comments**: Add comments for complex algorithms or non-obvious logic.
Share: