feat(preamble): reuse ladder in Search Before Building — rungs 2-5 of ponytail's ladder, completeness kept

Tier-3+ skills gain a per-edit reflex the section only stated as research
discipline: before writing new code, stop at the first rung that holds —
repo helper, stdlib, native platform feature, installed dependency — then
build the COMPLETE version of what remains. The closing clause is the
explicit reconciliation with Boil the Ocean: the ladder governs structure,
never coverage. Rungs 1/6/7 (YAGNI / one line / minimum that works) are
deliberately NOT imported.

Also ports ponytail's root-cause rule: one guard in the shared function
beats a guard in every caller.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-28 01:46:39 +00:00
co-authored by Claude Fable 5
parent cbb4d35792
commit fa655b6e97
18 changed files with 180 additions and 0 deletions
@@ -6,6 +6,16 @@ export function generateSearchBeforeBuildingSection(ctx: TemplateContext): strin
Before building anything unfamiliar, **search first.** See \`${ctx.paths.skillRoot}/ETHOS.md\`.
- **Layer 1** (tried and true) — don't reinvent. **Layer 2** (new and popular) — scrutinize. **Layer 3** (first principles) — prize above all.
**The reuse ladder — before writing new code, stop at the first rung that holds:**
1. A helper, util, or pattern already in this repo — re-implementing what's a few files over is the most common slop.
2. The standard library.
3. A native platform feature (CSS over JS, DB constraint over app code, \`<input type="date">\` over a picker lib).
4. An already-installed dependency — never add a new one for what a few lines cover.
Then build the complete version of what remains.
**Bug fixes hit root cause, not symptom:** one guard in the shared function beats a guard in every caller — grep the callers, fix it once where they all route through.
**Eureka:** When first-principles reasoning contradicts conventional wisdom, name it and log:
\`\`\`bash
jq -n --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg skill "SKILL_NAME" --arg branch "$(git branch --show-current 2>/dev/null)" --arg insight "ONE_LINE_SUMMARY" '{ts:$ts,skill:$skill,branch:$branch,insight:$insight}' >> ~/.gstack/analytics/eureka.jsonl 2>/dev/null || true