# Deploy skill for Claude Code

> Automatically deploy your application to Ploi Cloud with the pc-deploy skill for Claude Code.

Deploy skill for Claude Code
------------------------------

The `pc-deploy` skill is a Claude Code skill that automates the entire deployment process. It detects your project type, creates or updates the application on Ploi Cloud, deploys it, monitors the deployment, and automatically fixes common failures.

### What it does

When you run `/pc-deploy` from your project directory, the skill will:

1. Check for a git repository, or fall back to source upload mode
2. Detect your project type (Laravel, Node.js, WordPress, PHP, Statamic, Craft CMS)
3. Extract PHP/Node versions and required extensions
4. Detect services needed from your dependencies (databases, caches)
5. Create or update the application on Ploi Cloud
6. Configure build commands, init commands, and settings
7. Deploy and monitor progress
8. Auto-fix failures (up to 5 retries)
9. Report the live URL when done

### Installation

**All tools** — auto-detects your AI harness and installs to the right location:

```bash
npx skills add ploicloud/skill
```

**Claude Code** — install globally so it's available in all projects:

```bash
git clone https://github.com/ploicloud/skill ~/.claude/skills/pc-deploy
```

**Manual** — clone into your project's `.claude/skills/` directory:

```bash
git clone https://github.com/ploicloud/skill .claude/skills/pc-deploy
```

### Requirements

- A git repository with a remote URL (GitHub, GitLab, or Bitbucket), **or** a project directory without a git repo (deployed via source upload)
- The Ploi Cloud MCP server connected (see [Getting started](/documentation/ai/getting-started-with-ai))

If the skill detects a git repository with a remote URL, it deploys from git. If no git repo or remote is found, it automatically switches to upload mode — creating a tar.gz archive of your project and uploading it to Ploi Cloud. See [Deploying with source upload](/documentation/deployment/deploying-with-source-upload) for more about upload-based deployments.

### Usage

From your project directory in Claude Code, type:

```
/pc-deploy
```

The skill will handle everything automatically. You can also trigger it naturally:

> "Deploy this project to Ploi Cloud"

### Supported project types

| Type | Detection | Default build command |
|------|-----------|----------------------|
| Laravel | `composer.json` with `laravel/framework` | `composer install --no-dev --optimize-autoloader && npm install && npm run build` |
| Statamic | `composer.json` with `statamic/cms` | `composer install --no-dev --optimize-autoloader && npm install && npm run build` |
| Craft CMS | `composer.json` with `craftcms/cms` | `composer install --no-dev --optimize-autoloader` |
| WordPress | `wp-config.php` | None (pre-built) |
| PHP | `composer.json` (generic) | `composer install --no-dev --optimize-autoloader` |
| Node.js | `package.json` | `npm install && npm run build` |

### Service detection

The skill automatically detects services your application needs from its dependencies:

| Dependency | Service created |
|------------|----------------|
| `mysql2`, Prisma with MySQL | MySQL |
| `pg`, `postgres`, Prisma with PostgreSQL | PostgreSQL |
| `mongodb`, `mongoose` | MongoDB |
| `predis/predis`, `ext-redis`, `redis`, `ioredis` | Redis |
| `php-amqplib`, `amqplib` | RabbitMQ |

### Auto-fix capabilities

When a deployment fails, the skill analyzes the error and applies fixes automatically:

| Error | Fix applied |
|-------|-------------|
| Out of memory (OOMKilled) | Increases memory allocation |
| Missing PHP extension | Adds the extension to PHP config |
| Build failure | Adjusts build commands |
| Health check failure | Changes the health check path |
| Missing environment variable | Adds the required secret |

The skill retries up to 5 times, escalating fixes as needed (e.g., memory: 1Gi → 2Gi → 4Gi).

### Step-by-step walkthrough

Here's what a typical deployment looks like:

1. **Git check** — the skill reads your git remote URL and current branch
2. **Project scan** — reads `composer.json` or `package.json` to detect type and dependencies
3. **Existing app check** — searches your Ploi Cloud applications for a matching repo
4. **Create/update** — creates the app if new, or updates settings if it exists
5. **Services** — creates any needed database or cache services
6. **Secrets** — adds required environment variables from `.env.example`
7. **Deploy** — triggers the deployment
8. **Monitor** — polls every 15 seconds for up to 10 minutes
9. **Fix** — if something fails, applies a fix and redeploys
10. **Report** — shows the live URL and summary
