Get the FREE Ultimate OpenClaw Setup Guide →

copilot-docs

Scanned
npx machina-cli add skill Makiya1202/ai-agents-skills/copilot-docs --openclaw
Files (1)
SKILL.md
3.1 KB

GitHub Copilot Custom Instructions

Configure repository-specific instructions for GitHub Copilot.

Quick Start

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

# 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

# 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

# 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

# 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

# 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

Source

git clone https://github.com/Makiya1202/ai-agents-skills/blob/master/skills/copilot-docs/SKILL.mdView on GitHub

Overview

Configure repository-specific instructions for GitHub Copilot using the .github/copilot-instructions.md file. This skill standardizes AI-assisted code generation by codifying project context, coding standards, naming conventions, testing patterns, API conventions, and Do and Donts to guide Copilot across your codebase.

How This Skill Works

Create a Markdown file at .github/copilot-instructions.md and populate sections like Project Context, Code Standards, Naming Conventions, Testing, and API Patterns. GitHub Copilot reads these repository instructions to tailor suggestions and completions to your stack, enforcing consistency without changing your code directly. The file uses markdown sections and code blocks to describe patterns and the Do and Donts to influence outputs.

When to Use It

  • Setting up Copilot for a new repository to align with team standards
  • Enforcing TypeScript strict mode and React functional component conventions
  • Guiding API design and error handling with standard responses and Zod validation
  • Documenting project context for Next.js apps using App Router
  • Creating repository-wide AI guidance to prevent sensitive data leakage and production logs

Quick Start

  1. Step 1: Create .github/copilot-instructions.md in your repository
  2. Step 2: Fill in sections like Copilot Instructions, Project Context, Code Standards, Naming Conventions, Testing, API Patterns, and Do and Donts with concrete examples
  3. Step 3: Commit the file and keep it updated as the project evolves

Best Practices

  • Create the .github/copilot-instructions.md file and keep it in the repository
  • Use clear sections: Project Context, Code Standards, Naming Conventions, Testing, API Patterns, and Do and Donts
  • Mirror your tech stack (e.g., Next.js 14, TypeScript, Tailwind, Prisma) in the instructions
  • Include code blocks and concrete examples to guide Copilot outputs
  • Review and update the instructions regularly; avoid exposing sensitive data in the files

Example Use Cases

  • Next.js 14 app using App Router with API routes in app/api
  • Team enforcing TypeScript strict mode and functional components
  • Prisma ORM with PostgreSQL integration patterns
  • APIs validated with Zod and early validation
  • Do not leave console log statements in production or commit sensitive data

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers