archik 0.12.47 → 0.12.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<!-- archik:principles:functional -->
|
|
2
|
+
# Coding principles — Functional
|
|
3
|
+
|
|
4
|
+
The rules below govern *how code is written* once the archik loop reaches
|
|
5
|
+
BUILD. They sit underneath the engineering loop, not beside it: the loop
|
|
6
|
+
decides *what* to build and *in what order*; these decide *how the code is
|
|
7
|
+
shaped*.
|
|
8
|
+
|
|
9
|
+
## Purity
|
|
10
|
+
|
|
11
|
+
- Default to pure functions: output depends only on input, no observable
|
|
12
|
+
side effect. Same arguments, same result, every time.
|
|
13
|
+
- A pure core is the testable core — it needs no mocks, no setup, no clock.
|
|
14
|
+
Most BUILD logic should land here.
|
|
15
|
+
- When a function must do I/O, that's a signal it belongs at the edge, not
|
|
16
|
+
in the core (see "side effects at the edges").
|
|
17
|
+
|
|
18
|
+
## Immutability
|
|
19
|
+
|
|
20
|
+
- Treat data as immutable. Produce new values instead of mutating existing
|
|
21
|
+
ones; never reassign shared state in place.
|
|
22
|
+
- No shared mutable state across modules. Shared mutability is where
|
|
23
|
+
concurrency bugs and spooky-action-at-a-distance live.
|
|
24
|
+
- Model state transitions as functions `oldState -> newState`, returned and
|
|
25
|
+
threaded explicitly, not hidden in object fields.
|
|
26
|
+
|
|
27
|
+
## Composition
|
|
28
|
+
|
|
29
|
+
- Build behavior by composing small, total functions. The unit of reuse is
|
|
30
|
+
the function, not the class.
|
|
31
|
+
- Prefer pipelines (`map` / `filter` / `reduce`, function composition) over
|
|
32
|
+
imperative loops with accumulators when the intent is a transformation.
|
|
33
|
+
- Keep functions small and single-purpose so they compose cleanly. If a
|
|
34
|
+
function resists composition, it's probably doing two things.
|
|
35
|
+
|
|
36
|
+
## Side effects at the edges
|
|
37
|
+
|
|
38
|
+
- Push effects (I/O, network, DB, randomness, time) to the boundary of the
|
|
39
|
+
system; keep the interior pure. This maps directly onto the archik ECB
|
|
40
|
+
model: **boundary** code performs effects, **control** code is pure
|
|
41
|
+
orchestration, **entity** code is pure data + transitions.
|
|
42
|
+
- Make effects explicit and injected — pass the clock, the fetcher, the
|
|
43
|
+
writer in, rather than reaching for globals. This is what makes the pure
|
|
44
|
+
core testable.
|
|
45
|
+
- Isolate effectful code in thin, obvious shells so the dangerous parts are
|
|
46
|
+
small and easy to review.
|
|
47
|
+
|
|
48
|
+
## Totality and explicit errors
|
|
49
|
+
|
|
50
|
+
- Prefer total functions: defined for every input in their type. Narrow the
|
|
51
|
+
input type until the function can't fail, rather than guarding at runtime.
|
|
52
|
+
- Make failure a value, not a thrown surprise — return a Result/Option/union
|
|
53
|
+
the caller must handle. No silent `null` leaks, no swallowed exceptions.
|
|
54
|
+
- Handle every case explicitly; let exhaustiveness checking catch the ones
|
|
55
|
+
you forgot.
|
|
56
|
+
|
|
57
|
+
## Declarative over imperative
|
|
58
|
+
|
|
59
|
+
- Say *what*, not *how*. Express transformations and rules declaratively;
|
|
60
|
+
let the runtime handle the stepwise mechanics where possible.
|
|
61
|
+
- Avoid hidden control flow. Data flow should be visible in the shape of the
|
|
62
|
+
code.
|
|
63
|
+
- Comments explain *why*, never restate *what* (this mirrors the loop's
|
|
64
|
+
hard rules).
|
|
65
|
+
|
|
66
|
+
## How this interacts with the loop
|
|
67
|
+
|
|
68
|
+
- These principles shape the BUILD phase. They never override a HITL gate or
|
|
69
|
+
the requirements/structure/behavior/code ordering.
|
|
70
|
+
- If applying a principle would change the component graph (e.g. splitting a
|
|
71
|
+
pure core out from an effectful shell as separate nodes), that's a
|
|
72
|
+
structural change — go back through the archik sidecar, don't just
|
|
73
|
+
refactor silently.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!-- archik:principles:oop -->
|
|
2
|
+
# Coding principles — Object-Oriented
|
|
3
|
+
|
|
4
|
+
The rules below govern *how code is written* once the archik loop reaches
|
|
5
|
+
BUILD. They sit underneath the engineering loop, not beside it: the loop
|
|
6
|
+
decides *what* to build and *in what order*; these decide *how the code is
|
|
7
|
+
shaped*.
|
|
8
|
+
|
|
9
|
+
## Separation of concerns
|
|
10
|
+
|
|
11
|
+
- One module, one reason to change. A file that mixes HTTP parsing,
|
|
12
|
+
business rules, and persistence is three modules wearing one name.
|
|
13
|
+
- Map concerns onto the ECB stereotypes already in the archik model:
|
|
14
|
+
**boundary** code handles I/O and translation, **control** code holds
|
|
15
|
+
use-case logic, **entity** code owns state and invariants. Don't let a
|
|
16
|
+
boundary make business decisions or an entity reach for the network.
|
|
17
|
+
- A function does one thing at one level of abstraction. If you need "and"
|
|
18
|
+
to describe it, split it.
|
|
19
|
+
|
|
20
|
+
## Composition over inheritance
|
|
21
|
+
|
|
22
|
+
- Default to composition. Inheritance is for genuine *is-a* substitutability,
|
|
23
|
+
not code reuse — reuse via collaborators, not base classes.
|
|
24
|
+
- Prefer small objects that delegate to injected collaborators over deep
|
|
25
|
+
class hierarchies. Depth past two levels is a smell.
|
|
26
|
+
- Program to an interface (or the narrowest type that works), not a
|
|
27
|
+
concrete class, at module boundaries.
|
|
28
|
+
|
|
29
|
+
## SOLID
|
|
30
|
+
|
|
31
|
+
- **S**ingle responsibility — see separation of concerns above.
|
|
32
|
+
- **O**pen/closed — extend behavior by adding a collaborator or
|
|
33
|
+
implementation, not by editing a switch that grows with every case.
|
|
34
|
+
- **L**iskov — a subtype must be usable anywhere its supertype is, with no
|
|
35
|
+
surprises. If an override throws "not supported," the hierarchy is wrong.
|
|
36
|
+
- **I**nterface segregation — many small role interfaces beat one fat one.
|
|
37
|
+
Callers depend only on the methods they use.
|
|
38
|
+
- **D**ependency inversion — high-level policy depends on abstractions;
|
|
39
|
+
details (DB, HTTP, clock) are injected. This is what makes control logic
|
|
40
|
+
testable without the world attached.
|
|
41
|
+
|
|
42
|
+
## Design patterns — used judiciously
|
|
43
|
+
|
|
44
|
+
- Patterns are a vocabulary, not a goal. Reach for one when the forces it
|
|
45
|
+
resolves are actually present (e.g. Strategy when behavior varies by case,
|
|
46
|
+
Adapter at an external boundary, Repository to hide persistence).
|
|
47
|
+
- Never introduce a pattern speculatively. A factory with one product or a
|
|
48
|
+
strategy with one strategy is accidental complexity — delete it.
|
|
49
|
+
- Name the pattern in a comment only when the WHY isn't obvious from the
|
|
50
|
+
code.
|
|
51
|
+
|
|
52
|
+
## Clean code
|
|
53
|
+
|
|
54
|
+
- Names carry intent: `unsettledInvoices`, not `data2`. A good name removes
|
|
55
|
+
the need for a comment.
|
|
56
|
+
- Small functions, few parameters. Past three or four parameters, introduce
|
|
57
|
+
a value object.
|
|
58
|
+
- No dead code, no commented-out blocks, no speculative generality (YAGNI).
|
|
59
|
+
- Encapsulate state: expose behavior, not raw fields. Invariants live with
|
|
60
|
+
the data they constrain so they can't be violated from outside.
|
|
61
|
+
- Fail fast and explicitly. Validate at the boundary; let control and
|
|
62
|
+
entity code assume valid input.
|
|
63
|
+
- Comments explain *why*, never restate *what* (this mirrors the loop's
|
|
64
|
+
hard rules).
|
|
65
|
+
|
|
66
|
+
## How this interacts with the loop
|
|
67
|
+
|
|
68
|
+
- These principles shape the BUILD phase. They never override a HITL gate or
|
|
69
|
+
the requirements/structure/behavior/code ordering.
|
|
70
|
+
- If applying a principle would change the component graph (e.g. extracting
|
|
71
|
+
a new control object), that's a structural change — go back through the
|
|
72
|
+
archik sidecar, don't just refactor silently.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!-- archik:superpowers -->
|
|
2
|
+
# Superpowers ⨯ the engineering loop
|
|
3
|
+
|
|
4
|
+
This project opted into the **superpowers** plugin. The skills below are
|
|
5
|
+
wired into specific phases of the archik loop. At each phase, **invoke the
|
|
6
|
+
named skill** — but the skill *feeds* the archik artifact, it does not
|
|
7
|
+
replace it.
|
|
8
|
+
|
|
9
|
+
> If a superpowers skill isn't available in this session, the loop still
|
|
10
|
+
> stands on its own: `@.archik/ENGINEERING_LOOP.md` already describes the
|
|
11
|
+
> same discipline inline. These references make it explicit and stronger
|
|
12
|
+
> when the plugin is installed.
|
|
13
|
+
|
|
14
|
+
## Phase → skill map
|
|
15
|
+
|
|
16
|
+
| Loop phase | Invoke | What it feeds (the archik artifact) |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| DESIGN — requirements | `superpowers:brainstorming` | Explore intent before committing. Output is the **archik requirements model** (actors + use cases + slices), *not* a separate spec doc. |
|
|
19
|
+
| BUILD — plan | `superpowers:writing-plans` | Turn the accepted models into the **numbered build plan** that goes through the plan gate. |
|
|
20
|
+
| BUILD — code | `superpowers:test-driven-development` | RED → GREEN → REFACTOR per slice. The tests it writes are the ones a slice names; landing them flips the slice `proposed → active`. |
|
|
21
|
+
| BUILD — when stuck | `superpowers:systematic-debugging` | Root-cause a failure before patching. A fix that invalidates a model triggers the loop's back-edge to DESIGN. |
|
|
22
|
+
| VERIFY — before "done" | `superpowers:verification-before-completion` | Evidence before claiming a slice is done. Gates the `proposed → active` flip and any "tests pass" claim. |
|
|
23
|
+
| Pre-merge | `superpowers:requesting-code-review` | Review before integrating, alongside `archik trace` / `archik validate`. |
|
|
24
|
+
| Branch isolation | `superpowers:using-git-worktrees` | Isolate the workspace before executing a multi-step plan. |
|
|
25
|
+
|
|
26
|
+
## Precedence
|
|
27
|
+
|
|
28
|
+
1. **User instructions** (this file, CLAUDE.md, direct requests) win.
|
|
29
|
+
2. **The archik loop gates** (`@.archik/ENGINEERING_LOOP.md`) win over a
|
|
30
|
+
skill's own flow. Example: `brainstorming` wants to write its own spec
|
|
31
|
+
file and end by invoking `writing-plans` — here, the design artifact is
|
|
32
|
+
the archik requirements model, and the plan still goes through the archik
|
|
33
|
+
plan gate.
|
|
34
|
+
3. **Superpowers skill discipline** applies within each phase.
|
|
35
|
+
|
|
36
|
+
The rule of thumb: **use the skill to do the phase well; let archik decide
|
|
37
|
+
what the phase produces and when the gate opens.**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "archik",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.48",
|
|
4
4
|
"description": "The shared vocabulary between you and Claude Code, at the engineering level. Plain-YAML architecture diagrams with a live browser canvas, headless SVG render in CI, and an installable Claude skill so the model treats the diagram as the spec.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"architecture",
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
"docs/logo.svg",
|
|
35
35
|
"docs/wordmark.svg",
|
|
36
36
|
"docs/templates/CLAUDE.md",
|
|
37
|
+
"docs/templates/superpowers.md",
|
|
38
|
+
"docs/templates/principles/oop.md",
|
|
39
|
+
"docs/templates/principles/functional.md",
|
|
37
40
|
"skills",
|
|
38
41
|
"commands",
|
|
39
42
|
".claude-plugin",
|