|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## What This Repo Is |
| 6 | + |
| 7 | +A MkDocs-based tutorial site teaching FRC (FIRST Robotics Competition) Java programming to students. It is hosted on GitHub Pages via the `main` branch. The site is built with MkDocs Material and the `mkdocs-quiz` plugin. |
| 8 | + |
| 9 | +## Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +# Install dependencies (already done in devcontainer postCreate) |
| 13 | +pip install -r requirements.txt |
| 14 | + |
| 15 | +# Serve locally with live reload |
| 16 | +mkdocs serve |
| 17 | + |
| 18 | +# Build the static site to ./site/ |
| 19 | +mkdocs build |
| 20 | +``` |
| 21 | + |
| 22 | +There are no tests. There is no linter configured — the devcontainer installs an MkDocs Material linter VS Code extension (`ytianle.mkdocs-material-linter`) but it has no CLI equivalent. |
| 23 | + |
| 24 | +## Architecture |
| 25 | + |
| 26 | +### Content → Code separation via snippets |
| 27 | + |
| 28 | +Documentation pages live in [docs/](docs/) as Markdown. Java code examples live in [docs/code_examples/](docs/code_examples/) as real `.java` files. Pages embed code using the `pymdownx.snippets` `--8<--` syntax with named anchors: |
| 29 | + |
| 30 | +```markdown |
| 31 | +--8<-- "docs/code_examples/2026KitBotInline/subsystems/CANDriveSubsystem.java:motors" |
| 32 | +``` |
| 33 | + |
| 34 | +The anchor tags are comments in the Java files: |
| 35 | +```java |
| 36 | +// --8<-- [start:motors] |
| 37 | +... |
| 38 | +// --8<-- [end:motors] |
| 39 | +``` |
| 40 | + |
| 41 | +This means **code examples must be valid Java** and changes to them require updating the anchor tags. When adding new code examples, add both the `.java` file and the corresponding `--8<--` references in the Markdown page. |
| 42 | + |
| 43 | +### Navigation registration |
| 44 | + |
| 45 | +New pages must be added to the `nav:` section of [mkdocs.yml](mkdocs.yml) to appear in the site. Pages not listed in `nav:` are built but not linked. The site uses `use_directory_urls: false`. |
| 46 | + |
| 47 | +### FRC-specific content policy |
| 48 | + |
| 49 | +Before writing or editing any FRC programming content (WPILib APIs, vendor libraries, motor controllers, sensors), use the MCP documentation tools configured in [.github/copilot-instructions.md](.github/copilot-instructions.md): |
| 50 | + |
| 51 | +- `mcp_wpilib_search_frc_docs(query=..., vendors=[...])` — search docs |
| 52 | +- `mcp_wpilib_fetch_frc_doc_page(url=...)` — fetch full page |
| 53 | + |
| 54 | +Always base FRC answers on these results and include citations. Do not rely solely on training data for vendor APIs (REV, CTRE, Redux, etc.). |
| 55 | + |
| 56 | +Vendor-to-hardware mapping: |
| 57 | +| Hardware | Vendor param | |
| 58 | +|---|---| |
| 59 | +| SparkMax, SparkFlex, NEO | `"rev"` | |
| 60 | +| TalonFX, Falcon 500, Kraken, CANcoder, Pigeon | `"ctre"` | |
| 61 | +| Canandcoder, Canandmag | `"redux"` | |
| 62 | +| NavX, Limelight, PhotonVision | `"wpilib"` / `"photonvision"` | |
| 63 | + |
| 64 | +Default to the **2026 season** unless otherwise specified. |
| 65 | + |
| 66 | +### New page template |
| 67 | + |
| 68 | +Use [template_page.md](template_page.md) as the starting point for new pages. Key conventions: |
| 69 | + |
| 70 | +- Add contributor credit in the HTML comment at the top |
| 71 | +- Use `***` horizontal rules between major sections |
| 72 | +- Use `!!! tip`, `!!! note`, `!!! warning` admonitions for callouts |
| 73 | +- Link targets should use `{target=_blank}` for external links |
| 74 | + |
| 75 | +### Improvement planning docs |
| 76 | + |
| 77 | +[improvement_analysis/](improvement_analysis/) contains research and planning documents (not part of the tutorial content). These are not deployed to the site and do not appear in `nav:`. |
0 commit comments