Skip to content

Instantly share code, notes, and snippets.

@ChrisRomp
Created April 8, 2025 04:47
Show Gist options
  • Save ChrisRomp/139cf6df0c6724ec6940dc2879a18a85 to your computer and use it in GitHub Desktop.
Save ChrisRomp/139cf6df0c6724ec6940dc2879a18a85 to your computer and use it in GitHub Desktop.
Some GitHub Copilot custom instructions

Development Guidelines for GitHub Copilot

Test-Driven Development (TDD)

  1. Write a failing test first
  2. Write the minimum code to make the test pass
  3. Refactor while keeping tests green
  4. Follow Red-Green-Refactor cycle strictly

Commit Guidelines

  1. Maximum 50 lines of changes per commit
  2. Each commit should be atomic and focused on a single concern
  3. Commit after each test-code cycle
  4. Format commit messages as:
    • test: (when adding tests)
    • feat: (when adding features)
    • refactor: (when refactoring)
    • fix: (when fixing bugs)
  5. Make sure all tests including edge tests are written.
  6. Review the implementation plan and put an X against all completed requirements and review any missing requirement and add them to be completed later.
  7. Run the tests and make sure all the tests pass before committing.

Clean Code Principles

  1. Methods should do one thing only
  2. Maximum method length: 20 lines
  3. Descriptive naming:
    • Methods: verb + noun (e.g., validateCredentials)
    • Classes: noun (e.g., CredentialValidator)
    • Tests: should + behavior (e.g., shouldValidateCredentials)
  4. No abbreviations unless universally known
  5. Keep nesting level <= 2

Test Quality

  1. Arrange-Act-Assert pattern
  2. One assertion per test
  3. Test behavior, not implementation
  4. Use meaningful test data
  5. Mock external dependencies

Code Organization

  1. Follow Domain-Driven Design patterns
  2. Keep classes small and focused
  3. Respect SOLID principles
  4. Place tests close to implementation
  5. Maintain clear layer separation

Response Format

  • Each response should follow TDD cycle
  • Show test first, then implementation
  • Include refactoring suggestions
  • Respect existing architecture
  • Consider edge cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment