Github copilot

From G1Joshi/Agent-Skills · View interactive version

Github copilot is an AI agent skill from the GitHub repository G1Joshi/Agent-Skills. Expert GitHub Copilot assistance covering inline completions, Copilot Chat, workspace indexing, and custom instructions. Use when maximizing AI pair programming velocity and code quality.

How to use this skill

Skill file

GitHub Copilot

GitHub Copilot is an enterprise AI pair programming assistant, providing inline completions, multi-file code editing via Copilot Edits, pull request reviews, and CLI integration.

When to Use

Quick Start

Configure custom repository instructions in .github/copilot-instructions.md:

# GitHub Copilot Instructions

- Use modern ES2022+ syntax and TypeScript 5.
- Always validate incoming API payloads using Zod schemas.
- Do not add comments describing self-explanatory lines.
- Write unit tests using Vitest with AAA (Arrange-Act-Assert) pattern.

Core Concepts

Project-Wide Custom Instructions (.github/copilot-instructions.md)

Configuring persistent AI developer guidelines:

# .github/copilot-instructions.md

Repository Standards

- Language: TypeScript 5.5+ with strict mode enabled.
- Framework: Next.js 15 (App Router), Tailwind CSS v4.
- Database: Drizzle ORM with PostgreSQL.
- Testing: Vitest for unit tests, Playwright for e2e.

Coding Conventions

1. Always declare explicit return types on public functions.
2. Prefer async/await over raw Promises.
3. Use early returns and guard clauses to minimize nested blocks.
4. Never suggest 'any'; use typed generics or unknown.
5. All new business functions must include an accompanying unit test file.

Slash Commands & Context Modifiers in Copilot Chat

Directing the AI assistant with precision:

# Prompt in Copilot Chat
@workspace /explain How is user authentication state persisted across server and client components?

# Generating Unit Tests
/tests Generate comprehensive unit tests covering edge cases for validateOrderPayload()

# Fixing Errors
@terminal /fix Resolve this TypeScript compilation error with discriminated unions

Inline Prompt Engineering for Precise Code Generation

Guiding inline suggestions with intentional comment prompts:

// Function: parseJWTHeader
// Inputs: raw auth header string (e.g., 'Bearer <token>')
// Output: decoded payload object or throws UnauthorizedException
// Handles expired tokens, malformed base64, and missing prefix
export function parseJWTHeader(authHeader?: string): TokenPayload {
  // Copilot autocompletes implementation here
}

Common Patterns

Custom Copilot Instructions (.github/copilot-instructions.md)

Problem: Generic completions ignore repository style guides, testing patterns, and library versions.

Solution: Create project-level guidelines recognized by Copilot in VS Code and JetBrains.

<!-- .github/copilot-instructions.md -->

# Project Guidelines

- Architecture: Feature-sliced design (`src/features/<feature-name>/{api,components,hooks}`).
- State Management: TanStack Query for server state; Zustand for global client state.
- Testing: Write Vitest unit tests colocated as `<name>.test.ts` for all pure helper functions.
- Concurrency: Prefer `Promise.allSettled()` over `Promise.all()` for batch operations.

Prompt-Driven Unit Test Generation (/tests)

Problem: Writing repetitive unit test boilerplate for edge cases and validation schemas.

Solution: Highlight target function in editor and invoke /tests with constraints.

// Prompt: /tests generate vitest test cases covering boundary values, empty arrays, and null inputs
export function calculateDiscount(price: number, coupon?: string): number {
  if (price < 0) throw new Error("Price cannot be negative");
  if (coupon === "VIP50") return price * 0.5;
  if (coupon === "SAVE10") return Math.max(0, price - 10);
  return price;
}

Best Practices

Do:

Don't:

Troubleshooting

| Error | Cause | Solution |

| :------------------------------------------ | :------------------------------------------------------------------- | :----------------------------------------------------------------------- |

| Copilot completions not appearing | Editor extension logged out or GitHub Copilot subscription inactive. | Re-authenticate GitHub account in IDE settings. |

| Copilot generating obsolete API syntax | Context window lacks reference to modern framework version. | Open modern reference file in adjacent tab or specify version in prompt. |

| Copilot completions disabled for language | File type disabled in Copilot extension language settings. | Check github.copilot.enable settings in VS Code settings.json. |

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.