Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save medric/a896fd21bce8db3c62069a0a4275e77a to your computer and use it in GitHub Desktop.
Save medric/a896fd21bce8db3c62069a0a4275e77a to your computer and use it in GitHub Desktop.

πŸš€ GitHub Copilot Certification Cheat Sheet

πŸ“œ Contract Stack

Definition: Clarifies users’ legal terms and obligations.

Key Points:

  • Terms depend on whether Copilot is purchased through GitHub or Microsoft.
  • Includes licensing, data usage, and privacy policies.
  • Important for understanding code suggestions and intellectual property.

MBSA (Microsoft Business & Services Agreement): Part of the contract stack when Copilot is purchased through Microsoft, outlining the legal terms of service.

βš–οΈ 6 Principles of GitHub Copilot

  1. Fairness: Unbiased code suggestions - AI systems should treat all people fairly (incl. code styles and paradigms).
  2. Transparency: Clear communication about how Copilot works.
  3. Accountability: Users must validate generated code.
  4. Privacy & Security: Minimize vulnerabilities in code suggestions. Protect user data and code.
  5. Inclusiveness: AI systems should empower everyone and engage people.
  6. Reliability & Safety: Consistent, high-quality suggestions.

πŸ’Ό GitHub Copilot Plans

  1. Free Plan: Limited features for verified students, teachers, and open-source maintainersβ€”2000 completions + 50 messages/month.
  2. Pro Plan: Full features for individual developers (subscription-based).
  3. Business Plan: For small-medium teams with enhanced admin controls.
  4. Enterprise Plan: Advanced security, compliance, and integration features for large organizations.

πŸ“Š Metrics API

  • Overview: Provides usage data on GitHub Copilot.
  • Key Path Parameters: org, enterprise
  • Metrics: Code suggestions, acceptance rates, active users.
  • Max Days Retrieval: 28 days per page.
  • Query Parameters: since (start date), until (end date).
  • Requirement: Minimum 5 active Copilot licenses for metrics.

πŸ—‚οΈ Audit Logs

  • Log Retrieval: Available via the Audit Log API or GitHub UI.
  • Log Types: Vary by planβ€”Free/Pro (basic security), Business (repository activities), Enterprise (organization-wide actions).

πŸ”‘ GitHub Copilot API

  • Key Features: Access metrics, automate user management, retrieve content exclusion settings.
  • Auth: Fine-grained access tokens required.
  • Maximum number of results that can be fetched per page when listing all Copilot seat assignments for an enterprise: 100

πŸ’‘ Prompting

  • Definition: Guiding Copilot to generate desired code.
  • Types:
    1. Zero-shot: No examples.
    2. One-shot: One example.
    3. Few-shot: Multiple examples.
  • Use Cases: Enhance, refactor, or fix code.
  • Best Practices: Be specific, define context, and iterate.

🚫 Toxicity Filter

  • Purpose: Prevents harmful/offensive content but may block benign content (role of the proxy-server)

πŸ›‘οΈ Content Exclusion

  • Purpose: Prevents certain repos/files from training.
  • Limitations: Doesn’t affect already processed data/public code.
  • Pattern matching used to specify file paths: fnmatch.
  • Repository administrators and organization owners can configure content exclusion from their repositories settings.

🚫 Limitations of Content Exclusions

  • May not exclude semantic data in non-excluded files.
  • Policy management available to org/enterprise owners.
  • Policies help determine how Copilot can be used within the organization.
  • Available to organizations with a subscription to GitHub Copilot Business or GitHub Copilot Enterprise.

⌨️ Slash Commands, Variables, and Agents

Slash Commands:

  • /explain - Explain code.
  • /fix - Propose fixes.
  • /tests - Generate tests.
  • /help - Assistance.
  • /clear - Clear chat.
  • /doc - Add documentation.
  • /generate - Generate code.
  • /optimize - Improve performance.
  • /new - Scaffold code.
  • /simplify - Simplify code.
  • /feedback - Provide feedback.
  • /runCommand - Can be used with @vscode to execute VS Code commands.
  • copilot-debug - Debugging tool.

Variables: #codebase, #editor, #git, etc.

Agents: Target contexts like @workspace, @terminal, @vscode.

βš™οΈ Organization Configuration Permissions

  • Admins: Modify settings.
  • Owners: Full access.
  • Public Code Match Settings: Admin/owner control.

πŸ” Data Handling in Copilot

  • Code Suggestions: No retention unless saved.
  • Copilot Chat: Temporary session storage.

🌐 Test Connectivity

  • curl --verbose https://copilot-proxy.githubusercontent.com/_ping
  • With proxy: curl -x http://YOUR-PROXY-URL:PORT -i -L https://copilot-proxy.githubusercontent.com/_ping
  • Test Copilot Chat: https://api.githubcopilot.com/_ping

πŸ“Ÿ GitHub Copilot CLI

  • Usage: Execute commands via CLI.
  • Example: gh copilot explain "sudo apt-get"
  • Settings: gh copilot config

πŸ”§ LoRa (Low-Rank Adaptation)

  • Fast, cost-effective model specialization.
  • Adds small trainable parts to pre-trained models.

🧩 FIM (Fill In the Middle)

  • Complete content between provided prefix/suffix.

πŸ” SSO / 3rd Party IdP

  • Manage Copilot Business with IdP via SCIM.

✨ GitHub Spark

  • Create/share micro apps without coding using natural language.

πŸ’» Code Suggestions

  • To get suggestions with up-to-date libraries and code samples, guide Copilot with up-to-date library versions.

πŸ” Feedback loop

  • Modify a code suggestion
  • Reject a code suggestion
  • Accept a code suggestion

πŸ” Public Code Filter

  • Admin-configured, not in individual plans.
  • Detects exact matches, may miss semantic similarities.

🧩 Extensions

  • Integrate external tools with Copilot Chat.

βš™οΈ Config/Settings

  • Custom instructions via .github/copilot-instructions.md or github.copilot.chat.codeGeneration.instructions property in settings.json.
  • Settings managed individually or by business.

πŸ–ŠοΈ Copilot Edits

  • Allows users to engage in an ongoing conversation while applying code suggestions inline, combining multi-turn chat and fast inline feedback.
  • Supports multi-file editing and displays real-time previews of proposed changes within each file in the working set.
  • Working set is limited to 10 files.
  • Limited to one editing session at a time, which restricts parallel workflows.
  • Does not yet fully support Jupyter notebooks, custom text formats, or binary files.

πŸ“ˆ Other

  • 90% of devs report faster coding with Copilot.
  • Security risks when ignoring certificate errors.
  • Use Copilot logs to view public code matches.
  • Preprocessing user prompts in the GitHub Copilot data pipeline optimizes prompts for better suggestions.
  • Reload content exclusion settings by using the 'Developer: Reload Window' command.
  • Administrators can manage access to Copilot for members of the organization.
  • Organization owners can create knowledge bases, not specifically for administrators.
  • Administrators can review audit logs to understand actions taken within Copilot.
  • Responses containing unique identifiers like email addresses or IP addresses are truncated.
  • The feedback loop, through user actions like accepting, modifying, or rejecting suggestions, helps Copilot understand which suggestions are helpful and align with user needs.
  • Prompt pre-processing & code suggestions generation pipeline: Preprocessing -> Filtering -> LLM Processing -> Suggestion Generation
  • The ease of generating large code blocks might discourage developers from thoroughly understanding and verifying the code, potentially leading to lower quality or the introduction of errors.
  • Valid methods for defining test-generation instructions include configuring the github.copilot.chat.testGeneration.instructions setting in settings.json or linking to an external Markdown file that contains the instructions.
  • Insert into Terminal (Ctrl+Alt+Enter) -> executes the code block as a command within the integrated terminal.

πŸ“š Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment