agentleFS
zetaloopzetaloop/desktop/.github/copilot-instructions.md

desktop

Copilot instructions1k starsChanged 5 years agoMITView on GitHub

This repository contains GitHub Desktop, an open-source Electron-based GitHub application written in TypeScript and React. 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

35 rules. About 0 are common, 18 are distinctive, and 17 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.

  • 17

    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 21
  2. Distinctive:

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

    line 22
  3. Very specific:

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

    line 28
  4. Very specific:

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

    line 30
  5. Very specific:

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

    line 31
  6. Very specific:

    Avoid non-null assertions (!) unless absolutely necessary

    line 32
  7. Distinctive:

    Write custom type definitions when none exist

    line 33
  8. Very specific:

    Avoid any unless absolutely necessary

    line 34
  9. Very specific:

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

    line 42
  10. Distinctive:

    Avoid default exports: Use named exports only

    line 43
  11. Very specific:

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

    line 47
  12. Very specific:

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

    line 48
  13. Distinctive:

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

    line 49
  14. Distinctive:

    No string refs: Use React refs API instead

    line 50
  15. Very specific:

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

    line 55
  16. Very specific:

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

    line 56
  17. Distinctive:

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

    line 57
  18. Distinctive:

    Curly braces: Always use curly braces for control structures

    line 68
  19. Very specific:

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

    line 69
  20. Very specific:

    No eval: Never use eval()

    line 70
  21. Very specific:

    No var: Use const or let

    line 71
  22. Very specific:

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

    line 72
  23. Distinctive:

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

    line 77
  24. Distinctive:

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

    line 78
  25. Very specific:

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

    line 122
  26. Very specific:

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

    line 123
  27. Very specific:

    Use .ts or .tsx extensions

    line 124
  28. Distinctive:

    Avoid synchronous tests; use async/await.

    line 125
  29. Distinctive:

    Report security issues: Use private vulnerability reporting, not public issues

    line 156
  30. Distinctive:

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

    line 182
  31. Distinctive:

    Follow the Engineering Values

    line 187
  32. Distinctive:

    Check help wanted label for good first issues

    line 188
  33. Distinctive:

    Run tests frequently: Test after each meaningful change

    line 206
  34. Distinctive:

    Update documentation: Update docs if changes affect documented behavior

    line 208
  35. Distinctive:

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

    line 210

≈ “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.

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)

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 unit tests
yarn test

# Run specific test file
yarn test <file>

# Run tests in directory
yarn test <directory>

# Run script tests
yarn test:script

# Run ESLint tests
yarn test:eslint

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: Use private vulnerability reporting, 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

Download now (ZIP)

Trending

Quiet this year.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the zetaloop/desktop repository that our weekly crawl found: only 1 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about zetaloop/desktop

The biggest 1 of 1 mention linking to the repository that our crawl found. Each line is their own headline.

  • 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 repository3 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.