Architecture

From jikig-ai/soleur · View interactive version

Architecture is an AI agent skill from the GitHub repository jikig-ai/soleur. This skill should be used when managing Architecture Decision Records or C4 diagrams.

How to use this skill

Skill file

<!-- grok-harness-invoke:start -->

Grok Build (plugins/soleur/lib/harness.ts invokeSkill()): Read this SKILL.md in this process and run it to completion. A one-segment soleur:<name> in this document names a SKILL — on Grok Build, Read plugins/soleur/skills/<name>/SKILL.md in this process; it is not a nested tool_use. A multi-segment id such as soleur:<domain>:<name> names an AGENT: spawn it, never Read it, and on Grok Build spawn_subagent takes the id with its colons replaced by hyphens (agentIdToGrokSubagentType). Claude Code: Skill tool for a skill (soleur:<name>), Task tool with subagent_type for an agent. Forbidden is executing a subset, not the Read.

<!-- grok-harness-invoke:end -->

Architecture as Code

Create, manage, and query Architecture Decision Records (ADRs) and maintain an interactive LikeC4 architecture model. ADRs are version-controlled markdown; the C4 model is version-controlled LikeC4 DSL (.c4). All artifacts live in knowledge-base/engineering/architecture/.

<!-- operator-typed-render:start -->

Any message this skill PRINTS that tells the operator to run a skill or command renders at emit time. The doc names it canonically (soleur:<name>, ADR-226); before printing, render it as the active harness's operator-typed form per formatSkillInvocation (plugins/soleur/lib/harness.ts), which owns the per-harness slash and sigil forms — the operator types that string into a fresh session where no routing contract is in context, so a bare canonical name is model-discretion there rather than a dispatch. This covers abort messages, AskUserQuestion prompts and options, Display/echo lines and resume prompts alike; an agent-read instruction stays canonical.

<!-- operator-typed-render:end -->

Sub-commands

| Command | Description |

|---------|-------------|

| architecture create [title] | Create a new ADR with the next sequential number |

| architecture list | Display all ADRs with status, title, and date |

| architecture supersede <N> [title] | Mark ADR-N as superseded and create its replacement |

| architecture diagram [type] | Create or update the LikeC4 model and its views (context, container, component) |

| architecture add-container <id> | Add a container/database element to the model |

| architecture add-component <id> | Add a component element to the model |

| architecture add-relationship <from> <to> | Add a relationship between two model elements |

| architecture render | Validate the LikeC4 project (likec4 validate) and report element/view counts |

| architecture assess [feature] | Assess a feature against the NFR register and principles register |

| architecture principle list | Display the architecture principles register |

If no sub-command is provided, display the table above and ask which sub-command to run.

Arguments

$ARGUMENTS is parsed for a sub-command and optional parameters:

architecture [sub-command] [arguments...]

Phase 0: Prerequisites

Verify the knowledge-base directory exists:

if [[ ! -d "knowledge-base" ]]; then
  echo "No knowledge-base/ directory found. Create one first or run soleur:sync."
  # Stop execution
fi

Create the architecture directories if they do not exist:

mkdir -p knowledge-base/engineering/architecture/decisions
mkdir -p knowledge-base/engineering/architecture/diagrams

Branch safety check (defense-in-depth): Run git branch --show-current. If the result is main or master, abort with: "Error: architecture skill cannot run on main/master. Checkout a feature branch first."

Vocabulary. Before committing a word that names a concept, check it against knowledge-base/project/glossary.md and use the sense its pointer settles; if the word is materially ambiguous and has no entry, hedge in the artifact and name the ambiguity. The instruction is stated once in glossary-format.md §The consumer pointer and is not restated here.

Rejected-concepts substrate. Before recording a decision that refuses a concept rather than a

mechanism, read ADR-234:

an ADR's ## Alternatives Considered table is scoped to the mechanisms of one decision, so a

concept-level refusal belongs in the no-list at knowledge-base/project/rejected/ instead, where the

intake pre-check can find it by concept. The two are siblings, not substitutes — the no-list cites ADR

tables as a store the lookup also checks, and imports nothing from them.


Sub-command: create

Create a new ADR with the next sequential number.

Steps

  1. Determine next ADR number. List existing ADRs in knowledge-base/engineering/architecture/decisions/:

```bash

ls knowledge-base/engineering/architecture/decisions/ADR-*.md 2>/dev/null | sort -V | tail -1

```

Extract the highest number and increment by 1. If no ADRs exist, start at 001.

  1. Get the title. If a title was provided in $ARGUMENTS, use it. Otherwise, use AskUserQuestion: "What architectural decision are you recording?"
  1. Generate the filename. Convert the title to kebab-case: ADR-<NNN>-<kebab-title>.md
  1. Read the ADR template from adr-template.md. The template now documents two labeled body shapes (terse / rich) under the ## Choosing the shape section. Read that section before proceeding.
  1. Ask the shape rubric. Present the 5 triggers from the template's ## Choosing the shape section and pick between the terse and rich shapes. Use AskUserQuestion with options:

If the contributor picks "Unsure," ask each of the 5 triggers as its own yes/no AskUserQuestion. Compute: any yes → rich, all no → terse.

Pipeline mode default. If running inside soleur:one-shot or any other non-interactive caller (no AskUserQuestion available, only $ARGUMENTS context), default to terse. Rich-shape ADRs in pipeline mode require the caller to pass shape: rich explicitly in $ARGUMENTS, or the rubric falls through to terse.

  1. Write the ADR file. Create knowledge-base/engineering/architecture/decisions/ADR-<NNN>-<kebab-title>.md using the chosen shape's body block from the template. The filename is the sole ordinal authority; do not add an adr: frontmatter key. Fill in frontmatter:
  1. Gather context. Ask the user (or use $ARGUMENTS context if running in pipeline). The prompt list branches on the shape chosen in step 5:

Terse branch (3 prompts):

Rich branch (8 prompts):

  1. Write the ADR body with the gathered context. If a diagram was requested (rich branch only), update the consolidated LikeC4 model using likec4-reference.md (see the diagram sub-command) and embed the relevant view with a `likec4-view block.

8.5. Domain-model register check. If this ADR records or changes a business rule — an entity invariant, an ownership/access model, or a relationship encoded in a migration constraint / RLS policy / resolver-guard — update the affected row(s) in CODE0 in the same change: add or amend the rule with a citation back to this ADR. Rule IDs are immutable — supersede (mark + link the successor row), never reuse. If the ADR is purely a technology/process decision with no entity-invariant impact, skip silently.

  1. Announce: "Created ADR-<NNN>: <title> at knowledge-base/engineering/architecture/decisions/ADR-<NNN>-<kebab-title>.md"

Sub-command: list

Display all ADRs with their status, number, title, and date.

Steps

  1. Scan the decisions directory:

```bash

ls knowledge-base/engineering/architecture/decisions/ADR-*.md 2>/dev/null

```

  1. If no ADRs exist: Display "No ADRs found. Run soleur:architecture create to create one."
  1. For each ADR file: Read the YAML frontmatter and extract adr, title, status, date.
  1. Display as a table:

```text

| # | Title | Status | Date |

|---|-------|--------|------|

| ADR-001 | Use LikeC4 for diagrams | active | 2026-03-27 |

| ADR-002 | PWA-first architecture | superseded | 2026-03-20 |

```


Sub-command: supersede

Mark an existing ADR as superseded and create its replacement.

Steps

  1. Parse the ADR number from $ARGUMENTS. If not provided, use AskUserQuestion: "Which ADR number to supersede?"
  1. Find the existing ADR by matching ADR-<NNN>-*.md in knowledge-base/engineering/architecture/decisions/.
  1. If not found: Display "ADR-<NNN> not found." and stop.
  1. If already superseded: Display "ADR-<NNN> is already superseded by ADR-<M>." and stop.
  1. Get the replacement title. If provided in $ARGUMENTS, use it. Otherwise, use AskUserQuestion: "What is the title of the replacement decision?"
  1. Create the replacement ADR using the create sub-command flow (next sequential number). Add supersedes: ADR-<NNN> to the YAML frontmatter.
  1. Update the original ADR. Read the file and update:
  1. Announce: "ADR-<NNN> superseded by ADR-<NEW>: <title>"

Sub-command: diagram

Create or update the canonical LikeC4 model. Soleur uses ONE consolidated

model — every element is declared once and the views scope it to each C4 level

with clickable drill-down (Context → Container → Component). The model is

rendered interactively in the web Knowledge Base viewer; static Mermaid C4 is no

longer emitted.

Read likec4-reference.md now for the

complete LikeC4 DSL syntax before editing any model.

Project layout

.c4 edits are not gated for this workflow. The c4-edit runtime flag

(commit 3c8849655) gates ONLY direct end-user edits in the in-browser webapp

editor (PUT /api/kb/c4, default OFF). It does not gate a workflow: Concierge

and the Claude Code plugin terminal are equally-trusted agent contexts that edit

the .c4 files on the filesystem (Edit/Write) and commit them via this skill —

they never route through the webapp endpoint. Edit .c4 directly; do not defer a

model change to "ask the Concierge."

The model lives as a LikeC4 project under

knowledge-base/engineering/architecture/diagrams/:

Steps

  1. Gather context. Read to understand the system:

External-actor / external-system completeness sweep (do this before concluding "nothing to add"). For the change at hand, enumerate every (a) external human actor (who sends/receives the data — correspondents, reviewers, recipients), (b) external system/vendor (inbound webhook, outbound API, third-party store), (c) container/data-store touched, and (d) actor↔surface access relationship that changes. For each, confirm it is already modeled; if not, add it (element + #external tag if outside the platform boundary + the relationship edges + the views.c4 include line so it RENDERS). A grep for the feature's own noun returning zero is NOT evidence of absence — the gap is usually an external actor/vendor named by role/vendor, not the feature (e.g. an inbound-email "Correspondent" actor + a "Resend" system for an email feature). Also fix any element description the change falsifies (e.g. a "Solo founder" actor when the change adds multi-Owner sharing). See knowledge-base/project/learnings/2026-06-18-c4-impact-requires-reading-all-diagrams-and-enumerating-external-actors.md.

  1. Edit the consolidated model (spec.c4 / model.c4), following

likec4-reference.md. Key rules:

  1. Edit the views (views.c4): ensure a view exists per level you want to

show. Wire drill-down with view <id> of <parent> so the parent element in

the higher-level view links into it.

  1. Write/refresh the view page(s). For each view that needs a KB page, write

knowledge-base/engineering/architecture/diagrams/<view>.md:

````markdown

# <Title> (C4 Level N)

Generated: YYYY-MM-DD

```likec4-view

<view-id>

```

## Notes

[Context about the diagram, references to relevant ADRs]

````

  1. Validate (see render below) and announce:

"LikeC4 model updated — N elements, M relationships, K views."


Sub-commands: add-container, add-component, add-relationship

Incremental edits to the consolidated model. Each is a focused patch to the

.c4 files (no Mermaid). After any patch, run render (see below) to

validate the source, then regenerate model.likec4.json with render and commit it

with the .c4 change. (In the Soleur repository itself a c4-model-regenerate

pre-commit hook does this on commit; other repositories have no such hook.)

correct parent in model.c4 (container / database / component kind),

with technology and description. Add it to the relevant view's include

list in views.c4 if it should appear.

to model.c4, using existing element ids (qualified if nested).

Gather the label/technology/description from $ARGUMENTS or via AskUserQuestion.


Sub-command: render

Validate the LikeC4 project and rebuild the precomputed model the web viewer

renders. The Knowledge Base viewer does NOT run the likec4 toolchain at

runtime (it would pull vite/esbuild into production deps); it reads the

committed, layouted model.likec4.json.

Run this after every .c4 edit and commit the result. Only the Soleur repository

regenerates on commit automatically (its c4-model-regenerate lefthook hook, backed by

plugins/soleur/test/c4-model-freshness.test.sh in CI); in any other repository an

unregenerated model.likec4.json stays stale until someone runs this:

# Canonical regen (pinned, off-tree-validated, idempotent) — same primitive the
# pre-commit hook and the merge resolver run; renders the current repository:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/render-c4-model.sh"

# Or validate only (line-numbered diagnostics) without rewriting the artifact:
# --no-use-dot keeps the drift check on the same wasm layout the artifact was
# rendered with — a dot-layout verdict would disagree with committed bytes.
cd knowledge-base/engineering/architecture/diagrams
npx -y likec4@1.60.0 validate --no-use-dot .

The pinned 1.50.0 is load-bearing: it MUST match apps/web-platform/Dockerfile

c4-likec4-version-pin.test.ts. Never pin to a floating tag (the unpinned

likec4 / a moving release) — a CLI/client schema skew silently corrupts the

rendered diagram. render-c4-model.sh renders

off-tree and refuses to publish an empty/invalid/zero-view model, so a broken

.c4 or a failed layout can never clobber the good committed artifact.

On success, report element / relationship / view counts (read the

elements / relations / views key counts from model.likec4.json). On

failure, branch on the refusal class — do NOT uniformly "fix the source":

line-numbered diagnostics and fix the .c4 source before continuing.

innocent; editing it cannot help. Read the render log tail the refusal

prints, retry the render once, and if it persists reproduce with the

export json --no-use-dot command the message names, then report the

outcome rather than hand-editing the model.


Sub-command: assess

Assess a feature or plan against the NFR register to identify which non-functional requirements are relevant and what their current status is.

Read nfr-reference.md now for the assessment checklist and common NFR patterns by decision type.

Steps

  1. Get the feature description. If provided in $ARGUMENTS, use it. Otherwise, check for a plan file on the current branch:
  1. Read the NFR register at knowledge-base/engineering/architecture/nfr-register.md.
  1. Read the principles register at knowledge-base/engineering/architecture/principles-register.md. If it does not exist, skip principle alignment in step 5b.
  1. Identify affected containers and links. Read the Container & Link Inventory in the NFR register. Map the feature to specific C4 containers and links it touches (e.g., a new external service adds a network link; a new UI feature affects Dashboard and API Routes).
  1. Classify the feature against the decision type patterns from nfr-reference.md:
  1. Assess each NFR category. For each of the 7 categories (Observability, Resilience, Testing, Configuration & Delivery, Scaling & Recovery, Security, Data Quality), determine:
  1. Assess principle alignment. For each principle in the register (AP-001 through AP-NNN), determine: relevant to this feature (yes/no), alignment status (Aligned/Deviation/N/A), and brief rationale. Skip if the principles register was not found in step 3.
  1. Output the assessment as a per-container table:

```text

## NFR Assessment: [Feature Name]

### Affected Containers/Links

### Assessment

| NFR | Requirement | Container/Link | Status | Impact | Evidence Gap |

|-----|-------------|----------------|--------|--------|-------------|

| NFR-001 | Logging | New Service | — | Needs attention | No logging configured |

| NFR-026 | Encryption In-Transit | Agent Runtime -> New Service | — | Needs attention | HTTPS required |

| NFR-007 | Circuit Breaker | Agent Runtime -> New Service | — | Risk introduced | No fallback for new dependency |

| NFR-026 | Encryption In-Transit | Founder -> Dashboard | Implemented | No change | Cloudflare |

```

If the principles register was loaded, add a Principle Alignment section:

```text

### Principle Alignment

| Principle | Title | Status | Note |

|-----------|-------|--------|------|

| AP-001 | Terraform-only provisioning | Aligned | New infra uses Terraform |

| AP-008 | Doppler secrets | N/A | No new secrets |

```

  1. Recommend actions. For each NFR with "Needs attention" or "Risk introduced" impact, propose a specific action referencing the affected container/link (e.g., "Add circuit breaker on Agent Runtime -> Stripe link", "Configure structured logging for New Service container"). For each principle with "Deviation" status, explain the deviation and whether an exception is justified.
  1. Offer to create an ADR. If the assessment reveals architectural decisions (e.g., choosing to accept a risk, implementing a new NFR, deviating from a principle), ask: "Create an ADR to document these decisions?" Principle alignment will be pre-filled from the assessment.

Sharp Edges

ADR vs Learning

ADRs and learnings serve different purposes:

| | ADR | Learning |

|---|-----|---------|

| When | At decision time | After implementation |

| What | "Why we chose X over Y" | "What went wrong and how we fixed it" |

| Format | Context / Decision / Consequences | Problem / Solution / Key Insight |

| Location | knowledge-base/engineering/architecture/decisions/ | knowledge-base/project/learnings/ |

| Lifecycle | Active → Superseded | Evergreen (archived when stale) |


Sub-command: principle list

Display the architecture principles register.

Steps

  1. Read the principles register at knowledge-base/engineering/architecture/principles-register.md.
  1. If the file does not exist: Display "No principles register found. Create one at knowledge-base/engineering/architecture/principles-register.md."
  1. Display the principles table from the register, preserving the markdown table format.
  1. Display the enforcement tiers table below the principles table.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.