Skip to content

Create .github/instructions folder with cross-cutting topic instruction files#2198

Merged
Flix6x merged 19 commits into
mainfrom
copilot/create-instructions-folder
May 24, 2026
Merged

Create .github/instructions folder with cross-cutting topic instruction files#2198
Flix6x merged 19 commits into
mainfrom
copilot/create-instructions-folder

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 22, 2026

  • Explore all agent files to identify cross-cutting topics
  • Create .github/instructions/ directory with 9 topic-specific <topic>.instructions.md files following GitHub recommendations (with applyTo: frontmatter):
    • atomic-commits.instructions.md — commit discipline (applyTo: "**")
    • pre-commit-hooks.instructions.md — required hooks workflow (applyTo: "**")
    • docstrings.instructions.md — RST docstring format + doctests (applyTo: "**/*.py")
    • changelog.instructions.md — entry format and location (applyTo: "**")
    • error-handling.instructions.md — specific exception catching (applyTo: "**/*.py")
    • ui-terminology.instructions.md — "organisation" not "account" (applyTo: "flexmeasures/ui/**")
    • marshmallow-schemas.instructions.md — data_key conventions (applyTo: "flexmeasures/data/schemas/**/*.py")
    • timezone-awareness.instructions.md — always timezone-aware datetimes, including in log statements (applyTo: "**/*.py")
    • testing.instructions.md — full suite mandatory before session close, db vs fresh_db, requesting_user (applyTo: "flexmeasures/**/tests/**/*.py")
    • README.md — documents the folder structure, including step to remove redundant agent sections
  • Updated all 9 agent files to reference .github/instructions/ for shared cross-cutting conventions
  • Updated coordinator.md to document the .github/instructions/ structure
  • Removed redundant sections from all agent files (AGENTS.md, test-specialist.md, coordinator.md, and all other specialist files) — each now replaced with a one-liner pointer to the relevant instruction file
  • Added changelog entry under Infrastructure / Support in documentation/changelog.rst
  • All commits are atomic
  • PR Create .github/instructions folder with cross-cutting topic instruction files #2198 created
  • Label PR with "AI Infra"

Copilot AI and others added 12 commits May 22, 2026 22:36
Context:
- Every agent file repeats atomic commit requirements in its own section
- Extracting to a shared instruction makes it available to all Copilot interactions

Change:
- Created .github/instructions/atomic-commits.instructions.md
- Covers commit granularity, forbidden files, and commit message format

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- pre-commit requirements appear in tooling-ci-specialist, AGENTS.md (Lead),
  test-specialist, and coordinator — repeated four times across agent files

Change:
- Created .github/instructions/pre-commit-hooks.instructions.md
- Covers setup, mandatory execution, hook descriptions, and openapi caution

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- Docstring conventions appear in documentation-developer-experience-specialist
  and apply broadly to all Python contributors

Change:
- Created .github/instructions/docstrings.instructions.md
- Covers RST format, parameter alignment, doctests, Click conventions

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- Changelog requirements appear in AGENTS.md (Lead), documentation-specialist,
  and coordinator — all contributors need to know this

Change:
- Created .github/instructions/changelog.instructions.md
- Covers which files to update, RST format, PR template checkbox, and when
  a changelog entry is required vs optional

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- Error handling patterns appear in api-backward-compatibility-specialist and
  architecture-domain-specialist; relevant to any Python contributor

Change:
- Created .github/instructions/error-handling.instructions.md
- Covers specific exception catching, forbidden broad catches, HTTP status codes,
  and get-or-create idempotency pattern

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- 'organisation vs account' rule appears in documentation-developer-experience-specialist
  and AGENTS.md (Lead); applies to anyone touching UI templates or docs

Change:
- Created .github/instructions/ui-terminology.instructions.md
- Covers organisation/account distinction, internal role names, Jinja2 safety,
  and toast vs inline alert choice

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- data_key gotcha and schema parity requirements appear in both
  api-backward-compatibility-specialist and architecture-domain-specialist;
  ui-specialist also cross-checks API field keys in JS payloads

Change:
- Created .github/instructions/marshmallow-schemas.instructions.md
- Covers data_key vs attribute name, code paths to audit on schema changes,
  schema parity between Input/BeliefsSearchConfigSchema, and API schema conventions

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- Timezone requirements appear in data-time-semantics-specialist, architecture-
  domain-specialist, and documentation-specialist; any Python contribution may
  introduce naive datetime bugs

Change:
- Created .github/instructions/timezone-awareness.instructions.md
- Covers creating aware datetimes, pandas localize/convert, nominal durations,
  DST edge cases, and docs example requirements

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- Test conventions appear in test-specialist, tooling-ci-specialist, and AGENTS.md
  (Lead); relevant to any contributor writing or fixing tests

Change:
- Created .github/instructions/testing.instructions.md
- Covers full-suite requirement, module-level validation, db vs fresh_db fixture
  selection, API test isolation, test design intent, and module-scoped state resets

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
…entions

Context:
- .github/instructions/ was created with 9 instruction files covering topics that
  appear in 2+ agent files (atomic commits, pre-commit, docstrings, changelog,
  error handling, UI terminology, Marshmallow, timezone, testing)

Change:
- Added a blockquote note after ## Role in each specialist agent file pointing
  agents and contributors to .github/instructions/ for shared conventions
- Keeps agent files focused on domain-specific knowledge

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- A new .github/instructions/ directory was created with 9 cross-cutting
  instruction files extracted from agent knowledge
- Without documentation, future agents or contributors won't know the structure
  exists or how to extend it

Change:
- Added '### .github/instructions/ Structure' section under Domain Knowledge
- Documents purpose, current file list with applyTo globs and topics, and a
  Coordinator checklist for when to create new instruction files

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

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

My main comment is that I expect the agent files to now need fewer instructions, so this PR should also be removing some lines.

2. Add a YAML frontmatter block with `applyTo:` pointing to the relevant files.
3. Write concise, actionable instructions in natural language Markdown.
4. Update the table above.
5. Reference the new file from the relevant agent files in `.github/agents/`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. Go through the agent files to remove sections that have been made redundant by the new file.

## Entry format

```rst
* Brief description of the change, written for the intended audience. [see `PR #XXXX <https://www.github.com/FlexMeasures/flexmeasures/pull/XXXX>`_]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Follow the canonical formatting convention already present in the given changelog file (which might suddenly change or evolve in the future).

For instance, for the main changelog, we currently (!) prefer one sentence, without a period at the end of the sentence, abstracting away from technical details when possible, so you need to update this example.

API and CLI changelogs assume a slightly more technical audience and I think do use periods at the end. But again, the main rule is to follow the file's convention.

Comment thread .github/instructions/changelog.instructions.md
Comment thread .github/instructions/changelog.instructions.md
Comment thread .github/instructions/changelog.instructions.md
Comment thread .github/instructions/changelog.instructions.md

- Internal refactoring with no user-visible effect
- Test-only changes
- Agent instruction updates
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small agent instruction updates

Comment on lines +6 to +15
## Run the full test suite

After any code change, run the complete test suite — not just the tests for the module you changed:

```bash
uv sync --group test
uv run poe test
```

Partial test runs are insufficient. FlexMeasures has interconnected systems where changes in one area affect others.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A full test run is only mandatory before finishing the session and requesting a review. Intermediate full test runs are encouraged when appropriate.

start_time = datetime(2024, 1, 15, 10, 0, 0, tzinfo=timezone.utc)
```

Never show a naive `datetime(...)` call in user-facing documentation.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nor in log statements.

| Background job progress | `showToast("...", "info")` |
| Persistent field description users need while interacting | `<div class="alert alert-info">` |

Do not migrate inline `alert-info` divs showing persistent information to toasts — they would disappear before the user reads them.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

would -> could

Copilot AI and others added 7 commits May 23, 2026 09:44
…-terminology, and README

Context:
- PR #2198 review from @Flix6x

Change:
- changelog: follow canonical format (no period, section order feat/infra/fix, AI infra entry)
- testing: clarify full suite is mandatory only before requesting review
- timezone-awareness: add 'nor in log statements'
- ui-terminology: 'would' -> 'could'
- README: add step 6 to remove redundant agent sections after extraction

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- PR #2198 review requested a changelog entry under Infrastructure / Support

Change:
- Added entry for cross-cutting Copilot instruction files in .github/instructions/

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- Cross-cutting conventions extracted to .github/instructions/ in PR #2198

Change:
- Trim 'Must Run Pre-commit Hooks' to one-liner + pointer
- Trim 'Must Add Changelog Entry' to one-liner + pointer
- Trim 'Must Make Atomic Commits' + 'Commit Message Format' to one-liner + pointer
- Trim 'Must Avoid Temporary Files' to one-liner + pointer
- Trim 'Must Avoid Double Spaces' to one-liner + pointer
- Trim 'UI Terminology' to one-liner + pointer
- Trim session close checklist items to remove duplicated 'how-to' details

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
…ctions/

Context:
- Cross-cutting conventions extracted to .github/instructions/ in PR #2198

Change:
- Replace 'Docstring Style Rules' section with brief note + pointer to docstrings.instructions.md
- Replace 'Running Pre-commit Hooks', 'Pre-commit Hooks in This Project',
  'Fixing Linting Issues', 'Best Practices' with one-liner + pointer
- Collapse 'Small Atomic Commits', 'Commit Message Format', 'Avoiding Temporary Files'
  into a single short section + pointer to atomic-commits.instructions.md

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- Cross-cutting conventions extracted to .github/instructions/ in PR #2198

Change:
- Collapse 'Atomic Commit Discipline' + 'No Temporary Analysis Files' into one-liner + pointer
- Remove redundant 'Commit Message Format' section (now in atomic-commits.instructions.md)
- Add pointer to pre-commit-hooks.instructions.md in dev environment section

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
…ng files)

Context:
- Cross-cutting conventions extracted to .github/instructions/ in PR #2198

Change:
- api-backward-compatibility-specialist: trim 'Must Make Atomic Commits' to pointer
- architecture-domain-specialist: collapse 'Atomic Commits' + 'No Analysis Files' to pointer
- data-time-semantics-specialist: trim atomic commits list to pointer
- documentation-developer-experience-specialist: trim atomic commits + planning files to pointer
- performance-scalability-specialist: trim atomic commits list to pointer
- tooling-ci-specialist: slim 'Pre-commit Hook Execution' to requirement + pointer

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Context:
- Code review on PR #2198 flagged ambiguity in testing.instructions.md and changelog.instructions.md

Change:
- testing.instructions.md: clarify full suite is still mandatory at session close;
  targeted runs are only acceptable during active development
- changelog.instructions.md: define 'small' agent instruction updates concretely
- test-specialist.md: restore forbidden-docstring-pattern example

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Copilot finished work on behalf of Flix6x May 23, 2026 09:51
Copilot AI requested a review from Flix6x May 23, 2026 09:51
@Flix6x Flix6x marked this pull request as ready for review May 24, 2026 08:42
@Flix6x Flix6x merged commit 4c2c87d into main May 24, 2026
12 checks passed
@Flix6x Flix6x deleted the copilot/create-instructions-folder branch May 24, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants