agentleFS
pol-riveropol-rivero/github-desktop-plus/.github/copilot-instructions.md

github-desktop-plus

Copilot instructions824 starsChanged 5 days agoMITView on GitHub

This repository contains GitHub Desktop, an open-source Electron-based GitHub application written in TypeScript and React. Also follow the root AGENTS.md, including the shared PR-preparation skill. GitHub Desktop has been developed for many years through many iterations of technologies and coding styles, there may be conflicting styles in different parts of the codebase. When contributing new code or refactoring existing code, please follow the conventions outlined below.

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

39 rules. About 0 are common, 20 are distinctive, and 19 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈20

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 19

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Avoid creating new classes unless necessary.

    line 26
  2. Distinctive:

    Avoid using enums; prefer union types of string literals instead.

    line 27
  3. Very specific:

    Avoid reserved keywords as variable names (any, Number, String, Boolean, Undefined, etc.)

    line 33
  4. Very specific:

    Avoid using as for type assertions, prefer proper type narrowing and guards.

    line 35
  5. Very specific:

    Use the assertNever helper (from app/src/lib/fatal-error.ts) for exhaustiveness checks in switch statements or conditional logic

    line 36
  6. Very specific:

    Avoid non-null assertions (!) unless absolutely necessary

    line 37
  7. Distinctive:

    Write custom type definitions when none exist

    line 38
  8. Very specific:

    Avoid any unless absolutely necessary

    line 39
  9. Very specific:

    Visibility modifiers: Always use explicit member accessibility (public, private, protected)

    line 47
  10. Distinctive:

    Avoid default exports: Use named exports only

    line 48
  11. Very specific:

    Props and State: Always use readonly for props and state types to prevent accidental mutation

    line 52
  12. Very specific:

    JSX: Always use explicit boolean values (e.g., <Component visible={true} /> instead of <Component visible />)

    line 53
  13. Distinctive:

    No binding in JSX: Use arrow functions or pre-bind methods instead of binding in render

    line 54
  14. Distinctive:

    No string refs: Use React refs API instead

    line 55
  15. Very specific:

    Prefer const over let: Use const whenever possible to enforce immutability

    line 60
  16. Very specific:

    Prefer ternary over reassignment: Use const a = condition ? value : otherValue instead of let with conditional reassignment

    line 61
  17. Distinctive:

    Pure functions: Write functions that operate only on their parameters when possible

    line 62
  18. Distinctive:

    Curly braces: Always use curly braces for control structures

    line 73
  19. Very specific:

    Strict equality: Use === and !== (smart equality checking allowed)

    line 74
  20. Very specific:

    No eval: Never use eval()

    line 75
  21. Very specific:

    No var: Use const or let

    line 76
  22. Very specific:

    Async operations: Use async/await, avoid synchronous Node.js APIs in application code (use Sync suffix when necessary)

    line 77
  23. Distinctive:

    Git arguments: Follow the Git command argument conventions for option boundaries, revision and path separators, canonical refs, and …

    line 78
  24. Distinctive:

    Document public APIs: All public classes, methods, and properties should have JSDoc comments

    line 83
  25. Distinctive:

    Format: Use a short title line followed by blank line before detailed description

    line 84
  26. Very specific:

    Use Node.js built-in test runner (not Jest or Mocha)

    line 116
  27. Very specific:

    Test files should be in app/test/unit/ directory

    line 117
  28. Very specific:

    Use .ts or .tsx extensions

    line 118
  29. Distinctive:

    Avoid synchronous tests; use async/await.

    line 119
  30. Distinctive:

    Report security issues: Follow SECURITY.md, not public issues

    line 150
  31. Distinctive:

    Leverage TypeScript: Use type system for compile-time verification of exhaustiveness and correctness

    line 176
  32. Distinctive:

    Follow the Engineering Values

    line 181
  33. Distinctive:

    Check help wanted label for good first issues

    line 182
  34. Distinctive:

    Run tests frequently: Test after each meaningful change

    line 200
  35. Distinctive:

    Update documentation: Update docs if changes affect documented behavior

    line 202
  36. Distinctive:

    Don't remove working code: Only modify what's necessary for the task

    line 204
  37. Distinctive:

    When changing stats fields, dimensions, measures, serialization, or endpoint request envelopes:

    line 208
  38. Very specific:

    Commit the updated docs/process/usage-data.json.

    line 212
  39. Very specific:

    Never edit docs/process/usage-data.json manually.

    line 214

≈ “Common” is an estimate: at least 1 in 5 of the 3,669 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

GitHub Desktop - Copilot Instructions

This repository contains GitHub Desktop, an open-source Electron-based GitHub application written in TypeScript and React.

Agent workflow

Also follow the root AGENTS.md, including the shared PR-preparation skill.

Technology Stack

  • Language: TypeScript (strict mode enabled)
  • UI Framework: React 16.x
  • Runtime: Electron > 38.x (see .npmrc for specific version)
  • Build Tool: Webpack with parallel builds
  • Package Manager: Yarn (>= 1.21.1)
  • Node Version: >= 22 (see .nvmrc for specific version)
  • Testing: Node.js built-in test runner (run using yarn test, optionally providing one or more test files e.g yarn test app/test/unit/repository-list-test.ts)

Code Style & Conventions

GitHub Desktop has been developed for many years through many iterations of technologies and coding styles, there may be conflicting styles in different parts of the codebase. When contributing new code or refactoring existing code, please follow the conventions outlined below.

TypeScript Style

  • Avoid creating new classes unless necessary; prefer functions and interfaces/types, sticking to more idiomatic TypeScript/JavaScript patterns.
  • Avoid using enums; prefer union types of string literals instead.
  • Use strict TypeScript with all strict mode checks enabled
  • Naming conventions:
    • PascalCase for classes
    • camelCase for methods and properties
    • Interfaces MUST start with I prefix (e.g., IRepository, ICommit)
    • Avoid reserved keywords as variable names (any, Number, String, Boolean, Undefined, etc.)
  • Type safety:
    • Avoid using as for type assertions, prefer proper type narrowing and guards.
    • Use the assertNever helper (from app/src/lib/fatal-error.ts) for exhaustiveness checks in switch statements or conditional logic
    • Avoid non-null assertions (!) unless absolutely necessary
    • Write custom type definitions when none exist
    • Avoid any unless absolutely necessary
  • Member ordering in classes:
    1. Static fields
    2. Static methods
    3. Instance fields
    4. Abstract methods
    5. Constructor
    6. Instance methods
  • Visibility modifiers: Always use explicit member accessibility (public, private, protected)
  • Avoid default exports: Use named exports only

React Conventions

  • Props and State: Always use readonly for props and state types to prevent accidental mutation
  • JSX: Always use explicit boolean values (e.g., <Component visible={true} /> instead of <Component visible />)
  • No binding in JSX: Use arrow functions or pre-bind methods instead of binding in render
  • No string refs: Use React refs API instead
  • Accessibility: Autofocus is allowed when used appropriately in dialogs and focused contexts

Immutability & Pure Functions

  • Prefer const over let: Use const whenever possible to enforce immutability
  • Prefer ternary over reassignment: Use const a = condition ? value : otherValue instead of let with conditional reassignment
  • Pure functions: Write functions that operate only on their parameters when possible
  • Lift computation logic: Separate data gathering from data processing into different functions
  • Use readonly arrays: Mark arrays and objects as readonly in interfaces and function parameters

Import Restrictions

  • Never import ipcRenderer directly from electron or electron/renderer - use import * as ipcRenderer from 'ipc-renderer' (app/src/lib/ipc-renderer.ts) for strongly typed IPC methods
  • Never import ipcMain directly from electron or electron/main - use import * as ipcMain from 'ipc-main' (app/src/lib/ipc-main.ts) for strongly typed IPC methods

Code Quality

  • Curly braces: Always use curly braces for control structures
  • Strict equality: Use === and !== (smart equality checking allowed)
  • No eval: Never use eval()
  • No var: Use const or let
  • Async operations: Use async/await, avoid synchronous Node.js APIs in application code (use Sync suffix when necessary)
  • Git arguments: Follow the Git command argument conventions for option boundaries, revision and path separators, canonical refs, and caller-shaped tests.

Documentation

  • Use JSDoc format for documentation with /** opener (exactly two stars)
  • Document public APIs: All public classes, methods, and properties should have JSDoc comments
  • Format: Use a short title line followed by blank line before detailed description
  • AppStore methods: Internal methods called by Dispatcher should be prefixed with _ and include comment: /** This shouldn't be called directly. See 'Dispatcher'. */

ESLint Rules

The codebase uses comprehensive ESLint rules. Key custom rules:

  • insecure-random: Prevents use of insecure random number generation
  • react-no-unbound-dispatcher-props: Enforces proper dispatcher prop handling
  • react-readonly-props-and-state: Prevents mutation of React props and state
  • react-proper-lifecycle-methods: Enforces correct React lifecycle usage
  • no-loosely-typed-webcontents-ipc: Ensures type-safe IPC communication

Building & Testing

Development Workflow

# Install dependencies
yarn

# Development build
yarn build:dev

Testing

# Run all tests
yarn test:docker

Test Conventions:

  • Use Node.js built-in test runner (not Jest or Mocha)
  • Test files should be in app/test/unit/ directory
  • Use .ts or .tsx extensions
  • Avoid synchronous tests; use async/await.

Linting

# Run all linters
yarn lint

# Fix auto-fixable issues
yarn lint:fix

# Lint source code
yarn lint:src

# Check Markdown files
yarn markdownlint

# Format with Prettier
yarn prettier

# Fix Prettier issues
yarn prettier --write

Security & Quality

Security

  • Never commit secrets, passwords, or sensitive data
  • Validate and sanitize user input
  • Follow secure coding practices: Review code for XSS, injection, and other vulnerabilities
  • Report security issues: Follow SECURITY.md, not public issues

Git Practices

  • Follow commit message conventions: Clear, descriptive commit messages
  • Reference issues: Include issue numbers in commits when applicable

Project Structure

  • app/: Application source code and assets
    • app/src/: TypeScript source files
    • app/test/: Test files
    • app/static/: Static assets
    • app/styles/: SASS stylesheets
  • script/: Build and utility scripts
  • docs/: Documentation
    • docs/contributing/: Contributor guides
    • docs/process/: Process documentation
    • docs/technical/: Technical documentation
  • eslint-rules/: Custom ESLint rules
  • .github/: GitHub-specific files (workflows, issue templates, contributing guide)

Development Tips

  • Use the Dispatcher: Route state-changing interactions through the Dispatcher to the AppStore
  • Avoid direct AppStore manipulation: Methods in AppStore should be called via Dispatcher
  • Leverage TypeScript: Use type system for compile-time verification of exhaustiveness and correctness

Contributing

  • See CONTRIBUTING.md for detailed contribution guidelines
  • Follow the Engineering Values
  • Check help wanted label for good first issues
  • Review Style Guide before submitting code
  • Setup instructions: ../docs/contributing/setup.md

Code of Conduct

This project adheres to the Contributor Covenant Code of Conduct. All interactions must be respectful and professional.

Resources

When Making Changes

  1. Keep changes minimal: Make the smallest possible changes to achieve the goal
  2. Run tests frequently: Test after each meaningful change
  3. Run yarn lint:fix after any code change: This runs Prettier and ESLint with auto-fix to ensure formatting and lint rules are satisfied before committing
  4. Update documentation: Update docs if changes affect documented behavior
  5. Follow existing patterns: Match the style and patterns already in the codebase
  6. Don't remove working code: Only modify what's necessary for the task

Usage Data Changes

When changing stats fields, dimensions, measures, serialization, or endpoint request envelopes:

  1. Run yarn generate-example-usage-data.
  2. Run yarn test app/test/unit/usage-data-test.ts.
  3. Commit the updated docs/process/usage-data.json.

Never edit docs/process/usage-data.json manually. It must match the request body generated by StatsStore.

Download now (ZIP)

  • Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.

    Of the Copilot instructions files we read, the 2,297 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository5 other files it gives its agents.

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.