How to improve our coding workflow with Copilot
Better habits of Copilot usage help in two ways:
- Higher quality code output
- Reduced credit waste
The objective isn’t to limit our use of the tool. The goal is simply to be more precise.
Context becomes part of the cost
Under usage-based billing, context length directly impacts cost. Vague prompts often lead to repeated attempts, longer answers and more token usage. Effective prompting provides the AI with essential details immediately:
- The specific logic to modify
- All necessary source files
- Mandatory architectural constraints
- Code areas to remain untouched
- Required testing and validation
- The desired response format
Weak prompt example: “Fix this code”
Better prompt example: “Refactor the selected logic for clarity while maintaining the existing API. Do not modify the method signature. Provide unit tests covering edge cases like null inputs. Output the refactored code with a brief summary”
This approach is more professional. It significantly minimizes the need for repeated attempts.
Use custom instructions
One powerful way to standardize output is through repository-level instructions.
GitHub allows teams to define global standards in:
.github/copilot-instructions.mdThis file helps Copilot understand project-specific patterns and validation requirements. Support for path-aware guidance is also available via .github/instructions using the .instructions.md naming convention.
For example, a data engineering team, rules might include:
# Team standards for GitHub Copilot
Standardize on Python 3.12.
Use static typing throughout.
Prioritize modular, testable components.
Ensure exceptions are handled explicitly.
Initialize cloud clients outside primary loops.
Document infrastructure impact before modifying resources.
Keep SQL readable with clear aliases.
Evaluate schema evolution and idempotency in pipelines.
Include failure modes in all tests.
Outline complex architectural plans before implementation.These rules help align Copilot’s output with internal coding standards and reduce the time spent on manual corrections.
Path-level guidance
While global rules are helpful, complex projects often require localized logic.
GitHub supports directory-specific files such as:
.github/instructions/python.instructions.md
.github/instructions/terraform.instructions.md
.github/instructions/sql.instructions.mdEach configuration defines its own scope.
Example Python config:
---
applyTo: "**/*.py"
---
Use type hints.
Prefer pure functions for transformations.
Use pytest for tests.
Do not use broad except blocks unless the error is logged and re-raised.
For dataframes, avoid hidden schema changes.
When modifying ETL logic, add or update tests for nulls, duplicates and invalid formats.Example infrastructure (Terraform) config:
---
applyTo: "**/*.tf"
---
Prefer small, reviewable Terraform changes.
Do not rename resources unless explicitly requested.
Explain any resource replacement risk.
Keep variables and outputs documented.
Avoid hardcoded account IDs, regions or secrets.
Before changing IAM policies, explain the permission scope.This ensures Copilot adjusts its behavior based on the specific tech stack in use.
Configuring agentic workflows
For agentic workflows, repository instructions are not the only option. GitHub documents support for agent instruction files such as:
AGENTS.mdCLAUDE.mdGEMINI.md
Support depends on the Copilot surface being used. For example, GitHub documents support for repository-wide instructions, path-specific instructions and agent instructions across GitHub.com, VS Code, JetBrains, Copilot CLI and other environments.
A sample AGENTS.md might include
# Review data pipeline change
Review the selected changes as a senior data engineer.
Focus on:
- Data correctness
- Idempotency
- Schema evolution
- Partitioning
- Performance
- Error handling
- Observability
- Test coverage
- Backward compatibility
Return:
1. Main risks
2. Suggested fixes
3. Missing tests
4. Final approval recommendationThis is particularly effective for cloud agent and autonomous workflows.
Repeatable prompt files
Certain development activities are recurring:
- Performing PR reviews
- Creating test suites
- Interpreting legacy modules
- Drafting documentation
- Analyzing CI failures
Instead of writing the same prompt every time, use reusable prompt files.
GitHub documents prompt files as reusable prompt examples for common development tasks, although they are still marked as public preview and availability depends on the IDE.
# Review data pipeline change
Review the selected changes as a senior data engineer.
Focus on:
- Data correctness
- Idempotency
- Schema evolution
- Partitioning
- Performance
- Error handling
- Observability
- Test coverage
- Backward compatibility
Return:
1. Main risks
2. Suggested fixes
3. Missing tests
4. Final approval recommendationThis improves consistency and reduces long, repeated manual prompts.
Specialized skill folders
We can create agent skills as bundles of resources that the AI can trigger for specific workflows. These are supported in VS Code and the CLI.
Storage locations include:
.github/skills
.claude/skills
.agents/skillsThese are ideal for complex, process-driven tasks like:
- Infrastructure safety audits
- Optimization of SQL queries
- API contract validation
- Automated incident post-mortems
Example SKILL.md content:
---
name: data-pipeline-review
description: Review data pipeline changes for correctness, idempotency, schema evolution, tests and production risk.
---
Use this skill when reviewing ETL, ELT, Spark, Glue, Airflow, dbt, SQL or data lake changes.
Check:
- Input and output schema
- Null handling
- Duplicate handling
- Partition strategy
- Idempotency
- Retry behavior
- Backfill impact
- Performance risks
- Monitoring and logging
- Test coverage
Return:
1. Summary
2. Main risks
3. Required fixes
4. Suggested improvements
5. Validation checklistThis turns Copilot from a generic assistant into a more consistent engineering teammate.
Concise communication
Token waste often stems from excessive verbosity. For technical tasks, we rarely need conversational filler.
Prioritize:
- The actual implementation
- Core reasoning
- Risk assessment
Adopting a compressed style can drastically reduce token counts.
Example guidelines:
Be direct. Maintain accuracy. Eliminate filler. Only explain basics if requested. Focus on code changes and risks.
This is similar to a “caveman-style” prompting approach: short, direct and focused on technical signal instead of unnecessary wording
Comments