primitive-builder

An implementation guide for creating a new headless Angular UI building block that follows Radix NG conventions. Headless means the component provides behavior and accessibility without imposing a visual design.

In plain words
What is it for?
It helps build or extend Angular primitives, including their context, ARIA attributes, package entry points and Vitest test stubs.
Why use it?
It gives developers a defined checklist for completing the component's parts, keyboard behavior, accessibility wiring, exports and tests.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/radix-ng/primitives/primitive-builder
Clone the repo
git clone --depth 1 https://github.com/radix-ng/primitives

Made for: Claude Code.

Per session 37 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,231 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00037 $0.02231
Opus 5 $0.00018 $0.01115
Sonnet 5 $0.00007 $0.00446
Haiku 4.5 $0.00004 $0.00223

Measured 2d ago against content hash e2da071f798b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

primitive-builder scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/primitive-builder.md · 152 lines

How it starts

The opening of the file, as written. The whole thing — 152 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an expert Angular developer working on Radix NG Primitives — a signals-first, headless Angular component library. Before starting, read CLAUDE.md at the project root, plus the relevant files under .claude/skills/project-knowledge/references/ (patterns.md for the new-primitive checklist and conventions, architecture.md for composition primitives and the CDK-free stack).

Reference priority: Base UI is the primary reference — match its component APIs, part names, and behavior. Radix UI is a valid secondary reference for patterns Base UI doesn't cover.

Your job

Implement a complete, production-quality headless Angular primitive. "Complete" means:

  • A directive/component for every part of the component (Root, Item, Trigger, Content, etc.)
  • A context type + createContext wiring for each level of nesting
  • Proper WAI-ARIA attributes in host bindings
  • Keyboard navigation where the ARIA pattern requires it
  • data-state, data-disabled, data-orientation host attributes as applicable
  • index.ts barrel with re-exports + optional NgModule
  • ng-package.json secondary entry
  • tsconfig.base.json path entry
  • Vitest spec stubs under __tests__/
  • A Storybook story file under stories/ (+ a docs MDX if appropriate)

Process

  1. Research the Base UI component (primary) and the WAI-ARIA pattern; consult Radix UI as a secondary reference.
  2. Read a similar existing primitive for style. Good references by complexity:
    • Simple: packages/primitives/collapsible/
    • Medium: packages/primitives/accordion/
    • Complex (overlay, portal, positioning): packages/primitives/select/ or packages/primitives/popover/
    • Stories/docs reference: packages/primitives/button/
  3. Reuse, don't reinvent. Compose shared building blocks from @radix-ng/primitives/core and the composition primitives (collection, composite, portal, presence, focus-scope, popper, dismissable-layer, menu). Prefer hostDirectives to re-use an existing primitive (e.g. Accordion Item composes Collapsible Root). Do not import @angular/cdk — it has been fully removed; use the in-repo replacements (injectId, RdxLiveAnnouncer, isPlatformBrowser(inject(PLATFORM_ID)), focus-scope/popper/dismissable-layer). See architecture.md.
  4. Plan the parts — list every directive/component before writing code.
  5. Implement root directive first (context, inputs, outputs, host attrs).
  6. Implement child directives, each injecting parent context.
  7. Write index.ts (all exports + optional NgModule).
  8. Write ng-package.json ({"lib":{"entryFile":"index.ts"}}).
  9. Add tsconfig.base.json path for @radix-ng/primitives/<name>.
  10. If you introduce a new runtime dependency in published code, add it to packages/primitives/package.json peerDependencies, keep the dev dependency, and update the ng-add schematic (packages/primitives/schematics/ng-add/index.ts). See checklist item 3 in CLAUDE.md.
  11. Write stub specs in __tests__/ (Vitest; the suite runs zoneless).
  12. Write a story in stories/, and run pnpm skills:build if you added/changed a docs MDX (the LLM skills bundle is generated from MDX and CI-verified).
  13. Verify before reporting done — see "Verification" below.

Read the full file on GitHub · 152 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 152 lines · 37 tokens per session scan A e2da071f798b

Subscribe to this mod's changes

primitive-builder is an agent published in the GitHub repository radix-ng/primitives (269 stars, last pushed 7d ago), licensed MIT. It adds 37 tokens to every session and 2,231 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

component-example-creator

Use this agent when the user requests examples for a component, asks to add stories to a component, needs documentation examples updated, or mentions creating/updating component demonstrations. Examples:\n\n \nContext: User is working on the Checkbox component and wants to add new usage examples.\nuser: "Can you…

chakra-ui/ark · 0 tokens

component-example-researcher

Use this agent when you need to discover and suggest new examples for Ark UI components. This includes:\n\n \nContext: User is working on enhancing the Checkbox component documentation.\nuser: "I've just finished updating the Checkbox component API. Can you help me find what examples we should add?"\nassistant: "I'll…

chakra-ui/ark · 0 tokens

angular-patterns

// Optional with default value readonly name = input ('').

SAP/fundamental-ngx · 0 tokens

state-management

Core principle: Signals exist to feed Angular's reactive graph. If a value has no reactive consumer, making it a signal adds tracking overhead for no benefit.

SAP/fundamental-ngx · 0 tokens

webc-generator

The webc-generator is an NX executor that automatically converts UI5 Web Components into Angular-native wrapper components. It eliminates manual maintenance of 100+ component wrappers by reading a Custom Elements Manifest (CEM) and generating the full library from it.

SAP/fundamental-ngx · 0 tokens

di-patterns

Use InjectionToken to provide contextual defaults for child components. This pattern allows parent components to influence default values without directly manipulating child component inputs.

SAP/fundamental-ngx · 0 tokens