mirror of
https://github.com/garrytan/gstack.git
synced 2026-08-31 10:20:42 +02:00
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>
25 lines
1.4 KiB
TypeScript
25 lines
1.4 KiB
TypeScript
import type { TemplateContext } from '../types';
|
|
|
|
export function generateSearchBeforeBuildingSection(ctx: TemplateContext): string {
|
|
return `## Search Before Building
|
|
|
|
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
|
|
\`\`\``;
|
|
}
|
|
|