Skip to content

feat: add local-dev-setup skill for automated development environment#82

Merged
IvanildoBarauna merged 3 commits intomainfrom
feature/adding-development-claude-skills
Mar 3, 2026
Merged

feat: add local-dev-setup skill for automated development environment#82
IvanildoBarauna merged 3 commits intomainfrom
feature/adding-development-claude-skills

Conversation

@IvanildoBarauna
Copy link
Member

Summary

This PR introduces the local-dev-setup skill - a comprehensive automation for setting up the complete local development environment with SSH tunnel to remote PostgreSQL and Docker Compose orchestration.

Key Features

  • 🔐 SSH Tunnel Management: Automatically establishes secure tunnel to remote VPS PostgreSQL
  • 🐳 Docker Orchestration: Starts backend, frontend, and all services via Docker Compose
  • Health Checks: Validates backend and frontend readiness before completing
  • 📊 Status Display: Formatted output with service status, URLs, and cleanup instructions
  • 📚 Comprehensive Documentation: Architecture, troubleshooting, and usage guides
  • 🧪 Test Cases: 3 evaluation scenarios included

What Was Changed

New Files

  • .claude/skills/local-dev-setup/SKILL.md - Skill definition and metadata
  • .claude/skills/local-dev-setup/scripts/setup-local-dev.sh - 500+ line orchestration script
  • .claude/skills/local-dev-setup/README.md - Portuguese usage guide
  • .claude/skills/local-dev-setup/references/ARCHITECTURE.md - Technical deep-dive
  • .claude/skills/local-dev-setup/references/TROUBLESHOOTING.md - Debugging guide
  • .claude/skills/local-dev-setup/references/.env.example - Configuration template
  • .claude/skills/local-dev-setup/evals/evals.json - Test cases
  • .claude/skills/local-dev-setup/assets/docker-compose.yaml - Self-contained compose file

Modified Files

  • .claude/settings.json - Claude Code configuration

Removed Files

  • docker-compose.yaml - Moved to skill assets for self-containment

How It Works

  1. Validation - Checks prerequisites (Docker, SSH, .env, docker-compose)
  2. Configuration - Reads POSTGRES_HOST from .env
  3. SSH Tunnel - Opens background tunnel: ssh -g -L 0.0.0.0:5432:localhost:5432 root@{POSTGRES_HOST}
  4. Docker Startup - Launches services with docker-compose up -d
  5. Health Checks - Polls backend and frontend until ready
  6. Status Report - Displays formatted summary with URLs and cleanup commands

Usage

Simply tell Claude Code:

"Suba a aplicação localmente"
"Set up my development environment"
"Initialize the dev stack"

The skill automatically detects relevance and executes the complete setup workflow.

Architecture Highlights

  • Self-Contained: All skill files in .claude/skills/local-dev-setup/
  • Dynamic Paths: Uses ${PROJECT_ROOT} variable for portability
  • Versionable: Skill evolves with project via git
  • Team-Friendly: Clear documentation supports onboarding
  • Extensible: Easy to add migrations, monitoring, notifications

Testing

Skill has been tested and verified to:

  • ✅ Validate all prerequisites
  • ✅ Extract configuration from .env
  • ✅ Establish SSH tunnel
  • ✅ Start Docker services successfully
  • ✅ Pass health checks for backend and frontend
  • ✅ Display formatted status output

Benefits

  • 🎯 One Command: Replace 7 manual steps with natural language
  • 📚 Self-Documenting: Developers understand the workflow
  • 🔄 Repeatable: Same setup every time, no mistakes
  • 🤝 Onboarding: New team members: "Suba a aplicação" → done
  • 🛠️ Maintainable: Centralized, versioned configuration

Co-Authored-By: Claude Haiku 4.5 noreply@anthropic.com

IvanildoBarauna and others added 3 commits March 2, 2026 18:39
- Automates complete local development environment initialization
- Opens SSH tunnel to remote PostgreSQL (reads from .env)
- Starts Docker Compose with all services
- Validates prerequisites and performs health checks
- Provides comprehensive documentation and troubleshooting guide

Skill includes:
- SKILL.md: Main skill definition and metadata
- setup-local-dev.sh: 500+ line orchestration script with colored output
- README.md: Portuguese documentation for usage
- ARCHITECTURE.md: Technical deep-dive
- TROUBLESHOOTING.md: Comprehensive debugging guide
- evals.json: Test cases for validation
- .env.example: Configuration template

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Moved docker-compose.yaml from project root to .claude/skills/local-dev-setup/assets/
- Updated setup-local-dev.sh script to reference the docker-compose file in skill assets
- Script now dynamically determines asset location based on script directory
- This makes the skill self-contained and independent from project structure

Benefits:
- Skill owns all its configuration files (docker-compose, .env.example, etc)
- Easier to maintain and version the skill separately
- Clear separation between project root and skill-specific infrastructure

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Updated docker-compose.yaml to use ${PROJECT_ROOT} variable for build contexts
- Enables dynamic path resolution when skill runs from any directory
- Script exports PROJECT_ROOT to docker-compose environment
- Removed docker-compose.yaml from project root (now in skill assets)

This ensures the skill is completely self-contained and can be run
independently without relying on repository structure.

Changes:
- setup-local-dev.sh: export PROJECT_ROOT and pass to docker-compose
- docker-compose.yaml: use ${PROJECT_ROOT} for ./frontend and ./backend
- Cleaned up redundant config location checks

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bdaa976062

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- DD_TAGS="app:portfolio,tech:python,role:backend,env:local"
- DD_RUNTIME_METRICS_ENABLED=true
- POSTGRES_HOST=192.168.15.8
- POSTGRES_HOST=host.docker.internal

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add backend host-gateway alias for host.docker.internal

The backend now depends on POSTGRES_HOST=host.docker.internal for database access through the SSH tunnel, but unlike frontend it has no extra_hosts entry mapping host.docker.internal to host-gateway. On Linux Docker engines this hostname is not injected automatically, so the backend cannot resolve the DB host and the app fails to connect even though the tunnel is up.

Useful? React with 👍 / 👎.

# Wait for backend to be ready
log_info "Checking backend health at $BACKEND_HEALTH_URL..."
while [ $attempt -lt $MAX_HEALTH_CHECK_ATTEMPTS ]; do
if curl -s "$BACKEND_HEALTH_URL" > /dev/null 2>&1; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fail health checks on HTTP error responses

The health loops treat any HTTP response as success because they use curl -s without --fail; curl --help all documents -f, --fail as the flag that fails on HTTP errors. As written, a 500/404 response from backend or frontend will still mark the service as healthy, so the setup can report success while the app is actually broken.

Useful? React with 👍 / 👎.


# Show Docker Compose status
echo -e "${BLUE}║${NC} ${GREEN}Docker Services:${NC}"
docker-compose ps | tail -n +2 | while read line; do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reuse compose flags when showing service status

The stack is started with docker-compose -f "$SKILL_COMPOSE_FILE" -p portfolio up -d, but status output later runs plain docker-compose ps. Because this commit moved the compose file out of the repo root and uses a custom project name, ps targets the wrong/default project (or no config file), so the reported service status is incomplete or incorrect for the stack the script just launched.

Useful? React with 👍 / 👎.

@IvanildoBarauna IvanildoBarauna merged commit 1659dbe into main Mar 3, 2026
6 checks passed
@IvanildoBarauna IvanildoBarauna deleted the feature/adding-development-claude-skills branch March 3, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant