Skip to content
aoc-daily-solver logo

AoC Daily Solver

aoc-daily-solver

Automate Advent of Code daily puzzle solving - fetch puzzle, implement solution, test, and submit answers

mattnigh/skills_collection0installs24stars

SKILL.md

Full skill instructions

AoC Daily Solver

Automate the complete workflow for solving Advent of Code puzzles: fetch puzzle description and input, implement the solution, test it, and submit answers.

When to Use This Skill

  • User asks to solve today's AoC puzzle
  • User asks to solve a specific day's puzzle (e.g., "solve day 15")
  • User wants to work on AoC puzzles following the established workflow

Prerequisites

  • AOC_SESSION environment variable must be set (from .env file or GitHub secrets)
  • Python environment with required packages (requests, beautifulsoup4, etc.)
  • Repository structure follows the pattern: YYYY/​N/​dayN.py and YYYY/​N/​input.txt

Instructions

Follow this workflow for both automated (GitHub Action) and local solving:

1. Read Guidelines

  • Read "Problem-Solving Workflow" below for detailed problem-solving approach
  • Understand the repository structure and coding patterns

2. Load Environment Variables (Local Execution Only)

IMPORTANT: When running locally, you MUST load the .env file first to set AOC_SESSION:

set -a; source .env; set +a

This exports all variables from .env to the current shell. Skip this step in GitHub workflows (secrets are already set).

3. Fetch Puzzle and Input

FORCE_DAY=$DAY FORCE_YEAR=$YEAR python3 .claude/​skills/​aoc-daily-solver/​scripts/​solve_daily.py
  • This creates ${YEAR}/​${DAY}/​puzzle.md and ${YEAR}/​${DAY}/​input.txt
  • Script will notify if parts are already solved

4. Check Existing Solutions

  • Open puzzle.md and check for "Your puzzle answer was..."
  • If both parts solved: stop immediately
  • If only Part 1 solved: skip to Step 8 (Part 2)

5. Implement Solution

  • Create ${YEAR}/​${DAY}/​day${DAY}.py with:
    • part1() function
    • part2() function
    • run_example() for testing with sample input
    • if __name__ == "__main__" block to print results
  • Load input using: os.path.join(sys.path[0], 'input.txt')
  • Use any Python libraries needed (numpy, networkx, sympy, z3, etc.)

6. Test with Timeout

timeout 30 python3 ${YEAR}/​${DAY}/​day${DAY}.py
  • If it times out, rethink the algorithm (see "Performance Tips" below)
  • Test with example input first using run_example()

7. Submit Part 1

python3 .claude/​skills/​aoc-daily-solver/​scripts/​submit_answer.py 1 <answer> $DAY $YEAR
  • Read the response carefully
  • If wrong, analyze feedback and fix

8. Re-fetch Puzzle for Part 2 (MANDATORY)

IMPORTANT: You MUST re-fetch the puzzle after Part 1 is accepted, BEFORE implementing Part 2:

FORCE_DAY=$DAY FORCE_YEAR=$YEAR python3 .claude/​skills/​aoc-daily-solver/​scripts/​solve_daily.py

Why this is mandatory:

  • Part 2 description is only revealed after Part 1 is solved
  • The puzzle.md file must be updated to include Part 2 text
  • For older AoC years, AI models may have solutions in training data and could "solve" Part 2 without ever reading its description. Always re-fetch to ensure Part 2 is properly documented.

9. Implement and Submit Part 2

  • First: Read the updated puzzle.md to understand Part 2 requirements
  • Implement part2() function
  • Test again with timeout
  • Submit: python3 .claude/​skills/​aoc-daily-solver/​scripts/​submit_answer.py 2 <answer> $DAY $YEAR

10. Update Dependencies (if needed)

  • If you installed new packages, add them to requirements.txt

11. Commit Results

  • Commit the entire day folder with puzzle, input, and solution
  • Include which AI model assisted in the commit message

Examples

Solve today's puzzle:

"Solve today's Advent of Code puzzle"

Solve specific day:

"Solve AoC 2024 day 15"

Continue from Part 2:

"Part 1 is done, help me with Part 2 of day 10"

Important Notes

  • Never skip the filename pattern: Must be day${DAY}.py
  • Performance target: Solutions should run in <30 seconds
  • Test incrementally: Verify parsing with example input first
  • Sequential solving: When solving multiple days, finish one completely before starting the next
  • Mandatory re-fetch before Part 2: After Part 1 is accepted, ALWAYS re-fetch the puzzle to get Part 2 description. This ensures puzzle.md documents both parts, especially important for older puzzles where AI may have training data.

Problem-Solving Workflow

  1. Read carefully - Don't assume input format. Summarize the core mechanics in your own words before coding.
  2. Example first - Create run_example() with hardcoded sample input. Print parsed structures and validate against expected output before running on full input.
  3. Test incrementally - Verify each part works. On errors, re-check parsing first.
  4. Performance target - No puzzle should take >30 seconds. If slow, rethink the algorithm.

Parsing Tips

  • Read format carefully: char-by-char vs whitespace-separated, handle empty lines.
  • Debug parsing first: print parsed data on example, verify structure (grid dims, value ranges).
  • For grids: grid = [[int(c) for c in line] for line in lines if line.strip()]

Performance Tips (When Slow)

Quick fixes:

  • set() for O(1) lookups
  • collections.deque for BFS queues
  • @functools.cache for recursive memoization

Algorithm issues:

  • If >10s, brute force won't work. Look for: known algorithms, mathematical properties, structural patterns.
  • Avoid O(n² × cost) - preprocess to make inner checks O(1) via prefix sums, sparse tables, coordinate compression.
  • Sort candidates by potential value descending; early-terminate when remaining can't beat best.

Lessons from Past Days

Add a short note here whenever a day's solution required multiple iterations or ran into a performance issue—summarize the problem and the eventual fix so future runs avoid the same trap.

  • 2024 Day 24 Part 2: When finding defects in structured systems (circuits, graphs), analyze expected patterns rather than testing all combinations. Define structural invariants, find violations directly.
  • 2025 Day 9 Part 2: When checking O(n²) candidate pairs, don't let each validation be O(area). Preprocess data structures for O(1) checks. Use coordinate compression. Sort by potential and early-terminate.
  • 2025 Day 10: For constraint satisfaction problems involving linear toggling (modulo 2) or integer counts with a minimization objective, immediately use an SMT solver like z3. It is much faster to implement and less error-prone than manual Gaussian elimination or search/​DP.

Supporting Files

More skills from mattnigh

spring-framework-patterns logo
mattnigh/skills_collection

spring-framework-patterns

Comprehensive Spring Framework and Spring Boot best practices including dependency injection patterns, bean lifecycle and scopes, REST API development, Spring Data JPA, service layer design, Spring Security, testing strategies, caching, AOP, async processing, error handling, and common anti-patte...

24 0
View

TypeScript厳格モードによる型安全性設計を専門とするスキル。 📖 参照書籍: - 『Effective TypeScript』(Dan Vanderkam): 型設計 📚 リソース参照: - `resources/Level1_basics.md`: レベル1の基礎ガイド - `resources/Level2_intermediate.md`: レベル2の実務ガイド - `resources/Level3_advanced.md`: レベル3の応用ガイド - `resources/Level4_expert.md`: レベル4の専門ガイド - `resources/di...

24 0
View
deploying-cloud-k8s logo
mattnigh/skills_collection

deploying-cloud-k8s

Deploys applications to cloud Kubernetes (AKS/GKE/DOKS) with CI/CD pipelines. Use when deploying to production, setting up GitHub Actions, troubleshooting deployments. Covers build-time vs runtime vars, architecture matching, and battle-tested debugging.

24 0
View
moai-alfred-agent-guide logo
mattnigh/skills_collection

moai-alfred-agent-guide

19-agent team structure, decision trees for agent selection, Haiku vs Sonnet model selection, and agent collaboration principles. Use when deciding which sub-agent to invoke, understanding team responsibilities, or learning multi-agent orchestration.

24 0
View
mermaid-diagram-generator logo
mattnigh/skills_collection

mermaid-diagram-generator

Converts architecture descriptions, module specs, or workflow docs into Mermaid diagrams. Use when visualizing brick module relationships, workflows (DDD, investigation), or system architecture. Supports: flowcharts, sequence diagrams, class diagrams, state machines, entity relationship diagrams,...

24 0
View
pre-flight-check logo
mattnigh/skills_collection

pre-flight-check

INVOKE FIRST before any code work. Validates git workflow (branch, issue, worklog) and checks approach. Use at START of every task and END before completing. Prevents skipped steps.

24 0
View
browser-dev-tools logo
mattnigh/skills_collection

browser-dev-tools

This skill should be used when working with browser-rendered artifacts (i.e. Bun, React/React Native) to proactively validate that development work on localhost is being built appropriately and to support debugging browser-rendered content. Use this skill after making frontend changes to verify t...

24 0
View
lead-dev logo
mattnigh/skills_collection

lead-dev

Lead Développeur - Coordination technique opérationnelle, code review, mentoring et livraison. Pair de web-dev-process au niveau OPÉRATIONS.

24 0
View
worker-monitor logo
mattnigh/skills_collection

worker-monitor

Monitor Docker workers, RQ queue health, and auto-scale workers (max 4). Use when: checking job progress, monitoring queue depth, scaling workers up/down, diagnosing slow processing, or waiting for jobs to complete. Referenced by data-quality skill during reprocessing.

24 0
View
quality-advisor logo
mattnigh/skills_collection

quality-advisor

Proactive quality guidance system that monitors artifact creation and provides real-time feedback on documentation quality

24 0
View
bump-version logo
mattnigh/skills_collection

bump-version

This skill should be used when the user wants to bump the version number in the workspace. It updates versions across all pyproject.toml files (root, tde, and tda packages) and the CHANGELOG.md to keep them synchronized.

24 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View