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
- Distinctive: line 26
Avoid creating new classes unless necessary.
- Distinctive: line 27
Avoid using enums; prefer union types of string literals instead.
- Very specific: line 33
Avoid reserved keywords as variable names (any, Number, String, Boolean, Undefined, etc.)
- Very specific: line 35
Avoid using as for type assertions, prefer proper type narrowing and guards.
- Very specific: line 36
Use the assertNever helper (from app/src/lib/fatal-error.ts) for exhaustiveness checks in switch statements or conditional logic
- Very specific: line 37
Avoid non-null assertions (!) unless absolutely necessary
- Distinctive: line 38
Write custom type definitions when none exist
- Very specific: line 39
Avoid any unless absolutely necessary
- Very specific: line 47
Visibility modifiers: Always use explicit member accessibility (public, private, protected)
- Distinctive: line 48
Avoid default exports: Use named exports only
- Very specific: line 52
Props and State: Always use readonly for props and state types to prevent accidental mutation
- Very specific: line 53
JSX: Always use explicit boolean values (e.g., <Component visible={true} /> instead of <Component visible />)
- Distinctive: line 54
No binding in JSX: Use arrow functions or pre-bind methods instead of binding in render
- Distinctive: line 55
No string refs: Use React refs API instead
- Very specific: line 60
Prefer
constoverlet: Use const whenever possible to enforce immutability - Very specific: line 61
Prefer ternary over reassignment: Use const a = condition ? value : otherValue instead of let with conditional reassignment
- Distinctive: line 62
Pure functions: Write functions that operate only on their parameters when possible
- Distinctive: line 73
Curly braces: Always use curly braces for control structures
- Very specific: line 74
Strict equality: Use === and !== (smart equality checking allowed)
- Very specific: line 75
No
eval: Never use eval() - Very specific: line 76
No
var: Use const or let - Very specific: line 77
Async operations: Use async/await, avoid synchronous Node.js APIs in application code (use Sync suffix when necessary)
- Distinctive: line 78
Git arguments: Follow the Git command argument conventions for option boundaries, revision and path separators, canonical refs, and …
- Distinctive: line 83
Document public APIs: All public classes, methods, and properties should have JSDoc comments
- Distinctive: line 84
Format: Use a short title line followed by blank line before detailed description
- Very specific: line 116
Use Node.js built-in test runner (not Jest or Mocha)
- Very specific: line 117
Test files should be in app/test/unit/ directory
- Very specific: line 118
Use .ts or .tsx extensions
- Distinctive: line 119
Avoid synchronous tests; use async/await.
- Distinctive: line 150
Report security issues: Follow SECURITY.md, not public issues
- Distinctive: line 176
Leverage TypeScript: Use type system for compile-time verification of exhaustiveness and correctness
- Distinctive: line 181
Follow the Engineering Values
- Distinctive: line 182
Check help wanted label for good first issues
- Distinctive: line 200
Run tests frequently: Test after each meaningful change
- Distinctive: line 202
Update documentation: Update docs if changes affect documented behavior
- Distinctive: line 204
Don't remove working code: Only modify what's necessary for the task
- Distinctive: line 208
When changing stats fields, dimensions, measures, serialization, or endpoint request envelopes:
- Very specific: line 212
Commit the updated docs/process/usage-data.json.
- Very specific: line 214
Never edit docs/process/usage-data.json manually.
≈ “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.
Files
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
.npmrcfor specific version) - Build Tool: Webpack with parallel builds
- Package Manager: Yarn (>= 1.21.1)
- Node Version: >= 22 (see
.nvmrcfor specific version) - Testing: Node.js built-in test runner (run using
yarn test, optionally providing one or more test files e.gyarn 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
Iprefix (e.g.,IRepository,ICommit) - Avoid reserved keywords as variable names (
any,Number,String,Boolean,Undefined, etc.)
- Type safety:
- Avoid using
asfor type assertions, prefer proper type narrowing and guards. - Use the
assertNeverhelper (fromapp/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
anyunless absolutely necessary
- Avoid using
- Member ordering in classes:
- Static fields
- Static methods
- Instance fields
- Abstract methods
- Constructor
- 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
readonlyfor 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
constoverlet: Useconstwhenever possible to enforce immutability - Prefer ternary over reassignment: Use
const a = condition ? value : otherValueinstead ofletwith 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
readonlyin interfaces and function parameters
Import Restrictions
- Never import
ipcRendererdirectly fromelectronorelectron/renderer- useimport * as ipcRenderer from 'ipc-renderer'(app/src/lib/ipc-renderer.ts) for strongly typed IPC methods - Never import
ipcMaindirectly fromelectronorelectron/main- useimport * 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 useeval() - No
var: Useconstorlet - Async operations: Use async/await, avoid synchronous Node.js APIs in application code (use
Syncsuffix 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 generationreact-no-unbound-dispatcher-props: Enforces proper dispatcher prop handlingreact-readonly-props-and-state: Prevents mutation of React props and statereact-proper-lifecycle-methods: Enforces correct React lifecycle usageno-loosely-typed-webcontents-ipc: Ensures type-safe IPC communication
Building & Testing
Development Workflow
# Install dependencies
yarn
# Development build
yarn build:devTesting
# Run all tests
yarn test:dockerTest Conventions:
- Use Node.js built-in test runner (not Jest or Mocha)
- Test files should be in
app/test/unit/directory - Use
.tsor.tsxextensions - 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 --writeSecurity & 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 assetsapp/src/: TypeScript source filesapp/test/: Test filesapp/static/: Static assetsapp/styles/: SASS stylesheets
script/: Build and utility scriptsdocs/: Documentationdocs/contributing/: Contributor guidesdocs/process/: Process documentationdocs/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
Dispatcherto theAppStore - 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
- Keep changes minimal: Make the smallest possible changes to achieve the goal
- Run tests frequently: Test after each meaningful change
- Run
yarn lint:fixafter any code change: This runs Prettier and ESLint with auto-fix to ensure formatting and lint rules are satisfied before committing - Update documentation: Update docs if changes affect documented behavior
- Follow existing patterns: Match the style and patterns already in the codebase
- 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:
- Run
yarn generate-example-usage-data. - Run
yarn test app/test/unit/usage-data-test.ts. - 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.
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.
- AGENTS.mdAGENTS.md
- prepare-team-prSkill
- assign-copilotSkill
- testingSkill
- update-gitSkill
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
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.

