Your AI coding assistant is only as good as the instructions you give itโbut most developers treat prompts like casual conversations instead of precision tools.
As AI pair programming becomes standard practice, the ability to communicate effectively with language models is emerging as a critical developer skill. Prompt engineering isnโt just about getting answersโitโs about getting the right answers consistently, efficiently, and reproducibly.
This tutorial will transform your Copilot interactions from hit-or-miss requests into systematic, high-quality AI collaboration.
What is a Prompt?
A prompt is the input instruction you provide to an AI model. It combines context, task description, and output requirementsโanalogous to writing precise function specifications.
Why Structure Matters
The difference between vague and structured prompts is dramatic:
Vague โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Precise
"Help me code" "Generate a Python function that validates
email addresses using regex, handles edge
cases (empty, special chars), returns
tuple(bool, str), includes docstring"
โ Unstructured Prompt:
Write a function to validate email
โ Structured Prompt:
[ROLE] You are a senior Python developer specializing in input validation.
[CONTEXT] Building a user registration API that needs robust email validation.
[TASK] Write a Python function that:
- Validates email format using regex
- Handles edge cases: empty string, missing @, invalid domain
- Returns tuple: (is_valid: bool, error_message: str | None)
[CONSTRAINTS]
- Python 3.10+ with type hints
- No external libraries
- Include docstring with examples
- Maximum 25 lines
[FORMAT] Provide the function, then 3 test cases showing usage.
Objective: Practice converting unstructured requests into RCTF format
Challenge: Take this vague prompt and rewrite it using the RCTF pattern:
โMake a script that organizes my filesโ
Success Criteria:
The foundational pattern for most prompts:
[ROLE]
You are a [specific expert with relevant experience].
[CONTEXT]
The user is working on [situation/project].
Current state: [what exists now]
Goal: [what we're trying to achieve]
[TASK]
Your task is to [specific, actionable request].
Requirements:
1. [Requirement 1]
2. [Requirement 2]
3. [Requirement 3]
[CONSTRAINTS]
- [Technical constraint]
- [Quality constraint]
- [Scope constraint]
[FORMAT]
Structure your response as:
1. [Section 1]
2. [Section 2]
3. [Section 3]
Provide examples to establish the pattern:
Convert function names to descriptive comments:
Example 1:
Input: getUserById
Output: // Retrieves a user record from the database using their unique identifier
Example 2:
Input: validateEmail
Output: // Validates that a string conforms to standard email address format
Example 3:
Input: calculateTotalPrice
Output: // Computes the total price including taxes and applicable discounts
Now convert:
Input: processPaymentQueue
Output:
When to Use Few-Shot:
Force step-by-step reasoning for complex problems:
Problem: Design a caching strategy for a real-time dashboard.
Think through this step-by-step:
1. First, identify what data changes frequently vs. infrequently
2. Then, analyze the read/write patterns
3. Next, evaluate cache invalidation strategies
4. Finally, propose the architecture with trade-offs
For each step, explain your reasoning before moving to the next.
When to Use CoT:
[ROLE] You are a DevOps engineer specializing in CI/CD pipelines.
[CONTEXT] Migrating a monorepo from Jenkins to GitHub Actions.
The repo has 3 services: API (Node.js), Web (React), Worker (Python).
[TASK] Design the GitHub Actions workflow structure.
Think step-by-step:
1. Analyze which jobs can run in parallel
2. Identify shared dependencies and caching opportunities
3. Design the job dependency graph
4. Propose the workflow file structure
[FORMAT]
1. Analysis of parallelization opportunities
2. Mermaid diagram of job dependencies
3. YAML snippet for the main workflow
4. Caching strategy summary table
Objective: Practice selecting and applying the right pattern
Challenge: Choose the appropriate pattern and write a prompt for:
โI need to refactor a 500-line function into smaller unitsโ
Success Criteria:
Create .github/copilot-instructions.md to give Copilot persistent context:
# Project Copilot Instructions
## Code Style
- Use TypeScript with strict mode enabled
- Follow functional programming patterns where appropriate
- All functions must have JSDoc comments
- Maximum function length: 30 lines
## Architecture
- Services: `src/services/` - Business logic
- Components: `src/components/` - React components
- Utils: `src/utils/` - Pure helper functions
- Types: `src/types/` - TypeScript interfaces
## Testing
- Framework: Jest + React Testing Library
- Coverage target: 80%
- Test file naming: `*.test.ts` or `*.spec.ts`
## Security
- Never hardcode credentials or API keys
- Validate all user inputs
- Use parameterized queries for database operations
## Dependencies
- Prefer standard library over external packages
- Document why any new dependency is needed
Using @workspace for codebase context:
@workspace How is authentication handled in this project?
Using #file for specific file context:
#file:src/auth/login.ts Review this for security vulnerabilities
Using #selection for highlighted code:
#selection Refactor this to use async/await instead of callbacks
<!-- .github/copilot-instructions.md -->
# IT-Journey Project Instructions
## Core Principles
When generating code for this project:
- Apply DRY (Don't Repeat Yourself)
- Design for Failure (DFF) - include error handling
- Keep It Simple (KIS) - prefer clarity over cleverness
## Jekyll Context
- Site generator: Jekyll 3.9.5
- Template language: Liquid
- Content format: Markdown with YAML frontmatter
- Collections: _posts, _quests, _docs
## Content Standards
- All posts require complete frontmatter (see posts.instructions.md)
- Use fantasy/RPG theming for quest content
- Include multi-platform instructions where applicable
## File Organization
- Posts: `pages/_posts/YYYY-MM-DD-title.md`
- Quests: `pages/_quests/lvl_XXX/quest-name/index.md`
- Prompts: `.github/prompts/name.prompt.md`
Objective: Create project-specific Copilot instructions
Challenge: Write a .github/copilot-instructions.md for your current project
Success Criteria:
.github/prompts/ PatternCreate reusable prompts with variables:
---
name: "code-review"
description: "Structured code review prompt"
version: "1.0.0"
inputs:
- focus_area
- severity_threshold
---
# Code Review:
Review the provided code focusing on .
## Review Criteria
### Security
- [ ] Input validation present
- [ ] No hardcoded credentials
- [ ] Proper authentication checks
### Performance
- [ ] No unnecessary loops or iterations
- [ ] Appropriate data structures used
- [ ] Caching considered where applicable
### Maintainability
- [ ] Clear naming conventions
- [ ] Adequate documentation
- [ ] DRY principle followed
## Output Format
For each issue found:
- **Severity**: ๐ด Critical | ๐ก Warning | ๐ข Suggestion
- **Location**: File and line number
- **Issue**: Description of the problem
- **Fix**: Recommended solution with code example
Only report issues at level or higher.
.github/prompts/
โโโ README.md # Catalog and usage guide
โโโ code-review.prompt.md # Code review template
โโโ generate-tests.prompt.md # Test generation template
โโโ refactor.prompt.md # Refactoring assistant
โโโ document.prompt.md # Documentation generator
โโโ debug.prompt.md # Debugging assistant
โโโ explain.prompt.md # Code explanation template
---
name: "debug-assistant"
description: "Systematic debugging prompt for code issues"
version: "1.0.0"
inputs:
- language
- error_type
---
# Debug Assistant:
[ROLE] You are an expert debugger specializing in issues.
[CONTEXT]
The user is experiencing a in their code.
[TASK]
Analyze the provided code and error, then:
1. Identify the root cause
2. Explain why this error occurs
3. Provide a fix with explanation
4. Suggest prevention strategies
[FORMAT]
## ๐ Analysis
[Step-by-step breakdown of the issue]
## ๐ Root Cause
[Specific cause of the error]
## โ
Solution
[Fixed code with comments]
## ๐ก๏ธ Prevention
[How to avoid this in the future]
Objective: Build a reusable prompt for your common tasks
Challenge: Create a prompt template for one of these scenarios:
Success Criteria:
โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ
โ PLAN โโโโโถโ DO โโโโโถโ CHECK โโโโโถโ ACT โ
โ โ โ โ โ โ โ โ
โ Define โ โ Write โ โ Measure โ โ Refine โ
โ success โ โ prompt โ โ quality โ โ or โ
โ criteriaโ โ โ โ โ โ templateโ
โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ
โฒ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Rate each prompt output (0-10):
| Criterion | Description | Score |
|---|---|---|
| Correctness | Output works as intended | /10 |
| Completeness | All requirements addressed | /10 |
| Format | Follows requested structure | /10 |
| Efficiency | No unnecessary content | /10 |
Target: Average 8+ before templating
## Prompt Iteration Log: [Task Name]
### Version 1 (Baseline)
**Prompt**: [Original prompt]
**Score**: 4/10
**Issues**:
- Too vague, got minimal output
- No error handling included
- Missing type hints
### Version 2 (Added Structure)
**Changes**: Added RCTF pattern, specified constraints
**Score**: 7/10
**Issues**:
- Better structure, but missing edge cases
- No examples in docstring
### Version 3 (Added Examples)
**Changes**: Added few-shot examples for edge cases
**Score**: 9/10
**Decision**: โ
Template this version
Version 1 (Score: 3/10):
Write a function to parse dates
Version 2 (Score: 6/10):
Write a Python function that parses date strings into datetime objects.
Handle multiple formats. Include error handling.
Version 3 (Score: 9/10):
[ROLE] You are a Python developer specializing in date/time handling.
[TASK] Write a function that parses date strings into datetime objects.
Requirements:
1. Support formats: ISO 8601, US (MM/DD/YYYY), EU (DD/MM/YYYY)
2. Auto-detect format when possible
3. Return None for unparseable strings (don't raise exceptions)
4. Include type hints and docstring
[EXAMPLES]
Input: "2025-11-26" โ datetime(2025, 11, 26)
Input: "11/26/2025" โ datetime(2025, 11, 26) # US format
Input: "invalid" โ None
[CONSTRAINTS]
- Use standard library only (datetime, re)
- Maximum 30 lines
- Include 3 test cases in docstring
Objective: Experience the improvement cycle firsthand
Challenge:
Success Criteria:
# Install VS Code Copilot extension via CLI
code --install-extension GitHub.copilot
code --install-extension GitHub.copilot-chat
# Verify installation
code --list-extensions | grep -i copilot
# Install VS Code Copilot extension via CLI
code --install-extension GitHub.copilot
code --install-extension GitHub.copilot-chat
# Verify installation
code --list-extensions | Select-String "copilot"
# Install VS Code Copilot extension via CLI
code --install-extension GitHub.copilot
code --install-extension GitHub.copilot-chat
# Verify installation
code --list-extensions | grep -i copilot
Before completing, verify you can:
.github/copilot-instructions.md file.github/prompts/ directory with README catalogSymptoms: Suggestions donโt follow .github/copilot-instructions.md
Solution:
.github/copilot-instructions.md (not .github/copilot/)Cmd/Ctrl + Shift + P โ โReload WindowโPrevention: Test instructions with explicit @workspace queries
Symptoms: Same prompt produces varying quality results
Solution:
Prevention: Use templates with tested, consistent prompts
Symptoms: Response length doesnโt match needs
Solution:
Prevention: Always specify output length expectations in prompt
| Resource | Description |
|---|---|
| GitHub Copilot Docs | Official documentation |
| VS Code Copilot Extension | Extension marketplace page |
| Copilot Chat Extension | Chat interface extension |
| Resource | Type | Description |
|---|---|---|
| Prompt Engineering Guide | Guide | Community-maintained patterns |
| Learn Prompting | Course | Free structured curriculum |
| OpenAI Prompt Engineering | Docs | Official OpenAI guidance |
| Resource | Description |
|---|---|
prompts.instructions.md |
Kaizen-integrated prompt engineering guide |
posts.instructions.md |
Post creation standards |
.github/prompts/ |
Example prompt templates |
This article was created following IT-Journeyโs post standards and Kaizen continuous improvement principles. Found an issue or have a suggestion? Open an issue or contribute directly!