惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
Jina AI
Jina AI
量子位
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
博客园 - 聂微东
美团技术团队
Last Week in AI
Last Week in AI
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园_首页
V
Visual Studio Blog
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
GitHub Copilot Prompts vs Skills vs Instructions: What's ...
Luke Hackett · 2026-05-18 · via DEV Community

You've been using GitHub Copilot for a while. It's great out of the box, but you keep catching yourself repeating the same context. "We use Vitest, not Jest.", "Always use server actions, not API routes.", "Run migrations with this specific command."

GitHub Copilot now has three primitives that let you codify this kind of knowledge: Instructions, Prompts, and Skills. They overlap just enough to be confusing, but once you see how each one works, the choice becomes obvious.

Let's break them down.


Instructions: The Always-On Rules

instructions.md are Markdown files that passively shape Copilot's behavior. Think of them as the coding standards document your team actually reads - because the AI reads it for them.

Where they live:

  • .github/copilot-instructions.md - project-wide rules, loaded on every interaction
  • .github/instructions/*.instructions.md - file-specific or task-specific rules, loaded on-demand

When to use instructions

Use instructions when the guidance applies broadly and should always be in play without anyone explicitly asking for it.

Example 1: Project-wide standards

.github/copilot-instructions.md:

# Project Guidelines

## Code Style
- Use functional components with hooks, never class components
- Prefer named exports over default exports
- Use `pnpm`, not `npm` or `yarn`

## Architecture
- API routes live in `src/app/api/`
- All database access goes through the repository pattern in `src/lib/db/`
- Never import server-only modules in client components

## Testing
- Run tests with `pnpm test`
- Use Vitest, not Jest
- Co-locate test files next to source: `Button.test.tsx` beside `Button.tsx`

Enter fullscreen mode Exit fullscreen mode

This file is loaded into every Copilot interaction. When you ask it to write a test, it'll reach for Vitest. When it scaffolds a component, it'll use a named export. No reminders needed.

Example 2: File-specific rules loaded automatically

.github/instructions/react-components.instructions.md:

---
description: "Standards for React components"
applyTo: "src/components/**/*.tsx"
---

# React Component Standards

- Use the `cn()` utility from `@/lib/utils` for conditional classes
- Props types go above the component, named `{ComponentName}Props`
- Use `forwardRef` for any component that wraps a native element

Enter fullscreen mode Exit fullscreen mode

The applyTo glob means this loads automatically whenever Copilot is working on files in src/components/. You never invoke it — it just shows up when relevant.

Example 3: On-demand task instructions

.github/instructions/database-migrations.instructions.md:

---
description: "Use when writing database migrations, schema changes, or data transformations"
---

# Migration Guidelines

- Always create reversible migrations with explicit `up` and `down`
- Never drop a column in the same release as the code removal
- Add indexes concurrently: `CREATE INDEX CONCURRENTLY`
- Test rollback locally before pushing

Enter fullscreen mode Exit fullscreen mode

No applyTo here. Instead, the description tells Copilot when this instruction is relevant. When you ask Copilot to help with a migration, it reads the description, recognizes the match, and pulls in the instructions automatically.

Key Takeaway

Instructions are passive.

They shape behavior without you thinking about them. The best instructions are ones your team writes once and then forgets exist — because Copilot just does the right thing.


Prompts: The Reusable Tasks

What they are: Template files for specific, repeatable tasks you trigger on-demand. They're like saved chat messages with superpowers — you can pin them to specific models, restrict their tools, and parameterize inputs.

Where they live:

  • .github/prompts/*.prompt.md — workspace-scoped
  • ~/.config/github-copilot/prompts/*.prompt.md — personal, follows you across projects

When to use prompts

Use prompts when you have a single, focused task you do repeatedly and want consistent output every time.

Example 1: Generating tests from code

.github/prompts/generate-tests.prompt.md:

---
description: "Generate test cases for the selected code"
agent: "agent"
---

Generate comprehensive test cases for the provided code:

- Include happy path, edge cases, and error scenarios
- Follow existing test patterns in this codebase
- Use descriptive test names that read like specifications
- Mock external dependencies, never hit real APIs

Enter fullscreen mode Exit fullscreen mode

Now type /generate-tests in chat, and you get consistent, well-structured tests every time. No re-explaining your preferences.

Example 2: Writing a changelog entry

.github/prompts/changelog.prompt.md:

---
description: "Draft a changelog entry from recent git commits"
agent: "agent"
tools: [terminal]
---

Review the git log since the last tag and draft a changelog entry.

Format:
## [version] - YYYY-MM-DD
### Added
### Changed
### Fixed

Group by type. Use past tense. Link PR numbers. Keep entries to one line.

Enter fullscreen mode Exit fullscreen mode

Example 3: PR description generator

.github/prompts/pr-description.prompt.md:

---
description: "Generate a PR description from the current branch diff"
agent: "agent"
tools: [terminal]
---

Generate a pull request description based on the current branch's diff against main.

Include:
1. **Summary** — what changed and why (2-3 sentences)
2. **Changes** — bullet list of notable changes
3. **Testing** — how this was tested
4. **Screenshots** — placeholder if UI changed

Use the conventional commits in the log to understand intent.

Enter fullscreen mode Exit fullscreen mode

Key Takeaway

Prompts are active.

You invoke them deliberately when you want to run a specific task. They're your saved workflows — small, focused, and reusable. If you're reaching for the same chat prompt more than twice, it should be a prompt file.


Skills: The Multi-Step Workflows

What they are: Folders containing instructions, scripts, templates, and reference docs that Copilot loads on-demand for complex, multi-step tasks. Skills are the heavy machinery — they bundle everything the agent needs to execute a sophisticated workflow.

Where they live:

  • .github/skills/<skill-name>/SKILL.md — workspace-scoped
  • ~/.copilot/skills/<skill-name>/SKILL.md — personal

When to use skills

Use skills when you need a multi-step workflow with bundled assets — scripts to run, templates to fill, reference docs to consult. If a prompt is a recipe card, a skill is the entire cookbook chapter with ingredients included.

Example 1: A deployment verification skill

.github/skills/verify-deployment/
├── SKILL.md
├── scripts/
│   └── smoke-test.sh
└── references/
    └── endpoints.md

Enter fullscreen mode Exit fullscreen mode

SKILL.md:

---
name: verify-deployment
description: 'Verify a deployment is healthy. Use when deploying, after deploy, smoke test, health check.'
---

# Deployment Verification

## Procedure
1. Ask which environment (staging/production)
2. Run the [smoke test script](./scripts/smoke-test.sh) against the environment
3. Check each endpoint listed in [endpoints reference](./references/endpoints.md)
4. Report results as a table: endpoint, status, response time
5. Flag any endpoint returning non-200 or responding > 2s

Enter fullscreen mode Exit fullscreen mode

This bundles the smoke test script and endpoint list with the instructions. The agent doesn't need to search for them or ask you where they are.

Example 2: A component scaffolding skill

.github/skills/new-component/
├── SKILL.md
└── assets/
    ├── component.tsx.template
    ├── component.test.tsx.template
    └── component.stories.tsx.template

Enter fullscreen mode Exit fullscreen mode

SKILL.md:

---
name: new-component
description: 'Scaffold a new React component with tests and stories. Use when creating components, new UI element, add component.'
---

# New Component

## Procedure
1. Ask for the component name and directory
2. Create from [component template](./assets/component.tsx.template)
3. Create test from [test template](./assets/component.test.tsx.template)
4. Create story from [stories template](./assets/component.stories.tsx.template)
5. Add barrel export to the directory's `index.ts`

Enter fullscreen mode Exit fullscreen mode

Key Takeaway

Skills are orchestrations.

They package complex workflows with their dependencies. The bar for creating a skill is higher — you need a folder structure, and the task needs to be complex enough to justify it. But for workflows you run regularly, they're transformative.


Decisions, Decisions, Decisions

The examples above should help

You've seen all three, but you're probably still wondering which option best fits your usecase.

Don't overthink it — ask yourself these questions:

Question Answer Use
Should this apply without anyone asking? Yes Instructions
Is it a single, focused task? Yes Prompt
Does it need scripts, templates, or multi-step orchestration? Yes Skill
Does it apply to specific file types? Yes Instructions (with applyTo)
Do I want it as a slash command? Yes Prompt or Skill
Is it project-wide context? Yes Instructions (copilot-instructions.md)

Remember:

  • Instructions = "Always do this" (passive)
  • Prompts = "Do this now" (active, simple)
  • Skills = "Do this now, and here's everything you need" (active, complex)

Getting Started

Don't try to build all three at once.

  1. Start with copilot-instructions.md — write down the things you keep correcting Copilot on. "Use Vitest.", "We use pnpm.", "Components go here." This takes five minutes and pays off immediately.

  2. Notice your repeated prompts — if you've typed "write tests for this using our patterns" more than twice, make it a .prompt.md file.

  3. Graduate to skills when you feel the friction — when a prompt isn't enough because you need to reference a script or template, that's your signal to create a skill folder.

The goal isn't to configure Copilot perfectly on day one. It's to gradually encode your team's knowledge so the AI gets smarter about your codebase over time.