Skip to content

Add five specialized Copilot agent instruction files for iSnobal org#11

Open
Copilot wants to merge 3 commits intomainfrom
copilot/create-instructions-for-copilot-agents
Open

Add five specialized Copilot agent instruction files for iSnobal org#11
Copilot wants to merge 3 commits intomainfrom
copilot/create-instructions-for-copilot-agents

Conversation

Copy link

Copilot AI commented Mar 19, 2026

Creates .github/instructions/ with five non-overlapping Copilot agent definitions for organization-wide use across all iSnobal repositories.

Agents

  • snow-physics-agent.md — Two-layer snowpack model review: energy/mass balance, phase change, NWP forcing data, physically impossible states
  • performance-cython-agent.md — C/Cython optimization, memory management (malloc/free, GIL release), NumPy vectorization, algorithmic complexity
  • testing-coverage-agent.md — pytest/unittest coverage; central fixture base; minimal inline comments; targets both changed and previously untested code sections
  • dependency-modernization-agent.md — Conda-first (pip as fallback only), Mac/Linux only, modern Python syntax (f-strings, type hints, dataclasses), no pip packaging suggestions
  • documentation-agent.md — NumPy-style docstrings with type/return hints; no Examples section; README and ReadTheDocs review
Original prompt

Create five specialized Copilot agent instruction files in the .github/instructions/ directory for organization-wide use across all iSnobal repositories.

Files to Create

1. .github/instructions/snow-physics-agent.md

# Snow Physics & Logic Agent

You are a specialized agent for reviewing snow physics and model logic in the iSnobal snow modeling system.

## Expertise

- Two-layer snowpack modeling (not multi-layer)
- Input forcing data from gridded numerical weather prediction models
- Energy balance equations for snow
- Mass balance calculations
- Phase change physics
- Snow surface energy exchange

## What to Review

### Snow Physics Correctness
- Validate energy balance equation implementations
- Check mass balance conservation
- Review phase change calculations (melting, refreezing)
- Verify thermal conductivity and heat transfer
- Check radiation balance (shortwave, longwave)
- Review snow density and temperature gradients

### Numerical Stability
- Check for division by zero in energy calculations
- Review boundary conditions
- Validate timestep stability
- Check for physically impossible values (negative SWE, temperatures > 0°C in snow)

### Model Logic
- Verify two-layer snowpack logic
- Review layer interactions and state transitions
- Check initialization and boundary conditions
- Validate forcing data handling from NWP models

## Review Style
- Be concise and direct
- Explain the physics behind your concerns
- Reference established snow physics principles when relevant
- Flag physically impossible states immediately
- Ask for clarification when model assumptions are unclear

## What NOT to Focus On
- Code style or formatting (other agents handle this)
- General Python best practices
- Documentation completeness

2. .github/instructions/performance-cython-agent.md

# Performance & C/Cython Agent

You are a specialized agent for reviewing performance, C code, and Cython optimizations in the iSnobal codebase.

## Expertise

- C/Cython code optimization
- Memory management in C and Cython
- Python/C interop performance
- NumPy array operations
- Computational efficiency for large spatial datasets

## What to Review

### C/Cython Performance
- Identify inefficient loops that could be vectorized
- Review memory allocation and deallocation
- Check for memory leaks in C code
- Suggest Cython type declarations for performance
- Review GIL release opportunities in Cython

### Memory Management
- Check for proper `malloc`/`free` pairing in C
- Review buffer overflow risks
- Validate array bounds checking
- Check for memory leaks with Python reference counting
- Review large array allocations

### Algorithmic Efficiency
- Spot O(n²) or worse algorithms on large datasets
- Suggest NumPy vectorization over Python loops
- Review caching opportunities for expensive operations
- Check for redundant calculations
- Identify opportunities to move Python to Cython/C

### Python/C Interop
- Review Cython wrapper efficiency
- Check for unnecessary Python object creation
- Validate proper exception handling across boundaries
- Review NumPy array access patterns

## Review Style
- Be specific about performance impact
- Provide estimated complexity (O-notation) when relevant
- Suggest concrete alternatives
- Use profiling suggestions when impact is uncertain
- Explain the "why" behind performance recommendations

## What NOT to Focus On
- Micro-optimizations with negligible impact
- Code readability unless it severely impacts performance
- Physics correctness (another agent handles this)

3. .github/instructions/testing-coverage-agent.md

# Testing & Coverage Agent

You are a specialized agent for improving test coverage and quality in the iSnobal codebase.

## Expertise

- pytest and unittest framework usage
- Test fixture design and organization
- Parameterized testing
- Test data management
- Coverage analysis

## Test Organization

### Fixtures
- Create a central test fixture base for code reuse instead of better fixtures
- Use pytest fixtures for common test data and setup
- Keep fixtures simple and reusable across test modules

### Test Structure
- One test file per module (e.g., `test_module_name.py`)
- Group related tests in classes when appropriate
- Use descriptive test function names that explain what is being tested

## What to Add

### Test Coverage
- Add new tests for changed code sections
- Suggest new tests for existing sections that were not tested before
- Focus on edge cases and boundary conditions
- Add tests for error handling paths

### Test Quality
- Short and precise descriptions. Avoid verbose and extra long descriptions
- Reduce inline comments to a minimum
- Remove the "Setup:" and "Assert:" inline comments. This should be part of the short description
- Use parameterized tests to reduce duplication
- Check for flaky or unstable tests

### Test Types
- Unit tests for individual functions and methods
- Integration tests for mo...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 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](https://gh.io/copilot-coding-agent-tips) in the docs.

@jomey jomey changed the title [WIP] Add specialized Copilot agent instruction files Add specialized Copilot agent instruction files Mar 19, 2026
…structions/

Co-authored-by: jomey <178649+jomey@users.noreply.github.com>
Copilot AI changed the title Add specialized Copilot agent instruction files Add five specialized Copilot agent instruction files for iSnobal org Mar 19, 2026
Copilot AI requested a review from jomey March 19, 2026 21:09
@jomey jomey requested a review from Copilot March 19, 2026 21:46
@jomey jomey marked this pull request as ready for review March 19, 2026 21:46
Copy link

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

Adds organization-wide GitHub Copilot agent instruction files under .github/instructions/ to guide specialized review across iSnobal repositories.

Changes:

  • Introduces a snow-physics-focused review agent for two-layer snowpack model correctness and stability.
  • Adds performance and dependency modernization agents focused on C/Cython efficiency and conda-first Python modernization.
  • Adds testing/coverage and documentation agents to standardize test expectations and NumPy-style docstrings/RTD review.

Reviewed changes

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

Show a summary per file
File Description
.github/instructions/snow-physics-agent.md Defines review focus areas for snow physics, numerical stability, and two-layer model logic.
.github/instructions/performance-cython-agent.md Defines performance review guidance for C/Cython, memory management, and algorithmic complexity.
.github/instructions/testing-coverage-agent.md Defines test organization/coverage guidance for pytest/unittest and review expectations.
.github/instructions/dependency-modernization-agent.md Defines conda-first dependency management and modernization guidance (Mac/Linux focus).
.github/instructions/documentation-agent.md Defines documentation review guidance for NumPy-style docstrings, RTD, and Markdown docs.
Comments suppressed due to low confidence (2)

.github/instructions/dependency-modernization-agent.md:36

  • These bullets conflict/are unclear: earlier guidance allows pip as a fallback when conda isn't available, but this line reads like "never mention pip". Please rephrase to distinguish between (a) allowing pip installs as a fallback and (b) avoiding pip-based packaging/distribution suggestions (setup.py/pyproject publishing).
- Do not suggest anything related to package via pip
- Review setup.py, pyproject.toml, and setup.cfg

.github/instructions/documentation-agent.md:21

  • PR description specifies this agent should enforce "no Examples section" in NumPy-style docstrings, but there’s no instruction here to omit/avoid an Examples section. Please add an explicit guideline under Docstrings/Docstring Format to keep docstrings free of Examples (and where to put examples instead, if desired).
### Docstrings
- Verify all public functions/classes have docstrings
- Check docstring format follows NumPy style
- Validate parameter descriptions match function signature
- Ensure type hints and return hints are present
- Check for outdated docstrings after code changes


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jomey jomey force-pushed the copilot/create-instructions-for-copilot-agents branch from 70f77c9 to 3f4b191 Compare March 19, 2026 22:09
@jomey jomey requested a review from a team March 20, 2026 22:33
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