devcontainer-feature-creator
Dev Container Feature Creator
This skill acts as an implementation manual to assist you in scaffolding, developing, updating, and extensively testing Dev Container Features. It leverages the official Dev Container Features specification, testing framework, and authoring best practices.
Core Principles
- Mandatory Planning: Before scaffolding or modifying a feature, you MUST draft a design plan and obtain user approval. The plan should outline the feature ID, options, installation strategy, and testing scenarios.
- Idempotency: Installation scripts MUST be idempotent. They should be safe to run multiple times with different options without failing or causing unintended side effects.
- OS Compatibility: Installation scripts should verify the OS/distro at the beginning and support a diverse set of base images, defaulting to
shor safely bootstrappingbash. - Handling Non-Root Users: Scripts run as
root, but the final user might not be root. Use_REMOTE_USERto set permissions appropriately. - Comprehensive Testing: Always implement auto-generated tests, scenario tests, and duplicate tests using the
devcontainer features testcommand framework.
Workflow
Follow these steps to construct or update a Dev Container Feature:
1. Analyze & Scaffold
- Check the workspace structure. Features usually live in
src/<feature-name>/and their tests intest/<feature-name>/. - Create these directories if they don't exist.
2. Configure Metadata
- Create or update
src/<feature-name>/devcontainer-feature.json. - Define the feature
id,version,name,description, and any configurableoptions. - Use
assets/base-devcontainer-feature.jsonas a starting point. - See
references/feature-spec.mdfor metadata schema details.
3. Implementation & Best Practices
- Draft the entry point script:
src/<feature-name>/install.sh. - Options defined in the metadata are passed to the script as uppercase environment variables (e.g.,
OPTIONNAME). - Adhere strictly to the guidelines in
references/authoring-best-practices.md:- Check for OS support.
- Set up logic for the
_REMOTE_USER. - Minimize layers by cleaning package manager caches within the script.
- Ensure the script is executable (
chmod +x). - Use
assets/base-install.shas a template.
4. Documentation
- Create a
src/<feature-name>/README.mdto document the feature, its options, and examples of usage. - Alternatively, if the devcontainer CLI is available, suggest running
devcontainer features generate-docsto auto-generate the README from the metadata.
5. Testing
- Setup a comprehensive test suite in
test/<feature-name>/. - Auto-generated test: Create
test/<feature-name>/test.shto test default behavior. - Scenarios: Create
test/<feature-name>/scenarios.jsonand a corresponding<scenario-name>.shto test specific option combinations or multi-feature configurations. - Duplicate tests: Create
test/<feature-name>/duplicate.shto assert that installing the feature twice with different options does not conflict (ensuring idempotency). - Use
assets/base-test.shas a boilerplate for test scripts and utilize thedev-container-features-test-libframework. - Reference
references/testing-spec.mdfor comprehensive details on the testing framework.
Reference Materials
- feature-spec.md: Schema for
devcontainer-feature.jsonand context forinstall.sh. - testing-spec.md: Guidelines on how to write tests for dev container features.
- authoring-best-practices.md: Official best practices for creating resilient and efficient features.
More from zenless-lab/skills
cloud-init-crafter
Expert assistant for creating, modifying, and debugging cloud-init scripts. Supports multiple formats (YAML, shell, MIME archives), Jinja templating with instance-data, and multi-platform validation.
9readme-crafter
Use this skill when you need to write, refactor, or improve a project's README.md file. Trigger this anytime the user wants to create documentation, project overviews, or profile pages following best practices and modern aesthetics.
8skill-expert
Comprehensive master guide for designing, creating, editing, updating, and refactoring Agent Skills according to the official agentskills.io specification. Use this when you need to build or modify capabilities for an AI agent.
8agents-md-crafter
Use this skill when you need to create, update, or improve AI agent instruction files like AGENTS.md, GEMINI.md, or copilot-instructions.md. Trigger this anytime the user wants to set up standard AI rules, document project context for LLMs, or add repository-wide guidelines for AI agents.
8skill-crafter
Use this skill when creating a new skill or when modifying, updating, refactoring, restructuring, or reviewing an existing skill. Trigger it for framework-specific and framework-agnostic skill work, including SKILL.md design, folder layout, scripts, references, assets, metadata, and description optimization, even if the user only says "make a skill", "improve this skill", or "refactor the skill".
7secret-scanner
Use this skill when instructed to perform a security scan, find leaked secrets, or check for PII in the codebase or git diffs. Trigger this even if the user broadly asks to check for security issues, leaked credentials, passwords, API tokens, emails, or sensitive data before committing.
7