Infrastructure Planning Skill
This skill helps plan and document all the infrastructure, external services, and logistics a Paperclip company needs to operate.
When to Use
- Setting up infrastructure for a new company
- Auditing what services an existing company needs
- Planning CI/CD, deployment, and hosting
- Documenting infrastructure decisions
Infrastructure Categories
1. Source Code & Version Control
GitHub is the default. Each company needs:
| Resource |
Description |
| GitHub Organization |
Company org for all repositories |
| Monorepo |
Single repository for all services, apps, and infra |
GitHub CLI (gh) |
Authenticated in Paperclip container via GH_TOKEN |
| GitHub Actions |
CI/CD workflows for testing and deployment |
Monorepo layout (recommended):
{company-name}/
apps/
web/ # Frontend (React/TypeScript or Next.js)
Dockerfile
package.json
src/
services/
api/ # Backend API (FastAPI or Express)
Dockerfile
pyproject.toml
src/
{domain-service}/ # Domain-specific services
Dockerfile
src/
packages/
shared/ # Shared types, utilities, constants
infra/
helm/ # Helm charts for each service
k8s/ # Raw K8s manifests (alternative to Helm)
docker-compose.yml # Local dev stack
.github/
workflows/
ci.yml # Test on PR
deploy.yml # Build + push + deploy on merge
README.md
2. Container Registry
Docker Hub is the default:
| Resource |
Description |
| Docker Hub account |
Push/pull container images |
| Image naming |
{account}/{company}-{service}:{tag} |
| Tags |
latest, v{semver}, sha-{commit}, dev |
| Auth |
DOCKER_HUB_USERNAME + DOCKER_HUB_TOKEN in Paperclip container |
3. Orchestration & Hosting
Kubernetes is the default:
| Resource |
Description |
| Cluster |
microk8s-local (dev) or cloud (GKE, EKS, AKS) |
| Namespaces |
{company}-dev, {company}-staging, {company}-prod |
| Ingress |
Traefik as reverse proxy |
| Helm |
Chart templating for each service |
| Tools |
kubectl, helm installed in Paperclip container |
Namespace plan:
| Namespace |
Purpose |
{company}-dev |
Development and testing |
{company}-staging |
Pre-production validation |
{company}-prod |
Production |
4. Domain & DNS
| Resource |
Description |
| Primary domain |
{company}.{tld} (e.g., .cz, .com, .io) |
| DNS provider |
Cloudflare, Route53, or registrar DNS |
| SSL/TLS |
Let's Encrypt via cert-manager or Traefik |
5. Communication
Slack (recommended):
| Channel |
Purpose |
#general |
Company-wide announcements |
#engineering |
Technical discussions |
#marketing |
Marketing and content |
#operations |
Ops, fulfillment, logistics |
#alerts |
Automated alerts from monitoring |
6. Productivity
Google Workspace (recommended):
| Service |
Use |
| Gmail |
Company email ({name}@{domain}) |
| Calendar |
Meeting scheduling, deadlines |
| Drive |
Document storage and collaboration |
| Docs/Sheets |
Business documents, spreadsheets |
Agent access via gws CLI:
gws CLI is pre-installed in the Paperclip container
- GWS skills (gmail, drive, calendar, sheets, etc.) are pre-installed globally at
/paperclip/.codex/skills/gws-* — all agents can use them
- Each company needs a GWS service account JSON key (see the GWS setup guide)
- Place the key at
.company/gws/<company-slug>.json in the Paperclip repo root
- It is mounted into the container at
/paperclip/.gws/<company-slug>.json
- Agents that need GWS access set
GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=/paperclip/.gws/<company-slug>.json via .paperclip.yaml env inputs / adapter env
7. Payments
Stripe (recommended for prepaid/subscription models):
| Resource |
Description |
| Stripe account |
Payment processing |
| Test mode |
sk_test_..., pk_test_... for dev/staging |
| Live mode |
sk_live_..., pk_live_... for production |
| Webhooks |
STRIPE_WEBHOOK_SECRET for event handling |
| Payment methods |
Cards, Apple Pay, Google Pay, SEPA, iDEAL, Bancontact |
8. Database
PostgreSQL (recommended):
| Environment |
Setup |
| Dev |
docker-compose or microk8s StatefulSet |
| Staging |
Same as dev or managed |
| Production |
Managed (Cloud SQL, RDS) or self-hosted StatefulSet |
9. Logistics (Physical Products)
If the company ships physical products:
| Region |
Provider |
Notes |
| Czech Republic |
Zasilkovna (Packeta) |
Pickup points + home delivery |
| EU |
DHL, DPD, GLS |
Standard parcel |
| International |
DHL Express, FedEx, UPS |
Priority/express |
| Packaging |
Custom branded boxes |
Design via CMO/ContentCreator |
10. Monitoring & Observability
| Tool |
Purpose |
| Grafana |
Dashboards and alerting |
| Prometheus |
Metrics collection |
| Loki |
Log aggregation |
| Sentry |
Error tracking (frontend + backend) |
Deployment Flow Template
Agent writes code
-> git push to GitHub
-> Unit tests run locally (pytest / npm test)
-> docker build (inside Paperclip container)
-> docker push to Docker Hub
-> helm upgrade / kubectl apply to K8s
-> Verify via API/browser
CI/CD Pipeline (GitHub Actions)
ci.yml — runs on PRs:
- Checkout code
- Install dependencies
- Run tests (pytest, npm test)
- Lint and type-check
deploy.yml — runs on merge to main:
- Build Docker images
- Push to Docker Hub with commit SHA and
latest tags
- (Optional) Deploy to dev namespace
Environment Variables per Environment
| Category |
Dev |
Staging |
Prod |
| Database |
Local PG |
Staging PG |
Prod PG (managed) |
| Payments |
Test keys |
Test keys |
Live keys |
| AI/ML APIs |
Test keys |
Test keys |
Prod keys |
| Domain |
localhost |
staging.{domain} |
{domain} |
Infrastructure → Environment Variables Mapping
Each infrastructure category requires specific environment variables to be configured as company secrets in Paperclip. Use this mapping when generating scripts/setup-secrets.sh for a company.
| Infrastructure Category |
Env Var |
Kind |
Description |
| Source Code (GitHub) |
GH_TOKEN |
secret |
GitHub personal access token for gh CLI |
| Container Registry (Docker Hub) |
DOCKER_HUB_USERNAME |
secret |
Docker Hub username |
| Container Registry (Docker Hub) |
DOCKER_HUB_TOKEN |
secret |
Docker Hub access token |
| Payments (Stripe) |
STRIPE_SECRET_KEY |
secret |
Stripe secret API key |
| Payments (Stripe) |
STRIPE_WEBHOOK_SECRET |
secret |
Stripe webhook signing secret |
| Database (PostgreSQL) |
DATABASE_URL |
secret |
PostgreSQL connection string |
| AI Media (Gemini) |
GEMINI_API_KEY |
secret |
Google Gemini API key |
| AI Media (ElevenLabs) |
ELEVENLABS_API_KEY |
secret |
ElevenLabs TTS API key |
| Media Output |
MEDIA_OUTPUT_DIR |
plain |
Output directory for generated media |
| Monitoring (Sentry) |
SENTRY_DSN |
plain |
Sentry error tracking DSN |
| Communication (Slack) |
SLACK_WEBHOOK_URL |
plain |
Slack webhook for automated notifications |
| Productivity (Google Workspace) |
GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE |
plain |
Path to GWS service account JSON for gws CLI (e.g. /paperclip/.gws/<company>.json) |
Only include env vars for infrastructure the company actually uses. For example, a company without Stripe integration does not need STRIPE_SECRET_KEY.
Infrastructure Document Template
When generating infrastructure.md for a company, include:
- Source Code — GitHub org, repo URL, monorepo layout
- Container Registry — Docker Hub account, image naming convention
- Kubernetes — cluster info, namespace plan, services
- Database — engine, per-environment setup
- Payments — provider, env vars needed
- Paperclip Container Access — tools available inside the container
Paperclip Container Tools
Agents run inside the Paperclip Docker container and have access to:
| Tool |
Purpose |
codex |
Codex CLI |
gh |
GitHub CLI (authenticated via GH_TOKEN) |
docker |
Docker CLI (host daemon via mounted socket) |
kubectl |
Kubernetes CLI (host kubeconfig mounted) |
helm |
Helm chart manager |
git |
Version control |
python3 |
Python runtime |
uv |
Python package manager |
node |
Node.js runtime |
npm |
Node.js package manager |
gws |
Google Workspace CLI (Gmail, Calendar, Drive, Sheets, Docs) |
1---2name: infrastructure-planning3description: Plan and document the required software, infrastructure, and logistics for a Paperclip company — domains, GitHub, Docker Hub, Kubernetes, Slack, Google Workspace, Stripe, shipping providers, and CI/CD pipelines. Use when setting up infrastructure for a new company or auditing what an existing company needs.4---56# Infrastructure Planning Skill78This skill helps plan and document all the infrastructure, external services, and logistics a Paperclip company needs to operate.910## When to Use1112- Setting up infrastructure for a new company13- Auditing what services an existing company needs14- Planning CI/CD, deployment, and hosting15- Documenting infrastructure decisions1617## Infrastructure Categories1819### 1. Source Code & Version Control2021**GitHub** is the default. Each company needs:2223| Resource | Description |24|----------|-------------|25| GitHub Organization | Company org for all repositories |26| Monorepo | Single repository for all services, apps, and infra |27| GitHub CLI (`gh`) | Authenticated in Paperclip container via `GH_TOKEN` |28| GitHub Actions | CI/CD workflows for testing and deployment |2930**Monorepo layout (recommended):**3132```33{company-name}/34 apps/35 web/ # Frontend (React/TypeScript or Next.js)36 Dockerfile37 package.json38 src/39 services/40 api/ # Backend API (FastAPI or Express)41 Dockerfile42 pyproject.toml43 src/44 {domain-service}/ # Domain-specific services45 Dockerfile46 src/47 packages/48 shared/ # Shared types, utilities, constants49 infra/50 helm/ # Helm charts for each service51 k8s/ # Raw K8s manifests (alternative to Helm)52 docker-compose.yml # Local dev stack53 .github/54 workflows/55 ci.yml # Test on PR56 deploy.yml # Build + push + deploy on merge57 README.md58```5960### 2. Container Registry6162**Docker Hub** is the default:6364| Resource | Description |65|----------|-------------|66| Docker Hub account | Push/pull container images |67| Image naming | `{account}/{company}-{service}:{tag}` |68| Tags | `latest`, `v{semver}`, `sha-{commit}`, `dev` |69| Auth | `DOCKER_HUB_USERNAME` + `DOCKER_HUB_TOKEN` in Paperclip container |7071### 3. Orchestration & Hosting7273**Kubernetes** is the default:7475| Resource | Description |76|----------|-------------|77| Cluster | microk8s-local (dev) or cloud (GKE, EKS, AKS) |78| Namespaces | `{company}-dev`, `{company}-staging`, `{company}-prod` |79| Ingress | Traefik as reverse proxy |80| Helm | Chart templating for each service |81| Tools | `kubectl`, `helm` installed in Paperclip container |8283**Namespace plan:**8485| Namespace | Purpose |86|-----------|---------|87| `{company}-dev` | Development and testing |88| `{company}-staging` | Pre-production validation |89| `{company}-prod` | Production |9091### 4. Domain & DNS9293| Resource | Description |94|----------|-------------|95| Primary domain | `{company}.{tld}` (e.g., `.cz`, `.com`, `.io`) |96| DNS provider | Cloudflare, Route53, or registrar DNS |97| SSL/TLS | Let's Encrypt via cert-manager or Traefik |9899### 5. Communication100101**Slack** (recommended):102103| Channel | Purpose |104|---------|---------|105| `#general` | Company-wide announcements |106| `#engineering` | Technical discussions |107| `#marketing` | Marketing and content |108| `#operations` | Ops, fulfillment, logistics |109| `#alerts` | Automated alerts from monitoring |110111### 6. Productivity112113**Google Workspace** (recommended):114115| Service | Use |116|---------|-----|117| Gmail | Company email ({name}@{domain}) |118| Calendar | Meeting scheduling, deadlines |119| Drive | Document storage and collaboration |120| Docs/Sheets | Business documents, spreadsheets |121122**Agent access via `gws` CLI:**123- `gws` CLI is pre-installed in the Paperclip container124- GWS skills (gmail, drive, calendar, sheets, etc.) are pre-installed globally at `/paperclip/.codex/skills/gws-*` — all agents can use them125- Each company needs a GWS service account JSON key (see the [GWS setup guide](https://github.com/googleworkspace/cli/blob/main/README.md))126- Place the key at `.company/gws/<company-slug>.json` in the Paperclip repo root127- It is mounted into the container at `/paperclip/.gws/<company-slug>.json`128- Agents that need GWS access set `GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=/paperclip/.gws/<company-slug>.json` via `.paperclip.yaml` env inputs / adapter env129130### 7. Payments131132**Stripe** (recommended for prepaid/subscription models):133134| Resource | Description |135|----------|-------------|136| Stripe account | Payment processing |137| Test mode | `sk_test_...`, `pk_test_...` for dev/staging |138| Live mode | `sk_live_...`, `pk_live_...` for production |139| Webhooks | `STRIPE_WEBHOOK_SECRET` for event handling |140| Payment methods | Cards, Apple Pay, Google Pay, SEPA, iDEAL, Bancontact |141142### 8. Database143144**PostgreSQL** (recommended):145146| Environment | Setup |147|-------------|-------|148| Dev | docker-compose or microk8s StatefulSet |149| Staging | Same as dev or managed |150| Production | Managed (Cloud SQL, RDS) or self-hosted StatefulSet |151152### 9. Logistics (Physical Products)153154If the company ships physical products:155156| Region | Provider | Notes |157|--------|----------|-------|158| Czech Republic | Zasilkovna (Packeta) | Pickup points + home delivery |159| EU | DHL, DPD, GLS | Standard parcel |160| International | DHL Express, FedEx, UPS | Priority/express |161| Packaging | Custom branded boxes | Design via CMO/ContentCreator |162163### 10. Monitoring & Observability164165| Tool | Purpose |166|------|---------|167| Grafana | Dashboards and alerting |168| Prometheus | Metrics collection |169| Loki | Log aggregation |170| Sentry | Error tracking (frontend + backend) |171172## Deployment Flow Template173174```175Agent writes code176 -> git push to GitHub177 -> Unit tests run locally (pytest / npm test)178 -> docker build (inside Paperclip container)179 -> docker push to Docker Hub180 -> helm upgrade / kubectl apply to K8s181 -> Verify via API/browser182```183184### CI/CD Pipeline (GitHub Actions)185186**ci.yml** — runs on PRs:187- Checkout code188- Install dependencies189- Run tests (pytest, npm test)190- Lint and type-check191192**deploy.yml** — runs on merge to main:193- Build Docker images194- Push to Docker Hub with commit SHA and `latest` tags195- (Optional) Deploy to dev namespace196197### Environment Variables per Environment198199| Category | Dev | Staging | Prod |200|----------|-----|---------|------|201| Database | Local PG | Staging PG | Prod PG (managed) |202| Payments | Test keys | Test keys | Live keys |203| AI/ML APIs | Test keys | Test keys | Prod keys |204| Domain | localhost | staging.{domain} | {domain} |205206## Infrastructure → Environment Variables Mapping207208Each infrastructure category requires specific environment variables to be configured as company secrets in Paperclip. Use this mapping when generating `scripts/setup-secrets.sh` for a company.209210| Infrastructure Category | Env Var | Kind | Description |211|------------------------|---------|------|-------------|212| Source Code (GitHub) | `GH_TOKEN` | secret | GitHub personal access token for `gh` CLI |213| Container Registry (Docker Hub) | `DOCKER_HUB_USERNAME` | secret | Docker Hub username |214| Container Registry (Docker Hub) | `DOCKER_HUB_TOKEN` | secret | Docker Hub access token |215| Payments (Stripe) | `STRIPE_SECRET_KEY` | secret | Stripe secret API key |216| Payments (Stripe) | `STRIPE_WEBHOOK_SECRET` | secret | Stripe webhook signing secret |217| Database (PostgreSQL) | `DATABASE_URL` | secret | PostgreSQL connection string |218| AI Media (Gemini) | `GEMINI_API_KEY` | secret | Google Gemini API key |219| AI Media (ElevenLabs) | `ELEVENLABS_API_KEY` | secret | ElevenLabs TTS API key |220| Media Output | `MEDIA_OUTPUT_DIR` | plain | Output directory for generated media |221| Monitoring (Sentry) | `SENTRY_DSN` | plain | Sentry error tracking DSN |222| Communication (Slack) | `SLACK_WEBHOOK_URL` | plain | Slack webhook for automated notifications |223| Productivity (Google Workspace) | `GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE` | plain | Path to GWS service account JSON for `gws` CLI (e.g. `/paperclip/.gws/<company>.json`) |224225Only include env vars for infrastructure the company actually uses. For example, a company without Stripe integration does not need `STRIPE_SECRET_KEY`.226227## Infrastructure Document Template228229When generating `infrastructure.md` for a company, include:2302311. **Source Code** — GitHub org, repo URL, monorepo layout2322. **Container Registry** — Docker Hub account, image naming convention2333. **Kubernetes** — cluster info, namespace plan, services2344. **Database** — engine, per-environment setup2355. **Payments** — provider, env vars needed2366. **Paperclip Container Access** — tools available inside the container237238## Paperclip Container Tools239240Agents run inside the Paperclip Docker container and have access to:241242| Tool | Purpose |243|------|---------|244| `codex` | Codex CLI |245| `gh` | GitHub CLI (authenticated via `GH_TOKEN`) |246| `docker` | Docker CLI (host daemon via mounted socket) |247| `kubectl` | Kubernetes CLI (host kubeconfig mounted) |248| `helm` | Helm chart manager |249| `git` | Version control |250| `python3` | Python runtime |251| `uv` | Python package manager |252| `node` | Node.js runtime |253| `npm` | Node.js package manager |254| `gws` | Google Workspace CLI (Gmail, Calendar, Drive, Sheets, Docs) |