copilot-exec
npx machina-cli add skill dceoy/ai-coding-agent-skills/copilot-exec --openclawCopilot Exec Skill
Use GitHub Copilot CLI to execute development tasks that involve code modifications. This skill modifies code.
When to Use
- User asks to add, create, implement, or generate code
- User wants to refactor existing code
- User needs to fix a bug
- User wants to create tests
- User asks to update or modify code
Prerequisites
Verify GitHub Copilot CLI is available:
copilot --version
Note: Copilot will ask you to trust the files in the current folder before it can read them.
Basic Usage
Step 1: Understand the Task
Clarify:
- What to create/modify?
- Which files are affected?
- Expected outcome?
- Constraints or requirements?
Step 2: Gather Context
Review current state:
git status
git diff
Read relevant files to understand patterns.
Step 3: Launch Copilot CLI
cd /path/to/project
copilot
Step 4: Execute the Task
Provide clear instructions:
[TASK DESCRIPTION]
Follow these guidelines:
- Follow existing code patterns and conventions
- Add appropriate error handling
- Include necessary imports
- Maintain readability and style
- Use proper types if applicable
- Add comments for complex logic
Project context:
- Language: [e.g., TypeScript + React]
- Build tool: [e.g., Vite, webpack]
- Package manager: [e.g., npm, pnpm, yarn]
- Coding style: [e.g., see eslint config]
Preview all changes before applying them.
Step 5: Review and Approve
Copilot CLI will ask for approvals before it changes files or runs commands. Review each action and approve only what is correct.
Step 6: Verify Changes
git status
git diff
Run lint/tests if available.
Step 7: Report Results
Provide:
- Files modified/created
- Summary of changes
- Verification results
- Issues or follow-ups
Tips
-
Use
@path/to/fileto focus Copilot on a file. -
Use
/agentto pick a custom agent, or run:copilot --agent=refactor-agent --prompt "Refactor src/auth/*" -
Use
/add-diror--add-dirto add extra directories. -
Use
--add-dirto allow additional directories in the workspace. -
Use
/modelto pick another model if needed.
Use Custom Instructions
Copilot CLI automatically loads repository instructions if present:
.github/copilot-instructions.md.github/copilot-instructions/**/*.instructions.mdAGENTS.md(agent instructions)
Error Handling
- If Copilot is not found, ensure it is installed per the prerequisites in README.md and available in PATH.
- If authentication fails, run
/loginand follow prompts. - If results are off, refine the prompt and include file paths.
Related Skills
copilot-askfor read-only questionscopilot-reviewfor code reviews
Limitations
- Interactive mode by default
- Requires explicit approvals for file edits and commands
- Limited by current codebase context
Source
git clone https://github.com/dceoy/ai-coding-agent-skills/blob/main/skills/copilot-exec/SKILL.mdView on GitHub Overview
Copilot Exec uses GitHub Copilot CLI to perform code modifications, including creating features, refactoring, bug fixes, and test generation. It streamlines development requests by running guided prompts against your codebase and requires the Copilot CLI to be installed.
How This Skill Works
Clarify the task and gather repository context, then launch Copilot CLI in the project directory. Provide a clear, structured prompt with project metadata; Copilot suggests edits which you review and approve before applying. After changes, verify with git status/diff and run lint or tests if available.
When to Use It
- User asks to add, create, implement, or generate code
- User wants to refactor existing code
- User needs to fix a bug
- User wants to create tests
- User asks to update or modify code
Quick Start
- Step 1: Understand Task — clarify what to create/modify, affected files, desired outcome, and constraints
- Step 2: Launch Copilot CLI — cd /path/to/project and run copilot
- Step 3: Review & Verify — examine changes, approve correct edits, then run lint/tests and git diff
Best Practices
- Follow existing code patterns and conventions in the project
- Add appropriate error handling and include necessary imports
- Maintain readability, style, and use proper types where applicable
- Include comments to explain complex logic
- Preview all changes before applying them and provide clear task prompts with project context
Example Use Cases
- Add a new REST API endpoint in a TypeScript/Node.js service using Copilot CLI
- Refactor a Python function for clarity and performance with automated edits
- Fix a UI bug in a React component and update related tests
- Generate unit tests for a module with edge-case coverage
- Update build/config files to accommodate a new dependency or tool