Skip to main content

AI integration

Scaffold ships configuration for AI coding agents, so an agent can work in a generated project from the first commit. This page is for developers who use those agents. It describes each file, lists the commands an agent runs without asking and shows how to keep the architecture documentation current.

install.sh keeps this configuration by default. To remove it, answer n to the Use AI agents prompt, or pass --no-ai in place of --ai. install.sh then deletes CLAUDE.md, AGENTS.md, the .claude/ directory and the architecture documentation.

AGENTS.md​

AGENTS.md holds the project's architecture and coding conventions for AI coding agents. It also lists the commands that lint, test and build the project. The file follows the AGENTS.md convention. install.sh trims the template's AGENTS.md to the features you select.

The generated file's "Updating from the template" section holds the steps for pulling the template's latest infrastructure into the project. When you ask your agent to "update scaffold", the agent fetches the update-consumer-scaffold skill into .claude/skills/update-consumer-scaffold/ and runs it. The project's .gitignore lists that directory, so the skill stays out of commits.

CLAUDE.md​

Claude Code reads CLAUDE.md as its entry point. The file only imports AGENTS.md, so Claude Code reads the same guidance as other agents.

.claude/settings.json​

.claude/settings.json lists the commands Claude Code runs without asking you first. The list matches the commands in AGENTS.md. install.sh removes the entries for the features you didn't select, so a project without Docker has no Docker entries. The file is committed, so the whole team shares 1 list.

Each entry is a rule in 1 of 2 forms:

  • Rules for composer, npm and the project image's docker build and docker run each match 1 exact command line, such as Bash(composer test). Claude Code asks before any other spelling, such as composer run test.
  • Rules for PHPCS, PHPCBF, PHPStan, Rector, PHPUnit, BATS, Hadolint and PlantUML end in :* and match any arguments. So ./vendor/bin/phpunit --filter testName runs without a prompt.

.claude/settings.local.json holds your personal overrides, such as machine-specific or experimental permissions. To pre-approve a command for yourself only, add it to that file. The project's .gitignore lists the file, so it stays out of your commits.

.artifacts​

.artifacts holds temporary output from agents and developers, such as plans, notes and reports. Every generated project's .gitignore lists the directory, so its files stay out of commits.

Architecture documentation​

The architecture documentation is a walkthrough of how your project works, with diagrams an AI agent draws from the source code. It lives in docs/content/architecture/README.md, so the documentation site serves it with your other pages. When you leave out the documentation site, install.sh moves docs/content/architecture/ to docs/architecture/ and rewrites every path that points to it.

The feature adds the following:

  • docs/content/architecture/README.md: an initial walkthrough of the template's example code, trimmed to the stacks you select
  • .claude/skills/update-architecture-docs/SKILL.md: the Claude Code skill an agent follows to update the walkthrough
  • An "Architecture Documentation" section in AGENTS.md, with the instruction to update the walkthrough after any structural change

Pick a diagram format​

When you keep the AI configuration, install.sh asks for the AI architecture docs format. Pick the format that matches your toolchain:

FormatOptionDiagrams
mermaid (default)--ai-arch-docs or --ai-arch-docs=mermaidMermaid code blocks in README.md
plantuml--ai-arch-docs=plantumlCommitted .puml sources, rendered to committed light-theme .svg files
none--ai-arch-docs=none or --no-ai-arch-docsNone: install.sh removes the feature

The mermaid format needs no extra tools. GitHub renders Mermaid blocks in its light and dark themes. The documentation site renders them through its bundled @docusaurus/theme-mermaid theme.

The plantuml format needs PlantUML installed. .claude/settings.json keeps its Bash(plantuml:*) rule only for this format.

Update the walkthrough​

To update the walkthrough, ask your agent to "update architecture docs". The agent traces the codebase from its entry points and rewrites docs/content/architecture/README.md, or docs/architecture/README.md without the documentation site. The result has 1 component diagram for the overall structure and 1 sequence or flow diagram for each primary flow. When the walkthrough and the code disagree, the code wins.

With the plantuml format, the agent checks for PlantUML with plantuml -version, then renders the diagrams with plantuml -tsvg docs/content/architecture/*.puml, or docs/architecture/*.puml without the documentation site. When PlantUML is missing, the agent edits the prose and .puml sources but skips rendering. It reports that the .svg files weren't regenerated. The report includes the install commands: brew install plantuml on macOS and apt-get install plantuml on Debian or Ubuntu.