copilot-docs について
copilot-docsは、GitHub Copilot向けにリポジトリ固有の指示を設定するスキルです。プロジェクト情報、コード規約、命名、テスト、APIの記述例を扱い、指示ファイルの配置場所も示します。
主な機能
- 01リポジトリ単位のCopilot指示設定
- 02プロジェクト技術情報の記述
- 03コードと命名規約の設定
- 04テストとAPIパターンの記録
- 05指示ファイルの配置先の指定
活用シーン
- 01リポジトリ向けCopilotガイドの設定
- 02プロジェクトのコードスタイル統一
- 03Copilotへのテスト規約の提示
- 04プロジェクトのAPI処理規約の記録
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ hoodini/ ai-agents-skills --skill copilot-docsインストール後、Claude Code で/copilot-docsを入力して読み込まれたか確認します。
詳細
GitHub Copilot のカスタム指示
GitHub Copilot にリポジトリ固有の指示を設定します。
クイックスタート
リポジトリに .github/copilot-instructions.md を作成します。
# 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/`.
効果的なパターン
プロジェクトのコンテキスト
# 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
## 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
## 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 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 }
);
検証
- リクエストの検証には Zod を使用します
- 早期に検証し、速やかに失敗させます
### 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
ファイルの場所
ファイルは .github/copilot-instructions.md に配置する必要があります(ルートには配置しません)。
リソース
コメント
Markdown 対応