Skill Tracer
Skills › gstack › gstack › design-craft.ts

design-craft.ts

31 lines · scripts/resolvers/design-craft.ts at 3f79d81

1/**
2 * Craft resolvers shared by /design-review's craft audit and /plan-design-review.
3 *
4 * {{DESIGN_CRAFT_RULE:<lead>}} renders one paragraph of design-html's craft
5 * section verbatim, found by its bold lead (`**Ship floor.**`), with the
6 * bullets under it, so the audit holds a page to the rules /design-html builds
7 * it to and the two cannot drift. A renamed lead fails generation.
8 *
9 * {{DESIGN_PERSUADE_CHECKS}} is the five conversion checks, phrased to hold for
10 * a built page and for a plan of one. Adapted from Elaya's landing-page-design
11 * and redesign-skill (MIT); see NOTICE.md.
12 */
13import * as fs from 'fs';
14import * as path from 'path';
15import type { ResolverFn } from './types';
17const CRAFT_SECTION = path.resolve(import.meta.dir, '../../design-html/sections/craft.md.tmpl');
19export const DESIGN_CRAFT_RULE: ResolverFn = (_ctx, args) => {
20 const lead = args?.join(':');
21 if (!lead) throw new Error('{{DESIGN_CRAFT_RULE:<lead>}} requires the bold lead of a craft paragraph');
22 const matches = fs.readFileSync(CRAFT_SECTION, 'utf-8').split(/\n{2,}/).filter(p => p.startsWith(`**${lead}.**`) || p.startsWith(`**${lead},`));
23 if (matches.length !== 1) throw new Error(`{{DESIGN_CRAFT_RULE:${lead}}}: ${matches.length} paragraphs starting "**${lead}.**" or "**${lead}," in design-html/sections/craft.md.tmpl; need exactly one`);
24 return matches[0].trimEnd();
25};
27export const DESIGN_PERSUADE_CHECKS: ResolverFn = () => `1. **One primary action**, named; nothing competes with it above the fold, and the closing CTA repeats it.
282. **Named objections**: the visitor's top objections, each answered where it arises (FAQ of real questions, comparison, guarantee).
293. **Proof beside each claim**: a supplied customer, quote or figure next to the claim it supports, never a metric row; an unsupported claim is cut or marked \`[Needs proof: …]\`.
304. **A risk reversal** the business really offers (free plan, trial, no card, cancel anytime, refund); never an invented one.
315. **An index/noindex decision**: an ad-only or time-bound page is \`noindex\`; an indexed one has a real title and description, and its FAQ ships as FAQPage JSON-LD.`;