Agent Guidelines for stadt-geschichte-basel.github.io
This document provides guidance for AI agents (like GitHub Copilot, custom bots, or LLMs) working with this repository. Following these guidelines will improve the developer experience and ensure consistency across contributions.
Repository Overview
This repository contains the documentation platform for Stadt.Geschichte.Basel, focusing on research data management (RDM) and public history. The project uses Quarto to build a documentation website from Markdown and QMD (Quarto Markdown) files.
Key Information:
- Project Type: Documentation website built with Quarto
- Primary Languages: Quarto Markdown (
.qmd), R, Python, JavaScript - Deployment: GitHub Pages (published to
https://dokumentation.stadtgeschichtebasel.ch/) - Licenses: Code (AGPL-3.0), Data/Content (CC BY 4.0)
Purpose & Audience
- Purpose: Provide public-facing documentation of methods, guidelines, products, and activities of Stadt.Geschichte.Basel, with reproducible and citable outputs when appropriate.
- Audience: Researchers, cultural heritage professionals, educators, students, and partners. Content under
products/interna/primarily serves internal workflows and team collaboration. - Publication: Built with Quarto and deployed via GitHub Pages. Rendered output lives in
_site/; cached, reproducible artifacts are stored in_freeze/.
Technology Stack
Core Technologies
- Quarto: Static site generator for scientific and technical publishing
- R: Statistical computing and data analysis (managed with
renv) - Python: Scripting and automation (managed with
uv) - Node.js: JavaScript tooling, linting, and formatting
Package Managers
- npm: Node.js packages (
package.json) - uv: Python packages and virtual environments (
pyproject.toml) - renv: R packages (
renv.lock)
Repository Structure
The repository follows The Turing Way’s Advanced Structure for Data Analysis:
├── assets/ # Images, figures, and other media files
├── docs/ # Documentation files and assets
├── products/ # Final products (reports, papers, presentations)
├── renv/ # R environment and package dependencies
├── _extensions/ # Quarto extensions (custom themes)
├── _quarto.yml # Main Quarto configuration
├── *.qmd # Quarto markdown content files
└── styles.css # Custom CSS styles
Content Architecture
- Top-level pages:
index.qmd,about.qmd,team.qmdare public entry points without DOIs. - Products: Under
products/grouped by domain (e.g.,publications/,talks-posters/,research-data/). These may be citable and often carry DOIs in YAML. - Interna:
products/interna/holds internal or process documentation; typically not citable and should not carry DOIs. - Build artifacts:
_site/(rendered site),_freeze/(cached outputs for reproducibility),site_libs/(client libs). Do not edit these by hand.
Development Workflow
Initial Setup
# Install Node.js dependencies
npm install
# Setup Python environment
uv sync
# Setup R environment
Rscript -e 'install.packages("renv"); renv::restore()'Common Commands
| Command | Description |
|---|---|
npm run check |
Check if all files are properly formatted |
npm run format |
Auto-format all files with Prettier |
npm run commit |
Run commit message wizard (commitizen) |
npm run changelog |
Generate CHANGELOG.md |
uv run quarto preview |
Preview documentation locally |
uv run quarto render |
Build the documentation site |
uv run quarto check |
Check Quarto installation and setup |
Recommended Development Environment
GitHub Codespaces is the preferred development environment. It provides a pre-configured container with all necessary tools:
- Node.js with npm
- Python with uv
- R with renv
- Quarto
Repository Conventions
Commit Messages
This project uses Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types: feat, fix, docs, style, refactor, test, chore, ci
Use npm run commit to ensure proper formatting.
Code Formatting
- Prettier is used for all file formatting
- Configuration:
.prettierrc - Always run
npm run formatbefore committing - Pre-commit hooks enforce formatting (via Husky)
File Naming
- Use lowercase with hyphens for file names:
my-document.qmd - Quarto files use
.qmdextension for markdown with embedded code - Standard markdown files use
.mdextension
Multilingual Content
- Default language: German (
de). Keep German as the baseline unless a page requires additional languages. - Page-level language: Set
lang: de(oren, etc.) in page YAML. Translatetitle,description, and other metadata per language.
Agent-Specific Guidance
When Working with Content
- Respect Dual Licensing: Code changes (AGPL-3.0), content changes (CC BY 4.0)
- Language: Primary language is German; maintain consistency
- Content Structure: Follow existing patterns in
.qmdfiles - YAML Front Matter: Include title, description, and other metadata as seen in existing files
Citation & DOI Policy
- When to add a DOI: Citable outputs (e.g.,
products/publications/*,products/talks-posters/*) should include adoi:in YAML if a DOI exists (typically Zenodo or publisher DOI). - Citation block: Include a
citation:block in YAML when a canonical reference is available. Prefer standard formats and stable identifiers. - Internal pages: Do not add DOIs to internal or purely informational pages (e.g.,
products/interna/*, top-level landing pages). - Links: Use the canonical resolver form
https://doi.org/<doi>in content and references.
When Working with Code
- Dependencies:
- Always check for existing packages before adding new ones
- Update lock files:
package-lock.json,renv.lock,uv.lock - Test that new dependencies work in the Codespace environment
- Quarto Configuration:
- Main config:
_quarto.yml - Theme customizations:
_extensions/Stadt-Geschichte-Basel/sgb-theme/ - Don’t modify Quarto settings without understanding their impact
- Main config:
- Testing Changes:
- Always preview locally with
uv run quarto preview - Check formatting with
npm run check - Verify links are not broken
- Always preview locally with
Executable Code in Pages
- R: Some pages contain R code chunks (``
{r}). Execution occurs during Quarto render. Userenvto manage packages; preferfreeze: auto` in YAML for reproducibility. - Python: Python execution is currently uncommon/not required; only add Python chunks (``
{python}) if justified and ensureuv` environment is synced. - Avoid heavy ops: Keep chunks deterministic and resource-light; avoid network calls during build. Cache results or precompute and store artifacts under
assets/when necessary.
When Modifying Documentation Structure
- Update
_quarto.ymlif adding/removing pages or changing navigation - Maintain consistency in sidebar structure
- Update README.md if workflow changes
- Consider breadcrumb navigation paths
Common Tasks for Agents
Adding a New Documentation Page
- Create new
.qmdfile in appropriate directory - Add YAML front matter (title, description, etc.)
- Template: see docs/sample-index.qmd for a canonical example
- Add entry to
_quarto.ymlsidebar section - Preview with
uv run quarto preview - Format with
npm run format
Fixing Formatting Issues
- Run
npm run checkto identify issues - Run
npm run formatto auto-fix - For Quarto-specific issues, check with
uv run quarto check
Updating Dependencies
Node.js:
npm update
npm run checkPython:
uv sync --upgradeR:
Rscript -e 'renv::update()'Creating New Products/Outputs
- Place in
products/directory - Follow existing naming and structure conventions
- Update
products/products.qmdif it’s a new category - Update sidebar in
_quarto.yml
Troubleshooting
Quarto Won’t Render
- Check
uv run quarto checkoutput - Verify Python/R environments are activated
- Check for syntax errors in
.qmdfiles
Formatting Conflicts
- Prettier may conflict with some generated files
- Check
.prettierrcfor exclusions - Add problematic files to ignore patterns if needed
Build Failures
- Check all three package managers are in sync (npm, uv, renv)
- Clear cache:
uv run quarto render --clean - Verify environment matches
.devcontainer/devcontainer.json
Resources
Quick Reference for Agents
Before Making Changes
During Development
Before Submitting
Last Updated: 2025-11-13 Maintained By: @Stadt-Geschichte-Basel