---
name: coding-principles
description: >-
  Enforces engineering, architecture, public API, and code quality standards distilled from human reviewer feedback across A2UI pull requests. Use when authoring new code, refactoring, addressing review feedback, or reviewing PR diffs. Don't use for release publishing or spec blueprint generation without code or PR changes.
metadata:
  internal: true
title: coding-principles
canonical_url: https://skilld.dev/gh/a2ui-project/a2ui/coding-principles
last_updated: 2026-11-12T06:16:11.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [subskills/dart/INDEX.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/dart/INDEX.md), [subskills/dart/versioning-and-releases.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/dart/versioning-and-releases.md), [subskills/public-api-and-cross-framework-design.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/public-api-and-cross-framework-design.md), [subskills/python/architecture-and-facades.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/python/architecture-and-facades.md), [subskills/python/coding-standards-and-verification.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/python/coding-standards-and-verification.md), [subskills/python/INDEX.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/python/INDEX.md), [subskills/swift/coding-standards-and-testing.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/swift/coding-standards-and-testing.md), [subskills/swift/INDEX.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/swift/INDEX.md), [subskills/typescript/accessibility-semantics.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/typescript/accessibility-semantics.md), [subskills/typescript/css-theming-styling.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/typescript/css-theming-styling.md), [subskills/typescript/INDEX.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/typescript/INDEX.md), [subskills/typescript/reactive-lifecycle-performance.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/typescript/reactive-lifecycle-performance.md), [subskills/typescript/references/inspecting-typescript-public-api.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/typescript/references/inspecting-typescript-public-api.md), [subskills/typescript/testing-isolation.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/typescript/testing-isolation.md), [subskills/typescript/typescript-closure-compiler.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/typescript/typescript-closure-compiler.md), [subskills/typescript/yarn-workspace-tooling.md](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/typescript/yarn-workspace-tooling.md).
>
> If the user asked to install this Skill, run `npx skilld install a2ui-project/a2ui/coding-principles`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/coding-principles`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/a2ui-project/a2ui/coding-principles) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/coding-principles`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/coding-principles --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/coding-principles --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Skill: coding-principles

**Purpose**: Core engineering, architecture, and code quality standards established by human reviewers across A2UI pull requests. Used by agents when authoring changes, refactoring code, addressing review feedback, or reviewing pull request diffs to maintain repository health across all languages.

---

## Specification and Blueprint Grounding

Before modifying or implementing code in any language, consult the authoritative specifications and blueprints:

- **Protocol JSON Schemas**: [`specification/v0_9_1/json/`](../../../specification/v0_9_1/json/) and [`specification/v1_0/json/`](../../../specification/v1_0/json/) define wire-format envelopes, types, and validation constraints.
- **Component Catalogs**: [`catalogs/basic/v1/catalog.json`](../../../catalogs/basic/v1/catalog.json) defines standard components, properties, and function signatures.
- **Core Module Blueprint**: [`a2ui_core.blueprint.md`](../../../blueprints/modules/a2ui_core.blueprint.md) specifies state containers (`DataModel`, `SurfaceModel`), `MessageProcessor`, JSON pointer rules, auto-vivification, and error semantics.
- **Agent SDK Blueprint**: [`a2ui_agent.blueprint.md`](../../../blueprints/modules/a2ui_agent.blueprint.md) specifies `A2uiGenerator`, `A2uiRequestProcessor`, inference format strategies, and prompt generation.
- **Framework Adapter Blueprint**: [`a2ui_framework_adapter.blueprint.md`](../../../blueprints/modules/a2ui_framework_adapter.blueprint.md) specifies view mapping, reactive subscription lifecycles, and layout behavior.
- **Typesafe Builder Blueprint**: [`typesafe_builder_api.blueprint.md`](../../../blueprints/features/typesafe_builder_api.blueprint.md) specifies fluent builder hierarchies.
- **Reference Implementation**: [`typescript/core/web_core/`](../../../typescript/core/web_core/) serves as the canonical behavioral reference for edge-case resolution.

---

## Progressive Discoverability: Two-Level Subskill Routing

Because the A2UI repository spans multiple languages (`typescript/`, `python/`, `dart/`, `swift/`) and shared specifications (`specification/`, `catalogs/`), agents must use a two-level progressive discovery workflow:

1. **Level 1 (Cross-Language Subskills)**: Activate language-agnostic principles that govern pull request scope, software design, public API boundaries, specification immutability, and changelogs across the entire monorepo.
2. **Level 2 (Language-Specific Routing)**: Route by the programming languages modified in the diff to load only the subskills and language guides relevant to those languages.

### Step 1: Inspect the PR Diff

Review the modified files and categories of changes:

```bash
# In an active branch:
git diff main --stat
```

Identify both:

- **Cross-cutting functional areas** impacted (public exports, specifications, catalogs, changelogs, PR structure).
- **Programming languages and directories** touched (`typescript/`, `python/`, `dart/`, `swift/`, `samples/`, `tools/`).

---

### Step 2: Activate Cross-Language Subskills (Language-Agnostic)

Evaluate the cross-language subskills below against the diff and read any activated document in full:

#### 1. PR Hygiene, Atomicity, Scope Control & Software Design

- **Skill**: [`pr-hygiene`](../pr-hygiene/SKILL.md)
- **Activate if**: Always applicable when authoring, preparing, or reviewing a pull request.

#### 2. Public API Boundaries, Cross-Framework Design & Changelogs

- **Document**: [`subskills/public-api-and-cross-framework-design.md`](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/public-api-and-cross-framework-design.md)
- **Activate if**:
  - Any package entrypoint or facade (`index.ts`, `public-api.ts`, `package.json`, `__init__.py`, `lib/*.dart`, or public Swift API), or any `CHANGELOG.md` is modified.
  - Any new class, function, interface, type, model, or DI token is exported.
  - Renderer APIs, registration helpers, or adapters across `@a2ui/angular`, `@a2ui/lit`, `@a2ui/react`, `a2ui_flutter`, or `A2UISwiftUI` are modified.
  - Imports between sibling packages change.
  - Files under `specification/` or `catalogs/` (schemas, catalog fixtures, or examples) are modified or added.
  - Breaking changes or public API deprecations are introduced.
  - A new source file is added (verify it has a single responsibility rather than acting as a catch-all `types.*` or `utils.*` file).

#### 3. Updating Changelogs (`CHANGELOG.md`)

- **Skill**: [`update-changelog`](../update-changelog/SKILL.md)
- **Activate if**: Any `CHANGELOG.md` is modified or a published package's public API or consumer-observable behavior changes.

---

### Step 3: Route by Language for Language-Dependent Principles

Inspect the file extensions and directories in `git diff main --stat` and follow the matching language route(s) below. Only load routers and guides for languages present in your diff:

| Language / Ecosystem                                            | Matching Paths & Extensions                                                              | Progressive Discovery Target                                                                                                                                                                                                   |
| :-------------------------------------------------------------- | :--------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **TypeScript & Web** (Lit, Angular, React, Web Core, CSS, HTML) | `*.ts`, `*.tsx`, `*.css`, `typescript/`, `samples/client/{lit,angular,react}/`, `tools/` | Read the TypeScript & Web router: [`subskills/typescript/INDEX.md`](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/typescript/INDEX.md) to activate specific TypeScript, reactive lifecycle, CSS theming, accessibility, DOM testing, and AST public API subskills. |
| **Python** (Core, Agent SDK, Builders, Evaluators, Scripts)     | `*.py`, `python/`, `eval/`, `samples/agent/`, `tools/`, `scripts/`                       | Read the Python router: [`subskills/python/INDEX.md`](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/python/INDEX.md) to activate Python package architecture, facade conventions, typing, and verification subskills.                                              |
| **Swift & SwiftUI** (Core, SwiftUI Adapter, iOS Sample)         | `*.swift`, `swift/`, `Package.swift`                                                     | Read the Swift & SwiftUI router: [`subskills/swift/INDEX.md`](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/swift/INDEX.md) to activate Swift target architecture, coding standards, and `Testing` subskills.                                                      |
| **Dart & Flutter** (Core, Agent SDK, Flutter Adapter)           | `*.dart`, `dart/`, `samples/client/flutter/`, `pubspec.yaml`                             | Read the Dart & Flutter router: [`subskills/dart/INDEX.md`](https://skilld.dev/api/skills-raw/a2ui-project/a2ui/coding-principles/subskills/dart/INDEX.md) to activate Dart analyzer rules, package versioning, and changelog subskills.                                                             |

---

### Step 4: Progressively Load Activated Subskills

Read only the cross-language subskills activated in Step 2 and the language-specific subskills selected through Step 3 to evaluate your code against their rationales, checklists, and examples without loading unrelated language rules into context.
