Ddev Development 标志

Ddev Development

社区
alpham8
ddev-development

适用于在 DDEV 项目中进行开发:运行命令、自定义容器、配置 nginx/PHP、安装 PECL 扩展、管理附加组件或排查 DDEV 问题。遇到 .ddev/ 目录、ddev 命令、容器配置、PHP 扩展安装、自定义 nginx/apache 配置、Docker 构建失败或 web-build Dockerfile 修改时触发。

Add to TypingMind

概览

发布者alpham8
代码仓库agentic-webdev
技能名称ddev-development
星标数
4
复刻数
0
附带文件
仅含指令
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 alpham8 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Ddev Development AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/alpham8/agentic-webdev/tree/master/skills/ddev-development
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/alpham8/agentic-webdev.git /tmp/agentic-webdev
mkdir -p .claude/skills
cp -r /tmp/agentic-webdev/skills/ddev-development .claude/skills/ddev-development
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Ddev Development,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Ddev Development。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Ddev Development 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

DDEV Development Environment

Overview

DDEV is a Docker-based local development environment for PHP projects. All PHP, Composer, Node.js, and npm commands MUST run inside the DDEV container via ddev exec or shortcut commands. Git runs on the host.

Shopware projects: See also shopware-ddev (Shopware-specific CLI commands) and shopware (plugin architecture, version compatibility).

Quick Reference: Commands

TaskCommand
Start projectddev start
Stop projectddev stop
Restart (apply config changes)ddev restart
Run command in containerddev exec <command>
SSH into containerddev ssh
PHP via Composerddev composer <args>
Node.js packagesddev npm <args> or ddev yarn <args>
Database exportddev export-db --file=dump.sql.gz
Database importddev import-db --file=dump.sql.gz
Snapshot (full state)ddev snapshot --name=before-migration
Restore snapshotddev snapshot restore before-migration
View project infoddev describe
View all projectsddev list
Install add-onddev add-on get <repo> (e.g., ddev/ddev-redis)
Remove add-onddev add-on remove <name>
List add-onsddev add-on list
Xdebug toggleddev xdebug on / ddev xdebug off
Clean upddev clean / ddev delete

Config: .ddev/config.yaml

Core settings — changes require ddev restart:

yaml
name: my-project
type: php                    # php, drupal, wordpress, laravel, symfony, etc.
docroot: public              # Web root relative to project root
php_version: "8.3"           # "5.6" to "8.5"
webserver_type: nginx-fpm    # nginx-fpm (default), apache-fpm, or generic
nodejs_version: "20"         # Any major version, or "auto" (reads .nvmrc / package.json)
corepack_enable: false       # true = enables yarn and pnpm via corepack
composer_version: "2"        # "2", "2.2" (LTS), "2.9.3" (exact), "stable", "preview"
database:
  type: mariadb              # mariadb, mysql, or postgres
  version: "11.8"            # MariaDB 5.5–10.8/10.11/11.4/11.8, MySQL 5.5–8.4, PostgreSQL 9–18
xdebug_enabled: false
performance_mode: mutagen    # "" (default), "mutagen", "none"
timezone: "Europe/Berlin"    # defaults to host timezone or UTC
webimage_extra_packages:     # Extra apt packages for the web container (no Dockerfile needed)
  - php${DDEV_PHP_VERSION}-tidy
upload_dirs:                 # Paths excluded from Mutagen sync (user-uploaded files)
  - web/uploads
fail_on_hook_fail: false     # true = abort ddev start if a hook fails
disable_settings_management: false  # true = DDEV won't touch CMS settings files

# Extra hostnames and FQDNs
additional_hostnames: []
additional_fqdns: ["example.com"]

# Hooks
hooks:
  post-start:
    - exec: "composer install"
    - exec-host: "echo 'Project started'"

# Extra daemons (managed by supervisord)
web_extra_daemons:
  - name: "vite"
    command: "npm run dev"
    directory: /var/www/html

# Expose extra ports via ddev-router
web_extra_exposed_ports:
  - name: vite
    container_port: 5173
    http_port: 5172
    https_port: 5173

Config Overrides

  • config.*.yaml files merge into config.yaml (used by add-ons)
  • config.local.yaml for machine-specific overrides (gitignored by default)

Changing PHP Version

Edit .ddev/config.yaml or use the CLI, then restart:

bash
# Via CLI (recommended)
ddev config --php-version 8.3
ddev restart

# Supported versions: 5.6, 7.0–7.4, 8.0–8.5

Or set in config.yaml directly:

yaml
php_version: "8.3"

Gotchas:

  • Only major.minor versions are supported (e.g. 8.3), not patch versions.
  • After switching, verify with ddev exec php --version.
  • Extension packages installed via webimage_extra_packages must match the new version (use ${DDEV_PHP_VERSION} variable, not a hardcoded version).
  • PECL extensions in the Dockerfile also use ${DDEV_PHP_VERSION} — they rebuild automatically.

Changing Node.js Version

Edit .ddev/config.yaml or use the CLI, then restart:

bash
# Via CLI (recommended)
ddev config --nodejs-version 22
ddev restart

# Supported: any major (16, 18, 20, 22…) or precise version (18.19.2)

Or set in config.yaml directly:

yaml
nodejs_version: "22"

Use auto to read version from project files (.nvmrc, package.json engines.node, etc.):

bash
ddev config --nodejs-version=auto
ddev restart

This uses the n tool under the hood. Any version specifier supported by n works.

Enable yarn / pnpm via corepack:

yaml
corepack_enable: true   # Runs `corepack enable` — makes yarn and pnpm available

Then run ddev yarn <args> or ddev exec pnpm <args>.

Gotchas:

  • Non-default versions are downloaded on first ddev start — slower on first boot.
  • For CI, the default LTS version avoids download delays.
  • Verify with ddev exec node --version and ddev exec npm --version.

Changing Database Engine or Version

⚠️ Always snapshot before changing database type or version — existing data may be incompatible.

bash
ddev snapshot --name=before-db-change
ddev config --database=mysql:8.0
ddev restart

Supported types and versions:

TypeVersions
mariadb5.5–10.8, 10.11, 11.4, 11.8 (default)
mysql5.5–8.0, 8.4
postgres9–18

Changing Composer Version

bash
ddev config --composer-version=2.2   # LTS, or "2", "2.9.3", "stable", "preview"
ddev restart --no-cache              # Force re-download (Composer is cached at build time)

If you ran composer self-update inside the container, the change won't persist across restarts — use composer_version in config.yaml instead.


Customization

Custom nginx Configuration

Location: .ddev/nginx_full/nginx-site.conf

DDEV auto-generates this file with #ddev-generated marker. To customize:

  1. Remove the #ddev-generated line (otherwise DDEV overwrites it on restart)
  2. Edit as needed
  3. Run ddev restart

Additional .conf files in .ddev/nginx_full/ are also loaded.

Root path inside container: /var/www/html/{docroot} PHP-FPM socket: unix:/run/php-fpm.sock

Custom PHP Configuration

Location: .ddev/php/*.ini

All .ini files in this directory are copied to /etc/php/{version}/{cli,fpm}/conf.d/.

ini
; .ddev/php/my-php.ini
[PHP]
max_execution_time = 240
memory_limit = 512M
upload_max_filesize = 64M
post_max_size = 64M

You can also disable extensions by creating an empty file matching the extension's config name (e.g., empty .ddev/php/20-xdebug.ini disables Xdebug).

Custom Dockerfile (web-build)

Location: .ddev/web-build/Dockerfile

Extends the base DDEV web image. Runs as root. Available build args:

  • BASE_IMAGE — the DDEV webserver image
  • DDEV_PHP_VERSION — e.g., "8.3"
  • username — the host user mapped into the container
dockerfile
ARG BASE_IMAGE
FROM $BASE_IMAGE

# Example: install a system package
RUN apt-get update && apt-get install -y --no-install-recommends \
    some-package \
    && rm -rf /var/lib/apt/lists/*

Important: The container uses Debian/Ubuntu. Use apt-get, not yum or zypper.

Installing PECL Extensions

PECL extensions require compilation inside the Dockerfile. Key gotchas:

  • pecl is NOT installed by default — add php-pear package
  • make is NOT installed by default — add it explicitly
  • php{version}-dev is needed for phpize
  • Use phpenmod to enable extensions after installation
dockerfile
ARG BASE_IMAGE
FROM $BASE_IMAGE

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        php${DDEV_PHP_VERSION}-dev php-pear libbrotli-dev make \
    && pecl install brotli \
    && echo "extension=brotli.so" > /etc/php/${DDEV_PHP_VERSION}/mods-available/brotli.ini \
    && phpenmod brotli \
    && rm -rf /var/lib/apt/lists/*

Common PECL issues:

  • make failed — missing make package (add make to apt-get install)
  • pecl: command not found — missing php-pear package
  • phpize: command not found — missing php${DDEV_PHP_VERSION}-dev
  • --no-install-recommends skips build tools — always add make explicitly
  • Purging php-dev with autoremove can break other packages — skip the purge or be very careful

Note: php_extensions in config.yaml only works for extensions available as Debian apt packages (e.g., php8.3-redis). Most PECL-only extensions (like brotli) require the Dockerfile approach.

Environment Variables

MethodScopeLocation
.ddev/.envAll containersProject-level
.ddev/.env.webWeb container onlyPer-service
.ddev/.env.dbDB container onlyPer-service
web_environment in config.yamlWeb containerConfig

Hooks

Available hooks in config.yaml:

  • pre-start, post-start
  • pre-stop, post-stop
  • pre-import-db, post-import-db
  • pre-import-files, post-import-files
  • pre-snapshot, post-snapshot
yaml
hooks:
  post-start:
    - exec: "composer install"          # Runs in web container
    - exec-host: "echo done"           # Runs on host

Add-ons

Pre-packaged extensions for common services. Registry: https://addons.ddev.com/

bash
ddev add-on get ddev/ddev-redis          # Redis
ddev add-on get ddev/ddev-rabbitmq       # RabbitMQ
ddev add-on get ddev/ddev-minio          # MinIO (S3-compatible)
ddev add-on get ddev/ddev-elasticsearch  # Elasticsearch
ddev add-on get codingsasi/ddev-playwright  # Playwright

Add-ons create docker-compose.*.yaml and config.*.yaml files in .ddev/.

Node.js Dev Servers & Hot Reload Proxies

For tools like Vite, webpack-dev-server, or any filesystem watcher that runs its own HTTP server, DDEV exposes the dev server's port through ddev-router — making it reachable on the host at the project's .ddev.site URL.

Step 1: Bind the dev server to 0.0.0.0

The container is a separate network entity from the host. Binding to 127.0.0.1 (the default for most dev servers) makes the server unreachable from outside the container. Always bind to 0.0.0.0.

Vite (vite.config.js / vite.config.ts):

javascript
server: {
    host: '0.0.0.0',
    port: 5173,
    strictPort: true,
    origin: `${process.env.DDEV_PRIMARY_URL_WITHOUT_PORT}:5173`,
    cors: {
        origin: /https?:\/\/([A-Za-z0-9\-\.]+)?(\.ddev\.site)(?::\d+)?$/,
    },
},

Other dev servers: Pass --host 0.0.0.0 (webpack) or equivalent flag.

Step 2: Expose the port via ddev-router

Add to .ddev/config.yaml — all three fields are required (omitting https_port defaults it to 0 and crashes ddev-router):

yaml
web_extra_exposed_ports:
  - name: vite
    container_port: 5173
    http_port: 5172      # http://myproject.ddev.site:5172
    https_port: 5173     # https://myproject.ddev.site:5173

The dev server is now available at https://myproject.ddev.site:5173 on the host.

Step 3: Auto-start the dev server (optional)

Run it as a background daemon (managed by supervisord inside the container):

yaml
web_extra_daemons:
  - name: "vite"
    command: bash -c 'npm install && npm run dev -- --host'
    directory: /var/www/html

Or via a post-start hook (simpler, but blocks ddev start output):

yaml
hooks:
  post-start:
    - exec: "npm run dev -- --host"

Multi-port example (Vite + another service)

yaml
web_extra_exposed_ports:
  - name: vite
    container_port: 5173
    http_port: 5172
    https_port: 5173
  - name: storybook
    container_port: 6006
    http_port: 6005
    https_port: 6006

Inter-Project Communication

DDEV projects run in Docker and can communicate with each other. All container names follow the pattern ddev-<projectname>-<service>.

Hostname conventions

TargetHostname from inside any container
Another project's web containerddev-<projectname>-web
Another project's databaseddev-<projectname>-db
A named add-on serviceddev-<projectname>-<service>
The host machinehost.docker.internal

The target project must be running (ddev start) for its containers to be reachable.

Accessing another project's database

bash
# From inside the current project's web container
ddev exec mysql -h ddev-backend-db -u db -pdb db

# Or set it as DB host in .env
DB_HOST=ddev-backend-db

Note: If CMS settings management is enabled (disable_settings_management: false), DDEV may reset DB_HOST to db on restart. Disable it if you need a persistent cross-project DB connection.

Accessing another project via HTTP/S (since DDEV 1.24.10)

From inside any container, use either the public domain or the internal Docker hostname:

bash
# Public domain (goes through ddev-router, works the same as in a browser)
curl https://backend.ddev.site/api/endpoint

# Internal Docker hostname (faster, no DNS lookup)
curl https://ddev-backend-web/api/endpoint

For HTTPS to the internal hostname, the calling container must trust DDEV's CA. For external/add-on containers, mount the DDEV CA certificate.

Accessing host machine services from a container

bash
# Connect to a service running on the host (must listen on 0.0.0.0, not 127.0.0.1)
curl http://host.docker.internal:8080

Container Paths

HostContainer
Project root/var/www/html
{docroot}//var/www/html/{docroot}
.ddev/php//etc/php/{version}/{cli,fpm}/conf.d/
.ddev/nginx_full/nginx site configs

Common Gotchas

  1. #ddev-generated marker — DDEV overwrites files containing this marker on restart. Remove it to customize.
  2. Commands on host vs container — PHP/Node/Composer run in container (ddev exec), Git runs on host.
  3. Database version lock-in — DB data created with one version may not work with another. Use ddev snapshot before changing.
  4. Playwright inside DDEV — baseURL must be https://localhost (not *.ddev.site) when running tests inside the container.
  5. Port conflicts — If ports 80/443 are taken, use router_http_port / router_https_port in config.yaml.
  6. Container rebuild — Dockerfile changes require ddev restart. If cached layers cause issues, use ddev delete then ddev start.
  7. Multiple DDEV global configs — If you see "multiple global DDEV configurations found", delete one of ~/.ddev or ~/.config/ddev.

Debugging

bash
ddev logs                    # Web container logs
ddev logs -s db              # Database logs
ddev describe                # Project status and URLs
ddev debug diagnose          # Run diagnostics
ddev debug compose-config    # Show generated docker-compose
ddev debug rebuild           # Full rebuild with verbose output
ddev exec php --ini          # Show loaded PHP configuration
ddev exec php -m             # List loaded PHP modules

常见问题

Ddev Development AI 技能有什么作用?

适用于在 DDEV 项目中进行开发:运行命令、自定义容器、配置 nginx/PHP、安装 PECL 扩展、管理附加组件或排查 DDEV 问题。遇到 .ddev/ 目录、ddev 命令、容器配置、PHP 扩展安装、自定义 nginx/apache 配置、Docker 构建失败或 web-build Dockerfile 修改时触发。

为什么在 TypingMind 中使用 Ddev Development?

因为您只需安装一次,就能搭配任何模型使用。Ddev Development 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Ddev Development?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/alpham8/agentic-webdev/tree/master/skills/ddev-development。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Ddev Development?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Ddev Development 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Ddev Development 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Ddev Development AI 技能免费吗?

alpham8 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇