xiaohongshu
xiaohongshu
justfile-advanced-patterns
Level 3 patterns - test-smart, deploy, migrate, logs, status (production systems)
Full skill instructions
Production systems. Git-aware testing, deployment integration, migrations, observability.
Git-aware test execution. Conditional expensive tests based on changed files.
# Smart test execution (conditional component tests based on git changes)
test-smart mode="default":
@scripts/test-smart.sh {{mode}}
Implementation (scripts/test-smart.sh):
#!/usr/bin/env bash
set -euo pipefail
MODE="${1:-default}"
# Always run fast unit tests
echo "🧪 Unit tests (always)..."
pnpm vitest run --project unit --reporter=verbose
# Determine if component tests needed
NEED_COMPONENT=false
case "$MODE" in
staged) CHANGED=$(git diff --cached --name-only --diff-filter=ACMR || echo "") ;;
push) CHANGED=$(git diff --name-only origin/main...HEAD || echo "") ;;
*) CHANGED=$(git diff --name-only HEAD || echo "")
CHANGED+=$'\n'$(git diff --cached --name-only --diff-filter=ACMR || echo "") ;;
esac
# Check if component-related files changed
if echo "$CHANGED" | grep -qE "src/(components|design-system|pages)/.*\.tsx?$"; then
NEED_COMPONENT=true
fi
# Run component tests if needed
if [ "$NEED_COMPONENT" = true ]; then
echo "🎨 Component changes detected..."
pnpm vitest run --project component --reporter=verbose
else
echo "⏭️ No component changes"
fi
Usage:
just test-smart # Default (working + staged)
just test-smart staged # Pre-commit hook
just test-smart push # Pre-push hook
Deploy to environment. Cloud provider integration.
# Deploy to environment (default: dev)
deploy environment="dev":
@scripts/deploy/check-auth.sh {{environment}}
@scripts/deploy/full.sh {{environment}}
Auth check (scripts/deploy/check-auth.sh):
#!/usr/bin/env bash
set -euo pipefail
ENV="${1:-dev}"
# Check gcloud auth
if ! gcloud auth list --filter=status:ACTIVE >/dev/null 2>&1; then
echo "❌ Not authenticated"
exit 1
fi
# Check project
EXPECTED="myproject-$ENV"
CURRENT=$(gcloud config get-value project 2>/dev/null)
if [ "$CURRENT" != "$EXPECTED" ]; then
echo "❌ Wrong project"
echo " Expected: $EXPECTED"
echo " Current: $CURRENT"
exit 1
fi
echo "✅ Authenticated: $(gcloud auth list --filter=status:ACTIVE --format='value(account)')"
Partial deploys:
deploy-api environment="dev":
@scripts/deploy/api.sh {{environment}}
deploy-web environment="dev":
@scripts/deploy/web.sh {{environment}}
Database migrations. Apply, rollback, create, history.
# Apply database migrations
migrate:
<apply all pending migrations>
# Rollback last migration
migrate-down:
<rollback one migration>
# Create new migration
migrate-create message:
<generate migration with description>
# View migration history
migrate-history:
<show applied migrations timeline>
Python (Alembic):
migrate:
uv run alembic upgrade head
migrate-down:
uv run alembic downgrade -1
migrate-create message:
uv run alembic revision --autogenerate -m "{{message}}"
migrate-history:
uv run alembic history --verbose
Migration testing:
test-migration:
uv run pytest -v -m "migration" --durations=10
Service logs. Tail cloud logs.
# View service logs
logs service="api" environment="dev":
@scripts/gcp/logs.sh {{service}} {{environment}}
Implementation:
#!/usr/bin/env bash
SERVICE="${1:-api}"
ENV="${2:-dev}"
gcloud logging tail \
"resource.type=cloud_run_revision AND resource.labels.service_name=$ENV-$SERVICE" \
--project="myproject-$ENV" \
--format="table(timestamp, textPayload)"
Deployment health check.
# Check deployment status
status environment="dev":
@scripts/gcp/status.sh {{environment}}
Implementation:
#!/usr/bin/env bash
ENV="${1:-dev}"
echo "Services:"
gcloud run services list \
--project="myproject-$ENV" \
--format="table(SERVICE,URL,LAST_DEPLOYED)"
Problem: Full test suite slow (unit 3s, component 18s). Running all tests every commit slows development.
Solution: Conditionally run expensive tests based on git diff.
Modes:
default: Working directory + stagedstaged: Staged files only (pre-commit)push: Commits since origin/main (pre-push)Benefits:
Deployment as first-class justfile command. No context switching to console/scripts.
Commands:
deploy - Full deploymentdeploy-api, deploy-web - Partial (fast iteration)logs - Debuggingstatus - Health checkSafety:
Migrations alongside tests/builds. First-class development operation.
Workflow:
just migrate-create "add users table"just migratejust test-migrationTesting:
@pytest.mark.migration
def test_upgrade_downgrade_cycle():
downgrade(config, "base")
upgrade(config, "head")
downgrade(config, "-1")
upgrade(config, "head")
Add when:
Skip when:
GCP (Cloud Run): Examples above
AWS (ECS):
deploy environment="dev":
aws ecs update-service --cluster {{environment}} --service api --force-new-deployment
Azure (Container Apps):
deploy environment="dev":
az containerapp update --name api --resource-group {{environment}} --image {{image}}
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience