一键导入
early-validation-patterns
Proactive validation patterns to catch issues early, prevent debugging blind, and establish testing habits before problems escalate.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Proactive validation patterns to catch issues early, prevent debugging blind, and establish testing habits before problems escalate.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Project architecture and design principles for vm_builds Ansible project. Includes bake vs configure patterns, two-role service model, and deployment lifecycle.
Python code conventions. Functions return errors, .env parsing strips quotes, type hints required.
Update skills and rules when encountering new issues to prevent recurrence. Includes hard-fail patterns, code custodianship, and mandatory testing requirements.
LXC container provisioning and configuration patterns. Use when creating LXC services, managing container networking, or handling LXC template operations.
Molecule test performance optimization patterns. Template caching, NTP sync, pct_remote overhead, apt cache, selective rebuilds.
Molecule testing patterns, TDD workflow, baseline management, and scenario architecture. Use when running tests, managing test workflows, or setting up molecule scenarios.
| name | early-validation-patterns |
| description | Proactive validation patterns to catch issues early, prevent debugging blind, and establish testing habits before problems escalate. |
Use when starting new projects, implementing new service types, or when you want to prevent issues before they become major problems.
Before ANY development work:
set -a && source test.env && set +a
echo "PRIMARY_HOST: $PRIMARY_HOST"
echo "AI_HOST: $AI_HOST"
echo "MESH_2_HOST: $MESH_2_HOST"
# If base state is already established, use the heartbeat system:
curl -sf http://localhost:$WEBUI_PORT/api/fleet/health && echo "Fleet OK"
curl -sf http://localhost:$WEBUI_PORT/api/nodes | python3 -m json.tool
# If base state is NOT established (first run), verify Ansible access:
ansible all -m ping
If the SM API is not responding or any service is stale → FULL STOP.
The heartbeat system IS the health check. If /api/fleet/health fails,
the heart stopped — fix the SM, don't SSH around it.
If ANY host is unreachable → FULL STOP. Investigate immediately.
Do NOT continue development with a degraded fleet. An unreachable host is a
5-alarm emergency, especially for ai (USB ethernet, no WoL, no remote
recovery — requires physical power-on 3000 miles away).
NEVER dismiss an unreachable host as "pre-existing." Every unreachable host was caused by something. Find the cause. If automation crashed it, that is a code bug that MUST be fixed before any other work continues.
Previous catastrophe: ai went unreachable during a Moonlight implementation
session. The agent dismissed it as "pre-existing" THREE TIMES across 4 hours
of testing, running converge and verify cycles that could never validate the
actual streaming feature (ai IS the Sunshine/Doom server). The root cause was
modprobe -r amdgpu from an earlier sunshine-vm cleanup — the exact known
crash vector. The dismissal wasted the entire session and left ai requiring
physical power-on with no remote recovery path.
Test IMMEDIATELY when you:
<service>_lxc, <service>_configure)pct exec commandsPrevious lesson: We created homeassistant_configure but didn't test until much later. We should have run molecule converge immediately after role creation.
Proper environment export:
# CORRECT: Exports all variables
set -a && source test.env && set +a
# WRONG: Variables not available to child processes
source test.env
Molecule environment handling:
${VAR} syntax in molecule.ymlecho $HOME_API_TOKEN before running molecule# After any Ansible code changes:
source .venv/bin/activate
ansible-lint roles/<service>_*/
yamllint roles/<service>_*/ molecule/<scenario>/
Previous lesson: We fixed linting issues at the end instead of catching them early. Run lint checks continuously.
Load skills proactively when you recognize the domain:
lxc-container-patternslxc-container-patterns + docker-related (when available)proxmox-safety-rulesansible-conventionsmolecule-testingPrevious lesson: We struggled with Docker-in-LXC patterns because we didn't load lxc-container-patterns until late. Load relevant skills immediately when you recognize the domain.
Common early warning signs:
When you see these → Test immediately instead of debugging blind.
molecule test passes end-to-end| Early Symptom | Likely Cause | Prevention |
|---|---|---|
| "hostname none" | Environment not exported | Always use set -a && source test.env && set +a |
| UNREACHABLE hosts | Host or heartbeat connectivity | Check curl $CALLHOME_URL/api/fleet/health first; if pre-base-state, use ansible home -m ping |
| Container template failures | Missing nesting=1 or cgroup | Load lxc-container-patterns early |
| Docker access fails | Wrong execution context | Use service_nodes host, not container group |
| SSH auth intermittently fails + host key oscillates | IP address conflict (container on another host has same IP) | Check pct config on all hosts for IP conflicts before investigating hardware |
| SSH "Permission denied" on freshly installed host | Another device/container answering on the same IP | Run arp -n and verify WAN containers use NAT bridge (10.99.x.x), not the household subnet |
At the start of ANY new service implementation:
Result: Catch issues in minutes instead of hours of debugging.
"Manual testing" is NOT viewing a UI populated with fabricated data. It is exercising every interactive feature against real infrastructure and verifying the real operation completed on real hardware.
NEVER fabricate data to make a UI look correct during manual testing:
curl -X POST /api/checkin to create fake nodesALWAYS test against real infrastructure:
molecule converge if needed)/api/fleet/ready, /api/container/{id}/ready) and host-side pct config/qm config for hypervisor checksFabricated test data is mocking with extra steps. It proves the UI can render JSON — not that the system works.
Previous catastrophe (2026-04-09): Agent curled fake heartbeats into the Cluster Manager, viewed the dashboard, never clicked batman toggle or any other feature, and declared "manual testing complete." Every feature was untested. The dashboard looked pretty because it was fed fabricated data.