agentleFS
Microsoft AzureKnown publisherAzure/fleet-networking/.github/copilot-instructions.md

fleet-networking

Copilot instructions29 starsChanged 3 months agoMITView on GitHub

This repo contains networking components and controllers for the Fleet project. It is primarily written in Go and leverages Kubernetes client-go and controller-runtime libraries. The repository is organized as a monorepo, with packages grouped by functionality.

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

24 rules. About 0 are common, 18 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈18

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use @terminal when answering questions about Git.

    line 7
  2. Distinctive:

    If you're waiting for my confirmation ("OK"), proceed without further prompting.

    line 8
  3. Distinctive:

    Follow the Go Style Guide and Uber Go Style Guide if possible.

    line 9
  4. Distinctive:

    Run goimports on save.

    line 11
  5. Distinctive:

    Run golint and go vet to check for errors.

    line 12
  6. Distinctive:

    Use go mod tidy if the dependencies are changed.

    line 13
  7. Distinctive:

    Use table-driven tests for unit tests.

    line 59
  8. Very specific:

    Run go test -v ./... to execute all tests.

    line 60
  9. Distinctive:

    Run tests for modified packages and verify they pass.

    line 61
  10. Distinctive:

    When adding tests, reuse existing setup and contexts where possible.

    line 67
  11. Distinctive:

    Only add imports if absolutely needed.

    line 68
  12. Very specific:

    Use specifications from the .github/.copilot/specifications folder.

    line 76
  13. Very specific:

    Use the .github/.copilot/specifications/.template.md file as a template for specification structure.

    line 78
  14. Very specific:

    Create the breadcrumb file in the ${REPO}/.github/.copilot/breadcrumbs folder using the format: yyyy-mm-dd-HHMM-{title}.md …

    line 99
  15. Distinctive:

    Update the breadcrumb BEFORE making any code changes.

    line 112
  16. Distinctive:

    Update the breadcrumb AFTER completing each significant change.

    line 114
  17. Distinctive:

    Keep the breadcrumb as our single source of truth as it contains the most recent information.

    line 115
  18. Distinctive:

    Ask me to verify the plan with: "Are you happy with this implementation plan?" before proceeding with code changes.

    line 117
  19. Distinctive:

    Before concluding, ensure the breadcrumb file properly documents the entire process, including any course corrections or challenges …

    line 121
  20. Distinctive:

    When creating a plan, organize it into numbered phases (e.g., "Phase 1: Setup Dependencies").

    line 126
  21. Distinctive:

    Start all planning tasks as unchecked, and update them to checked as implementation proceeds.

    line 131
  22. Very specific:

    If the domain knowledge has changed, update the related files in the domain_knowledge folder.

    line 135
  23. Very specific:

    If specifications have changed, update the related files in the specifications folder.

    line 136
  24. Distinctive:

    When coding you need to follow the plan phases and check off the tasks as they are completed.

    line 139

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Overview

This repo contains networking components and controllers for the Fleet project. It is primarily written in Go and leverages Kubernetes client-go and controller-runtime libraries. The repository is organized as a monorepo, with packages grouped by functionality.

General Rules

  • Use @terminal when answering questions about Git.
  • If you're waiting for my confirmation ("OK"), proceed without further prompting.
  • Follow the Go Style Guide and Uber Go Style Guide if possible. If there are any conflicts, follow the Go Style Guide.
  • Favor using the standard library over third-party libraries.
  • Run goimports on save.
  • Run golint and go vet to check for errors.
  • Use go mod tidy if the dependencies are changed.

Terminology

  • Fleet: A collection of Kubernetes clusters managed as a unit.
  • Networking Controller: A controller responsible for managing network resources across clusters.
  • Hub cluster: An Kubernetes cluster that hosts the control plane of the fleet.
  • Member cluster: A Kubernetes cluster that is part of the fleet.
  • Fleet-system Namespace: A reserved namespace in all clusters for running Fleet networking controllers and putting internal resources.
  • Reserved member cluster namespace in the hub cluster: A reserved namespace in the hub cluster where a member cluster can access to communicate with the hub cluster.

Repository directory structure

  • api/ - Contains Golang structs for CRDs.
  • charts/ - Helm charts for deploying networking components.
    • charts/hub-net-controller-manager/ - Helm chart for the fleet hub networking components.
      • charts/mcs-controller-manager/ - Helm chart for the fleet member networking component which provides the L4 load balancing functionality.
      • charts/member-net-controller-manager/ - Helm chart for the fleet member networking components.
  • cmd/ - Entry points for networking controllers and agents.
    • cmd/hub-net-controller-manager/ - Main entry point for the hub networking components.
    • cmd/mcs-controller-manager/ - Main entry point for the member networking component which provides the L4 load balancing functionality.
    • cmd/member-net-controller-manager/ - Main entry point for the member networking components.
  • config/ - CRD manifests and configuration files built from the CRD definitions in the api/ folder.
    • config/crd/bases - CRD definitions for the networking features.
  • docker/ - Dockerfiles for building images for networking components.
  • examples/ - Example YAMLs for CRDs and networking resources.
  • hack/ - Scripts and tools for development.
  • pkg/ - Libraries and core logic for networking controllers.
    • pkg/common/ - Common libraries shared between networking controllers.
    • pkg/controllers/ - Core networking controllers.
      • pkg/controllers/hub/ - Hub networking controller logic.
      • pkg/controllers/member/ - Member networking controller logic.
      • pkg/controllers/mcs/ - MCS networking controller logic.
  • test/ - Integration, and e2e tests.
    • test/apis/ - The tests for the CRD definitions.
    • test/common/ - Common test utilities and helpers.
    • test/e2e/ - End-to-end tests for networking components.
    • test/perftest/ - Performance tests for networking components.
    • test/scripts/ - Scripts to setup and clean the e2e test environments.
  • tools/ - Client-side tools for managing networking resources.
  • Makefile - Build and test automation.
  • go.mod / go.sum - Dependency management.

Testing Rules

  • Unit test files should be named <go_file>_test.go and be in the same directory.
  • Use table-driven tests for unit tests.
  • Run go test -v ./... to execute all tests.
  • Run tests for modified packages and verify they pass.
  • Share analysis for failing tests and propose fixes.
  • Integration test files should be named <go_file>_integration_test.go and placed in the same or test directory.
  • Integration and e2e tests are written in Ginkgo style.
  • E2E tests are under test/e2e and run with make e2e-tests.
  • Clean up e2e tests with make e2e-cleanup.
  • When adding tests, reuse existing setup and contexts where possible.
  • Only add imports if absolutely needed.

Domain Knowledge

Use the files in the docs/** and .github/.copilot/domain_knowledge/**/* as a source of truth when it comes to domain knowledge. These files provide context in which the current solution operates. This folder contains information like entity relationships, workflows, and ubiquitous language. As the understanding of the domain grows, take the opportunity to update these files as needed.

Specification Files

Use specifications from the .github/.copilot/specifications folder. Each folder under specifications groups similar specifications together. Always ask the user which specifications best apply for the current conversation context if you're not sure.

Use the .github/.copilot/specifications/.template.md file as a template for specification structure.

examples:

├── application_architecture
│   └── main.spec.md
|   └── specific-feature.spec.md
├── database
│   └── main.spec.md
├── observability
│   └── main.spec.md
└── testing
   └── main.spec.md

Breadcrumb Protocol

A breadcrumb is a collaborative scratch pad that allow the user and agent to get alignment on context. When working on tasks in this repository, follow this collaborative documentation workflow to create a clear trail of decisions and implementations:

  1. At the start of each new task, ask me for a breadcrumb file name if you can't determine a suitable one.
  2. Create the breadcrumb file in the ${REPO}/.github/.copilot/breadcrumbs folder using the format: yyyy-mm-dd-HHMM-{title}.md (year-month-date-current_time_in-24hr_format-{title}.md using UTC timezone)
  3. Structure the breadcrumb file with these required sections:
    • Requirements: Clear list of what needs to be implemented.
    • Additional comments from user: Any additional input from the user during the conversation.
    • Plan: Strategy and technical plan before implementation.
    • Decisions: Why specific implementation choices were made.
    • Implementation Details: Code snippets with explanations for key files.
    • Changes Made: Summary of files modified and how they changed.
    • Before/After Comparison: Highlighting the improvements.
    • References: List of referred material like domain knowledge files, specification files, URLs and summary of what is was used for. If there is a version in the domain knowledge or in the specifications, record the version in the breadcrumb.
  4. Workflow rules:
    • Update the breadcrumb BEFORE making any code changes.
    • Get explicit approval on the plan before implementation.
    • Update the breadcrumb AFTER completing each significant change.
    • Keep the breadcrumb as our single source of truth as it contains the most recent information.
  5. Ask me to verify the plan with: "Are you happy with this implementation plan?" before proceeding with code changes.
  6. Reference related breadcrumbs when a task builds on previous work.
  7. Before concluding, ensure the breadcrumb file properly documents the entire process, including any course corrections or challenges encountered.

This practice creates a trail of decision points that document our thought process while building features in this solution, making pull request review for the current change easier to follow as well.

Plan Structure Guidelines

  • When creating a plan, organize it into numbered phases (e.g., "Phase 1: Setup Dependencies").
  • Break down each phase into specific tasks with numeric identifiers (e.g., "Task 1.1: Add Dependencies").
  • Include a detailed checklist at the end of the document that maps to all phases and tasks.
  • Plan should always lookup related information from domain_knowledge folder and any applicable specification files.
  • Mark tasks as - [ ] for pending tasks and - [x] for completed tasks.
  • Start all planning tasks as unchecked, and update them to checked as implementation proceeds.
  • Each planning task should have clear success criteria.
  • End the plan with success criteria that define when the implementation is complete.
  • Plans should start with writing Unit Tests first when possible, so we can use those to guide our implementation. Same for UI tests when it makes sense.
  • If the domain knowledge has changed, update the related files in the domain_knowledge folder.
  • If specifications have changed, update the related files in the specifications folder.

Following Plans

  • When coding you need to follow the plan phases and check off the tasks as they are completed.
  • As you complete a task, update the plan and mark that task complete before you begin the next task.
  • Tasks that involved tests should not be marked complete until the tests pass.

Example Usage

User: I need to implement JWT authentication for our Express API.

Agent: I'll help with implementing JWT authentication for your Express API. Let me create a breadcrumb file to track our implementation. What would you like to name this breadcrumb?

User: Use "jwt-auth-implementation"

Agent: I've created the breadcrumb file 2025-04-08-1430-jwt-auth-implementation.md. Are you happy with this implementation plan?

[high level plan with tasks here]

User: Looks good, but let's use 30-minute expiration for tokens.

Agent: I've updated the breadcrumb with your specification: Are you happy with this implementation plan?

[high level plan with tasks here]

User: Yes, please proceed.

Agent: I'll implement the JWT authentication now. Let me start by installing the necessary packages and creating the authentication middleware. I've updated the breadcrumb with implementation details. Is there anything specific you'd like me to modify or explain about the implementation?

User: This looks good.

Agent: I've updated the breadcrumb with the latest understanding.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.