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
- Distinctive: line 21
Avoid creating new classes unless necessary.
- Distinctive: line 22
Avoid using enums; prefer union types of string literals instead.
- Very specific: line 28
Avoid reserved keywords as variable names (any, Number, String, Boolean, Undefined, etc.)
- Very specific: line 30
Avoid using as for type assertions, prefer proper type narrowing and guards.
- Very specific: line 31
Use the assertNever helper (from app/src/lib/fatal-error.ts) for exhaustiveness checks in switch statements or conditional logic
- Very specific: line 32
Avoid non-null assertions (!) unless absolutely necessary
- Distinctive: line 33
Write custom type definitions when none exist
- Very specific: line 34
Avoid any unless absolutely necessary
- Very specific: line 42
Visibility modifiers: Always use explicit member accessibility (public, private, protected)
- Distinctive: line 43
Avoid default exports: Use named exports only
- Very specific: line 47
Props and State: Always use readonly for props and state types to prevent accidental mutation
- Very specific: line 48
JSX: Always use explicit boolean values (e.g., <Component visible={true} /> instead of <Component visible />)
- Distinctive: line 49
No binding in JSX: Use arrow functions or pre-bind methods instead of binding in render
- Distinctive: line 50
No string refs: Use React refs API instead
- Very specific: line 55
Prefer
constoverlet: Use const whenever possible to enforce immutability - Very specific: line 56
Prefer ternary over reassignment: Use const a = condition ? value : otherValue instead of let with conditional reassignment
- Distinctive: line 57
Pure functions: Write functions that operate only on their parameters when possible
- Distinctive: line 68
Curly braces: Always use curly braces for control structures
- Very specific: line 69
Strict equality: Use === and !== (smart equality checking allowed)
- Very specific: line 70
No
eval: Never use eval() - Very specific: line 71
No
var: Use const or let - Very specific: line 72
Async operations: Use async/await, avoid synchronous Node.js APIs in application code (use Sync suffix when necessary)
- Distinctive: line 77
Document public APIs: All public classes, methods, and properties should have JSDoc comments
- Distinctive: line 78
Format: Use a short title line followed by blank line before detailed description
- Very specific: line 122
Use Node.js built-in test runner (not Jest or Mocha)
- Very specific: line 123
Test files should be in app/test/unit/ directory
- Very specific: line 124
Use .ts or .tsx extensions
- Distinctive: line 125
Avoid synchronous tests; use async/await.
- Distinctive: line 156
Report security issues: Use private vulnerability reporting, not public issues
- Distinctive: line 182
Leverage TypeScript: Use type system for compile-time verification of exhaustiveness and correctness
- Distinctive: line 187
Follow the Engineering Values
- Distinctive: line 188
Check help wanted label for good first issues
- Distinctive: line 206
Run tests frequently: Test after each meaningful change
- Distinctive: line 208
Update documentation: Update docs if changes affect documented behavior
- Distinctive: line 210
Don't remove working code: Only modify what's necessary for the task
≈ “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.
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)
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 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:eslintTest 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: 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 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
Trending
Quiet this year.thin dataabout the whole repository
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.
- 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.

