Developer Environment Guide¶
Set up your local development environment for contributing to SkillMeat with native hot reload, debugging, and full test coverage.
Quick Start¶
Option 1: Native Setup (Fastest)¶
For rapid development with hot reload:
# Install dependencies
pip install -e ".[dev]"
# or with uv
uv tool install --editable ".[dev]"
# Start dev servers (API + Web)
make dev
Then open http://localhost:3000. Both API and Web servers auto-reload on file changes.
Option 2: Docker Containerized¶
For isolated development environment:
Services run in containers with hot reload via bind mounts.
Prerequisites¶
For Native Development¶
- Python 3.9+ (3.11+ recommended)
- Node.js 18+
- pnpm (recommended) or npm v9+
- SQLite 3 (usually pre-installed)
- Git
Check versions:
For Docker Development¶
- Docker Engine v24+
- Docker Compose v2.0+
Setup¶
Step 1: Clone Repository¶
Step 2: Create Virtual Environment¶
# Using venv
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Or using uv (faster)
uv venv
source .venv/bin/activate
Step 3: Install Python Dependencies¶
# With development dependencies
pip install -e ".[dev]"
# Or with uv
uv tool install --editable ".[dev]"
This installs: - Core dependencies (FastAPI, SQLAlchemy, etc.) - Development tools (pytest, black, mypy, flake8) - Web dependencies (Next.js, React, etc.)
Step 4: Install Node/Web Dependencies¶
Step 5: Create Environment File¶
Copy the local example:
For development with authentication:
Development Commands¶
All development commands are available through the Makefile. View all targets:
Starting Development Servers¶
Native (Recommended for Rapid Development)¶
Start both API and Web servers with hot reload:
This runs:
- API: skillmeat web dev --api-only (port 8080, auto-reload)
- Web: skillmeat web dev --web-only (port 3000, hot module reload)
Then open: - Web UI: http://localhost:3000 - API docs: http://localhost:8080/docs
API Only¶
Useful when working on backend only.
Web Only¶
Useful when working on frontend only.
Docker Containerized¶
For containerized development with hot reload:
Services run in containers with code directories bind-mounted. Changes to source files trigger rebuilds automatically.
Access at http://localhost:3000.
Testing¶
Run All Tests¶
This runs: - Python tests with coverage - Web (Next.js) tests
Run Python Tests Only¶
View test coverage report:
Run Web Tests Only¶
Run specific test file:
Watch mode (re-run on changes):
Run Integration Tests¶
These tests require PostgreSQL (enterprise edition) or use SQLite shim.
Test Coverage¶
# Python coverage
pytest -v --cov=skillmeat --cov-report=term-missing
# HTML report
pytest -v --cov=skillmeat --cov-report=html
open htmlcov/index.html
Minimum coverage: 80% for new features.
Code Quality¶
Format Code¶
Applies Black formatter to all Python files.
Check Linting¶
Runs flake8 to check for errors and style issues.
Type Check¶
Runs mypy to check type annotations. For web:
All Quality Checks¶
Pre-commit hook runs these automatically.
Database Operations¶
Create & Initialize Database¶
Automatically done on first startup. Manual reset:
Run Migrations¶
# Apply pending migrations
make db-migrate
# View migration status
docker compose exec api alembic current
# Rollback one migration
docker compose exec api alembic downgrade -1
Seed Database¶
Populate the database with demo artifacts:
make db-seed # Local SQLite, full profile
make db-seed-minimal # Minimal profile
make db-seed-enterprise # Enterprise PostgreSQL (requires DATABASE_URL)
make db-seed-container # Seed inside running API container
Or use the seed runner script directly:
./scripts/seed-runner.sh full # Full profile
./scripts/seed-runner.sh minimal # Minimal profile
./scripts/seed-runner.sh --dry-run # Preview without writing
Access Database¶
For native development (SQLite):
For Docker development (SQLite):
For enterprise (PostgreSQL):
Debugging¶
Python Debugger (Native)¶
Add breakpoint in code:
Run with API server:
Debugger prompt appears in terminal. Commands:
(Pdb) n # Next line
(Pdb) c # Continue
(Pdb) s # Step into function
(Pdb) p var # Print variable
(Pdb) l # List current code
(Pdb) h # Help
Python Debugger (Docker)¶
Enable debug port in docker-compose.dev.yml:
Connect from IDE (VS Code, PyCharm):
API Logs¶
View real-time API logs:
Enable more verbose logging in .env:
Web Logs¶
Browser console logs appear in terminal when running make dev-web.
View in browser: - Open DevTools: F12 or Cmd+Option+I - Console tab
Database Query Logging¶
Enable SQLAlchemy query logging:
Or set environment variable:
Docker Development¶
Docker with Hot Reload¶
Code changes trigger automatic rebuilds. Volumes map to host directories:
/app/skillmeat/→./skillmeat/(source code)/app/skillmeat/web/→./skillmeat/web/(web code)
Build Operations¶
Rebuild container images (with or without cache):
make rebuild # Rebuild all images (uses cache)
make rebuild-nocache # Rebuild all images without cache (captures all changes)
make rebuild-api # Rebuild API image only
make rebuild-web # Rebuild Web image only
Run Docker Containers Individually¶
Enter Container Shell¶
Run Commands in Container¶
# Run pytest in API container
docker compose exec api pytest -v
# Run pnpm in Web container
docker compose exec web pnpm test
Enterprise Operations¶
For enterprise development and testing:
make up-enterprise # Start enterprise profile in background
make up-enterprise-seed # Start enterprise and auto-seed database
make enterprise-shell # Shell into API container
These targets require the enterprise profile and PostgreSQL. Set DATABASE_URL to configure the database connection:
Environment Variables¶
Development environment file (.env):
# Application
SKILLMEAT_ENV=development
SKILLMEAT_EDITION=local
SKILLMEAT_LOG_LEVEL=DEBUG
# API
SKILLMEAT_API_PORT=8080
SKILLMEAT_API_HOST=0.0.0.0
SKILLMEAT_WORKERS=1
SKILLMEAT_RELOAD=true
# Web
SKILLMEAT_WEB_PORT=3000
NEXT_PUBLIC_API_URL=http://localhost:8080
# Collection
SKILLMEAT_COLLECTION_DIR=~/.skillmeat
# Optional: Clerk authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_your_key
CLERK_SECRET_KEY=sk_test_your_key
For complete reference, see Configuration Guide.
Development Workflow¶
1. Create Feature Branch¶
2. Make Changes¶
Edit files in your editor. Both API and Web servers auto-reload:
- Backend changes: API auto-reloads (FastAPI with
SKILLMEAT_RELOAD=true) - Frontend changes: Web hot-reloads (Next.js HMR)
3. Run Tests¶
Before committing, ensure all tests pass:
4. Check Code Quality¶
Pre-commit hook runs these checks automatically when you run git commit.
5. Create Commit¶
Pre-commit hooks validate: - Python formatting (Black) - Linting (flake8) - Type checking (mypy) - No secrets committed
Fix any issues and commit again.
6. Push & Create PR¶
Then create a pull request on GitHub.
Common Development Tasks¶
Add Python Dependency¶
# Add to pyproject.toml
pip install package-name
# Record in lock file
pip freeze > requirements.txt
Add JavaScript/Web Dependency¶
Create Database Migration¶
# Generate migration file
docker compose exec api alembic revision --autogenerate -m "Description of change"
# Review generated file in skillmeat/cache/migrations/versions/
# Apply migration
docker compose exec api alembic upgrade head
Create New API Endpoint¶
- Create router in
skillmeat/api/routers/ - Define request/response schemas in
skillmeat/api/schemas/ - Implement business logic using repositories
- Add tests in
tests/api/test_*.py - Check OpenAPI docs at http://localhost:8080/docs
Create New Web Component¶
- Create component in
skillmeat/web/components/ - Use Radix UI primitives for accessibility
- Add Storybook story in
.storybook/ - Add tests in
skillmeat/web/__tests__/ - Run
pnpm testto verify
Troubleshooting¶
Port Already in Use¶
Kill process on port:
# macOS/Linux
lsof -ti:3000 | xargs kill -9
lsof -ti:8080 | xargs kill -9
# Windows
netstat -ano | findstr :3000
taskkill /PID <PID> /F
Or use different ports in .env:
Virtual Environment Issues¶
Node Modules Issues¶
# Clear pnpm cache
pnpm store prune
rm -rf skillmeat/web/node_modules
cd skillmeat/web
pnpm install
cd ../..
Database Locked¶
Tests Fail Randomly¶
# Run with verbose output
pytest -v -s
# Run single test multiple times
pytest -v tests/test_something.py -x --count=10
Hot Reload Not Working¶
Ensure SKILLMEAT_RELOAD=true in .env:
For Docker:
Performance Tips¶
Speed Up Tests¶
# Run only fast tests (skip integration tests)
pytest -v -m "not integration"
# Run specific test
pytest -v tests/test_module.py::test_function
# Run in parallel
pytest -v -n auto
Speed Up Builds¶
# Use --no-cache only if necessary
docker compose build --no-cache
# Otherwise, Docker uses layer cache for speed
Reduce Web Build Time¶
Pre-Commit Hooks¶
Pre-commit hooks automatically run on git commit:
# View all hooks
cat .pre-commit-config.yaml
# Run hooks manually
pre-commit run --all-files
# Skip hooks (not recommended)
git commit --no-verify
Hooks verify: - Black formatting - flake8 linting - mypy type checking - No secrets in commits
IDE Setup¶
VS Code¶
Install extensions: - Python (Microsoft) - Pylance - ES7+ React/Redux/React-Native snippets
Create .vscode/settings.json:
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.formatting.provider": "black",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": ["tests"]
}
PyCharm¶
- Set Python interpreter: Settings → Project → Python Interpreter
- Point to
.venv/bin/python - Enable pytest: Settings → Tools → Python Integrated Tools
Debugging in IDE¶
VS Code — Add to .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: API Debug",
"type": "python",
"request": "launch",
"module": "skillmeat.cli",
"args": ["web", "dev", "--api-only"],
"justMyCode": true
}
]
}
Contributing¶
See CONTRIBUTING.md for full contribution guidelines.
Next Steps¶
- Testing Strategy — Full testing guide
- API Documentation — API endpoint reference
- Contributing Guide — Code of conduct and process
- Architecture — System design
Support¶
For development setup issues:
- Check this guide's Troubleshooting section
- Review CONTRIBUTING.md
- Check existing issues on GitHub
- Ask in discussions or create an issue