bama-design-from-app
Rebuild the look of an app the user likes as a native SwiftUI design kit, by measuring its screenshots (sizes, spacing, type, colors, icons), building its parts, and comparing pixel by pixel until they match. Use when the user names an app whose look they want, shares screenshots of one, or says "make it look like X".
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- bama-design-from-app
- description
- Rebuild the look of an app the user likes as a native SwiftUI design kit, by measuring its screenshots (sizes, spacing, type, colors, icons), building its parts, and comparing pixel by pixel until they match. Use when the user names an app whose look they want, shares screenshots of one, or says "make it look like X".
- argument-hint
- <app name or screenshot paths>
02 资源文件 4
- 参考文档agents/openai.yaml129 B
- 参考文档measuring.md3.9 KB
- 脚本scripts/compare.swift6.1 KB
- 脚本scripts/measure.swift12.7 KB
03 SKILL.md 正文
<!-- Version-Timestamp: 2026-10-27 07:36:32 AST -->
Adapted execution contract
This is the pinned, MIT-attributed BAMA capability adapted for the owned design kit. Read ADAPTATION.md at the BAMA package root before executing helpers. Project instructions, approved DESIGN.md and canonical tokens take precedence. Use supported Codex or Claude Code tools. Resolve this skill's sibling files relative to its installed SKILL.md; skill_dir is a task-local shell variable that you set to that resolved directory before running the examples in either host. Invoke a named bama-* skill through the host's supported skill mechanism.
Stage local builds by default. Installation, signing identity selection, launch, CLI linking, MCP registration, system setting changes and capture access are separate explicit operations. Existing task authorization applies; ask only for an action not already authorized. Stage or commit only when the current task or repository workflow authorizes it. Stage explicit paths and include required attribution. The helpers do not commit. Preserve the feature, story and testing workflow below using the hardened helpers. Legacy installed-app paths in examples must be replaced by the staged binary returned by build.sh.
Before a new scaffold exists, keep planning evidence under the selected <AppName>-planning/docs/ sibling or an existing approved planning folder. Treat docs paths below as relative to that planning folder until the fresh app is scaffolded, then copy the planning docs explicitly without replacing existing files. For an existing app, keep its current project layout.
The upstream acceptance statements describe checks to perform, never completed results. Screenshots, runtime behavior, permissions and cross-host acceptance require actual evidence. Use synthetic data and owned temporary test roots. Do not run a hosted session over real app data without project authorization.
Design from app
Look at an app, measure it, and rebuild its design system in SwiftUI. The
result is a design kit (bama-design-kit skill) with the reference app's
numbers, and one reference screen that matches the screenshot.
Guessing gets close. Measuring gets it right. Two scripts do the measuring, next to this skill:
scripts/measure.swift: sizes, positions, text heights, and colors from a screenshot.scripts/compare.swift: a side-by-side, a diff, and the share of pixels that differ.
Run them with swift "${skill_dir}/scripts/measure.swift" ....
Record the capture scale explicitly. Pass --scale 1 for a 1x screenshot or --scale 2 for a verified Retina capture when measuring. Full-image comparison uses pixel dimensions directly. Region comparison requires --scale N, the measured pixels per logical point. Never infer the scale merely from the browser or host.
1. Get the screenshots
Ask for screenshots, or take them with the bama-clone skill. You need:
- The window only, at 2x, no desktop. Save them in
design/reference/. - One screen with the most parts on it (a sidebar, a list, a toolbar), plus close-ups of menus, dialogs, and dark mode if they matter.
- The window size:
measure.swift info shot.png.
Check: info prints the window size in points, and every screenshot uses
the same scale.
2. List the parts
Look at each screenshot and name every distinct part: window chrome,
sidebar row, section header, primary action, list row, checkbox, date
chip, icon button, divider. Start design/KIT.md from the bama-design-kit
skill's kit-spec.md with one section per part.
Check: every visible element on the main screenshot belongs to a part.
3. Measure
Fill design/KIT.md with numbers, not estimates. The recipes and the
traps are in measuring.md. In short:
| To find | Command |
|---|---|
| Sidebar width, panes | hline shot.png <y in an empty area> |
| Row positions and pitch | rows shot.png <x0> <x1> [y0 y1] |
| Left edges, gaps | cols shot.png <y0> <y1> [x0 x1] |
| Selection pill, dividers | vline and hline through it, --tolerance 4 |
| Text and icon colors | ink shot.png x y w h |
| Surface colors | palette shot.png x y w h |
| A close look | crop shot.png x y w h out.png 4 |
Check: every token and every part size in design/KIT.md has a number
from a command.
4. Find the font and the icons
- Most apps on the Mac use the system font, even web apps. Start there. When the letters differ (a, g, t, digits), name the font and pick it or an open alternative with a license that allows bundling.
- Text sizes come from step 6: build, measure the same word in both images, scale.
- Icons: note the size, stroke weight, corners, and whether selected rows
switch to a filled form. Match with SF Symbols at a light weight first;
draw the ones that do not match as shapes (
bama-design-kitparts.md, Icons).
Check: design/KIT.md names the font, the icon source, and the icon size
and weight.
5. Build the kit and one screen
Invoke the host-supported skill bama-design-kit and build the tokens, the parts, the
window chrome, and the gallery from design/KIT.md. Then build the main
screenshot's screen from kit parts only, with the same data and the same
window size.
Check: a snapshot of that screen has the same size in pixels as the reference.
6. Compare until it matches
swift "${skill_dir}/scripts/compare.swift" design/reference/main.png /tmp/<App>-shots/<page>-light.png /tmp/<App>-compare
swift "${skill_dir}/scripts/compare.swift" ... /tmp/<App>-compare-sidebar 0 0 220 300 --scale 2 # only for a verified 2x capture
Open side-by-side.png and diff.png with the Read tool. Then measure
the same rows, edges, and words in both images, and fix the tokens, not
the views. Order: window size, text sizes, columns and left edges, row
heights, colors, icons.
Check: under 2% of pixels differ on the whole window, and every row and left edge is within 1.5 pt of the reference.
7. Make it yours
Before the app ships to anyone else, replace what belongs to the other
company: its name, logo, illustrations, and any font or icon it owns.
Keep the structure, the spacing, and the feel. Write the replacements in
design/KIT.md.
Done when design/KIT.md has a measured number for every token and part,
the kit's gallery shows every part, the reference screen passes step 6,
and step 7 lists what was replaced.
04 同仓库更多 Skills
web-design
Load before planning, designing, auditing or launching any website, landing page, cinematic hero, microsite or above-the-fold layout, or a prompt for Lovable, Bolt or v0 to build one, including regulated (prescription drug, health, finance), multilingual or market-specific launches. Covers page types (home, product, pricing, about, blog), conversion and ethical persuasion, responsive and fluid layouts, Core Web Vitals, SEO and structured data, localization and language-law requirements, stack and CMS choice (Astro, Next.js, WordPress, Webflow, Framer) and launch QA.
ux-design
Load before designing or reviewing any flow, form, onboarding, navigation or content for real users, especially low-literacy, older, neurodivergent, child or other specific audiences. Covers research and usability tests, heuristic reviews, personas and jobs to be done, journeys and service blueprints, information architecture, UX laws, SUS, SEQ and HEART metrics, plain language and reading level, and microcopy and error messages.
ui-design
Load before designing or specifying any interface screen or component, even a quick one: forms, tables, navigation, dashboards, onboarding, auth and passkeys, pricing, checkout, search and filters, settings, empty, loading and error states, notifications, consent and age-appropriate flows, and AI chat and agent interfaces, all to WCAG 2.2 AA. Also picks React UI libraries (toasts, drawers, command menus). Gives component specs, state matrices, sizes, density and keyboard and accessibility behavior.
typography
Choose, pair, size and set type for brand, web, app, print, slides, signage and motion: modular scales, fluid clamp() type, measure, leading, tracking, OpenType features, font licensing and web font loading, and multiscript setting for CJK, Arabic, Hebrew, Devanagari and Thai. Use when selecting or pairing fonts, building a type scale or type tokens, fixing weak hierarchy or bad line breaks, setting long-form text or numbers, loading web fonts, or localizing type for another market.
reference-reconstruction
Reconstructs the observed interface and behavior of a supplied app, site or screenshot set using a screen index, measurements, state and command maps, reusable components and matched-condition comparisons. Use when asked to reverse engineer, clone, reproduce or match a reference product, then adapt it if requested.
print-packaging-social
Load before any print, packaging, label, barcode, social, out-of-home, slide-deck or email design question, even a quick one, and before making finished collateral files. Specs: bleed, safe zones, 300ppi, CMYK, PDF/X preflight, dielines, barcodes, social formats with 9:16 safe areas, billboard letter heights, 16:9 decks, bulletproof email. Renders token-driven brand books, sell sheets, cards, carousels and decks to PDF and PNG with a Canva editable twin.