Docs: Add copilot config, extract shared agent workflow guidelines

Create .github/copilot-instructions.md as a minimal GitHub Copilot entry point, trim CLAUDE.md to a minimal pointer file, and move shared safety/output-expectation guidance into docs/agents/workflow.md. Also update the header/implementation-split rule in docs/agents/coding-style.md to allow short one-line bodies and short initializer lists inline in the header.
This commit is contained in:
Magne Sjaastad committed 2026-09-15 12:51:35 +02:00
1 parent 2474e8885e
commit aad5fca262
4 files changed
+74 -56

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
# GitHub Copilot Instructions
You are an automated contributor to the ResInsight repository.
## Source of Truth
You MUST follow the canonical agent guidelines located in the `docs/agents/` directory:
- **[docs/agents/core.md](../docs/agents/core.md)** - Core agent guidelines, architecture overview, PDM system, Python integration
- **[docs/agents/build.md](../docs/agents/build.md)** - Build system, prerequisites, test commands
- **[docs/agents/coding-style.md](../docs/agents/coding-style.md)** - Code formatting, style conventions
- **[docs/agents/repo-map.md](../docs/agents/repo-map.md)** - Repository structure and file locations
- **[docs/agents/workflow.md](../docs/agents/workflow.md)** - Safety guidelines and output expectations
These documents contain the authoritative information about the project. Always consult them when working on code.
+2 -51
View File
@@ -10,57 +10,8 @@ You MUST follow the canonical agent guidelines located in the `docs/agents/` dir
- **[docs/agents/build.md](docs/agents/build.md)** - Build system, prerequisites, test commands
- **[docs/agents/coding-style.md](docs/agents/coding-style.md)** - Code formatting, style conventions
- **[docs/agents/repo-map.md](docs/agents/repo-map.md)** - Repository structure and file locations
- **[docs/agents/workflow.md](docs/agents/workflow.md)** - Safety guidelines and output expectations
These documents contain the authoritative information about the project. Always consult them when working on code.
## Claude-Specific Rules
### Change Philosophy
- Prefer minimal diffs - make the smallest possible changes to achieve the goal
- Do not reformat unrelated code
- Preserve existing code style and comments
- Only modify files directly related to your task
### Safety Guidelines
- Never modify CI/CD configuration unless explicitly asked
- Always validate changes don't break existing behavior
- Always validate changes don't introduce security vulnerabilities
- If unsure about a change, stop and explain the uncertainty to the user
### Testing
- Run existing linters and tests before making changes
- Run linters and tests after making changes
- Do not add new testing tools unless necessary
- Do not remove or modify unrelated tests
## Output Expectations
### Before Making Changes
- Explain your reasoning and approach
- List the specific files that will be modified
- Describe the expected impact of the changes
### When Making Changes
- Make incremental, focused changes
- Test each change before proceeding
- Report progress frequently using the `report_progress` tool
### After Making Changes
- Verify the changes work as expected
- Run relevant tests and linters
- Document any issues or limitations discovered
## Working with Python
When working with Python code:
- Always format code with `ruff format`
- Always check style with `ruff check --fix`
- Run these before committing changes
## Commit Messages
Follow these conventions:
- Start with issue number: `#12773 Python: Add API for creating valve templates`
- Use standard git commit message format
- Only use line breaks between paragraphs in the description
- Keep first line concise and descriptive
Use `report_progress` to report progress frequently while working.
+30 -5
View File
@@ -46,7 +46,7 @@ python -m ruff check --fix test_polygons.py
1. **Minimal Changes**: Make the smallest possible changes to achieve the goal
2. **Preserve Formatting**: Do not reformat unrelated code
3. **Comments**: Match the style of existing comments in the file
3. **Comments**: Match the style of existing comments in the file, keep them concise and as short as possible while still being clear
4. **Libraries**: Use existing libraries whenever possible; only add new libraries or update versions if absolutely necessary
### Code Quality
@@ -69,17 +69,27 @@ python -m ruff check --fix test_polygons.py
Put function bodies in the `.cpp` file, not inline in the header.
- Declare member functions in the header; define them in the matching `.cpp`.
- This applies even to one-line bodies (`return false;`, `return m_field;`, trivial forwarders).
- Exceptions: function templates that must stay in the header, and `constexpr` functions where the compiler requires the definition to be visible.
- Exceptions: function templates that must stay in the header, `constexpr` functions where the compiler requires the definition to be visible, and functions with an empty body (`{}`) or a short initializer list.
```cpp
// Bad – inline body in the header
// OK – short one-line body allowed inline
class RimFoo
{
public:
bool canAddSubCollection() const override { return false; }
};
// Bad – multi-statement body inline in the header
class RimFoo
{
public:
bool canAddSubCollection() const override
{
if ( m_locked ) return false;
return m_children.empty();
}
};
// Good – declared in the header, defined in the .cpp
// RimFoo.h
class RimFoo
@@ -91,8 +101,23 @@ public:
// RimFoo.cpp
bool RimFoo::canAddSubCollection() const
{
return false;
if ( m_locked ) return false;
return m_children.empty();
}
// OK – empty body / short initializer list allowed inline
class RimBar
{
public:
void reset() {}
RimBar( int value )
: m_value( value )
{
}
private:
int m_value = 0;
};
```
Why: keeps headers light (faster builds, smaller include surface), keeps the implementation file as the single source of truth for behavior, and matches the existing style across `ApplicationLibCode`.
+27
View File
@@ -0,0 +1,27 @@
# Agent Workflow Guidelines
This document describes how AI agents should operate when making changes to ResInsight.
## Safety Guidelines
- Never modify CI/CD configuration unless explicitly asked
- Always validate changes don't break existing behavior
- Always validate changes don't introduce security vulnerabilities
- If unsure about a change, stop and explain the uncertainty to the user
## Output Expectations
### Before Making Changes
- Explain your reasoning and approach
- List the specific files that will be modified
- Describe the expected impact of the changes
### When Making Changes
- Make incremental, focused changes
- Test each change before proceeding
- Report progress frequently
### After Making Changes
- Verify the changes work as expected
- Run relevant tests and linters
- Document any issues or limitations discovered