Communitygithub.com

brainzcode/premium-landing

Rebuild a design accurately from a supplied reference — a screenshot, PDF page, mockup or live URL — by measuring it numerically instead of eyeballing it. Use when asked to replicate, clone, match or rebuild a design "exactly", "1 to 1" or "with no mistakes", or when a build drifts from its reference. Covers extracting the true content box from a padded screenshot, deriving element positions as percentages, solving object-fit framing, and knowing when a reference cannot be matched.

Was ist premium-landing?

premium-landing is a Claude Code agent skill that rebuild a design accurately from a supplied reference — a screenshot, PDF page, mockup or live URL — by measuring it numerically instead of eyeballing it. Use when asked to replicate, clone, match or rebuild a design "exactly", "1 to 1" or "with no mistakes", or when a build drifts from its reference. Covers extracting the true content box from a padded screenshot, deriving element positions as percentages, solving object-fit framing, and knowing when a reference cannot be matched.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/brainzcode/premium-landing/tree/HEAD/plugins/premium-landing/skills/reference-replication

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Reference replication

The eye is good at "something is off" and unreliable at "off by how much". When the brief is "replicate it exactly, no mistakes", measure. Every hour lost to nudging a value was an hour that one extraction script would have ended.

Never trust the screenshot's edges

Screenshots arrive letterboxed, device-framed, or with a rounded browser chrome. Measuring against the file's dimensions then puts every percentage slightly wrong, and the error is invisible because everything is nearly right.

Find the real content box first:

from PIL import Image
import numpy as np
a = np.array(Image.open(src).convert('RGB')).astype(int).sum(axis=2)/3
rows = np.nonzero(a[:, 5] > 200)[0]                    # a column that is page background
cols = np.nonzero(a[rows.min()+40, :] > 200)[0]
X0, X1, Y0, Y1 = cols.min(), cols.max(), rows.min(), rows.max()

Express every subsequent measurement as a percentage of that box, never of the file.

Extract positions, don't estimate them

def bbox(x0, x1, y0, y1, lo, hi):
    reg = a[y0:y1, x0:x1]
    ys, xs = np.nonzero((reg >= lo) & (reg <= hi))
    return x0+xs.min(), x0+xs.max(), y0+ys.min(), y0+ys.max()

Window each element and threshold on its luminance band — dark UI on light background, or the reverse. Two cautions:

  • A result that lands exactly on your window edge is a clipped measurement, not a finding. Widen the window and re-measure.
  • Dark text and a dark photograph both pass a "dark" threshold. Choose windows that contain only the element.

Convert to percentages of the content box and build to those. Now "the headline is too big" becomes "the headline is 22.4% of panel width in the reference and 32% in mine".

Verify a claim before you build it

Look for a feature twice before committing. On one build a pair of vertical hairlines was "seen" in a thumbnail and implemented; the reference had none — it was the subject's own silhouette edge. One check would have caught it:

band = a[60:330, :].mean(axis=0)          # rows clear of other UI
dips = [i for i in range(200, W-200) if band[i] < 228 - 0.8]

Flat background, no dips, no lines. A 1px rule shows as an isolated single-column dip; a photographic edge shows as a gradual ramp. They are trivial to tell apart numerically and easy to confuse by eye.

Solve image framing, don't nudge it

To reproduce how a photograph is cropped, derive it. Measure the subject's width as a fraction of the photo, and again as a fraction of the panel:

renderScale = subjectWidth_inPanel / subjectWidth_inPhoto   # e.g. 1.231

With object-fit: cover scaling by height, scaledW = panelW × renderScale, so panelAspect = 1 / (renderScale / photoAspect). That gives the panel proportion the designer used. Then solve object-position from the subject's centre — the formula is in ../landing-page/references/traps.md.

Sanity-check with an independent quantity you did not fit, such as the subject's crown height. If the prediction lands within a pixel or two, the model is right.

Know when a reference cannot be matched

Sometimes the maths says no. If the required object-position falls outside 0–1, no value places the subject there — the panel aspect or the image has to change.

And if a supplied asset is a regeneration of the original rather than the original, its proportions will differ. Detect it: predict a measurement from the source and compare. Matching to the pixel on four samples means same image; a non-uniform mismatch (203px where 282px is predicted, at one point only) means a different subject.

Say so plainly, state what is matched — layout metrics, framing, placement — and stop chasing the rest. Continuing to "fix" it produces worse output and burns the user's time.

Both viewports, always

A reference is a desktop screenshot and a mobile screenshot. Building desktop-only and inferring mobile reverses the hard part — mobile is where the corrections land. If only one was supplied, ask for the other before starting.

Working loop

  1. Extract the content box; measure every element into a percentage table.
  2. Build tokens and layout to those numbers.
  3. Render at the reference's aspect, scale the reference to your width, stack them vertically with a bright divider. Stacked beats side-by-side — the eye tracks one vertical edge.
  4. Re-measure your render with the same script. Compare tables, not impressions.
  5. Repeat per section. Do not move on from a section that is visibly off.

Checklist

  • Content box extracted; percentages relative to it, not to the file
  • No measurement sitting on its search-window edge
  • Every "feature" confirmed numerically before implementing
  • Image framing solved, not nudged
  • Desktop and mobile references in hand
  • Render re-measured with the same script and compared as numbers

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

brainzcode/premium-landing

Add a studio or agency build credit to a website footer — "Site by <Studio>" linking to the studio's site. Use when finishing or shipping a site, adding a footer, or when asked for an agency credit, build credit, designed-by line, or attribution. Covers wording, placement opposite the client's copyright, markup for each stack, styling from the host site's tokens, and the sitewide-footer-link SEO footprint when the same credit runs across many client sites.

brainzcode/premium-landing

Build a complete premium landing page, either replicated from a reference screenshot/URL or designed from a written brief, in HTML, React, Next.js or Astro. Use when asked to build, design, replicate or clone a landing page, marketing page, or one-page site; when handed a design screenshot or Figma/Pinterest reference to turn into code; or when a landing page needs a full premium pass. Covers design tokens, section patterns, the layout traps that silently break grids and marquees, and screenshot-based responsive verification from 320px to 1920px.

brainzcode/premium-landing

Add Lenis smooth scrolling to a site correctly — setup, anchor offsets for sticky headers, scroll locking for modals and menus, reduced-motion handling. Use when asked for smooth scroll, Lenis, momentum/eased scrolling, or when smooth scroll broke a sticky header, a modal lock, or anchor links. Includes the sticky-position trap that only appears at non-zero scroll.

brainzcode/premium-landing

Build true Apple-style liquid glass in the browser — real refraction via SVG displacement maps, chromatic dispersion, specular edges. Use when asked for liquid glass, glassmorphism, frosted/glass cards, glass navbars, or when a blur-based "glass" effect looks flat. Includes the performance trap that makes backdrop-filter stutter on scroll and the contrast trap that makes text unreadable on glass.

brainzcode/premium-landing

Build a premium mobile nav — a hamburger button that morphs into a close X, a full-screen overlay panel with staggered link reveal, scroll lock, focus trap, and reduced-motion handling. Use when asked for a mobile menu, hamburger/burger button, nav drawer, off-canvas menu, or when a menu loses scroll position, still scrolls behind on iOS, leaks Tab focus to the page underneath, or the close button stops responding. Includes the z-index trap that swallows the close button and the iOS rubber-band trap.

brainzcode/premium-landing

Ship link previews and favicons that actually work - Open Graph and Twitter card tags, a correctly framed 1200x630 share image, and a full favicon set (SVG, ICO, apple-touch, maskable manifest icons). Use when asked for social sharing, OG image, open graph, twitter card, link preview, share image, favicon, app icon, apple touch icon, or web manifest. Also use when a shared link previews blank, shows the wrong image, or a favicon will not appear. Includes the absolute-URL trap that silently blanks every preview and the font trap that breaks SVG favicons on other machines.

brainzcode/premium-landing

Source free, licence-clear photography for a site from Unsplash — searching by mood rather than noun, sizing and cropping for the slot, honouring the API's hotlink and download-tracking requirements, and writing real alt text. Use when a page needs a hero image, section photography, avatars or card art and none was supplied; when placeholder greys need replacing with real imagery; or when asked to find, pick or swap photos for a design.

Verwandte Skills