تخطي إلى المحتوى الرئيسي
Login

Sign in to access your account

البدء في تطبيق كود المنصات

دليل عملي لإعداد قالب كود المنصات بمساعدة وكلاء البرمجة الذكية، وبناء الصفحات والتحقق منها، والانتقال إلى الإصدارات الجديدة.

نظرة عامة

يقدم هذا الدليل طريقة سهلة للحصول على صفحات متوافقة مع كود المنصات، مبنية وفق خطة واضحة ومفحوصة في المتصفح. يكفي لصق أمر واحد ليتولى وكيل البرمجة الذكي بقية العمل، مستنداً إلى NDS IQ، دليل القواعد الذي ينظم بناء الصفحات الجديدة، ونقل الصفحات القائمة، ومراجعتها.

دعم المتصفحات

لا يعتمد القالب قائمة محددة للمتصفحات المدعومة؛ فإذا افتقد المتصفح ميزة ما، تعطّل الجزء المرتبط بها فقط وبقيت الصفحة تعمل، ضمن الحدود الموضحة أدناه.

  • المتصفحات الصادرة منذ عام 2022: تعمل جميع مكونات القالب، وفي Chrome وEdge تعمل جميعها منذ عام 2021.
  • Safari وFirefox بين أواخر 2020 و2021: لا تعمل النافذة المنبثقة (Modal) واللوحة الجانبية (Panel).
  • المتصفحات قبل أواخر 2020: لا يعمل كود JavaScript الخاص بالقالب.

1. الإعداد

يتم الإعداد مرة واحدة فقط، إذ يثبّت الوكيل NDS IQ، وينزّل القالب، ويعدّ خطة العمل، ثم يطرح أسئلته دفعة واحدة.

أمر الإعداد

افتح جلسة جديدة مع الوكيل، والصق الأمر التالي:

Download the raw file to `NDS-IQ.md` at the project root using `curl` or another direct HTTP client. Do not use a web-fetch tool: it may save a re-rendered copy. https://raw.githubusercontent.com/mazin-musleh/NDS-vanilla/refs/heads/main/_includes/NDS-IQ.md Confirm that the file starts with `# NDS IQ`, then read it from top to bottom. This is the project's UI-layer rulebook. All NDS work runs by its rules. Set up NDS IQ in this project as its install section describes, then build the plan.

إذا تعذّر على الوكيل تنزيل الملفات، فراجع التثبيت اليدوي.

يضيف الإعداد ثلاثة عناصر إلى المشروع:

  1. NDS-IQ.md في جذر المشروع، وهو ملف القواعد. ولا ينبغي تعديله يدوياً، لأن التحديثات تستبدله بالكامل.
  2. مرساة (Anchor) في CLAUDE.md (Claude Code) أو AGENTS.md (Cursor وCodex)، وهي فقرة قصيرة تحفظ مسارات المشروع، وتوجّه الوكيل إلى قراءة القواعد قبل أي عمل على القالب.
  3. قالب كود المنصات في .nds/، بالإصدار نفسه المستخدم في المشروع، أو بأحدث إصدار عند التثبيت الأول.

المسارات

تحفظ المرساة مسارين: مجلد القالب، ومجلد الملفات الثابتة. ويحدد الوكيل قيمة NDS_ASSETS تلقائياً، ولا يسأل إلا عند وجود أكثر من مجلد مناسب، ثم يتأكد من رابط ملفات القالب (CSS وJavaScript والخطوط) قبل إضافة أول وسم يحمّلها في الصفحات.

المتغيرالوصف
NDS_ROOTمجلد القالب، والقيمة الافتراضية: .nds/.
NDS_ASSETSالمجلد الذي يعرض منه التطبيق الملفات الثابتة، مثل public/assets/ أو wwwroot/.

مراجعة الخطة

بعد ذلك يحصر الوكيل الصفحات والمسارات ومكتبات الواجهة القديمة في NDS-PLAN.md، ثم يتوقف ليطرح أسئلة المشروع كلها في رسالة واحدة: رابط ملفات القالب، وطريقة نقل الصفحات القائمة، والتعامل مع أي عمل سابق على القالب، وسياسة أمان المحتوى (CSP) إن وجدت، وهل يتحقق الموقع من الختم الرقمي، ووتيرة العمل. وتمثل الإجابات موافقة على الخطة، فيبدأ الوكيل البناء.

إذا لم يعدّ الوكيل الخطة، فالصق الأمر التالي:

Inventory the project and write NDS-PLAN.md for my review.

الخطة مطلوبة عند العمل على أكثر من صفحة. ويمكن الاستغناء عنها في تجربة من صفحة واحدة، لكن الوكيل لن يحتفظ حينها بأي سجل بين الجلسات.

2. البناء

بعد اعتماد الخطة، يكفي وصف المطلوب لكل صفحة: الهدف منها، ومحتواها، والبيانات التي تعرضها، وأي قيود خاصة بها، فيما يتولى NDS IQ تحديد طريقة بنائها.

وتيرة العمل

تتوفر طريقتان:

  • صفحة بصفحة (الافتراضي): يبني الوكيل صفحة واحدة في كل مرة؛ فيطرح أسئلته، ثم يبنيها ويفحصها في المتصفح، ويحدّث الخطة، ويتوقف بانتظار الموافقة.
  • الخطة كاملة: يبني الوكيل جميع الصفحات بالإجابات الافتراضية، ثم يعرض في النهاية القرارات والفحوص المعلقة.

في الحالتين، يبقى اعتماد الصفحة بيد المطور وحده عبر وضع علامة Built and Verified (تم البناء والتحقق)، أما الصفحات التي تحمل علامة Awaiting Verification (بانتظار التحقق) فتنتظر الاعتماد. وينتهي العمل عندما تحمل جميع صفحات الخطة علامة Built and Verified.

التحقق في المتصفح

يفحص الوكيل كل صفحة في المتصفح من جانبين:

  • السلوك: يحمّل الصفحة، ويراجع وحدة التحكم (console)، ويشغّل NDS.init.audit()، ويختبر جميع التفاعلات وعمليات التحقق في النماذج.
  • المظهر: يقارن الصفحة بنظيرتها في القالب على شاشات سطح المكتب والجوال، في الوضعين الفاتح والداكن.

ولا تكفي مراجعة الكود وحدها للتحقق.

الجلسة التالية

عند بدء جلسة جديدة، الصق الأمر التالي:

Continue: read NDS-PLAN.md and propose the next step.

بعد اكتمال الخطة، يمكن طلب التعديلات بلغة عادية دون خطة. ويعيد الوكيل فحص كل صفحة يعدّلها في الحالات التي يمسها التغيير، وإذا شمل التعديل ملفاً مشتركاً، مثل التخطيط أو ملف أنماط المشروع، أعاد فحص جميع الصفحات التي تستخدمه.

قد تنحرف الجلسات الطويلة عن مسارها؛ فإذا تجاوز الوكيل الخطة أو سأل عما تجيب عنه القواعد، فاطلب منه أن «يتبع IQ»، فيعيد قراءة القواعد ويعود إلى المسار الصحيح.

إزالة المكتبات القديمة

لا تحمّل صفحات القالب مكتبات الواجهة القديمة مثل jQuery أو Bootstrap، لكن الوكيل لا يزيلها من المشروع؛ فقرار إزالتها يعود إلى المطور.

تقرير الملاحظات

عند اكتشاف خلل أو نقص في القالب، يسجّله الوكيل في NDS-REPORT.md. ويتضمن كل بند إصدار القالب، وإصدار القواعد، والمكوّن، ومثالاً مختصراً يعيد إنتاج المشكلة. وبعد مراجعة التقرير، أرسل الملاحظات المؤكدة إلى GitHub Issues.

3. الترقية

عند صدور إصدار جديد، الصق الأمر التالي:

Upgrade the NDS template to the latest release.

ينفّذ الوكيل الخطوات التالية:

  • يستبدل القالب في NDS_ROOT وينسخ الملفات الثابتة الجديدة (CSS وJavaScript والخطوط) إلى NDS_ASSETS.
  • يراجع ملاحظات الترحيل في سجل التغييرات، ويشغّل فحص الترحيل على كل صفحة، ثم يصلح الصفحات المتأثرة وفق الخطة.
  • يستبدل NDS-IQ.md بأحدث نسخة منه.
  • يعرض الميزات الجديدة التي قد تفيد المشروع.

تبقى المرساة والمسارات دون تغيير. ولفحص صفحة يدوياً، راجع دليل الترحيل.

تحديث القواعد

لتحديث القواعد فقط، الصق الأمر التالي:

Update the NDS IQ rules file to the latest revision.

يستبدل الوكيل NDS-IQ.md عند اختلافه عن النسخة المنشورة، وينبّه إذا كان القالب نفسه بحاجة إلى تحديث. أما القوالب الأقدم من الإصدار 2.0، فيثبّت لها النسخة v3.2 من القواعد، وهي آخر نسخة متوافقة معها.

التثبيت اليدوي (اختياري)

يجمع الإعداد الخطوتين التاليتين، ولا حاجة إلى تنفيذهما يدوياً إلا إذا تعذّر على الوكيل تنزيل الملفات.

الخطوة 1. تثبيت القالب. نزّل nds-vanilla-template-v2.1.2.zip من GitHub Releases، وفك ضغطه في مجلد .nds/ في جذر المشروع، وأضف هذا المجلد إلى .gitignore. ويجب أن يكون NDS-INDEX.md مباشرة داخل .nds/، دون مجلد فرعي باسم الإصدار.

القالب مرجع للقراءة فقط، فانسخ منه ما تحتاج دون تعديله.

.nds/ ├── README.md - Overview and entry-point documentation ├── NDS-INDEX.md - Map from each need to this release's files ├── _site/ - Compiled documentation and runtime assets │ ├── components/ - Built doc pages, the visual reference │ └── assets/ - Runtime CSS, JS, fonts, and i18n ├── _source/ - Source files and catalogs (added on install) ├── CHANGELOG.md - Release history and migration notes └── LICENSE - License terms

الخطوة 2. تثبيت القواعد. احفظ القواعد التالية باسم NDS-IQ.md في جذر المشروع كما هي دون أي تعديل، ثم أضف المرساة إلى ملف الوكيل، واضبط قيمة NDS_ASSETS. ونص المرساة موجود في قسم This file من القواعد.

Markdown IQ v4.1
# NDS IQ — building UI with the National Design System (instructions v4.1) ## Start here **Before anything else, open `NDS_ROOT/NDS-INDEX.md`.** It maps every need to this release's files. Read it once per session. - **No `NDS_ROOT` yet, or a placeholder path?** Keep reading: §Setup restores it. - **`NDS-INDEX.md` one folder down** (inside the zip's versioned folder)? Move that folder's contents up into `NDS_ROOT`, then open it. - **`NDS_ROOT` holds a template but no `NDS-INDEX.md`?** The template predates this file, and this file cannot serve it. Download https://raw.githubusercontent.com/mazin-musleh/NDS-vanilla/refs/tags/IQv3.2/_includes/NDS-IQ.md with curl or the stack's HTTP client, check that line 1 starts `# NDS IQ`, replace the project-root `NDS-IQ.md` with it, and read it. Tell the dev it is the last rules revision for this template: new rules come with an upgrade to a release that ships `NDS-INDEX.md`. Stop reading this file. The project's agent file (`CLAUDE.md` / `AGENTS.md`) holds the anchor: the values of `NDS_ROOT` and `NDS_ASSETS`, and the trigger that sent you here. - Read this file top to bottom once per session, before any NDS or UI work, and when unsure. At each phase boundary, reread that phase's gates. - It is universal and read-only: no project values, no edits. Path values live only in the anchor. - **This file holds rules, not facts.** It names no NDS file, class or API, because each release can change them. The template carries the facts: the docs the index names hold markup, options, APIs, layout and styling rules, and the template's audit checks a live page. - An older release may lack a doc or feature a newer one has: use what it ships, report the gap, and propose the upgrade as the dev's call. A missing route never blocks. **`NDS_ROOT`**: the flat contents of one template release from https://github.com/mazin-musleh/NDS-vanilla/releases. Default `.nds/` at the project root, gitignored, read-only. It is correct when `NDS_ROOT/NDS-INDEX.md` resolves directly; never keep the zip's versioned wrapper folder. **`NDS_ASSETS`**: the project's static folder for the NDS runtime; never under `NDS_ROOT`. Write it relative to the project root, as `NDS_ROOT` is: the anchor travels with the project, so an absolute path breaks on every other machine. - Derive its folder and served URL from the stack, and confirm both with the dev as one question in the plan review, before §Setup copies the runtime (no plan: one question before the copy). - Placeholder path? NDS-side work waits for the answer: ask it in the plan review (no plan: ask now). Inventory and plan work continue; NDS targets stay `blocked on NDS_ROOT` until the sources resolve. - Never adopt a candidate path yourself: list the candidates, read their version banners, and let the dev choose. Write a dev-supplied path into the anchor that session, never into `NDS-PLAN.md`. ## Red lines 1. **Never edit `NDS_ROOT`; never hand-edit NDS files in `NDS_ASSETS`.** If NDS itself needs a change, report it and stop. 2. **Never read minified JS or CSS. Never use an NDS path from memory.** Every path comes from the index; a remembered path is an invented one, even when the file exists. The one exception is a bundle's opening comment, read for its `Version:` banner. 3. **Copy canonical markup verbatim. Never invent it.** The index says where a doc keeps its canon and how to read it. Never copy a live demo or a built page: the docs are the only copy source. Preserve structure, classes, `data-*` attributes, and ARIA. Only these edits are allowed: | Edit | Allowed change | |---|---| | Asset URL | Rewrite `href`/`src` to `NDS_ASSETS` URLs | | Content | Replace placeholder text and content attributes | | Option | Add an option the doc lists, on the element it names | | CSP | The conversion the docs give for a strict Content Security Policy | - Keep every canonical part, in order. A small dataset or a minimal existing page is no reason to remove one. A matched source ships every part; name any domain-required removal to the dev before the page is done. - Put host-framework bindings on canonical elements as attributes. Never insert framework-generated UI elements. - Edit a copied script point by point against its source; never rewrite it. - Keep canonical wrappers with their children; never lift a child out. - Inherited markup follows the same rule. 4. **All page content uses the NDS page structure and layout primitives** the docs describe. No other framework's layout, no custom wrappers, no spacing the primitives do not set. 5. **Style in this order: documented knobs → tokens → scoped overrides.** Rebind tokens in a project stylesheet loaded after the NDS stylesheet, the way the tokens doc shows. An override is the last resort: scope it under a project class or `data-*`, comment why, and never restyle NDS internals. 6. **No legacy UI libraries: NDS and vanilla JS only.** The index maps common legacy libraries to NDS. Any other UI library is legacy too: replace it as §Design choices says. Never mix NDS and legacy UI on one page: NDS pages load the NDS runtime, exclude inherited legacy CSS, and migrate inherited JS through §JS wiring. Removing legacy libraries project-wide is the dev's decision. An NDS spike is ONE parallel page with the full head, runtime, and canonical markup; it needs no plan, and every other rule applies. 7. **Replacing existing UI needs an approved porting strategy before file #1.** - **Default: parallel files.** Each NDS page goes beside its legacy page on a separate route or flag; legacy stays as reference and rollback. In a client-rendered app, a parallel page is a parallel view on its own route inside the same app; when one build loads the legacy global CSS on every route, the NDS views get their own build target in that app, with their own head and styles, reusing its code. Prior non-conformant NDS rebuilds in place (§Plan). - **Score the strategy:** (1) NDS markup stays in markup: HTML files or the framework's own templates (JSX, a Vue or Svelte template), never in strings that code assembles; (2) fewest edits to existing files; (3) side-by-side serving and rollback survive; (4) page JS sits beside its page. Show the dev the comparison; in-place edits and deletions need approval. - **Page JS** loads after the NDS scripts. Inline page JS is a module script. ## Checks before claims Read the source before you ask or answer an NDS question or wire page JS. A claim needs its check first: - "NDS has no X" (yours, or the dev's "just use native X") → read every entry's fit line in the catalog (the index names the catalog and its field), as §Composition cascade says. - "I cannot see the page" → a failed headless attempt (§Verify). - "The page is done" → both browser passes and a clean audit (§Verify). The audit checks markup, never how the page looks. Ask the dev only what NDS does not answer: project paths and conventions, pacing, unresolved trade-offs. ## Stop and ask **Banner checks are bounded.** Read only a bundle's opening comment for `Version:`; absent means the release is unknown. Never scan deeper or infer the version elsewhere. Report and stop when the dev must decide: | State | Report | Dev decides | |---|---|---| | JS/CSS banners disagree | hand-assembled runtime or interrupted upgrade | release | | both lack `Version:` | release unknown | release | | `-dev` banner | no matching release | release | | runtime outside `NDS_ASSETS` | location + affected pages | point the anchor there / move it | | reference newer than runtime | pending upgrade | upgrade or not | | prior NDS work / inherited plan | conformance split (§Plan) | adopt / retire / rebuild | | project rules conflict | conflict | which rules win | | NDS itself needs changes | gap | separate conversation | If the dev says a found runtime is legacy, treat setup as new, with the latest release as default, and assess its pages as prior NDS work. ## Setup **The existing runtime version wins: never follow `latest` when `NDS_ASSETS` already has a runtime.** 1. Read the opening `Version:` banners of the main NDS script and stylesheet in `NDS_ASSETS`. They must agree; otherwise stop and ask. 2. Download that exact release's template zip from the release page and extract its contents flat into `NDS_ROOT`. 3. Follow the Install section of `NDS_ROOT/NDS-INDEX.md`: it names the sources to add and what to copy into `NDS_ASSETS`. No `NDS-INDEX.md` in the extracted release → §Start here. - An empty `NDS_ASSETS` proves nothing: search the project for NDS runtime files and the layouts that load them. Found → stop and ask. None → install the latest release and report it. - At session start, compare the runtime banner in `NDS_ROOT` with `NDS_ASSETS`. Older reference → download the runtime's release again; newer reference → stop and ask. - Older releases stay valid canon. Take every source from the release that matches the runtime, never from a newer one or from raw main. ## Plan NDS is a UI layer; the host project (frontend and backend) serves it. NDS IQ never chooses or scaffolds the stack. | Project state | Workflow | Plan | |---|---|---| | No host project | Stop NDS work; set the project up outside NDS IQ and resume once it serves. | None yet | | Host serves; no UI | Greenfield: the dev brief gives pages and content, NDS canon gives structure and behavior. | Required for several pages; the dev may waive it for one | | Existing non-NDS UI | Port: keep requirements and project contracts; replace UI structure with NDS canon. | Required; an explicit waiver permits one parallel page | | Conformant NDS; one new page | Extend: its verified family archetype, then the composition cascade. | None; Build and Verify gates apply | | Conformant NDS; several new pages | Inventory the named pages and their shared shapes. | Required | | Conformant NDS; changes to existing pages | Edit: match each new or changed part through the catalog and copy its canon; verify each changed page (§Verify). | None; a page with a plan row returns to `In Progress` until its checks pass again | | Prior NDS conformance unknown | Assess the current pages first. | Required | **Plan entry gate.** Choose the work mode first. When a plan applies, list routes, layouts, shared partials, pages and views (one row per client-side view), and legacy UI libraries; map every page through the §Build cascade and record its page shape. Greenfield lists only the pages the dev named. No-plan work inspects only the named page, its shared layout, its global files, and the project contracts. Check response headers and middleware for a Content Security Policy once, project-wide. None → record `no CSP` and skip this file's CSP rules: ask the dev nothing about CSP. Found → read the docs' CSP guidance and record what the head needs. Recommend its grants in the order it gives. - **Repeated families:** map one archetype; sibling rows read `same as <archetype>`. - **Prior NDS:** assess each page against current canon: conformant → `Awaiting Verification`; non-conformant → rebuild. Never silently resume an inherited plan. - **Rebuild** clean, in place. Old work is a content, flow, and data reference, never a copy source. Remove its NDS footprint through the approved plan; rollback is the dev's version control. The approval names the cost: unported pages run on the new runtime before their rebuild and may render worse. - **Second runtime:** only by explicit dev decision, with parallel files and a second assets folder, accepting the cost. When a plan is required, create `NDS-PLAN.md` at the project root, starting with `Managed by NDS IQ`, with columns for page, route, legacy libraries, NDS target, and status. Stop before building only for this ONE review: ask every project-wide decision (the `NDS_ASSETS` folder and URL when unconfirmed, porting strategy, prior-NDS split, CSP grant only when a CSP was found, the digital stamp, pacing), each with options and a recommended default. Ask nothing the rules already settle: the rest of the chrome and the language switcher follow §Build. Ask it in the same turn you write the plan, never in a message that offers to ask, through the host's question tool, the one that shows the dev options to pick from, when the host has one, in back-to-back calls if it caps how many questions one call holds. With no such tool, ask in one numbered message. Record the answers in the plan. The answers approve the plan: start building in the same turn, even when the plan file is written after them, with no second stop. Page-specific questions wait for that page's session (under `whole plan`: a default and an open checkbox). In every phase, the conversation asks and the plan records, and a question with options takes the question tool the same way. **The plan is cross-session memory.** - Statuses, in the Status column only: `Planned`, `In Progress`, `Awaiting Verification`, `Built and Verified`. Only dev confirmation sets `Built and Verified`. - After every write to the plan, read the rows you changed back from the file. A scripted edit can miss its row and land elsewhere, and the next session trusts what the file says. - `Awaiting Verification` means every agent-owned check passed with its evidence recorded. An unmet required check keeps the row `In Progress`, and you run it next. An open checkbox holds only what the dev must supply or decide, never a check you can run. - Every open question, check, fix, or deferred decision is a `- [ ]` item, resolved as `- [x]`, never deleted. Checkboxes are not status. - **Pacing:** `page-by-page` (default) builds one row to `Awaiting Verification`, reports it, and waits for the dev's go before the next row. Under either pacing, a row reaches `Awaiting Verification` only when every agent-owned check passed. The row, not the agent, waits there for the dev. - **`whole plan`** takes this file's defaults, verifies each page, and builds row after row without stopping until every row is at `Awaiting Verification` or blocked. A finished row gets no report: record its evidence under the row and start the next row in the same turn. The one report to the dev comes when no row is `Planned` or `In Progress`. Only a §Stop and ask state blocks. A missing asset or a question with a sensible default never does: ship the placeholder or the default, record it as an open checkbox, and go on. Before you end a turn, read the Status column back from the file, never from memory: any other row means keep building, however long the plan. - When every row is verified, retire the plan. A new multi-page effort or a dev-requested re-audit recreates it from current state: passing pages `Awaiting Verification`, drifted pages `Planned` with their deltas named. - **No-plan work** covers one named page: state its source paths and open questions first; the final report carries the verification evidence and any unmet check. If the dev waived a required plan, note once that cross-session memory is lost. - **`NDS-REPORT.md`** holds NDS findings only: a missing API or event, a canon/rule/doc contradiction, a reproducible bug, a rule gap. Give the NDS version, instruction version, component, and a generic repro; never project markup, routes, or data. ## Helper agents Do all NDS work yourself: never hand a page, a row or a check to a helper agent unless the dev asks for one. Each helper reads these rules and the docs again, and browser checks run side by side slow each other down. ## Build **Build entry gate.** Reopen the page's plan row. Before markup, record the work mode, the chosen archetype, template, example, or custom case, the doc sources, and the page's parts list (§Composition cascade) (no-plan work states them). Resolve every open source or path question first. **Chrome first.** Build each required page shape once, then its pages. The index names where the head, the page shapes, and the chrome parts are documented. 1. **Head:** copy the head canon as a unit. Rewrite asset URLs only; never remove or reorder entries. Under a CSP, apply the docs' CSP guidance to the head. 2. **Page shape:** copy the shape's canon and swap the content; never recreate it from prose. - Layout state (the shape's classes) is in the first HTML the browser paints. A client-rendered app follows the page layout doc's framework rules for its layout classes and mount element. - Set both `<html lang>` and `dir`: `rtl` for a right-to-left language (Arabic `ar`, Urdu `ur`, Persian `fa`), `ltr` for the rest. 3. **Brand:** the project logo replaces the template's; drop the brand text when the logo already carries the name. **Copied chrome ships as-is:** every chrome part the page shape's canon carries. Record each part as a plan checkbox only the dev ticks to remove it; never infer affiliation. The one exception is the digital stamp: it claims a government verification, so the plan review asks whether the site holds it, and it ships only if so. Before page #2, wire project-backed controls to real session, API, or route data; remove what the project cannot back. Never ship an invented identity or a dead widget: a copied link or control with no real target, such as a footer link with no page behind it, is removed even from chrome, with a plan checkbox naming it. ### Composition cascade Match by each entry's fit line (the index names the field) across the catalog's templates, examples, and components, never by title. Read every fit line, unfiltered: a keyword search may confirm a match, never pick the candidates. Then: 1. A matching template → copy it. 2. No template → the closest example: its parts are a floor, its markup is not copied as is. 3. No match → a custom scaffold inside red line #4, reusing canonical wiring patterns. Keep the matched source's structure and put the project's content into every part; never rebuild it. It is a floor, not a ceiling: add the sections the project needs, matched through the catalog. With an example or a custom scaffold, each part's markup comes from that component's own doc, never from the example. A family's `Built and Verified` archetype outranks the cascade for its siblings. Screens that share one app shell (one layout with the same navigation) keep that shell's page shape: a matched template supplies the content inside it, never a different page shape. At each page start, resolve its recorded questions, list every UI part, and match each against the component catalog: every field, control and state is a part, so a date field is matched like a table, and so is each state the page can reach (signed out, empty, loading, failed, not found, denied, success). Name each part by the job it does, never by the legacy class or element it replaces. Record the list under the page's plan row before the first line of markup, one line per part: `part → component`, where the component is a catalog entry's name, never a bare HTML tag such as `select`, followed by every line of that component's doc that limits its use (never, only, do not) (no-plan: in the final report). ### Authority by concern The existing UI means the screens being replaced, never a separate app. | Concern | Authority | |---|---| | Required content, fields, order, business outcomes | Existing UI; the dev brief when there is none | | Routes, views, client state, asset paths, load order | Project frontend | | APIs, authentication, permissions, validation, data rules | Project backend | | Page structure, component markup, classes, ARIA, `data-*`, component interactions | NDS canonical sources | A conflict between the existing UI and a backend contract is the dev's decision: report it, never guess. ### Design choices **NDS UI outranks the legacy UI.** The existing UI sets the content, fields, order, and outcomes a page carries, never how they are presented, and never a component's feature set: a legacy page that lacked a control is missing a default, not drawing a scope boundary. Search, sorting, filtering, export, counts, validation chrome (how a check shows, never which fields it requires), and responsive behavior are NDS defaults, not questions; they never change business rules or backend contracts. Map every part a matched source ships to the project's data, each in the type its doc picks. Legacy filtering by one thing is no reason to ship one facet. - An existing page without a hero still gets the hero its page shape names. - A different required presentation picks a documented NDS variant first; it never changes a component's canonical anatomy. - A form that needs a confirmation before it submits, such as an application, a booking or a payment, ends with a review step; add input steps only when the flow needs them. A simple form, such as a contact form, stays one screen and shows a status or redirects after it sends. A terminal confirmation is not an input step: keep the success step the source ships. - Greenfield only: remove a template section the brief does not cover; never invent content to fill one. - Data scale follows the existing API: an endpoint that returns the full set → fetch once and let the NDS components filter, sort, page, and export in the browser; an endpoint that pages, sorts, or filters on the server → wire the NDS controls to its parameters. A shape that misfits the data → report it; backend changes are the dev's. **Replacing a legacy library:** name the capability, search the catalog, compose NDS components if needed, and port its callbacks through NDS methods and events. Truly uncovered → vanilla JS inside red line #4; never the legacy library for one widget. ### JS wiring Before listening on NDS elements or writing NDS-owned attributes, read the component's JS API (the index names where). If NDS ships a behavior, use its methods and events; never rebuild it. Before hand-writing fetch, debounce, resize, state, text, or date logic, read the core APIs the index names. - Every request needs a visible failure path (form or component status, or an alert), exercised in §Verify. - If NDS has no surface you need, direct code is allowed: comment what you checked. **Build exit gate.** Before §Verify: - Name the canonical page source and the doc sources used. - Point to the recorded parts list: every part, state, and behavior matched through the catalog and the docs, each part with its use-limit lines. - List the matched source's facets, controls, and columns beside the page's: equal counts, or each difference named. - Confirm every structural change is one of red line #3's allowed edits. - Check every icon name in the page HTML and its JS against the icon catalog: the audit cannot see names inside JS strings. - Under a strict CSP, find every inline style the copied markup carries and convert it as the docs show. Record the evidence under the plan row (no-plan: in the final report). An unmet check stays open: the row stays `In Progress`. ## Verify **Verify entry gate.** The §Build exit evidence is recorded. Open the built reference page that matches yours (the index names where built pages are and how to serve them). Never verify from code inspection. A page needs both browser passes: - **Behavioral:** load it, run the template's audit, and fix or name every finding. Exercise the wired behavior, including one request failure path. Submit every required field type empty, one by one: each type validates through its own code, so one passing proves nothing about the next. - **Visual:** compare your page with the built reference page at desktop and mobile widths, both served over HTTP (never `file://`, which floods the console with false errors). **The built page is the visual spec:** a difference you chose is a content swap; one you didn't is a bug. Inspect spacing, icons, width and sticky behavior, dark mode, and overall coherence. Measurements alone are not visual verification. - **Every state:** run both passes, the audit included, on each state in the parts list, not only the default one. Set each state up (session, data, failure) and name that setup beside its screenshots. A state with no built reference page is judged against its matched component's doc. - **After an edit:** both passes and the audit run on each changed page, in the states the change touches, unless the index names a lighter re-check for that kind of edit. A change to a shared file (a layout, partial, stylesheet, or script) reopens every page that loads it. **Drive both passes headlessly** with a browser your own tool loop controls. Keep scratch files (a verify config, a probe script, temporary tooling) in `tmp/` at the project root, listed in `.gitignore` and kept out of the build; never add them to the project's own `package.json` or lockfile. Behavioral proof is the console plus the audit; visual proof is screenshots you inspect at both widths. **Set the viewport, never the window.** OS window minimums clamp small widths while screenshots still crop to the requested size, faking a responsive failure. Use Puppeteer `page.setViewport()`, a Playwright context `viewport`, or CDP `Emulation.setDeviceMetricsOverride`; never `--window-size` or a window resize. No CDP-capable tool? Set one up: `puppeteer-core` or Playwright in the project's `tmp/`, pointed at the installed Chrome. The viewport is unmet only after that attempt fails. Before trusting a screenshot, read `window.innerWidth`: it must equal the target, or the viewport is wrong, not the page. Claim "cannot see the page" only after the headless attempt fails, and report the failure. Then take the first available fallback and report what stays unverified: 1. An existing browser tool or harness, authenticated sessions included. An unreachable viewport stays unmet. 2. A smoke check: `curl -sI` for status and CSP; `curl -s` for an intact head and scripts, server errors, and forbidden inline styles under a strict CSP. 3. The dev checklist: [VERIFICATION CHECKLIST FOR DEV] - [ ] Check the console for NDS warnings and the audit's findings. - [ ] Test responsiveness at mobile width. - [ ] Check expected spacing. - [ ] Check every icon renders as a glyph. - [ ] Check dark mode on page content. **Verify exit gate.** Record under the plan row (no-plan: in the final report): - the audit result, exercised behavior, and failure-path result; - the built reference page and the inspected desktop screenshot; - the mobile target width, the equal `window.innerWidth`, and the inspected mobile screenshot; - each state from the parts list, its setup, and its inspected screenshots at both widths; - for a page re-checked without screenshots (a lighter re-check the index names): that result, with the screenshots inspected before the edit standing for the three items above; - the icon, dark-mode, and strict-CSP results that apply; - every unmet item, with what blocks it. A check you can run is never unmet: run it. An unmet item keeps the row `In Progress`; no-plan work reports the page unverified. With every agent-owned check passed, a row may move to `Awaiting Verification` (no-plan: report that it awaits the dev). Only dev confirmation makes a page `Built and Verified`. ## Upgrade - An explicit upgrade request is approval. - A request to update the rules or instructions is not an upgrade: it runs only §This file's Update. - An update check compares the runtime banner with the latest release and reports relevant changelog entries, and compares the project-root `NDS-IQ.md` with raw main as §This file's Update does. It reports both, and upgrades or installs only on dev approval. - Write with absolute paths, never `cd` into `NDS_ROOT` or `NDS_ASSETS`, and inspect each destination after writing. 1. **Compare versions:** the runtime banners in `NDS_ROOT` and `NDS_ASSETS`. 2. **Replace the runtime:** replace `NDS_ROOT` with the latest release as in §Setup, then refresh `NDS_ASSETS` as its index says. Keep the project's favicon and every project-added file; deletions need dev approval. Work done under earlier rules passes §Plan's conformance check first. 3. **Sweep the pages:** follow the Upgrade section of the new `NDS-INDEX.md` on every page, not only the ones you touched. Add the affected work to `NDS-PLAN.md`, map it to pages, execute, and report. Also report useful new and changed features for the dev to choose. 4. **Update this file** (below). ## This file Two pieces: **`NDS-IQ.md`** at the project root, replaced whole on update, from `https://raw.githubusercontent.com/mazin-musleh/NDS-vanilla/refs/heads/main/_includes/NDS-IQ.md`; and **the anchor** in `CLAUDE.md` / `AGENTS.md`, holding the only project paths and the read trigger, installed once. **Update:** compare raw main's content with the project-root copy; any difference is a newer revision, installed on dev approval (an explicit update request is approval). Download with curl or the stack's HTTP client, never a web-fetch tool. Accept it only if line 1 starts `# NDS IQ`; otherwise discard and retry once, and after a second failure report it and keep the installed copy. Replace the root copy whole (no merging, anchor untouched), then read it again before continuing. **First install:** download the raw file to the project root, add the anchor with `NDS_ROOT=.nds/` and `NDS_ASSETS` as a placeholder until the plan review confirms it, then run the §Plan inventory, create `NDS-PLAN.md`, and ask the review. §Setup copies the runtime once the answers confirm `NDS_ASSETS`. The anchor, with `NDS_ASSETS` set to the project's static folder, relative to the project root: ```markdown ## NDS — National Design System (UI layer) - `NDS_ROOT` = `.nds/` - `NDS_ASSETS` = `public/assets/` All UI in this project is built with NDS. Before any UI, page, component, styling, or asset work — or when unsure whether a task touches NDS — read `NDS-IQ.md` at this project's root, top to bottom, once per session. Do no NDS work before that read. A compacted or summarized context starts a new session: read the file again before more NDS work. If the file is missing, stop and ask the dev. These hold even before the read: - Never edit anything under `NDS_ROOT`; never hand-edit NDS files in `NDS_ASSETS`. - Never write `.nds-*` markup from memory — copy from the sources `NDS-IQ.md` names. ``` **Anchor update:** if the compacted-context sentence is missing, add it exactly; change nothing else.
تاريخ آخر تعديل: 27/11/2026 - 04:09 PM
Was this page useful?
60% of users said Yes from 2843 Feedbacks