Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Dev Environment

ASecurity

Start, stop, and manage the local dev stack (Docker infra, backend, frontend). Works in any directory — worktree or main repo.

33 stars
0 votes
0 copies
0 views
Added 9/20/2026
developmentrustgobashsqlnodedockergitapidatabasefrontend

Works with

cliapi

Security Analysis

A100/100

Scanned 9/20/2026

Install to Claude Code

$npx -y skills add ayunis-core/ayunis-core --skill dev-environment --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dev Environment?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Dev Environment
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ayunis-core-dev-environment/badge)](https://www.skillsdirectory.com/skills/ayunis-core-dev-environment)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: dev-environment
description: Start, stop, and manage the local dev stack (Docker infra, backend, frontend). Works in any directory — worktree or main repo.
---

# Dev Environment

## Starting the Stack

The `./dev` script manages the local development stack. It works from any checkout — worktree or main repo.

By default, `./dev up` omits the slow anonymisation service. Use this for routine backend, frontend, migration, and QA work:

```bash
# Requires a slot number on first run
./dev up --slot 2

# Subsequent runs remember the slot
./dev up
```

Before starting the stack, decide whether the task actually exercises anonymisation. Only include the service when the task tests or changes anonymisation behavior:

```bash
./dev up --slot 2 --with-anonymisation
```

### What `./dev up` does

1. Starts Docker infrastructure (postgres, minio, mailcatcher, code-execution, redis, gotenberg, plus anonymize only when `--with-anonymisation` is set)
2. Generates `.env.dev` with localhost connection config for the slot
3. Runs database migrations
4. Starts the backend natively (`nest start --watch`)
5. Starts the frontend natively (`vite`)
6. Waits for the backend health check, prints port summary, returns

## Port Reference

Ports are offset by `slot × 10`:

| Service  | Formula       | Slot 2 | Slot 3 | Slot 4 |
| -------- | ------------- | ------ | ------ | ------ |
| Backend  | 3000 + offset | 3020   | 3030   | 3040   |
| Frontend | 3001 + offset | 3021   | 3031   | 3041   |
| Postgres | 5432 + offset | 5452   | 5462   | 5472   |
| MinIO    | 9000 + offset | 9020   | 9030   | 9040   |

**Avoid slots 0 and 1** — their ports (5432, 3000, etc.) often conflict with existing services on the host.

## Checking Status and Logs

```bash
./dev status                      # Overview of all services
./dev logs backend                # Backend logs (last 80 lines)
./dev logs frontend               # Frontend logs
./dev logs infra                  # Docker infrastructure logs
./dev logs --tail 200 backend     # More lines
```

## Restarting

The backend runs `nest start --watch` — it auto-reloads on code changes. If it crashes:

```bash
./dev logs backend    # Check what went wrong
./dev down
./dev up              # Slot is remembered; add --with-anonymisation only if needed
```

## Stopping

```bash
./dev down
```

## Troubleshooting

If `./dev up` fails, check logs:

```bash
./dev logs backend
./dev logs infra
```

### Migration fails with `42P07 duplicate-table` — stale Postgres volume

Slots reuse their Postgres data volume across branches. If a previous branch
on this slot already ran a migration that creates the same table as the
current branch's pending migration, `./dev up` fails with:

```text
error: relation "<table>" already exists (PostgreSQL 42P07)
```

The volume is stale — it has the table but no record of the migration that
created it. Resolving it means wiping the slot's Postgres volume so `./dev up`
replays migrations from scratch.

**Do not run this yourself.** Wiping a volume requires a destructive Docker
flag (`docker compose down -v`), which is on the Forbidden Actions list in
`CLAUDE.md` — volumes hold database data that cannot be restored. Instead,
surface the situation to the user and let them decide. Tell them the slot's
Postgres volume is stale and that recovering it requires:

```bash
# Run by the user — destroys the slot's Postgres data
docker compose -p ayunis-dev-<SLOT> down -v
./dev up --slot <SLOT>
```

Slots are per-developer scratch state (not shared), so this is normally safe —
but it is the user's call, not the agent's.

### Cross-worktree slot squat — frontend OR backend

When two worktrees both think they own the same slot (e.g. both ran
`./dev up --slot 2` at different times), one of the slot's ports can end up held
by a process from worktree A while you `./dev up` in worktree B. Two flavors:

**Frontend squat** — `vite`/`node` from worktree A holds `3021`/`3031`/...
`./dev up` sees the port bound, **silently skips frontend startup**, and the
backend comes up fresh against your branch's code while the frontend serves
worktree A's old code. `./dev status` looks healthy.

**Backend squat** — `nest`/`node` from worktree A holds `3020`/`3030`/`3040`/...
The `./dev up` in worktree B either skips backend startup or fails a health
check. More insidiously, any tool that hits the backend port from worktree B
(e.g. `pnpm run openapi:update`, which fetches `http://localhost:<port>/api/docs-json`)
will silently pull from worktree A's server — regenerating a **stale OpenAPI
client that's missing endpoints you just added in worktree B**.

Diagnose (same recipe, use the port relevant to the symptom):

```bash
# Frontend port: 3021 = slot 2, 3031 = slot 3, 3041 = slot 4
# Backend port:  3020 = slot 2, 3030 = slot 3, 3040 = slot 4
lsof -nP -iTCP:3040 -sTCP:LISTEN

# Inspect that process's cwd — if it points to a different worktree, that's the squatter
lsof -p <PID> | grep cwd
```

Before regenerating any code from a running dev server (OpenAPI schema, GraphQL
codegen, etc.), verify the process serving the port is rooted in the current
worktree — not another slot's stale backend.

Fix: the squatter must be stopped before `./dev up --slot <SLOT>` succeeds
and before any codegen-from-running-server is trustworthy. **Do not kill it
yourself** — killing processes is on the Forbidden Actions list in `CLAUDE.md`.
Report the offending PID and its worktree cwd to the user and let them stop
it. If you want to keep both worktrees running, give them different slots
instead.

### Orphaned processes from a trashed worktree

When a git worktree is removed via `git worktree remove` — or moved to
`.git/wt/trash/…` — while its `./dev` stack is still running, the native
`nest`/`vite`/`esbuild` children **survive the worktree deletion** and keep
holding the slot's ports. Next `./dev up --slot <SLOT>` from any worktree fails
because those ports are still bound.

The distinguishing signal from a live cross-worktree squat is the cwd: an
orphaned process's `lsof -p <PID> | grep cwd` resolves to a path under
`.git/wt/trash/…` (or is deleted entirely and shows up as `cwd (deleted)`),
not a real live worktree.

Prevent: **always `./dev down` in a worktree before trashing/removing it.**
The `worktree` skill's cleanup section names this too — respect it.

Recover: because the parent worktree is already gone, there's no ambiguity
about whether the process is still owned — it isn't. Report the orphan PIDs
plus the trashed cwd to the user and ask permission to `kill <PID>` them. Once
approved, `./dev up --slot <SLOT>` from your current worktree comes up clean.
`docker compose down` alone does **not** clean these up — they're native
processes, not containers.

Attribution

ayunis-coreayunis-core
View sourceMore from ayunis-core →
SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Your tool, in front of Claude Code builders.

3 founder slots · $299/mo · GSC-verified traffic · sponsors can never buy grades.

See placements

Related Skills

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

281612 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2132 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

9881 votes

Pentest

PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.

5491 votes
View all in development →