@hanzlaa/rcode 2.7.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/AGENTS.md +11 -1
  2. package/CONTRIBUTING.md +7 -0
  3. package/README.md +39 -20
  4. package/package.json +2 -2
  5. package/rihal/agents/rihal-advisor-researcher.md +1 -1
  6. package/rihal/agents/rihal-assumptions-analyzer.md +1 -1
  7. package/rihal/agents/rihal-codebase-mapper.md +1 -1
  8. package/rihal/agents/rihal-docs-auditor.md +3 -3
  9. package/rihal/agents/rihal-executor.md +10 -0
  10. package/rihal/agents/rihal-fatima.md +31 -101
  11. package/rihal/agents/rihal-haitham.md +125 -57
  12. package/rihal/agents/rihal-hanzla.md +23 -98
  13. package/rihal/agents/rihal-hussain-pm.md +33 -102
  14. package/rihal/agents/rihal-integration-checker.md +1 -1
  15. package/rihal/agents/rihal-mariam.md +26 -94
  16. package/rihal/agents/rihal-noor.md +2 -2
  17. package/rihal/agents/rihal-omar.md +112 -31
  18. package/rihal/agents/rihal-phase-researcher.md +1 -1
  19. package/rihal/agents/rihal-planner.md +25 -0
  20. package/rihal/agents/rihal-project-researcher.md +1 -1
  21. package/rihal/agents/rihal-research-synthesizer.md +1 -1
  22. package/rihal/agents/rihal-roadmapper.md +1 -1
  23. package/rihal/agents/rihal-sadiq.md +30 -95
  24. package/rihal/agents/rihal-sprint-checker.md +19 -1
  25. package/rihal/agents/rihal-verifier.md +1 -1
  26. package/rihal/agents/rihal-waleed.md +34 -98
  27. package/rihal/agents/rihal-yousef.md +111 -52
  28. package/rihal/commands/code-review.md +1 -1
  29. package/rihal/commands/memory-audit.md +10 -0
  30. package/rihal/commands/memory-distill.md +11 -0
  31. package/rihal/commands/memory-init.md +12 -0
  32. package/rihal/commands/memory-update.md +12 -0
  33. package/rihal/config/model-profiles.json +5 -5
  34. package/rihal/references/agent-shared-rules.md +81 -0
  35. package/rihal/references/karpathy-guidelines-full.md +1 -1
  36. package/rihal/references/no-unauthorized-git-ops.md +1 -1
  37. package/rihal/references/verb-dictionary.md +1 -1
  38. package/rihal/skills/actions/2-plan/rihal-frontend-design/SKILL.md +49 -139
  39. package/rihal/skills/actions/2-plan/rihal-frontend-design/references.md +79 -0
  40. package/rihal/skills/actions/4-implementation/rihal-browser-verify/SKILL.md +70 -0
  41. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +1 -1
  42. package/rihal/skills/actions/4-implementation/rihal-ci/SKILL.md +108 -0
  43. package/rihal/skills/actions/4-implementation/rihal-debug/SKILL.md +78 -0
  44. package/rihal/skills/actions/4-implementation/rihal-git-flow/SKILL.md +90 -0
  45. package/rihal/skills/actions/4-implementation/rihal-harden/SKILL.md +91 -0
  46. package/rihal/skills/actions/4-implementation/rihal-incremental/SKILL.md +50 -0
  47. package/rihal/skills/actions/4-implementation/rihal-migrate/SKILL.md +86 -0
  48. package/rihal/skills/actions/4-implementation/rihal-perf/SKILL.md +96 -0
  49. package/rihal/skills/actions/4-implementation/rihal-prove-it/SKILL.md +64 -0
  50. package/rihal/skills/actions/4-implementation/rihal-source-truth/SKILL.md +76 -0
  51. package/rihal/skills/actions/4-implementation/rihal-trim/SKILL.md +73 -0
  52. package/rihal/skills/agents/dalil-scout/SKILL.md +43 -125
  53. package/rihal/skills/agents/dalil-scout/references.md +67 -0
  54. package/rihal/skills/agents/fatima-qa/SKILL.md +21 -0
  55. package/rihal/skills/agents/hanzla-engineer/SKILL.md +22 -0
  56. package/rihal/skills/agents/hussain-pm/SKILL.md +21 -0
  57. package/rihal/skills/agents/majlis-council/SKILL.md +50 -144
  58. package/rihal/skills/agents/majlis-council/references.md +90 -0
  59. package/rihal/skills/agents/mariam-marketing/SKILL.md +19 -0
  60. package/rihal/skills/agents/raees-orchestrator/SKILL.md +56 -117
  61. package/rihal/skills/agents/raees-orchestrator/references.md +47 -0
  62. package/rihal/skills/agents/sadiq-analyst/SKILL.md +30 -0
  63. package/rihal/skills/agents/waleed-architect/SKILL.md +20 -0
  64. package/rihal/skills/core/rihal-advanced-elicitation/SKILL.md +36 -136
  65. package/rihal/skills/core/rihal-advanced-elicitation/references.md +101 -0
  66. package/rihal/skills/core/rihal-auth-audit/SKILL.md +93 -0
  67. package/rihal/skills/core/rihal-brainstorming/SKILL.md +5 -0
  68. package/rihal/skills/core/rihal-client-gate/SKILL.md +91 -0
  69. package/rihal/skills/core/rihal-clone-website/SKILL.md +30 -371
  70. package/rihal/skills/core/rihal-clone-website/references.md +213 -0
  71. package/rihal/skills/core/rihal-deploy-unify/SKILL.md +87 -0
  72. package/rihal/skills/core/rihal-distillator/SKILL.md +37 -187
  73. package/rihal/skills/core/rihal-distillator/references.md +118 -0
  74. package/rihal/skills/core/rihal-editorial-review-prose/SKILL.md +5 -0
  75. package/rihal/skills/core/rihal-editorial-review-structure/SKILL.md +45 -183
  76. package/rihal/skills/core/rihal-editorial-review-structure/references.md +110 -0
  77. package/rihal/skills/core/rihal-help/SKILL.md +6 -1
  78. package/rihal/skills/core/rihal-incident-record/SKILL.md +161 -0
  79. package/rihal/skills/core/rihal-index-docs/SKILL.md +5 -0
  80. package/rihal/skills/core/rihal-init/SKILL.md +5 -0
  81. package/rihal/skills/core/rihal-memory-audit/SKILL.md +88 -0
  82. package/rihal/skills/core/rihal-memory-distill/SKILL.md +87 -0
  83. package/rihal/skills/core/rihal-memory-init/SKILL.md +77 -0
  84. package/rihal/skills/core/rihal-memory-update/SKILL.md +73 -0
  85. package/rihal/skills/core/rihal-mvp-graduate/SKILL.md +116 -0
  86. package/rihal/skills/core/rihal-ocr-consistency/SKILL.md +106 -0
  87. package/rihal/skills/core/rihal-party-mode/SKILL.md +5 -0
  88. package/rihal/skills/core/rihal-rebrand/SKILL.md +133 -0
  89. package/rihal/skills/core/rihal-review-adversarial-general/SKILL.md +5 -0
  90. package/rihal/skills/core/rihal-review-edge-case-hunter/SKILL.md +5 -0
  91. package/rihal/skills/core/rihal-shard-doc/SKILL.md +5 -0
  92. package/rihal/skills/core/rihal-theme-system/SKILL.md +113 -0
  93. package/rihal/team.yaml +3 -22
  94. package/rihal/templates/memory/INDEX.md +46 -0
  95. package/rihal/templates/memory/change-records/.gitkeep +4 -0
  96. package/rihal/templates/memory/distillates/project.distillate.md +11 -0
  97. package/rihal/templates/memory/distillates/stack.distillate.md +11 -0
  98. package/rihal/templates/memory/incidents/known-issues.md +27 -0
  99. package/rihal/templates/memory/incidents/post-mortems/.gitkeep +3 -0
  100. package/rihal/templates/memory/milestones/archive/.gitkeep +2 -0
  101. package/rihal/templates/memory/milestones/current.md +39 -0
  102. package/rihal/templates/memory/people/stakeholders.md +25 -0
  103. package/rihal/templates/memory/people/team.md +35 -0
  104. package/rihal/templates/memory/project/decisions.md +32 -0
  105. package/rihal/templates/memory/project/glossary.md +16 -0
  106. package/rihal/templates/memory/project/stack.md +46 -0
  107. package/rihal/workflows/audit.md +3 -3
  108. package/rihal/workflows/code-review.md +32 -1
  109. package/rihal/workflows/council.md +1 -1
  110. package/rihal/workflows/discuss-phase-power.md +3 -3
  111. package/rihal/workflows/do.md +1 -1
  112. package/rihal/workflows/docs-update.md +4 -4
  113. package/rihal/workflows/execute.md +61 -5
  114. package/rihal/workflows/help.md +5 -5
  115. package/rihal/workflows/karpathy-audit.md +9 -9
  116. package/rihal/workflows/memory-audit.md +83 -0
  117. package/rihal/workflows/memory-distill.md +103 -0
  118. package/rihal/workflows/memory-init.md +102 -0
  119. package/rihal/workflows/memory-update.md +83 -0
  120. package/rihal/workflows/plan.md +66 -1
  121. package/server/dashboard.js +6 -1
  122. package/server/lib/api.js +8 -2
  123. package/server/lib/html/client.js +63 -0
  124. package/server/lib/html/shell.js +5 -0
  125. package/server/lib/scanner.js +76 -1
  126. package/rihal/agents/rihal-architect.md +0 -79
  127. package/rihal/agents/rihal-tech-writer.md +0 -80
  128. package/rihal/commands/check-implementation-readiness.md +0 -8
  129. package/rihal/commands/discuss-phase-power.md +0 -11
  130. package/rihal/commands/karpathy-audit.md +0 -12
  131. package/rihal/commands/new-project-research.md +0 -11
  132. package/rihal/commands/new-project-roadmap.md +0 -11
  133. package/rihal/commands/report.md +0 -10
  134. package/rihal/commands/review-adversarial.md +0 -8
  135. package/rihal/commands/review-edge-case-hunter.md +0 -8
@@ -10,15 +10,13 @@ description: >
10
10
  "yeh site clone karo", or "exact same UI chahiye like [URL]". Provide the
11
11
  target URL as input. Do NOT use for: creating original designs from scratch
12
12
  (use rihal-create-ux-design with Layla), writing new components from a
13
- brief (use rihal-dev-story with Hanzla or Bilal), or inspiration-only
14
- references without rebuild intent.
13
+ brief (use rihal-dev-story with Hanzla), or inspiration-only references
14
+ without rebuild intent.
15
15
  triggers:
16
- - "clone
17
- this website"
16
+ - "clone this website"
18
17
  - "clone this site"
19
18
  - "rebuild this page"
20
- - "replicate this
21
- UI"
19
+ - "replicate this UI"
22
20
  - "pixel-perfect clone"
23
21
  - "make exact UI like this"
24
22
  - "copy this site"
@@ -31,386 +29,47 @@ argument-hint: "<url>"
31
29
  user-invocable: true
32
30
  ---
33
31
 
34
- # Clone Website (Rihal)
35
-
36
- You are about to reverse-engineer and rebuild **$ARGUMENTS** as a pixel-perfect clone.
37
-
38
- This is not a two-phase process (inspect then build). You are a **foreman walking the job site** — as you inspect each section of the page, you write a detailed specification to a file, then hand that file to a specialist builder agent with everything they need. Extraction and construction happen in parallel, but extraction is meticulous and produces auditable artifacts.
39
-
40
- ## Pre-Flight
41
-
42
- 1. **Chrome MCP is required.** Test it immediately. If it's not available, stop and tell the user to enable it — this skill cannot work without browser automation.
43
- 2. Read `TARGET.md` for URL and scope. If the URL doesn't match `$ARGUMENTS`, update it.
44
- 3. Verify the base project builds: `npm run build`. The Next.js + shadcn/ui + Tailwind v4 scaffold should already be in place. If not, tell the user to set it up first.
45
- 4. Create the output directories if they don't exist: `docs/research/`, `docs/research/components/`, `docs/design-references/`, `scripts/`.
46
-
47
- ## Guiding Principles
48
-
49
- These are the truths that separate a successful clone from a "close enough" mess. Internalize them — they should inform every decision you make.
50
-
51
- ### 1. Completeness Beats Speed
52
-
53
- Every builder agent must receive **everything** it needs to do its job perfectly: screenshot, exact CSS values, downloaded assets with local paths, real text content, component structure. If a builder has to guess anything — a color, a font size, a padding value — you have failed at extraction. Take the extra minute to extract one more property rather than shipping an incomplete brief.
54
-
55
- ### 2. Small Tasks, Perfect Results
56
-
57
- When an agent gets "build the entire features section," it glosses over details — it approximates spacing, guesses font sizes, and produces something "close enough" but clearly wrong. When it gets a single focused component with exact CSS values, it nails it every time.
58
-
59
- Look at each section and judge its complexity. A simple banner with a heading and a button? One agent. A complex section with 3 different card variants, each with unique hover states and internal layouts? One agent per card variant plus one for the section wrapper. When in doubt, make it smaller.
60
-
61
- **Complexity budget rule:** If a builder prompt exceeds ~150 lines of spec content, the section is too complex for one agent. Break it into smaller pieces. This is a mechanical check — don't override it with "but it's all related."
62
-
63
- ### 3. Real Content, Real Assets
64
-
65
- Extract the actual text, images, videos, and SVGs from the live site. This is a clone, not a mockup. Use `element.textContent`, download every `<img>` and `<video>`, extract inline `<svg>` elements as React components. The only time you generate content is when something is clearly server-generated and unique per session.
66
-
67
- **Layered assets matter.** A section that looks like one image is often multiple layers — a background watercolor/gradient, a foreground UI mockup PNG, an overlay icon. Inspect each container's full DOM tree and enumerate ALL `<img>` elements and background images within it, including absolutely-positioned overlays.
68
-
69
- ### 4. Foundation First
70
-
71
- Nothing can be built until the foundation exists: global CSS with the target site's design tokens (colors, fonts, spacing), TypeScript types for the content structures, and global assets (fonts, favicons). This is sequential and non-negotiable. Everything after this can be parallel.
72
-
73
- ### 5. Extract How It Looks AND How It Behaves
74
-
75
- A website is not a screenshot — it's a living thing. Elements move, change, appear, and disappear in response to scrolling, hovering, clicking, resizing, and time. If you only extract the static CSS of each element, your clone will look right in a screenshot but feel dead when someone actually uses it.
76
-
77
- For every element, extract its **appearance** (exact computed CSS via `getComputedStyle()`) AND its **behavior** (what changes, what triggers the change, and how the transition happens).
78
-
79
- Examples of behaviors to watch for:
80
- - Navbar that shrinks/changes background/gains shadow after scroll threshold
81
- - Elements that animate into view on viewport entry (fade-up, slide-in, stagger)
82
- - Sections with `scroll-snap-type`
83
- - Parallax layers
84
- - Hover state transitions (duration and easing matter)
85
- - Dropdowns/modals/accordions with enter/exit animations
86
- - Auto-playing carousels
87
- - Tabbed/pill content that cycles
88
- - Scroll-driven tab/accordion switching (IntersectionObserver, NOT click handlers)
89
- - Smooth scroll libraries (Lenis, Locomotive Scroll)
90
-
91
- ### 6. Identify the Interaction Model Before Building
92
-
93
- This is the single most expensive mistake in cloning: building a click-based UI when the original is scroll-driven, or vice versa.
94
-
95
- How to determine this:
96
- 1. **Don't click first.** Scroll through the section slowly and observe if things change on their own as you scroll.
97
- 2. If they do, it's scroll-driven. Extract the mechanism.
98
- 3. If nothing changes on scroll, THEN click/hover to test for click/hover-driven interactivity.
99
- 4. Document the interaction model explicitly in the component spec.
100
-
101
- ### 7. Extract Every State, Not Just the Default
102
-
103
- For tabbed/stateful content: click each tab via Chrome MCP and extract content per state. For scroll-dependent elements: capture at scroll position 0 and after crossing the trigger threshold.
104
-
105
- ### 8. Spec Files Are the Source of Truth
106
-
107
- Every component gets a specification file in `docs/research/components/` BEFORE any builder is dispatched. The builder receives the spec file contents inline in its prompt — the file also persists as an auditable artifact.
108
-
109
- ### 9. Build Must Always Compile
110
-
111
- Every builder agent must verify `npx tsc --noEmit` passes before finishing. After merging worktrees, you verify `npm run build` passes.
112
-
113
- ## Phase 1: Reconnaissance
114
-
115
- Navigate to the target URL with Chrome MCP.
116
-
117
- ### Screenshots
118
- - Take **full-page screenshots** at desktop (1440px) and mobile (390px) viewports
119
- - Save to `docs/design-references/` with descriptive names
120
-
121
- ### Global Extraction
122
- Extract before anything else:
123
-
124
- **Fonts** — Inspect `<link>` tags for Google Fonts or self-hosted fonts. Check computed `font-family` on key elements. Configure in `src/app/layout.tsx` using `next/font`.
125
-
126
- **Colors** — Extract color palette from computed styles. Update `src/app/globals.css` with the target's actual colors.
127
-
128
- **Favicons & Meta** — Download to `public/seo/` and update `layout.tsx` metadata.
129
-
130
- **Global UI patterns** — Custom scrollbar, scroll-snap on page container, global keyframes, backdrop filters, smooth scroll libraries.
131
-
132
- ### Mandatory Interaction Sweep
133
-
134
- **Scroll sweep:** Scroll the page slowly from top to bottom. Record header changes, viewport animations, auto-switching sidebars, scroll-snap points, smooth scroll libraries.
135
-
136
- **Click sweep:** Click every element that looks interactive.
137
-
138
- **Hover sweep:** Hover over every interactive element.
139
-
140
- **Responsive sweep:** Test at 1440px, 768px, 390px. Note layout changes at each breakpoint.
141
-
142
- Save findings to `docs/research/BEHAVIORS.md`.
143
-
144
- ### Page Topology
145
- Map every distinct section from top to bottom. Give each a working name. Save as `docs/research/PAGE_TOPOLOGY.md`.
146
-
147
- ## Phase 2: Foundation Build
148
-
149
- Sequential. Do it yourself:
150
-
151
- 1. **Update fonts** in `layout.tsx`
152
- 2. **Update globals.css** with target's color tokens, spacing, keyframes, scroll behaviors
153
- 3. **Create TypeScript interfaces** in `src/types/`
154
- 4. **Extract SVG icons** as React components in `src/components/icons.tsx`
155
- 5. **Download global assets** via `scripts/download-assets.mjs`
156
- 6. Verify: `npm run build` passes
157
-
158
- ### Asset Discovery Script
159
-
160
- Run via Chrome MCP:
161
-
162
- ```javascript
163
- JSON.stringify({
164
- images: [...document.querySelectorAll('img')].map(img => ({
165
- src: img.src || img.currentSrc,
166
- alt: img.alt,
167
- width: img.naturalWidth,
168
- height: img.naturalHeight,
169
- parentClasses: img.parentElement?.className,
170
- position: getComputedStyle(img).position,
171
- zIndex: getComputedStyle(img).zIndex
172
- })),
173
- videos: [...document.querySelectorAll('video')].map(v => ({
174
- src: v.src || v.querySelector('source')?.src,
175
- poster: v.poster,
176
- autoplay: v.autoplay, loop: v.loop, muted: v.muted
177
- })),
178
- backgroundImages: [...document.querySelectorAll('*')].filter(el => {
179
- const bg = getComputedStyle(el).backgroundImage;
180
- return bg && bg !== 'none';
181
- }).map(el => ({
182
- url: getComputedStyle(el).backgroundImage,
183
- element: el.tagName + '.' + el.className?.split(' ')[0]
184
- })),
185
- fonts: [...new Set([...document.querySelectorAll('*')].slice(0, 200).map(el => getComputedStyle(el).fontFamily))],
186
- favicons: [...document.querySelectorAll('link[rel*="icon"]')].map(l => ({ href: l.href, sizes: l.sizes?.toString() }))
187
- });
188
- ```
189
-
190
- ## Phase 3: Component Specification & Dispatch
191
-
192
- For each section (top to bottom): **extract → write spec file → dispatch builders**.
193
-
194
- ### Step 1: Extract
195
-
196
- 1. **Screenshot** the section in isolation
197
- 2. **Extract CSS** via this script (replace SELECTOR):
198
-
199
- ```javascript
200
- (function(selector) {
201
- const el = document.querySelector(selector);
202
- if (!el) return JSON.stringify({ error: 'Element not found: ' + selector });
203
- const props = [
204
- 'fontSize','fontWeight','fontFamily','lineHeight','letterSpacing','color',
205
- 'textTransform','textDecoration','backgroundColor','background',
206
- 'padding','paddingTop','paddingRight','paddingBottom','paddingLeft',
207
- 'margin','marginTop','marginRight','marginBottom','marginLeft',
208
- 'width','height','maxWidth','minWidth','maxHeight','minHeight',
209
- 'display','flexDirection','justifyContent','alignItems','gap',
210
- 'gridTemplateColumns','gridTemplateRows',
211
- 'borderRadius','border','borderTop','borderBottom','borderLeft','borderRight',
212
- 'boxShadow','overflow','overflowX','overflowY',
213
- 'position','top','right','bottom','left','zIndex',
214
- 'opacity','transform','transition','cursor',
215
- 'objectFit','objectPosition','mixBlendMode','filter','backdropFilter',
216
- 'whiteSpace','textOverflow','WebkitLineClamp'
217
- ];
218
- function extractStyles(element) {
219
- const cs = getComputedStyle(element);
220
- const styles = {};
221
- props.forEach(p => {
222
- const v = cs[p];
223
- if (v && v !== 'none' && v !== 'normal' && v !== 'auto' && v !== '0px' && v !== 'rgba(0, 0, 0, 0)') styles[p] = v;
224
- });
225
- return styles;
226
- }
227
- function walk(element, depth) {
228
- if (depth > 4) return null;
229
- const children = [...element.children];
230
- return {
231
- tag: element.tagName.toLowerCase(),
232
- classes: element.className?.toString().split(' ').slice(0, 5).join(' '),
233
- text: element.childNodes.length === 1 && element.childNodes[0].nodeType === 3 ? element.textContent.trim().slice(0, 200) : null,
234
- styles: extractStyles(element),
235
- images: element.tagName === 'IMG' ? { src: element.src, alt: element.alt, naturalWidth: element.naturalWidth, naturalHeight: element.naturalHeight } : null,
236
- childCount: children.length,
237
- children: children.slice(0, 20).map(c => walk(c, depth + 1)).filter(Boolean)
238
- };
239
- }
240
- return JSON.stringify(walk(el, 0), null, 2);
241
- })('SELECTOR');
242
- ```
243
-
244
- 3. **Extract multi-state styles** — capture before AND after trigger states
245
- 4. **Extract real content** — all text, alt, aria labels
246
- 5. **Identify assets** — which downloaded images/videos/icons
247
- 6. **Assess complexity** — split if necessary
248
-
249
- ### Step 2: Write Component Spec File
250
-
251
- Template at `docs/research/components/<component-name>.spec.md`:
252
-
253
- ```markdown
254
- # <ComponentName> Specification
255
-
256
32
  ## Overview
257
- - **Target file:** `src/components/<ComponentName>.tsx`
258
- - **Screenshot:** `docs/design-references/<screenshot-name>.png`
259
- - **Interaction model:** <static | click-driven | scroll-driven | time-driven>
260
-
261
- ## DOM Structure
262
- <hierarchy>
263
-
264
- ## Computed Styles (exact values)
265
- ### Container
266
- - display, padding, maxWidth, etc.
267
-
268
- ### <Child element>
269
- - every relevant property
270
-
271
- ## States & Behaviors
272
- ### <Behavior name>
273
- - **Trigger:** <exact mechanism>
274
- - **State A (before):** CSS values
275
- - **State B (after):** CSS values
276
- - **Transition:** transition CSS
277
- - **Implementation approach:** <CSS transition | IntersectionObserver | etc.>
278
33
 
279
- ## Assets
280
- - Background/overlay images with paths
281
- - Icons used from icons.tsx
34
+ Reverse-engineer a target URL into a working Next.js + shadcn/ui + Tailwind clone. The skill is **foreman-style**: extract a section, write a spec file, dispatch a builder agent in a worktree, move on to the next section. Extraction is meticulous (computed CSS, real assets, both static and behavioral) — building runs in parallel. Detailed principles, scripts, and templates live in [`references.md`](references.md).
282
35
 
283
- ## Text Content (verbatim)
284
- <copy-pasted from live site>
36
+ ## Process
285
37
 
286
- ## Responsive Behavior
287
- - Desktop (1440px): <layout>
288
- - Tablet (768px): <changes>
289
- - Mobile (390px): <changes>
290
- - Breakpoint: ~<N>px
291
- ```
292
-
293
- ### Step 3: Dispatch Builders
294
-
295
- **Simple section** (1-2 sub-components): One builder agent.
296
- **Complex section** (3+ sub-components): Break up. One agent per sub-component + one for wrapper.
297
-
298
- Each builder receives:
299
- - Full spec file contents inline
300
- - Path to section screenshot
301
- - Which shared components to import
302
- - Target file path
303
- - Instruction to verify `npx tsc --noEmit`
304
-
305
- **Don't wait** — as soon as one builder is dispatched, move to next section extraction.
306
-
307
- ### Step 4: Merge
308
-
309
- As agents complete: merge worktree branches, verify build passes, fix conflicts intelligently.
310
-
311
- ## Phase 4: Page Assembly
312
-
313
- Wire everything together in `src/app/page.tsx`:
314
- - Import all section components
315
- - Implement page-level layout (scroll containers, z-index)
316
- - Connect real content to component props
317
- - Implement page-level behaviors (scroll-snap, smooth scroll, theme transitions)
318
- - Verify `npm run build` passes
319
-
320
- ## Phase 5: Visual QA Diff
321
-
322
- Take side-by-side screenshots with original. Compare section by section at 1440px AND 390px. For each discrepancy: re-extract, update spec, fix component. Test all interactive behaviors.
323
-
324
- ## Pre-Dispatch Checklist
325
-
326
- Before dispatching ANY builder:
327
- - [ ] Spec file written with ALL sections filled
328
- - [ ] Every CSS value is from `getComputedStyle()`, not estimated
329
- - [ ] Interaction model identified and documented
330
- - [ ] All states captured (not just default)
331
- - [ ] Scroll/hover triggers with before/after/transition recorded
332
- - [ ] All images identified including overlays
333
- - [ ] Responsive behavior documented
334
- - [ ] Text content verbatim
335
- - [ ] Builder prompt ≤150 lines
38
+ 1. **Pre-flight** — Chrome MCP available, Next.js + shadcn scaffold builds clean, output dirs exist.
39
+ 2. **Phase 1 — Reconnaissance** — full-page screenshots (desktop + mobile), global extraction (fonts, colors, favicons), mandatory interaction sweep (scroll, click, hover, responsive), page topology map.
40
+ 3. **Phase 2 — Foundation build** — fonts, `globals.css`, TypeScript types, SVG icons, downloaded assets. Sequential, must compile.
41
+ 4. **Phase 3 — Component spec & dispatch** — for each section: extract DOM + computed CSS + states + content + assets → write `docs/research/components/<name>.spec.md` → dispatch builder agent with full spec inline. Don't wait between sections.
42
+ 5. **Phase 4 — Page assembly** — wire components in `src/app/page.tsx`, implement page-level behaviours (scroll-snap, smooth scroll, theme transitions). Build must pass.
43
+ 6. **Phase 5 — Visual QA diff** — side-by-side screenshots vs original at 1440px and 390px. Re-extract on discrepancies.
336
44
 
337
45
  ## Output Format
338
46
 
339
- - Every builder dispatches with an inline spec (not a file reference)
340
- - Every commit keeps `npm run build` green
341
- - Final report structure:
342
- - Total sections built: N
343
- - Total components created: N
344
- - Total spec files written: N (must match components)
345
- - Total assets downloaded: N
346
- - Build status: PASS/FAIL
347
- - Visual QA discrepancies: list
348
- - Do NOT include: vague status like "mostly done", builders dispatched without spec files, or estimated CSS values
349
- - Do NOT merge with red builds
350
- - Do NOT skip responsive extraction
351
-
352
- ## Workflow
47
+ ```
48
+ Total sections built: N
49
+ Total components created: N
50
+ Total spec files written: N (must match component count)
51
+ Total assets downloaded: N (images / videos / SVGs / fonts)
52
+ Build status: PASS | FAIL
53
+ Visual QA discrepancies: <list of remaining diffs>
54
+ ```
353
55
 
354
- 1. Read the user request and extract key parameters.
355
- 2. Execute the skill logic as described in the Overview.
356
- 3. Return output in the format specified below.
56
+ Do NOT include: vague status like "mostly done", builders dispatched without spec files, or estimated CSS values.
357
57
 
358
58
  ## Examples
359
59
 
360
- ### Happy Path
361
- **Input:** "clone https://linear.app"
362
-
363
- **Expected behavior:**
364
- 1. Pre-flight: verify Chrome MCP, base Next.js+shadcn scaffold
365
- 2. Reconnaissance: full-page screenshots, global extraction (fonts/colors/favicons), interaction sweep
366
- 3. Foundation build: update layout.tsx fonts, globals.css colors, icons.tsx, download assets
367
- 4. For each section top-to-bottom: extract CSS via getComputedStyle, write spec file, dispatch builder in worktree
368
- 5. Merge branches as builders complete, keep build green
369
- 6. Visual QA diff at desktop + mobile
370
- 7. Report with component counts, asset counts, build status
371
-
372
- ### Edge Case: Missing Chrome MCP
373
- **Input:** "clone this site: https://example.com"
374
-
375
- **Expected behavior:** STOP immediately. Respond: "Chrome MCP not available. Enable it first — this skill requires browser automation to extract computed styles and screenshots. Without it, I'd be guessing from HTML which produces bad clones."
376
-
377
- ### Edge Case: Scroll-Driven Site Mistaken for Click-Driven
378
- **Input:** User asks to clone a site with scroll-driven tabs
379
-
380
- **Expected behavior:** During interaction sweep, scroll BEFORE clicking. If content switches on scroll, document as "INTERACTION MODEL: scroll-driven with IntersectionObserver". Do NOT build click-based tabs.
381
-
382
- ### Edge Case: Builder Prompt Too Long
383
- **Input:** (Extracting a complex section with 4 card variants)
60
+ **Happy path** — `clone https://linear.app` → reconnaissance → foundation → spec each section → dispatch builders → assemble → visual QA. ~6 phases, parallel where possible.
384
61
 
385
- **Expected behavior:** Check the 150-line rule. If spec exceeds it, split: one builder per card variant + one for the section wrapper. Do NOT override with "it's all related."
62
+ **Edge case missing Chrome MCP** STOP immediately and tell the user to enable it. Without browser automation we'd be guessing from HTML, which produces bad clones.
386
63
 
387
- ### Negative Test
388
- **Input:** "Design a new landing page for our Rihal product"
64
+ **Edge case — scroll-driven site** — during interaction sweep, scroll BEFORE clicking. If content switches on scroll, document as "INTERACTION MODEL: scroll-driven (IntersectionObserver)" and do NOT build click-based tabs. This is the #1 expensive mistake.
389
65
 
390
- **Expected behavior:** Stay silent. This is original design worknot cloning. Redirect: "This needs original design invoke Layla (rihal-agent-layla) for UX or Bilal (rihal-agent-bilal) for direct build. I clone existing sites, not create new ones."
66
+ **Negative original design request**"Design a new landing page" is not a clone. Redirect to Layla (UX) or Hanzla (direct build).
391
67
 
392
- ## What NOT to Do
68
+ ## Memory Bank Hooks
393
69
 
394
- - Don't build click-based tabs when the original is scroll-driven
395
- - Don't extract only the default state of tabbed content
396
- - Don't miss overlay/layered images
397
- - Don't build HTML mockups for content that's actually videos/Lottie/canvas
398
- - Don't approximate CSS classes — extract exact values
399
- - Don't build monolithic commits
400
- - Don't reference external docs from builder prompts — inline everything
401
- - Don't skip asset extraction
402
- - Don't give a builder too much scope
403
- - Don't bundle unrelated sections into one agent
404
- - Don't skip responsive extraction at 1440/768/390
405
- - Don't forget smooth scroll libraries (Lenis, Locomotive)
406
- - Don't dispatch builders without a spec file
70
+ - **Reads:** `package.json` and existing `src/` to detect scaffold; `.rihal/memory/project/stack.md` if present (records the stack used)
71
+ - **Writes:** `docs/research/` (artefacts, persistent), `docs/design-references/` (screenshots), nothing in `.rihal/memory/` directly
407
72
 
408
- ## Completion Report
73
+ ## Detailed reference
409
74
 
410
- - Total sections built: N
411
- - Total components created: N
412
- - Total spec files written: N
413
- - Total assets downloaded (images/videos/SVGs/fonts): N
414
- - Build status: `npm run build` result
415
- - Visual QA results: any remaining discrepancies
416
- - Any known gaps or limitations
75
+ See [`references.md`](references.md) for: the 9 guiding principles, the asset discovery script, the CSS extraction script, the component spec template, the pre-dispatch checklist, and the "what NOT to do" list.
@@ -0,0 +1,213 @@
1
+ # Clone Website — Detailed Reference
2
+
3
+ Detailed principles, scripts, templates, and checklists for [`SKILL.md`](SKILL.md). Keep this file open in another tab while running the skill.
4
+
5
+ ---
6
+
7
+ ## 9 Guiding Principles
8
+
9
+ These are the truths that separate a successful clone from a "close enough" mess.
10
+
11
+ ### 1. Completeness beats speed
12
+ Every builder agent must receive **everything** it needs: screenshot, exact CSS values, downloaded assets with local paths, real text content, component structure. If a builder has to guess any value, extraction failed. One extra minute of extraction beats an incomplete brief.
13
+
14
+ ### 2. Small tasks, perfect results
15
+ Builder prompts ≤150 lines of spec. If a section's spec exceeds that, split it: one agent per sub-component plus one for the wrapper. Don't override with "but it's all related."
16
+
17
+ ### 3. Real content, real assets
18
+ Extract actual text, images, videos, SVGs from the live site. Use `element.textContent`, download every `<img>` and `<video>`, extract inline `<svg>` as React components. Layered assets matter — a section that looks like one image is often multiple layers (background, foreground UI mockup, overlay icon). Inspect the full DOM tree.
19
+
20
+ ### 4. Foundation first
21
+ Sequential and non-negotiable: global CSS with the target's design tokens, TypeScript types for content structures, global assets (fonts, favicons). Everything after this can be parallel.
22
+
23
+ ### 5. Extract how it looks AND how it behaves
24
+ Static CSS alone produces dead-feeling clones. For every element extract appearance (`getComputedStyle`) AND behaviour (what changes, what triggers it, how the transition runs). Behaviours to watch: scroll-shrink navbars, viewport-entry animations, scroll-snap, parallax, hover transitions, modals/accordions, auto-play carousels, scroll-driven tab switching, smooth-scroll libraries (Lenis, Locomotive Scroll).
25
+
26
+ ### 6. Identify the interaction model before building
27
+ The single most expensive mistake: building click-based UI when the original is scroll-driven (or vice versa).
28
+ - Scroll first, slowly. Watch for self-changing elements.
29
+ - If something changes on scroll, it's scroll-driven. Extract the mechanism.
30
+ - Only THEN test for click/hover-driven interactivity.
31
+ - Document the interaction model explicitly in every spec.
32
+
33
+ ### 7. Extract every state, not just the default
34
+ For tabbed/stateful content: click each tab via Chrome MCP, extract per state. For scroll-dependent elements: capture at scroll position 0 and after crossing the trigger threshold.
35
+
36
+ ### 8. Spec files are the source of truth
37
+ Every component gets a spec file in `docs/research/components/` BEFORE any builder is dispatched. The builder receives the spec contents inline; the file persists as an auditable artefact.
38
+
39
+ ### 9. Build must always compile
40
+ Every builder verifies `npx tsc --noEmit` before finishing. After merging worktrees, you verify `npm run build` passes. No red merges.
41
+
42
+ ---
43
+
44
+ ## Asset Discovery Script (Chrome MCP)
45
+
46
+ ```javascript
47
+ JSON.stringify({
48
+ images: [...document.querySelectorAll('img')].map(img => ({
49
+ src: img.src || img.currentSrc,
50
+ alt: img.alt,
51
+ width: img.naturalWidth,
52
+ height: img.naturalHeight,
53
+ parentClasses: img.parentElement?.className,
54
+ position: getComputedStyle(img).position,
55
+ zIndex: getComputedStyle(img).zIndex
56
+ })),
57
+ videos: [...document.querySelectorAll('video')].map(v => ({
58
+ src: v.src || v.querySelector('source')?.src,
59
+ poster: v.poster,
60
+ autoplay: v.autoplay, loop: v.loop, muted: v.muted
61
+ })),
62
+ backgroundImages: [...document.querySelectorAll('*')].filter(el => {
63
+ const bg = getComputedStyle(el).backgroundImage;
64
+ return bg && bg !== 'none';
65
+ }).map(el => ({
66
+ url: getComputedStyle(el).backgroundImage,
67
+ element: el.tagName + '.' + el.className?.split(' ')[0]
68
+ })),
69
+ fonts: [...new Set([...document.querySelectorAll('*')].slice(0, 200).map(el => getComputedStyle(el).fontFamily))],
70
+ favicons: [...document.querySelectorAll('link[rel*="icon"]')].map(l => ({ href: l.href, sizes: l.sizes?.toString() }))
71
+ });
72
+ ```
73
+
74
+ ---
75
+
76
+ ## CSS Extraction Script (per section, replace `SELECTOR`)
77
+
78
+ ```javascript
79
+ (function(selector) {
80
+ const el = document.querySelector(selector);
81
+ if (!el) return JSON.stringify({ error: 'Element not found: ' + selector });
82
+ const props = [
83
+ 'fontSize','fontWeight','fontFamily','lineHeight','letterSpacing','color',
84
+ 'textTransform','textDecoration','backgroundColor','background',
85
+ 'padding','paddingTop','paddingRight','paddingBottom','paddingLeft',
86
+ 'margin','marginTop','marginRight','marginBottom','marginLeft',
87
+ 'width','height','maxWidth','minWidth','maxHeight','minHeight',
88
+ 'display','flexDirection','justifyContent','alignItems','gap',
89
+ 'gridTemplateColumns','gridTemplateRows',
90
+ 'borderRadius','border','borderTop','borderBottom','borderLeft','borderRight',
91
+ 'boxShadow','overflow','overflowX','overflowY',
92
+ 'position','top','right','bottom','left','zIndex',
93
+ 'opacity','transform','transition','cursor',
94
+ 'objectFit','objectPosition','mixBlendMode','filter','backdropFilter',
95
+ 'whiteSpace','textOverflow','WebkitLineClamp'
96
+ ];
97
+ function extractStyles(element) {
98
+ const cs = getComputedStyle(element);
99
+ const styles = {};
100
+ props.forEach(p => {
101
+ const v = cs[p];
102
+ if (v && v !== 'none' && v !== 'normal' && v !== 'auto' && v !== '0px' && v !== 'rgba(0, 0, 0, 0)') styles[p] = v;
103
+ });
104
+ return styles;
105
+ }
106
+ function walk(element, depth) {
107
+ if (depth > 4) return null;
108
+ const children = [...element.children];
109
+ return {
110
+ tag: element.tagName.toLowerCase(),
111
+ classes: element.className?.toString().split(' ').slice(0, 5).join(' '),
112
+ text: element.childNodes.length === 1 && element.childNodes[0].nodeType === 3 ? element.textContent.trim().slice(0, 200) : null,
113
+ styles: extractStyles(element),
114
+ images: element.tagName === 'IMG' ? { src: element.src, alt: element.alt, naturalWidth: element.naturalWidth, naturalHeight: element.naturalHeight } : null,
115
+ childCount: children.length,
116
+ children: children.slice(0, 20).map(c => walk(c, depth + 1)).filter(Boolean)
117
+ };
118
+ }
119
+ return JSON.stringify(walk(el, 0), null, 2);
120
+ })('SELECTOR');
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Component Spec Template
126
+
127
+ Save to `docs/research/components/<component-name>.spec.md`:
128
+
129
+ ```markdown
130
+ # <ComponentName> Specification
131
+
132
+ ## Overview
133
+ - **Target file:** `src/components/<ComponentName>.tsx`
134
+ - **Screenshot:** `docs/design-references/<screenshot-name>.png`
135
+ - **Interaction model:** <static | click-driven | scroll-driven | time-driven>
136
+
137
+ ## DOM Structure
138
+ <hierarchy>
139
+
140
+ ## Computed Styles (exact values)
141
+ ### Container
142
+ - display, padding, maxWidth, etc.
143
+
144
+ ### <Child element>
145
+ - every relevant property
146
+
147
+ ## States & Behaviors
148
+ ### <Behavior name>
149
+ - **Trigger:** <exact mechanism>
150
+ - **State A (before):** CSS values
151
+ - **State B (after):** CSS values
152
+ - **Transition:** transition CSS
153
+ - **Implementation approach:** <CSS transition | IntersectionObserver | etc.>
154
+
155
+ ## Assets
156
+ - Background/overlay images with paths
157
+ - Icons used from icons.tsx
158
+
159
+ ## Text Content (verbatim)
160
+ <copy-pasted from live site>
161
+
162
+ ## Responsive Behavior
163
+ - Desktop (1440px): <layout>
164
+ - Tablet (768px): <changes>
165
+ - Mobile (390px): <changes>
166
+ - Breakpoint: ~<N>px
167
+ ```
168
+
169
+ ---
170
+
171
+ ## Pre-Dispatch Checklist (every builder, every time)
172
+
173
+ - [ ] Spec file written with ALL sections filled
174
+ - [ ] Every CSS value is from `getComputedStyle()`, not estimated
175
+ - [ ] Interaction model identified and documented
176
+ - [ ] All states captured (not just default)
177
+ - [ ] Scroll/hover triggers with before/after/transition recorded
178
+ - [ ] All images identified including overlays
179
+ - [ ] Responsive behavior documented
180
+ - [ ] Text content verbatim
181
+ - [ ] Builder prompt ≤150 lines
182
+
183
+ ---
184
+
185
+ ## What NOT to Do
186
+
187
+ - Don't build click-based tabs when the original is scroll-driven
188
+ - Don't extract only the default state of tabbed content
189
+ - Don't miss overlay/layered images
190
+ - Don't build HTML mockups for content that's actually videos / Lottie / canvas
191
+ - Don't approximate CSS classes — extract exact values
192
+ - Don't build monolithic commits
193
+ - Don't reference external docs from builder prompts — inline everything
194
+ - Don't skip asset extraction
195
+ - Don't give a builder too much scope
196
+ - Don't bundle unrelated sections into one agent
197
+ - Don't skip responsive extraction at 1440 / 768 / 390
198
+ - Don't forget smooth scroll libraries (Lenis, Locomotive)
199
+ - Don't dispatch builders without a spec file
200
+
201
+ ---
202
+
203
+ ## Final Completion Report Format
204
+
205
+ ```
206
+ Total sections built: N
207
+ Total components created: N
208
+ Total spec files written: N (must match components)
209
+ Total assets downloaded: N (images / videos / SVGs / fonts)
210
+ Build status: PASS | FAIL
211
+ Visual QA discrepancies: <remaining diffs>
212
+ Known gaps / limitations: <list>
213
+ ```