IT and digitalisation

How to use GitHub Copilot for boilerplate and setup

GitHub Copilot can do much more than complete code. Learn how, with just a few prompts, you can generate complete setups - from Dockerfiles to CI pipelines - directly in Visual Studio Code using Edits mode.

You can use GitHub Copilot for boilerplate and setup.
Image: IDA

Creating new projects is rarely the most exciting part of development work. Environments need to be set up, repetitive configuration must be written, and standard structures have to be created before the actual logic can begin.

This is exactly where an AI tool like GitHub Copilot can make your life easier—not by writing algorithms, but by removing friction in the setup process.

Example 1: a new Flask app in minutes

Create an empty folder in Visual Studio Code and open the Copilot Chat panel (or use the command line in the editor’s built-in terminal). Then type:

copilot: create a new Python Flask API with one GET route /status returning JSON {"status": "ok"}

1. Copilot typically generates:

  • app.py with a minimal Flask structure
  • an appropriate .gitignore
  • a suggested requirements.txt

2. Next, use Edits mode in the Copilot panel with the prompt:

“Add a Dockerfile for this project using Python 3.12 and expose port 8080.”

Copilot will usually generate a usable Dockerfile with pip install -r requirements.txt, EXPOSE 8080, and CMD ["python", "app.py"].

Copilot does not always guarantee fully working code; this depends on the prompt and the model. That’s why it is always important to review and test the generated code.

3. Then add configuration:

“Generate a docker-compose.yml that maps port 8080 and mounts the current directory.”

Copilot usually understands this and produces a working setup, ready to run with docker compose up, although small adjustments may be necessary.

In just a few minutes, you’ve gone from an empty folder to a running prototype—without digging through old snippets or documentation.

Example 2: Node.js REST API with Express

The same approach works across languages. In a new Node project, you can for example write:

copilot: initialize a new Express.js project with a single GET endpoint /api/ping returning JSON {"pong": true}

Copilot now automatically creates:

  • package.json with the necessary dependencies (express, nodemon)
  • server.js with a basic Express setup
  • a .gitignore that includes node_modules

In Edits mode, you can then extend the setup:

“Add a Dockerfile for Node 20 using port 3000 and include a start script.”

Copilot generates a complete Dockerfile with WORKDIR /usr/src/app, COPY package*.json ., RUN npm install, EXPOSE 3000, and CMD ["npm","start"].

Finally, add:

“Generate a simple README.md describing how to run the container locally.”

You now have a complete, containerized Express project in under five minutes - with documentation, dependencies, and a build file included.

Example 3: automate the build process with CI scripts

Copilot can also save time on small, repetitive DevOps tasks. Instead of writing build scripts from scratch, you can use Edits mode to generate a standardized CI workflow.

You can, for example, prompt Copilot with:

“Create a GitHub Actions YAML workflow for building and testing a Python Flask app using pytest.”

Copilot will typically suggest a workflow file such as .github/workflows/build.yml with steps like:

  • checking out the code (actions/checkout@v3)
  • setting up Python (actions/setup-python@v4)
  • running tests (pytest)

This sets up the environment and runs tests automatically. In practice, Copilot will often generate a full workflow, but the key value is that you quickly get a working starting point that you can refine.

With a few adjustments, you have a CI setup that runs tests on every commit—without writing the entire YAML file manually.

Ask, Edits, and Agent mode – three ways to work with Copilot

Most developers use Ask mode to generate new code in a separate window. But Copilot also offers Edits mode and Agent mode, each of which can streamline your workflow:

  • Ask mode: Used for conversations, generating new code, and ideas in a separate panel.
  • Edits mode: Edits existing files directly and suggests changes as diffs that you can accept selectively.
  • Agent mode: Allows Copilot to perform multiple connected actions across files and tools (currently in preview).

All three modes can understand the project’s file structure, especially when context is enabled. This makes it possible to build and refine configuration layer by layer -just as you would manually, but much faster.

When Copilot misses the mark

Copilot cannot always guess your build pipeline.

If, for example, you need to deploy to AWS ECS or use Poetry for dependency management, you must provide clear context yourself.

For example:

“Adjust the Dockerfile for deployment on AWS ECS using Gunicorn as entrypoint.”

Copilot will typically add gunicorn as a dependency and update the CMD instruction - but you should always validate the result yourself.

In short: AI does not replace setup expertise - but it makes it possible to use that expertise where it creates the most value.

How to get the most out of Copilot

  • Be precise in your prompts—describe the purpose, technology, and desired output.
  • Use context: enable project understanding so Copilot can see multiple files and their relationships.
  • Always test the result, especially for Docker, build, and CI files.
  • Combine Ask, Edits, and Agent mode to work more efficiently across the entire project.

Course

Enhance your software development with Github Copilot

Learn to integrate GitHub Copilot in Visual Studio Code and across your development workflow. Write and refactor code, automate tests, enhance documentation, and improve collaboration with AI-powered tools.

Course

Enhance your software development with Github Copilot

Learn to integrate GitHub Copilot in Visual Studio Code and across your development workflow. Write and refactor code, automate tests, enhance documentation, and improve collaboration with AI-powered tools.

Read more:

Theme

IT and digitalisation

Read about IT architecture, cyber security, UX and UI, AI and machine learning, programming and software development, data science, compliance and security.

Theme

Courses & training programmes

Are you a STEM professional and do you want to ensure your market value and develop your skills? See all IDA's courses, they are tailored to your needs.

Contact

Get help now

Find relevante quality courses and further education.