Back to articles/Development
Development
20 min read

Turning Ideas into Code: Supercharging Claude Code with YOLO Mode & Playwright

Claude Code can kickstart development with impressive power… However, to make it truly autonomous, some hands-on setup is needed. Here's how I unlocked its full potential.

MS

Maxim St-Hilaire

Lead Product Manager | MarTech & AI

Claude Code in YOLO mode

Empowering Claude Code with Playwright MCP

Report showing each test individually ran

Setting up the environment

Requirements

  • VS Code with ‘Dev Containers’ extension
  • Docker Application
  • Claude Code (Pro+)
Cloning Claude-Code repo
git clone https://github.com/anthropics/claude-code.git <project name>
bash
Repository cleanup
# Move .devcontainer to your home directory (or anywhere you deem better)
mv .devcontainer ~/

# Remove everything else in the project folder
rm -rf ./* .[^.]*

# Move .devcontainer back
mv ~/.devcontainer .
bash
devcontainer.json
{
  "name": "Claude Code Sandbox",
  "build": {
    "dockerfile": "Dockerfile",
    "context": ".",
    "args": {
      "TZ": "${localEnv:TZ:America/Los_Angeles}"
    }
  },
  "runArgs": ["--cap-add=NET_ADMIN", "--cap-add=NET_RAW"],
  "customizations": {
    "vscode": {
      "extensions": [
        "dbaeumer.vscode-eslint",
        "esbenp.prettier-vscode",
        "eamodio.gitlens"
      ],
      "settings": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "esbenp.prettier-vscode",
        "editor.codeActionsOnSave": {
          "source.fixAll.eslint": "explicit"
        },
        "terminal.integrated.defaultProfile.linux": "zsh",
        "terminal.integrated.profiles.linux": {
          "bash": {
            "path": "bash",
            "icon": "terminal-bash"
          },
          "zsh": {
            "path": "zsh"
          }
        }
      }
    }
  },
  "remoteUser": "node",
  "mounts": [
    "source=claude-code-bashhistory-${devcontainerId},target=/commandhistory,type=volume",
    "source=claude-code-config-${devcontainerId},target=/home/node/.claude,type=volume"
  ],
  "remoteEnv": {
    "NODE_OPTIONS": "--max-old-space-size=4096",
    "CLAUDE_CONFIG_DIR": "/home/node/.claude",
    "POWERLEVEL9K_DISABLE_GITSTATUS": "true"
  },
  "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=delegated",
  "workspaceFolder": "/workspace"
  //"postCreateCommand": "sudo /usr/local/bin/init-firewall.sh"
}
json
Dockerfile
FROM node:20

ARG TZ
ENV TZ="$TZ"

# Install basic development tools and iptables/ipset
RUN apt update && apt install -y less \
  git \
  procps \
  sudo \
  fzf \
  zsh \
  man-db \
  unzip \
  gnupg2 \
  gh \
  iptables \
  ipset \
  iproute2 \
  dnsutils \
  aggregate \
  jq

# Install dependencies needed for Playwright browsers
RUN apt-get update && apt-get install -y \
  libnss3 \
  libatk-bridge2.0-0 \
  libxss1 \
  libasound2 \
  libxcomposite1 \
  libxdamage1 \
  libxrandr2 \
  libgbm1 \
  libgtk-3-0 \
  wget \
  curl \
  gnupg2 \
  fonts-liberation \
  --no-install-recommends && \
  rm -rf /var/lib/apt/lists/*

# Ensure default node user has access to /usr/local/share
RUN mkdir -p /usr/local/share/npm-global && \
  chown -R node:node /usr/local/share

ARG USERNAME=node

# Persist bash history.
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
  && mkdir /commandhistory \
  && touch /commandhistory/.bash_history \
  && chown -R $USERNAME /commandhistory

# Set `DEVCONTAINER` environment variable to help with orientation
ENV DEVCONTAINER=true

# Create workspace and config directories and set permissions
RUN mkdir -p /workspace /home/node/.claude && \
  chown -R node:node /workspace /home/node/.claude


WORKDIR /workspace

RUN ARCH=$(dpkg --print-architecture) && \
  wget "https://github.com/dandavison/delta/releases/download/0.18.2/git-delta_0.18.2_${ARCH}.deb" && \
  sudo dpkg -i "git-delta_0.18.2_${ARCH}.deb" && \
  rm "git-delta_0.18.2_${ARCH}.deb"

# Set up non-root user
USER node

# Install global packages
ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
ENV PATH=$PATH:/usr/local/share/npm-global/bin

# Set the default shell to zsh rather than sh
ENV SHELL=/bin/zsh

# Default powerline10k theme
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.0/zsh-in-docker.sh)" -- \
  -p git \
  -p fzf \
  -a "source /usr/share/doc/fzf/examples/key-bindings.zsh" \
  -a "source /usr/share/doc/fzf/examples/completion.zsh" \
  -a "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
  -x

# Install Claude
RUN npm install -g @anthropic-ai/claude-code

# Copy and set up firewall script
COPY init-firewall.sh /usr/local/bin/
USER root
RUN chmod +x /usr/local/bin/init-firewall.sh && \
  echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
  chmod 0440 /etc/sudoers.d/node-firewall

# Install playwright and playwright-mcp as root
RUN npm install -g playwright @playwright/mcp

# Install Playwright browsers with all dependencies as root
RUN npx playwright install chrome chromium firefox webkit

# Create playwright cache directory for node user and copy browsers
RUN mkdir -p /home/node/.cache/ms-playwright && \
    cp -r /root/.cache/ms-playwright/* /home/node/.cache/ms-playwright/ 2>/dev/null || true && \
    chown -R node:node /home/node/.cache

# Switch to node user
USER node
text
.mcp.json
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp"]
    }
  }
}
json

Building the container to run Claude

BASH Code
code .
bash
Visual studio code prompt to reopen the folder in a container
BASH Code
curl -4 https://example.com
bash

Launching Claude Code in YOLO mode

BASH Code
claude
bash
Anthropic page to authorize Claude
Prompt asking to enable MCP servers
BASH Code
claude --dangerously-skip-permissions
bash
Prompt warning about Claude YOLO mode
Prompt
Use whatever Playwright MCP tools you have available to open a browser, navigate to https://example.com and take a screenshot
text

MCP Tools availability

It’s possible Claude might not recognize the MCP tools just yet. If that’s the case, I had success nudging it by simply typing /mcp then trying again.

Closing Thoughts

Share this article

Help others discover insights on AI and marketing