Логотип Nav Dekoratoren

Nav Dekoratoren

Організація
navikt
nav-dekoratoren

Інтегруйте, налаштовуйте й перевіряйте Nav Dekoratøren — спільні верхній і нижній колонтитули для застосунків nav.no. Використовуйте цю навичку, коли команда впроваджує Dekoratøren, перевіряє наявну інтеграцію, оновлює конфігурацію, додає breadcrumbs/перемикач мови/аналітику (Innblikk), налаштовує згоду (ekomloven), CSP або усуває проблеми з інтеграцією Dekoratøren.

Add to TypingMind

Огляд

Видавецьnavikt
Репозиторійcopilot
Назва навичкиnav-dekoratoren
Зірки
60
Форки
16
Файли в пакеті
6
ЛіцензіяMIT
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Файлів у комплекті: 6

    Скрипти, шаблони й довідкові матеріали, які модель може читати під час роботи. Файли доступні лише для читання й ніколи не виконуються.

  • Відкритий вихідний код

    Видавець на GitHub: navikt. Перед установленням перегляньте вихідні файли навички.

Встановлення

Установіть навичку ШІ Nav Dekoratoren у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки на GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до розділу «Плагіни» → «Навички».
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/navikt/copilot/tree/main/skills/nav-dekoratoren
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Додати навичку → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/navikt/copilot.git /tmp/copilot
mkdir -p .claude/skills
cp -r /tmp/copilot/skills/nav-dekoratoren .claude/skills/nav-dekoratoren
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Nav Dekoratoren в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Nav Dekoratoren, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для певного постачальника, тому навичка Nav Dekoratoren не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож поки навичка не потрібна, токени на її інструкції не витрачаються.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

Nav Dekoratøren – integration

Dekoratøren is the shared header and footer for public-facing nav.no applications. It provides SSR/CSR integration, login buttons via ID-porten, analytics (Innblikk, Umami-based) and consent and cookie handling under the Norwegian Electronic Communications Act (ekomloven). Dekoratøren does not give the app access to the user's login session. Set up authentication and access control in the app itself.

Slack: #dekoratøren_på_navno Repo: https://github.com/navikt/nav-dekoratoren Documentation: https://github.com/navikt/nav-dekoratoren/blob/main/README.md Modules package: https://github.com/navikt/nav-dekoratoren-moduler Storybook: https://navikt.github.io/nav-dekoratoren

Without Dekoratøren? Use the innblikk skill (skills/innblikk).


Step 1: Find out what the team needs

If you have access to the code, start by inspecting the repository. Look for:

  1. Purpose – does the app already use Dekoratøren, or is this a first integration?
  2. Framework – Next.js app/ (App Router), Next.js pages/ (Page Router), Remix / React Router framework mode, Vite SPA / React Router library mode, or plain Node/Express.
  3. Environment – prod, dev, localhost, an existing nais.yaml, and whether service discovery is available.
  4. Needs – breadcrumbs, language selector, analytics, chatbot, consent/cookies, CSP and skip link.

Only ask about what you cannot find in the repository or what requires a product decision. Then follow steps 2–7 and the relevant references. If the app already uses Dekoratøren and the team wants to check the setup or troubleshoot, go to Auditing an existing integration.


Step 2: Installation and setup

2.1 Install the modules package

bash
npm install --save @navikt/nav-dekoratoren-moduler

The package is published only on GitHub Packages. Add to .npmrc:

text
@navikt:registry=https://npm.pkg.github.com

Log in with a PAT that has the read:packages scope and navikt SSO authorization:

bash
npm login --registry=https://npm.pkg.github.com --auth-type=legacy

2.2 GitHub Actions

yaml
- uses: actions/setup-node@v4
  with:
      registry-url: "https://npm.pkg.github.com"

- run: npm ci
  env:
      NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}

2.3 Access policy in nais.yaml

With service discovery (recommended, used automatically on dev-gcp/prod-gcp):

yaml
accessPolicy:
    outbound:
        rules:
            - application: nav-dekoratoren
              namespace: personbruker

With external ingresses (if serviceDiscovery: false):

yaml
accessPolicy:
    outbound:
        external:
            - host: www.nav.no # prod
            - host: dekoratoren.ekstern.dev.nav.no # dev

Step 3: SSR integration (recommended)

Server-side rendering gives the best performance and avoids layout shift. See SSR-FUNCTIONS.md for full API details. The modules package tries to fetch Dekoratøren three times before it falls back to static placeholders rendered on the client. With SSR on Nais, the package sets teamName to NAIS_APP_NAME.NAIS_NAMESPACE automatically for consumer logging. The variables are read when Dekoratøren is fetched, so they exist only at runtime on Nais, not in the build step. Without them the package warns once and uses params.teamName if you set it manually. See consumer logging for direct SSR calls or CSR.

3.1 Next.js App Router

Use this for new Next.js apps and apps that already have app/. The root layout can be async and fetch Dekoratøren directly. Keep dynamic = "force-dynamic" so the layout is not prerendered at build time (see 3.4). Next.js rejects this export when cacheComponents is enabled; in that case call await connection() from next/server before fetchDecoratorReact instead, and follow the Next.js Cache Components guide for Suspense boundaries.

tsx
// app/layout.tsx
import { fetchDecoratorReact } from "@navikt/nav-dekoratoren-moduler/ssr";
import type { ReactNode } from "react";
import Script from "next/script";

// Render per request so Dekoratøren is not frozen at build time (see 3.4)
export const dynamic = "force-dynamic";

export default async function RootLayout({
    children,
}: {
    children: ReactNode;
}) {
    const Decorator = await fetchDecoratorReact({
        env: "prod",
        params: {
            context: "privatperson",
            language: "nb",
            origin: "min-app",
        },
    });

    return (
        <html lang="nb">
            <head>
                <Decorator.HeadAssets />
            </head>
            <body>
                <Decorator.Header />
                {children}
                <Decorator.Footer />
                <Decorator.Scripts loader={Script} />
            </body>
        </html>
    );
}

3.2 Next.js Page Router

Use this only for existing Next.js apps with pages/. In the Page Router, Dekoratøren must be fetched in pages/_document.tsx, because _document owns <html>, <head> and the server-rendered HTML shell. _document alone does not make pages dynamic: every page that shows Dekoratøren must be rendered per request, for example with getServerSideProps (see 3.4).

tsx
// pages/_document.tsx
import {
    fetchDecoratorReact,
    type DecoratorComponentsReact,
} from "@navikt/nav-dekoratoren-moduler/ssr";
import Document, {
    Head,
    Html,
    Main,
    NextScript,
    type DocumentContext,
    type DocumentInitialProps,
} from "next/document";

type MyDocumentProps = DocumentInitialProps & {
    Decorator: DecoratorComponentsReact;
};

class MyDocument extends Document<MyDocumentProps> {
    static async getInitialProps(
        ctx: DocumentContext,
    ): Promise<MyDocumentProps> {
        const initialProps = await Document.getInitialProps(ctx);
        const Decorator = await fetchDecoratorReact({
            env: "prod",
            params: {
                context: "privatperson",
                language: "nb",
                origin: "min-app",
            },
        });

        return { ...initialProps, Decorator };
    }

    render() {
        const { Decorator } = this.props;
        return (
            <Html lang="nb">
                <Head>
                    <Decorator.HeadAssets />
                </Head>
                <body>
                    <Decorator.Header />
                    <Main />
                    <Decorator.Footer />
                    <Decorator.Scripts />
                    <NextScript />
                </body>
            </Html>
        );
    }
}

export default MyDocument;

3.3 Express/Node (HTML fragments)

ts
import { fetchDecoratorHtml } from "@navikt/nav-dekoratoren-moduler/ssr";

const {
    DECORATOR_HEAD_ASSETS,
    DECORATOR_HEADER,
    DECORATOR_FOOTER,
    DECORATOR_SCRIPTS,
} = await fetchDecoratorHtml({
    env: "dev",
    params: { context: "privatperson", origin: "min-app" },
});

For direct calls without the modules package, send teamName as a query parameter on /ssr, for example https://www.nav.no/dekoratoren/ssr?teamName=team-navno.navno. With service discovery the address is http://nav-dekoratoren.personbruker/ssr?teamName=team-navno.navno, without /dekoratoren before /ssr. teamName must have the form teamnavn.namespace: lowercase, at least one dot, and only a-z, 0-9, - and .. origin is used for analytics and does not replace teamName.

3.4 Avoid static generation of pages with Dekoratøren

Dekoratøren must be fetched at runtime, per request or from the modules package cache. If Next.js builds the page as static HTML, Dekoratøren's HTML, CSS and version ID are frozen at build time. After the next Dekoratøren deploy, the page mixes old CSS with new HTML from /auth and other endpoints, and the logged-in menu, for example, can render incorrectly. Rebuilding the app fixes it until the next deploy. teamName is also missing: the modules package reads NAIS_APP_NAME and NAIS_NAMESPACE when Dekoratøren is fetched, and they exist only in the pod on Nais, not in the build step (for example GitHub Actions or Docker build). When the page is rendered per request, for example with getServerSideProps, _document runs in the pod and teamName is set automatically.

When you inspect a repository, look for:

  • Page Router: _document also runs for statically generated pages. That covers pages with getStaticProps and pages without data fetching (Automatic Static Optimization). Replace getStaticProps with getServerSideProps. Pages without data fetching can be made dynamic one by one with getServerSideProps, or for the whole app with getInitialProps in pages/_app.tsx. The latter does not apply to pages with getStaticProps. next build marks static pages with ○ or ● and dynamic pages with ƒ.
  • App Router: routes without dynamic APIs are prerendered in the build step. Make the root layout dynamic with export const dynamic = "force-dynamic";, or call await connection() from next/server before fetchDecoratorReact. Apps with cacheComponents enabled must use connection(), because Next.js rejects the dynamic export there.
ts
// pages/minside.tsx (Page Router)
export async function getServerSideProps() {
    return { props: {} };
}

If the app cannot be made dynamic yet, set teamName manually in params (for example teamName: "min-app.mitt-namespace") so the requests can at least be traced. This does not fix the version problem.

3.5 Cache invalidation

ts
import { addDecoratorUpdateListener } from "@navikt/nav-dekoratoren-moduler/ssr";

addDecoratorUpdateListener({ env: "prod" }, (versionId) => {
    console.log(`Ny dekoratørversjon: ${versionId} – tømmer cache`);
    myHtmlCache.clear();
});

Step 4: Configuration

See PARAMS.md for every parameter with type and default value.

The most important:

ParameterTypeDefault
contextprivatperson / arbeidsgiver / samarbeidspartnerprivatperson
languagenb / nn / en / se / pl / uk / runb
breadcrumbs{ title, url, handleInApp? }[][]
availableLanguages{ locale, url, handleInApp? }[][]
simplebooleanfalse
chatbotbooleantrue
redirectToAppbooleanfalse
logoutWarningbooleantrue
feedbackbooleanfalse
originstringundefined

language accepts every language in the table, but text in Dekoratøren's own interface exists only in Norwegian Bokmål, English and partly Northern Sami. URLs containing /no/, /nb/, /nn/, /en/ or /se/ can override language. URLs in breadcrumbs and availableLanguages must be on nav.no or a subdomain; otherwise Dekoratøren responds with 500.

Use redirectToUrl or redirectToUrlLogout for the return address after login and logout respectively. Both reject URLs outside nav.no and its subdomains. Do not confuse them with logoutUrl: it hands all of logout, including deleting cookies and sessions, to the app. If you turn off logoutWarning, the app must let the user postpone logout itself. See all parameters.


Step 5: Client-side features

See CLIENT-FUNCTIONS.md for complete examples.

5.1 Breadcrumbs

Use handleInApp: true when the app handles navigation itself. Replace navigateTo with the framework's router, for example router.push in Next.js or navigate from React Router. title is logged to Innblikk (Umami-based) as [redacted]. Set analyticsTitle only to text without personal data if you want to log a title.

ts
import {
    setBreadcrumbs,
    onBreadcrumbClick,
} from "@navikt/nav-dekoratoren-moduler";

setBreadcrumbs([
    { title: "Ditt Nav", url: "https://www.nav.no/person/dittnav" },
    {
        title: "Kontakt oss",
        url: "https://www.nav.no/person/kontakt-oss",
        handleInApp: true,
    },
]);

onBreadcrumbClick((breadcrumb) => {
    navigateTo(breadcrumb.url);
});

5.2 Language selector

The same pattern applies to language selection with handleInApp: true.

ts
import {
    setAvailableLanguages,
    onLanguageSelect,
} from "@navikt/nav-dekoratoren-moduler";

setAvailableLanguages([
    { locale: "nb", url: "https://www.nav.no/min-side/nb" },
    { locale: "en", url: "https://www.nav.no/min-side/en", handleInApp: true },
]);

onLanguageSelect((language) => {
    navigateTo(language.url);
});

5.3 Analytics (Innblikk, Umami-based)

Pass the app's technical name as origin in the decorator parameters. The value is added to automatic besøk events, so page views can be filtered per app. When the parameter is omitted, besøk events use the value nav-dekoratoren. Dekoratøren does not send Innblikk events without consent. The logger still accepts the calls and discards them locally. Query parameters are stripped from page views by default; use analyticsQueryParams only for names whose values cannot contain personal data. Changing analyticsRedactFilter requires a separate risk assessment.

ts
import { getAnalyticsInstance, Events } from "@navikt/nav-dekoratoren-moduler";

const logger = getAnalyticsInstance("min-app");

// Taxonomy event (strictly typed from @navikt/analytics-types)
logger(Events.SKJEMA_STARTET, { skjemaId: "1234", skjemanavn: "aap" });

// Custom event
logger.custom("feedback åpnet", { komponent: "feedback-widget", steg: 2 });

⚠️ getAmplitudeInstance() was removed in v4+. Use getAnalyticsInstance().

5.4 Chatbot

ts
import { openChatbot } from "@navikt/nav-dekoratoren-moduler";

openChatbot(); // opens Frida and sets chatbotVisible=true

Step 6: Consent and cookies (ekomloven)

See CONSENT.md for details. Keys must be on the allowlist. Consent alone does not make an unknown key allowed.

ts
import {
    awaitDecoratorData,
    isStorageKeyAllowed,
    setNavCookie,
    getNavCookie,
    navLocalStorage,
} from "@navikt/nav-dekoratoren-moduler";

// Wait until Dekoratøren has loaded consent
await awaitDecoratorData();

// Replace with a key registered as a cookie on the allowlist
if (isStorageKeyAllowed("registrert-cookie")) {
    setNavCookie("registrert-cookie", "verdi");
}

// Use a key registered for localStorage
navLocalStorage.setItem("registrert-localstorage-nøkkel", "verdi");

Step 7: CSP header

Use buildCspHeader to combine the app's CSP with the directives Dekoratøren needs. With a direct integration, the app must keep its CSP in sync with /dekoratoren/api/csp itself.

ts
import { buildCspHeader } from "@navikt/nav-dekoratoren-moduler/ssr";

const csp = await buildCspHeader(
    { "default-src": ["min-cdn.nav.no"], "style-src": ["css.nav.no"] },
    { env: "prod" },
);

res.setHeader("Content-Security-Policy", csp);

Skip link

Dekoratøren shows a link to the main content when the document has an element with id="maincontent". Make the element focusable so keyboard focus moves there:

html
<main id="maincontent" tabindex="-1">Appens innhold</main>

Auditing an existing integration

When the team wants to check an existing integration, or a bug shows up only now and then (for example after a Dekoratøren deploy), follow the checklist in AUDIT.md. Start with static generation (3.4), the most common cause.


Common errors and fixes

ProblemCauseFix
403 on npm installMissing PAT or SSOCreate a PAT with read:packages, enable navikt SSO
Dekoratøren does not showMissing access policyAdd nav-dekoratoren to accessPolicy.outbound.rules
Layout shiftCSR is usedSwitch to SSR via fetchDecoratorReact
Cookie not setConsent not obtainedUse awaitDecoratorData() + setNavCookie
getAmplitudeInstance is not a functionModules v4+ (API changed)Upgrade to v4+ and switch to getAnalyticsInstance
availableLanguages URL errorURL outside nav.noOnly nav.no and subdomains are allowed
Consumer shows as unknownMissing teamNameSet teamName for direct SSR calls and CSR with modules
unknown even with SSR and modules 4.5+The page is built staticallyMake the page dynamic, see 3.4
Header or logged-in menu wrong after a decorator deploy, fixed by redeployThe page is built staticallyMake the page dynamic, see 3.4

Environments and ingresses

EnvironmentService hostIngress
prodhttp://nav-dekoratoren.personbrukerhttps://www.nav.no/dekoratoren
devhttp://nav-dekoratoren.personbrukerhttps://dekoratoren.ekstern.dev.nav.no
betahttp://nav-dekoratoren-beta.navnohttps://dekoratoren-beta.intern.dev.nav.no
beta-tmshttp://nav-dekoratoren-beta-tms.navnohttps://dekoratoren-beta-tms.intern.dev.nav.no

⚠️ Beta instances are only for internal testing by Team Nav.no / Team Min Side and may be unstable.

Файли в пакеті

Модель читає ці файли за потреби, поки навичку завантажено. Вони доступні для читання й ніколи не виконуються.

Поширені запитання

Що робить навичка ШІ Nav Dekoratoren?

Інтегруйте, налаштовуйте й перевіряйте Nav Dekoratøren — спільні верхній і нижній колонтитули для застосунків nav.no. Використовуйте цю навичку, коли команда впроваджує Dekoratøren, перевіряє наявну інтеграцію, оновлює конфігурацію, додає breadcrumbs/перемикач мови/аналітику (Innblikk), налаштовує згоду (ekomloven), CSP або усуває проблеми з інтеграцією Dekoratøren.

Навіщо використовувати Nav Dekoratoren у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Nav Dekoratoren — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Nav Dekoratoren у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/navikt/copilot/tree/main/skills/nav-dekoratoren. TypingMind прочитає файл SKILL.md, додасть супровідні файли та встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Nav Dekoratoren?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Nav Dekoratoren?

Зі скількома забажаєте. У TypingMind ви можете використовувати Nav Dekoratoren із будь-якою моделлю, яка підтримує навички, зокрема з GPT, Claude, Gemini, Grok, DeepSeek, Mistral чи Llama. Для цього ви використовуєте власні ключі API.

Чи безкоштовна навичка ШІ Nav Dekoratoren?

Так. На GitHub цю навичку публікує navikt за ліцензією MIT. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це набір інструкцій для повторного використання, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти, які вона може викликати, — код, який десь виконується й повертає результат. Натомість навичка ШІ дає моделі знання й пояснює порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі
Логотип affaan-m

Change Impact

affaan-m
СпільнотаПопулярне

Perform evidence-backed impact analysis before changing code, data, interfaces, or governance documents, then compare the planned impact with the actual diff after implementation. Covers call paths,…

41.4K
277.3K
Файлів: 1
Відкрити
Логотип affaan-m

Test Collaboration

affaan-m
СпільнотаПопулярне

Inventory and govern a project's test assets. Connect requirements, business rules, risks, bugs, and cross-boundary contracts to stable TEST-IDs and executable evidence in the repository's existing…

41.4K
277.3K
Файлів: 2
Відкрити
Логотип affaan-m

Product Capability

affaan-m
СпільнотаПопулярне

Перетворюйте задум PRD, запити щодо дорожньої карти або обговорення продукту на готовий до реалізації план можливостей, у якому визначено обмеження, інваріанти, інтерфейси та невирішені питання ще до початку роботи з кількома…

40.4K
270.2K
Файлів: 1
Відкрити
Логотип affaan-m

Django Patterns

affaan-m
СпільнотаПопулярне

Шаблони архітектури Django, проєктування REST API за допомогою DRF, найкращі практики ORM, кешування, сигнали, проміжне програмне забезпечення та створення Django-застосунків промислового рівня.

39.1K
261.1K
Інструкції
Відкрити

Створіть власний робочий простір зі ШІ вже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇