home / skills / hoodini / ai-agents-skills / copilot-docs

copilot-docs skill

/skills/copilot-docs

This skill helps configure repository specific Copilot instructions by guiding how to create and maintain copilot-instructions.md.

npx playbooks add skill hoodini/ai-agents-skills --skill copilot-docs

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.1 KB
---
name: copilot-docs
description: Configure GitHub Copilot with custom instructions. Use when setting up .github/copilot-instructions.md, customizing Copilot behavior, or creating repository-specific AI guidance. Triggers on Copilot instructions, copilot-instructions.md, GitHub Copilot config.
---

# GitHub Copilot Custom Instructions

Configure repository-specific instructions for GitHub Copilot.

## Quick Start

Create `.github/copilot-instructions.md` in your repository:

```markdown
# Copilot Instructions

## Code Style
- Use TypeScript with strict mode
- Prefer functional components with hooks
- Use Tailwind CSS for styling

## Project Context
This is a Next.js 14 app using the App Router.
API routes are in `app/api/`.
```

## Effective Patterns

### Project Context
```markdown
# Project Context

## Tech Stack
- Next.js 14 with App Router
- TypeScript 5.3+
- Tailwind CSS 3.4
- Prisma ORM with PostgreSQL

## Architecture
- `app/` - Next.js App Router pages and API routes
- `components/` - React components
- `lib/` - Utility functions and shared code
- `prisma/` - Database schema and migrations
```

### Code Standards
```markdown
# Code Standards

## TypeScript
- Enable strict mode
- Prefer `interface` over `type` for object shapes
- Use explicit return types on functions

## React
- Use functional components exclusively
- Prefer named exports
- Extract hooks to `hooks/` directory

## Error Handling
- Use Result pattern for fallible operations
- Always handle async errors with try/catch
- Log errors with structured format
```

### Naming Conventions
```markdown
# Naming Conventions

## Files
- Components: PascalCase (Button.tsx)
- Utilities: camelCase (formatDate.ts)
- Constants: SCREAMING_SNAKE_CASE

## Code
- Boolean variables: is*, has*, should* prefix
- Event handlers: handle* prefix (handleClick)
- Async functions: *Async suffix
```

### Testing
```markdown
# Testing Guidelines

## Unit Tests
- Use Vitest for unit testing
- Place tests next to source files (*.test.ts)
- Mock external dependencies

## Test Patterns
```typescript
describe('Component', () => {
  it('should render correctly', () => {
    // Arrange, Act, Assert pattern
  });
});
```
```

### API Patterns
```markdown
# API Patterns

## Route Handlers
```typescript
// Standard response format
return NextResponse.json({
  data: result,
  error: null,
  meta: { timestamp: Date.now() }
});

// Error response
return NextResponse.json(
  { data: null, error: { code: 'NOT_FOUND', message: '...' } },
  { status: 404 }
);
```

## Validation
- Use Zod for request validation
- Validate early, fail fast
```

### Do's and Don'ts
```markdown
# Guidelines

## Do
- Write self-documenting code
- Add JSDoc comments for public APIs
- Use meaningful variable names

## Don't
- Use `any` type
- Leave console.log in production code
- Commit sensitive data
```

## File Location

The file must be at `.github/copilot-instructions.md` (not in root).

## Resources

- **GitHub Docs**: https://docs.github.com/en/copilot/customizing-copilot/adding-custom-instructions-for-github-copilot
- **VS Code Copilot**: https://code.visualstudio.com/docs/copilot/copilot-customization

Overview

This skill helps you configure GitHub Copilot with repository-specific instructions by creating and managing a .github/copilot-instructions.md file. It guides on what to include: project context, code standards, naming conventions, testing and API patterns to steer Copilot suggestions. Use it to enforce consistent AI-generated code behavior across a project.

How this skill works

The skill inspects triggers like references to Copilot instructions, copilot-instructions.md, or GitHub Copilot configuration and proposes a focused instructions document for the repository. It generates concise sections (Project Context, Code Standards, Naming Conventions, Testing, API Patterns, Do's and Don'ts) tailored to your tech stack and workflows. It also validates location and format, reminding you to place the file under .github/copilot-instructions.md.

When to use it

  • Setting up Copilot for a new repository
  • Standardizing AI suggestions across a team
  • Onboarding contributors to project coding standards
  • Customizing Copilot behavior for framework or stack specifics
  • When repeating Copilot-generated inconsistencies in PRs

Best practices

  • Keep project context short and specific: tech versions, folder structure, and runtime expectations
  • Prefer concrete examples (file names, snippets, response formats) over vague rules
  • Scope instructions to repository-level concerns; avoid personal preferences best kept to individual settings
  • Use explicit rules for error handling, testing, and API responses to reduce ambiguity
  • Place the file exactly at .github/copilot-instructions.md so Copilot recognizes it

Example use cases

  • Create instructions for a Next.js 14 + TypeScript app that enforces Tailwind and App Router conventions
  • Add TypeScript and testing rules to reduce type churn and inconsistent tests
  • Define API response shapes and validation (Zod) so Copilot suggests compliant handlers
  • Establish naming conventions and file layout for consistent imports and refactors
  • Prevent unsafe patterns by explicitly forbidding any usage and console.log left in production code

FAQ

Where must the file be located?

Place the document at .github/copilot-instructions.md in the repository — Copilot looks for that path specifically.

How specific should project context be?

Be concise but concrete: list framework and versions, key folders, database/ORM, and any runtime constraints so Copilot can generate relevant code.