Leveling Up Automation with GitHub Copilot Agent Skills

Leveling Up Automation with GitHub Copilot Agent Skills

GitHub Copilot is already a powerful tool for developers, but with the introduction of Agent Skills, you can now teach Copilot repeatable, team-specific workflows that go far beyond its general-purpose code suggestions. In this post, I'll break down how I implemented Agent Skills for my own team, showing you the nuts and bolts, sharing example folder layouts, and providing commented Python and JavaScript samples you can use today.

What Are Agent Skills?

Agent Skills are a way to give Copilot agents "domain knowledge" and step-by-step instructions for specialized tasks. Instead of relying on broad prompts, you organize automation scripts, documentation, and config files in dedicated folders within your repository. When Copilot receives a related request, it loads everything in the folder and executes your process as defined, bringing expert context to every automation.

Check the official docs for more details.

How to Structure a Skill Folder

At the core, each Skill is a directory inside .github/skills in your repo. Here's a typical structure:

.github/
  skills/
    onboarding/
      README.md
      onboarding.py
    format_compliance/
      README.md
      formatter.js

Example 1: Python Onboarding Skill

Let's automate onboarding for new engineers.

Folder structure:

.github/skills/onboarding/
  README.md
  onboarding.py

README.md

# Onboarding Skill

Automates the creation of onboarding tasks for new engineers.
- Creates JIRA issues
- Sends welcome email
- Provisions cloud access

onboarding.py

"""
Automated onboarding for new engineers using Python.

This script:
- Creates a JIRA onboarding ticket
- Sends a welcome email
- Provisions access using cloud API
"""

import requests
import smtplib

def create_jira_ticket(user_email, user_name):
    # Example: Create a JIRA ticket (replace with real API/token)
    jira_payload = {
        "fields": {
            "project": {"key": "ONBOARD"},
            "summary": f"Onboard {user_name}",
            "description": f"Set up access for {user_email}",
            "issuetype": {"name": "Task"}
        }
    }
    # For demo: print instead of sending
    print(f"Would create JIRA ticket: {jira_payload}")

def send_welcome_email(user_email):
    # Example: Send a simple welcome email
    # Note: For real use, configure SMTP details securely
    print(f"Would send email to: {user_email}")

def provision_access(user_email):
    # Example: Provision cloud access (replace URL and auth)
    # resp = requests.post("https://api.cloud.com/provision", json={"email": user_email})
    print(f"Would provision cloud access for: {user_email}")

def onboard_new_engineer(user_email, user_name):
    create_jira_ticket(user_email, user_name)
    send_welcome_email(user_email)
    provision_access(user_email)

# Example usage
if __name__ == "__main__":
    onboard_new_engineer("new.hire@example.com", "New Hire")

How Copilot Uses This:

When you prompt Copilot to "onboard a new engineer," it loads this skill and executes the defined automation steps, so onboarding is consistent every time.

Example 2: JavaScript Compliance Formatter Skill

Let's automate formatting of compliance documentation.

Folder structure:

.github/skills/format_compliance/
  README.md
  formatter.js

README.md

# Compliance Formatter Skill

Automatically formats compliance documents:
- Ensures proper section headers and numbering
- Normalizes terminology

formatter.js

/**
 * Automatically formats compliance documents.
 * - Adds section numbers
 * - Converts headers to title case
 * - Normalizes specific terminology
 */

const fs = require('fs');

// Utility: Title Case Converter
function toTitleCase(str) {
    return str.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
}

// Format Document Function
function formatComplianceDoc(inputPath, outputPath) {
    let content = fs.readFileSync(inputPath, 'utf8');
    let lines = content.split('\n');
    let sectionNumber = 1;
    let formattedLines = lines.map(line => {
        if (line.startsWith('section:')) {
            line = `Section ${sectionNumber++}: ${toTitleCase(line.replace('section:', '').trim())}`;
        }
        // Normalize terminology
        line = line.replace(/gdpr/gi, 'GDPR').replace(/pci/gi, 'PCI DSS');
        return line;
    });
    fs.writeFileSync(outputPath, formattedLines.join('\n'));
    console.log(`Compliance doc formatted: ${outputPath}`);
}

// Example usage
formatComplianceDoc('input.txt', 'output.txt');

How Copilot Uses This:

Prompt Copilot to "format compliance doc," and it will execute this script, ensuring every doc meets your standards.

Tips for Organizing Skills

  1. Keep instructions clear in your README.md.
    The agent uses it for context, so think of it as your process playbook.
  2. Use version control.
    Scripts evolve, so update folders as your workflows change.
  3. Leverage language strengths.
    Use Python for APIs and automation, JavaScript for text or file manipulation.
  4. Modularize your scripts.
    Keep them focused, one skill per folder for easier updates.

The Payoff

Agent Skills let me automate repetitive tasks the exact way our team prefers. Instead of describing what I want in every Copilot prompt, I simply set up the Skill folder once, then anyone can trigger the workflow and Copilot executes with the same expertise every time.

You can read more and see advanced features here:
https://docs.github.com/en/copilot/concepts/agents/about-agent-skills

Let me know if you need a more complex example or want to dig into error handling, secrets management, or cross-skill orchestration!

Fun Technical Fact

Copilot Agents can leverage any language or tool your repo supports, as long as the Skill folder provides instructions and executable code. Skills are a bridge between "AI suggestions" and full "automation platform," putting you in control.

How are you using Agent Skills? Any favorite scripts or organization tips?

#Copilot #GitHubCopilot #AgentSkills