Skip to main content

Claude/ChatGPT Prompt to Configure GitHub Codespaces Dev Containers

Create a GitHub Codespaces dev container for instant, consistent environments with the right base image, extensions, and tools pre-installed for your stack.

Füllen Sie die Platzhalter aus

Edit the values, then copy your finished prompt.

Ihr Prompt
prompt.txt

                                

What this prompt does

This prompt creates a GitHub Codespaces / Dev Container configuration for a [language]/[framework] project so anyone can go from clone to coding in minutes. It generates a devcontainer.json built on your [base_image], installs the [vscode_extensions] and [dev_features] you need, runs a post-create command to install dependencies and run migrations, and forwards your [ports] with labels. The goal is a reproducible environment that matches production rather than each developer's local machine.

It works because it captures the whole environment as code, matched as closely as possible to production. Docker Compose stands up your [services] (database, cache), the shell is customised with [shell_tools], and prebuilt images keyed to [prebuild_trigger] cut cold-start time toward your [startup_target] seconds. Matching the container to production is what spares you the long tail of works-on-my-machine bugs that come from environment drift, and a README section explains exactly how to launch and use the Codespace.

When to use it

  • Onboarding new collaborators and wanting setup to take minutes, not an afternoon
  • Standardising the dev environment across a team so everyone runs the same stack
  • Reproducing production locally to avoid works-on-my-machine bugs
  • Spinning up dependent [services] like a database and cache with Docker Compose
  • Pre-installing the right [vscode_extensions] and [dev_features] for your stack
  • Reducing Codespaces cold-start time toward a [startup_target] with prebuilds

Example output

You get a full Dev Container setup: a devcontainer.json using [base_image], the listed [vscode_extensions], feature installs for [dev_features], a post-create command for dependencies and migrations, port forwarding for [ports] with labels, env vars sourced from GitHub Secrets, a Docker Compose file for [services], a customised shell with [shell_tools], a prebuilt-image config triggered on [prebuild_trigger], and a README section on launching and using Codespaces.

Pro tips

  • Pick a [base_image] that matches your runtime version (for example the official PHP 8.3 image) so the container mirrors production closely
  • Forward every port you actually use in [ports] with labels, including the framework, the dev server, and each service, so nothing is reachable but unlabelled
  • Define your [services] in Docker Compose at the versions production runs, since a mismatched database version is a classic source of subtle bugs
  • Use a [prebuild_trigger] on your main branches so cold starts approach [startup_target] instead of rebuilding from scratch each time
  • Source secrets from GitHub Secrets rather than committing them; the config wires env vars in for you without exposing credentials
  • Put dependency install and migrations in the post-create command so a fresh Codespace is ready to run, not half-configured
  • Pre-install the [vscode_extensions] your stack relies on, so the editor lights up with the right language support the moment the Codespace opens
  • Keep [shell_tools] to what the team actually uses so the shell stays fast and familiar rather than bloated

Frequently Asked Questions

How does this reduce Codespaces startup time?
It configures prebuilt images triggered on `[prebuild_trigger]`, such as pushes to your main branches, so dependencies and features are baked in ahead of time. This pushes cold-start time toward your `[startup_target]` instead of rebuilding the whole environment on each launch.
Does it set up databases and other services?
Yes, it generates a Docker Compose file for the `[services]` you list, like MySQL and Redis. Pin these to the versions production runs, because a mismatched database or cache version is a common cause of bugs that only appear in one environment.
How are secrets handled in the container?
Environment variables are sourced from GitHub Secrets rather than committed to the repository. The devcontainer.json wires them in so the container has what it needs at runtime without exposing credentials in version control.
Will the container match my production environment?
It aims to, by using a `[base_image]` matched to your runtime and Compose services pinned to production versions. Matching these closely is what eliminates most works-on-my-machine issues, though you should still verify version parity for anything critical.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Mehr in Git & GitHub Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support