Skip to content

Add comprehensive copilot-instructions.md for agent onboarding#2048

Merged
GernotMaier merged 10 commits intomainfrom
copilot/add-copilot-instructions
Feb 16, 2026
Merged

Add comprehensive copilot-instructions.md for agent onboarding#2048
GernotMaier merged 10 commits intomainfrom
copilot/add-copilot-instructions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 15, 2026

Expanded .github/copilot-instructions.md from 20 lines to 616 lines of actionable guidance for coding agents. This one-time onboarding investment improves agent efficiency and code quality across the repository.

Content Added

Project Context

  • Monte Carlo simulations for CTAO gamma-ray astronomy
  • Module structure: model/, simtel/, corsika/, ray_tracing/, visualization/, 50+ CLI applications
  • Python ≥3.12, scientific computing stack (numpy, astropy, h5py, eventio)

Development Workflow

  • Installation: pip install -e '.[dev,tests]' + pre-commit install
  • Testing: Mandatory unit tests (>90% coverage target), pytest commands, fixtures (tmp_test_directory not tmp_path)
  • Linting: ruff + pylint via pre-commit (70%+ docstring coverage required)

Conventions

  • Use pathlib, logging, f-strings, NumPy-style docstrings
  • Telescope naming: Site-Class-Type pattern (e.g., North-LST-1, South-MST-FlashCam-D)
  • Validate names via simtools.utils.names.validate_array_element_name()
  • Camera positions in centimeters, not meters

Infrastructure

  • CI: 14 GitHub Actions workflows (unit tests, integration tests, linting, docs, SonarQube)
  • Database: MongoDB for simulation models
  • Containers: ghcr.io/gammasim/simtools-dev:latest includes CORSIKA + sim_telarray

Quick Reference & Debugging

  • Common commands, known issues, workarounds
  • 10 principles for AI agents (test coverage, mocking, minimal changes)

Impact

Provides complete context for agents unfamiliar with:

  • Scientific computing domain (CTAO, Cherenkov telescopes)
  • Project-specific conventions (telescope naming, camera coordinate units)
  • Mandatory quality standards (unit tests, docstring coverage)
  • Tooling configuration (pytest markers, pylint exceptions for scientific variables)

Code review comment about HTTP URL in line 569: matches project's README.md, likely GitLab Pages without HTTPS configured.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cta-computing.gitlab-pages.cta-observatory.org
    • Triggering command: /usr/bin/curl curl -I -s --max-time 5 REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…cumentation

Co-authored-by: GernotMaier <14001688+GernotMaier@users.noreply.github.com>
Copilot AI changed the title [WIP] Add onboarding instructions for coding agent Add comprehensive copilot-instructions.md for agent onboarding Feb 15, 2026
Copilot AI requested a review from GernotMaier February 15, 2026 19:16
@GernotMaier GernotMaier marked this pull request as ready for review February 16, 2026 10:45
@GernotMaier GernotMaier requested a review from Copilot February 16, 2026 11:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR significantly expands the .github/copilot-instructions.md file from 20 lines to 323 lines, providing comprehensive guidance for AI coding agents working on the simtools project. The document serves as an onboarding resource covering project context, development workflows, coding conventions, testing requirements, and role-specific guidelines for different types of agents (Astrophysics Expert, Developer, Documentation Manager).

Changes:

  • Expanded copilot instructions from 20 lines to 323 lines with detailed project context, setup instructions, testing guidelines, coding conventions, and troubleshooting advice
  • Added changelog entry for the maintenance update
  • Includes project structure overview, dependency information, CI/CD context, and agent-specific role definitions

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
.github/copilot-instructions.md Comprehensive expansion of agent instructions covering project overview, setup, testing (mandatory unit tests, fixtures), code standards (pre-commit hooks, linting), coding conventions, development workflow, troubleshooting, documentation, dependencies, and role-specific guidelines for different agent types
docs/changes/2048.maintenance.md Changelog fragment documenting the improvement to copilot instructions

Critical Issues Found:

  1. Line 147: Incorrectly states "Do not use type hints on function signatures" when the codebase extensively uses type hints throughout (e.g., mirror_number: int, camera_config_file: str | Path, -> dict, -> float)
  2. Line 152: The example function demonstrates type hints, directly contradicting line 147's instruction
  3. Line 147: Minor formatting issue with double space before "type hints"
  4. Line 149: Minor grammatical error - "Private function can have" should be "Private functions can have"

The type hints contradiction is a critical issue that could mislead future AI agents to avoid using type hints, which are a well-established convention in this codebase. This needs to be corrected before merging.

- Use semantic versions without "v" prefix ("1.0.0", not "v1.0.0")
- Do not use **type hints** on function signatures

**Docstrings (MANDATORY):** NumPy style with Parameters, Returns, Raises, Examples sections. 70%+ coverage required for all public functions/methods. Private function can have single-line docstring if self-explanatory.
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammatical error: "Private function can have" should be "Private functions can have" (plural).

Suggested change
**Docstrings (MANDATORY):** NumPy style with Parameters, Returns, Raises, Examples sections. 70%+ coverage required for all public functions/methods. Private function can have single-line docstring if self-explanatory.
**Docstrings (MANDATORY):** NumPy style with Parameters, Returns, Raises, Examples sections. 70%+ coverage required for all public functions/methods. Private functions can have single-line docstrings if self-explanatory.

Copilot uses AI. Check for mistakes.
- Use **astropy.units** for physical quantities
- Validate names with `simtools.utils.names` functions
- Use semantic versions without "v" prefix ("1.0.0", not "v1.0.0")
- Do not use **type hints** on function signatures
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instruction "Do not use type hints on function signatures" is incorrect. The codebase extensively uses type hints throughout, including in core modules like src/simtools/model/telescope_model.py and src/simtools/model/camera.py. For example, functions use parameter annotations like mirror_number: int, camera_config_file: str | Path, and return type annotations like -> dict, -> float. This instruction should be removed or corrected to reflect the actual codebase convention of using type hints.

Suggested change
- Do not use **type hints** on function signatures
- Use **type hints** on function signatures, consistent with the existing codebase

Copilot uses AI. Check for mistakes.
**Docstrings (MANDATORY):** NumPy style with Parameters, Returns, Raises, Examples sections. 70%+ coverage required for all public functions/methods. Private function can have single-line docstring if self-explanatory.

```python
def example_function(parameter: str, optional_param: int | None = None) -> dict:
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example function shows type hints in the signature (parameter: str, optional_param: int | None = None) -> dict), which directly contradicts the instruction on line 147 that states "Do not use type hints on function signatures". Since the codebase does use type hints (as seen in telescope_model.py and camera.py), this example is correct and line 147 should be removed or corrected.

Copilot uses AI. Check for mistakes.
@ctao-sonarqube
Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@GernotMaier GernotMaier merged commit edf0ecb into main Feb 16, 2026
16 checks passed
@GernotMaier GernotMaier deleted the copilot/add-copilot-instructions branch February 16, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants