Automated summary
Starts all local development services (FastAPI backend, Next.js frontend, Fumadocs docs) with dependency pre-checks, automatic free-port group selection, and diagnosed retries.
Strengths
- Allocates a free three-port group automatically (offset +10) and distinguishes free ports, ports held by the current worktree, and ports held by another worktree.
- Runs idempotent dependency checks (uv sync, venv activation, npm packages) before anything is launched.
- Health-checks each service and retries up to twice after diagnosing the failure.
- Fixes editable packages that resolve to the wrong path inside a git worktree, a common uv sync pitfall.
Limitations
- The port table and service names are hardcoded to one specific stack (Next.js 8080, FastAPI 8061, Fumadocs 8062).
- Depends on lsof, git and uv, so it assumes a Unix/macOS environment, and only offers five port groups (8080-8122).
- The provided document cuts off mid-way through Step 1, so the exact diagnosis and fix logic for startup failures is not fully specified.
Use it when you need the full local stack running in a fresh worktree or after a crash, without manually untangling port conflicts or missing dependencies.
Avoid it on projects that don't follow this exact port map and uv/Next.js/FastAPI/Fumadocs stack, since port detection and dependency steps assume that layout.
Security analysis
SafeThe skill automates local development service startup using standard tools (bash, lsof, curl, npm, uv). All actions are scoped to localhost and the project's own scripts; no destructive commands, exfiltration, or obfuscation are present.
No concerns found
How this analysis is madeExamples
Start all the local services for this worktree — backend, frontend and docs.Ports 8080/8061/8062 are already used by another worktree, spin up frontend, backend and docs on a free port group.uv sync failed earlier and the backend won't start — fix the dependencies and restart every service.name: run-services description: Start all local services (backend, frontend, docs) with dependency checking, error diagnosis, and automatic recovery. Handles missing npm/python packages, port conflicts, and stale processes.
Run Services
Start all local development services with pre-flight dependency checks and automatic error recovery.
Overview
This command automates the full startup workflow: 0. Smart port selection — auto-detects free port group or reuses current worktree's ports
- Pre-flight dependency checks (uv sync, venv, npm, worktree editable packages)
- Stops any existing services (only if needed)
- Starts all services via
run_services.sh - Health-checks each service
- Diagnoses and fixes failures, then retries (up to 2 retries)
Port Configuration
Ports are allocated in groups of 3 with a +10 offset between groups:
| Group | Frontend | Backend | Docs | |-------|----------|---------|------| | Default | 8080 | 8061 | 8062 | | +10 | 8090 | 8091 | 8092 | | +20 | 8100 | 8101 | 8102 | | +30 | 8110 | 8111 | 8112 | | +40 | 8120 | 8121 | 8122 |
| Service | Env Var | Base Port |
|---------|---------|-----------|
| Frontend (Next.js) | FRONTEND_PORT | 8080 |
| Backend (FastAPI) | BACKEND_PORT | 8061 |
| Docs (Fumadocs) | DOCS_PORT | 8062 |
Step 0 (Smart Port Selection) determines which group to use automatically, unless ports are already set via environment variables.
Execution Steps
Step 0: Smart Port Selection
Pre-check: If BACKEND_PORT, FRONTEND_PORT, or DOCS_PORT are already set in the environment, skip auto-detection entirely and use those values directly. Report "Using pre-configured ports" and proceed to Step 1.
0.1 Get current worktree root:
WORKTREE_ROOT=$(git rev-parse --show-toplevel)
0.2 For each port group (offset 0, 10, 20, 30, 40 — max 5 attempts), check all 3 ports in the group. For each port, determine its status:
PID=$(lsof -t -i:$PORT 2>/dev/null | head -1)
If no PID → port is free.
If PID exists, get the process's working directory:
PROC_CWD=$(lsof -a -p $PID -d cwd -Fn 2>/dev/null | tail -1 | sed 's/^n//')
Then classify:
- own —
$PROC_CWDstarts with$WORKTREE_ROOT(use prefix match, since child processes like Next.js run from subdirectories like$WORKTREE_ROOT/reflexio/website) - other —
$PROC_CWDdoes NOT start with$WORKTREE_ROOT
0.3 Decision per group:
- All 3 ports are free or own → use this group. Any "own" ports will be restarted in Step 3.
- Any port is other → skip this group, try the next offset (+10)
- All 5 groups exhausted → report error: "All port groups (8080-8122) are occupied by other worktrees. Free some ports or set BACKEND_PORT/FRONTEND_PORT/DOCS_PORT manually."
0.4 Export the chosen ports:
export FRONTEND_PORT=<8080+N>
export BACKEND_PORT=<8061+N>
export DOCS_PORT=<8062+N>
export API_BACKEND_URL="http://localhost:${BACKEND_PORT}"
Report which group was selected and why, e.g.:
- "Using default ports (8080/8061/8062) — all free"
- "Using default ports (8080/8061/8062) — restarting own services"
- "Using offset +10 ports (8090/8091/8092) — default ports occupied by another worktree"
Also record whether any ports in the chosen group were "own" (needs stop) or all "free" (skip stop).
Step 1: Pre-flight Dependency Checks
Run these checks before starting anything. They are idempotent and fast when deps are already installed.
Python dependencies (run first — creates .venv if missing):
uv sync
Activate virtual environment (after uv sync so .venv exists):
source .venv/bin/activate
Worktree editable packages:
In a git worktree, uv sync may resolve reflexio_commons and reflexio_client to a different worktree's path. Check and fix:
python -c "import reflexio_commons; import os; assert os.path.abspath(reflexio_commons.__file__).startswith(os.path.abspath('.'))" 2>/dev/null || uv pip install -e reflexio/reflexio_commons -e reflexio/reflexio_client
Frontend dependencies (reflexio/website):
Check if node_modules exists and has content. If missing or empty, install:
ls reflexio/website/node_modules/.package-lock.json 2>/dev/null || (cd reflexio/website && npm install)
Docs dependencies (reflexio/public_docs):
Check if node_modules exists and has content. If missing or empty, install:
ls reflexio/public_docs/node_modules/.package-lock.json 2>/dev/null || (cd reflexio/public_docs && npm install)
Step 2: Stop Existing Services (Conditional)
If any ports in the chosen group were classified as "own" in Step 0: stop existing services first:
./stop_services.sh
Wait 2 seconds for ports to fully release.
If all ports were "free": skip this step entirely — nothing to stop.
Step 3: Start Services
Run run_services.sh in the background with the exported port variables:
FRONTEND_PORT=$FRONTEND_PORT BACKEND_PORT=$BACKEND_PORT DOCS_PORT=$DOCS_PORT ./run_services.sh > /tmp/reflexio-services.log 2>&1 &
Wait ~15 seconds for services to boot. Next.js compilation takes time on first request.
Step 4: Health Check Each Service
Check each service individually. Use curl --max-time 10 -s -o /dev/null -w "%{http_code}" to get HTTP status codes.
Backend:
curl --max-time 10 -s -o /dev/null -w "%{http_code}" http://localhost:${BACKEND_PORT}/health
Expected: 200
Frontend:
curl --max-time 10 -s -o /dev/null -w "%{http_code}" http://localhost:${FRONTEND_PORT}
Expected: 200 or 3xx (redirect is OK)
Docs:
curl --max-time 10 -s -o /dev/null -w "%{http_code}" http://localhost:${DOCS_PORT}
Expected: 200 or 3xx (redirect is OK)
A status of 000 means the service is not responding at all.
Step 5: On Failure — Diagnose and Fix
If any health check fails, read the log for error details:
cat /tmp/reflexio-services.log
Also check if processes are even running:
lsof -i:${BACKEND_PORT} -i:${FRONTEND_PORT} -i:${DOCS_PORT}
Common Failure Patterns and Fixes
a. "Cannot find package" / "Cannot find module" (npm) An npm dependency is missing. Fix:
# Identify which service (website or public_docs) from the error path
cd reflexio/website && npm install # or reflexio/public_docs
Then retry from Step 3.
b. "ModuleNotFoundError" / "ImportError" (Python — general) A Python dependency is missing. Fix:
uv sync
Then retry from Step 3.
b2. "ModuleNotFoundError" for reflexio_commons or reflexio_client (worktree path mismatch)
In a worktree, editable packages may resolve to a different worktree's path. Fix:
uv pip install -e reflexio/reflexio_commons -e reflexio/reflexio_client
Then retry from Step 3.
c. "Address already in use" / "EADDRINUSE" A port is still occupied. Fix:
# Kill whatever is on the port
lsof -t -i:PORT | xargs kill -9 2>/dev/null
Wait 2 seconds, then retry from Step 3.
d. ".next build cache errors" / "ENOENT .next" Stale Next.js build artifacts. Fix:
rm -rf reflexio/website/.next reflexio/public_docs/.next
Then retry from Step 3.
e. Script syntax errors or unknown errors Report the error output to the user and suggest manual steps. Do not retry.
Retry Logic
- Maximum 2 retries after applying a fix
- Each retry starts from Step 3 (stop, start, health check)
- If all retries exhausted, report final status with error details
Step 6: Report Final Status
Report a summary table:
Service | Port | Status
-----------|-------|-------
Backend | 8091 | Running
Frontend | 8090 | Running
Docs | 8092 | Running
Port group: offset +10 (8090/8091/8092) — default ports occupied by another worktree
Include the port group selection reason in the summary (e.g., "all free", "restarting own services", "default ports occupied by another worktree").
If all services are running, confirm success. If any failed after retries, show:
- The specific error message from logs
- Suggested manual debugging steps
Important Notes
- Do NOT modify
.envfiles — port overrides come from shell environment variables only - Logs location:
/tmp/reflexio-services.logcontains combined service output - Smart port selection: Ports are auto-detected unless
BACKEND_PORT,FRONTEND_PORT, orDOCS_PORTenv vars are already set - If the user mentions a specific service to start (e.g., "just start the backend"), adapt the workflow to only start/check that service
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/run-services-msfn19m4/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/run-services-msfn19m4' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/run-services-msfn19m4/download' --output '.skill-downloads/run-services-msfn19m4/SKILL.md.part' && mv '.skill-downloads/run-services-msfn19m4/SKILL.md.part' '.skill-downloads/run-services-msfn19m4/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/run-services-msfn19m4/SKILL.md' && test -s '.skill-downloads/run-services-msfn19m4/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/run-services' && cp -R '.skill-downloads/run-services-msfn19m4' '.claude/skills/run-services'Codex
test -f '.skill-downloads/run-services-msfn19m4/SKILL.md' && test -s '.skill-downloads/run-services-msfn19m4/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/run-services' && cp -R '.skill-downloads/run-services-msfn19m4' '.agents/skills/run-services'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/run-services-msfn19m4'openskills read 'run-services-msfn19m4'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/run-services-msfn19m4/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
Configure a Chat Channel with SecretRefs
DevOps
Set up chat channels using non-interactive commands, with secrets only as SecretRefs. Covers gather, mutate, repair, and prove steps for reliable delivery.
Investigate ClickHouse CI Failures
DevOps
Investigate a ClickHouse CI failure end-to-end from a PR or S3 report URL. Fetches failed tests, classifies flaky vs real regression, and checks for existing issues/fixes.
Ansible PR Review
DevOps
Reviews an Ansible PR following the project's standardized process, including changelog checks, test coverage validation, and feedback tracking.