agentleFS
hugobatistahugobatista/agent-skills/skills/python/python-devcontainer/SKILL.md

python-devcontainer

Skill1 starsChanged 53 days agoMITView on GitHub

ALWAYS load alongside the python-project skill for any new or existing Python project. Creates a Dev Container configuration for Python projects using uv. Ask the user if they want devcontainers set up during project scaffolding.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When scaffolding a new Python project, or when adding Dev Containers to an existing one:

    line 12
  2. Distinctive:

    Ask: *"Do you want to set up a Dev Container for this project?"*

    line 16
  3. Distinctive:

    If yes, proceed with Step 2.

    line 20
  4. Very specific:

    Read the project's pyproject.toml:

    line 24
  5. Very specific:

    Read assets/devcontainer.json.tmpl and substitute placeholders:

    line 55
  6. Very specific:

    Write the result to .devcontainer/devcontainer.json.

    line 64
  7. Distinctive:

    Create the directory before writing:

    line 66
  8. Distinctive:

    After creating the Dev Container, add the following badge to README.md:

    line 79

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Dev Container setup

When scaffolding a new Python project, or when adding Dev Containers to an existing one:

Step 1: Ask the user

Ask: "Do you want to set up a Dev Container for this project?"

If no, skip.

If yes, proceed with Step 2.

Step 2: Gather project metadata

Read the project's pyproject.toml:

InfoSource
Python versionrequires-python field — extract the minor version (e.g. >=3.12 → 3.12)
uv version[tool.uv] required-version — extract the bare version (e.g. "==0.11.18" → 0.11.18)
Sync commandIf [dependency-groups] has a dev group, use uv sync --group dev; otherwise use uv sync

Then extract the uv version from [tool.uv] required-version:

uv_version=$(grep "^required-version" pyproject.toml \
  | sed 's/.*"\([0-9.]*\)".*/\1/')

This strips any leading operator (==, >=, ~=) and returns the bare version (e.g. 0.11.18).

Then fetch the image digest for the selected Python version:

curl -s "https://mcr.microsoft.com/v2/devcontainers/python/manifests/2-{python_version}-trixie" \
  -H "Accept: application/vnd.oci.image.index.v1+json" \
  -H "Accept: application/vnd.docker.distribution.manifest.list.v2+json" \
  -o /dev/null -w "%{header_json}" 2>/dev/null \
| python3 -c "import json,sys; print(json.load(sys.stdin).get('docker-content-digest',['N/A'])[0])"

This returns the manifest list digest (e.g. sha256:132c3dc2b618d194d5d56e4b385e11f5f67b265008a3d7cdddf806ab3ff8572b).

Step 3: Substitute and write

Read assets/devcontainer.json.tmpl and substitute placeholders:

| Placeholder | Value | |---|---|---| | {{python_version}} | The minor version from step 2 (e.g. 3.12) | | {{python_image_digest}} | The SHA256 digest from step 2 (e.g. sha256:132c3dc2b618d194d5d56e4b385e11f5f67b265008a3d7cdddf806ab3ff8572b) | | {{uv_version}} | The bare uv version from step 2 (e.g. 0.11.18) | | {{post_create_command}} | The sync command from step 2 (e.g. uv sync --group dev) |

Write the result to .devcontainer/devcontainer.json.

Create the directory before writing:

mkdir -p .devcontainer

The devcontainer-lock.json is auto-generated by VS Code on first build — do not create it manually.

SELinux (Fedora/RHEL): On systems with SELinux enforcing, Docker bind-mounts of files with user_home_t context cause Permission denied inside the container. The --security-opt label=disable flag in runArgs disables SELinux separation for the container. It is a no-op on macOS and Windows.

Cache invalidation: Feature options in devcontainer.json are passed as env vars to the install script, but Docker's build cache only tracks files — not env vars. After changing feature options, use Dev Containers: Rebuild Container Without Cache in VS Code.

Step 4: README badge

After creating the Dev Container, add the following badge to README.md:

[![Dev Container](https://img.shields.io/badge/Dev--Container-ready-brightgreen?logo=visualstudiocode)](https://containers.dev)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.