# Nean Teardown

> Tear down a NEAN project — drop database, delete local files, and optionally delete the GitHub repo.

- **Type:** Skill
- **Install:** `agentstack add skill-edfenton-claude-skills-nean-teardown`
- **Verified:** Pending review
- **Seller:** [edfenton](https://agentstack.voostack.com/s/edfenton)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [edfenton](https://github.com/edfenton)
- **Source:** https://github.com/edfenton/claude-skills/tree/main/nean/nean-teardown

## Install

```sh
agentstack add skill-edfenton-claude-skills-nean-teardown
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

## Purpose

Completely tear down a NEAN project created by `/nean-kit`. Drops the PostgreSQL
database, kills running dev servers, and deletes all local files. By default,
keeps the GitHub repo for reference — use `--delete-repo` to remove it too.
Use `--keep-db` to preserve the database.

## Arguments

- `--delete-repo` — Also delete the GitHub repository (default: keep it)
- `--keep-db` — Skip database deletion (default: drop it)

## Prerequisites

- Must be run from inside the project directory (or provide the path)
- `gh` CLI authenticated (if `--delete-repo`)
- PostgreSQL 14 running via Homebrew (if dropping database)

## Teardown steps

### 1. Detect project

Confirm this is a NEAN project by checking for:
- `nx.json`
- `apps/api/`
- `libs/shared/`

If any are missing, warn and ask the user to confirm before proceeding.

Record the **project root** (absolute path) for later deletion.

### 2. Detect GitHub remote

```bash
git remote get-url origin 2>/dev/null
```

- If a remote exists, extract `owner/repo` from the URL
- If no remote, skip GitHub steps

### 3. Detect database

Determine the database name:

1. Read `.env` for `DATABASE_NAME=...`
2. Fall back to the project directory name with `-` replaced by `_`
   (e.g., `hello-nean` → `hello_nean`)

Verify the database exists:

```bash
/opt/homebrew/opt/postgresql@14/bin/psql -U postgres -lqt | grep 
```

If the database doesn't exist, note it and skip database steps.

### 4. Show summary and confirm

Check for running dev servers first:

```bash
lsof -ti:3000,4200 2>/dev/null
```

If processes are found on ports 3000 or 4200, warn the user.

Display exactly what will happen:

```
Project:  /path/to/my-app
GitHub:   owner/repo (will be DELETED | will be KEPT)
Database: hello_nean (will be DROPPED | will be KEPT | not found)

⚠ Dev servers detected on ports 3000, 4200 — they will be killed.

This will permanently delete:
  - All local files in /path/to/my-app
  [- GitHub repository owner/repo (if --delete-repo)]
  [- PostgreSQL database hello_nean (unless --keep-db)]

Type the project name to confirm: _
```

**Do NOT proceed without explicit confirmation.**

### 5. Kill dev servers

If processes were detected on ports 3000 or 4200:

```bash
lsof -ti:3000 | xargs kill -9 2>/dev/null
lsof -ti:4200 | xargs kill -9 2>/dev/null
```

### 6. Delete GitHub repo (if --delete-repo)

```bash
gh repo delete owner/repo --yes
```

If this fails (permissions, network), stop and report — do not continue to
local deletion so the user can retry.

### 7. Drop database (unless --keep-db)

```bash
/opt/homebrew/opt/postgresql@14/bin/psql -U postgres -c 'DROP DATABASE IF EXISTS ;'
```

If this fails, warn but continue to local deletion — the database may already
be gone or in use.

**Never stop the postgresql@14 Homebrew service.** Other projects may depend on it.

### 8. Delete local project

```bash
cd ..
rm -rf /absolute/path/to/project
```

Use the absolute path recorded in step 1. Never use relative paths.

### 9. Confirm completion

Report what was deleted or kept:
- Dev servers: killed / none found
- GitHub repo: deleted / kept (with URL if kept)
- Database: dropped / kept / not found
- Local directory: deleted

## Safety

- Always confirm before destructive operations
- Show the full absolute path that will be deleted
- Never delete parent directories or anything outside the project root
- If GitHub deletion fails, stop — don't leave the user with a deleted
  local copy and a still-existing repo they can't find
- If database drop fails, warn but continue to local deletion
- Never stop the PostgreSQL Homebrew service (other projects may use it)
- Check for running dev servers and warn before killing them

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [edfenton](https://github.com/edfenton)
- **Source:** [edfenton/claude-skills](https://github.com/edfenton/claude-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: flagged — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-edfenton-claude-skills-nean-teardown
- Seller: https://agentstack.voostack.com/s/edfenton
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
