@inixiative/config 0.5.260 → 0.5.261
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.
- package/README.md +18 -0
- package/dist/cli.js +545 -175
- package/package.json +3 -1
- package/skills/cleanup-scan/SKILL.md +89 -0
- package/skills/code-walkthrough/SKILL.md +29 -0
- package/skills/experiment/SKILL.md +79 -0
- package/skills/experiment/design.md +44 -0
- package/skills/experiment/finding.json +16 -0
- package/skills/experiment/review.md +33 -0
- package/skills/labeling/SKILL.md +40 -0
- package/skills/no-slop-writing/SKILL.md +69 -0
- package/skills/no-slop-writing/references/register-anchors.md +64 -0
- package/skills/no-slop-writing/references/slop-quarantine.md +97 -0
- package/skills/permissions-syntax-first/SKILL.md +142 -0
- package/skills/probe/SKILL.md +74 -0
- package/skills/probe/record.json +24 -0
- package/skills/reflecting-without-flinching/SKILL.md +32 -0
- package/skills/review-adversarial/SKILL.md +39 -0
- package/skills/review-dedupe/SKILL.md +38 -0
- package/skills/review-naming/SKILL.md +35 -0
- package/skills/review-plan/SKILL.md +38 -0
- package/skills/review-subtractor/SKILL.md +48 -0
- package/skills/worktrees/SKILL.md +57 -0
- package/standards/CODE_STYLE.md +83 -0
- package/standards/ENGINEERING_DOCTRINE.md +84 -0
- package/standards/GREAT_PROGRAMMER.md +128 -0
- package/standards/NAMING_VOCABULARY.md +72 -0
- package/standards/SKILL_AUTHORING.md +55 -0
- package/versions.json +4 -4
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Code Style
|
|
2
|
+
|
|
3
|
+
Universal code-style standards across all inixiative repositories. Grounded in [GREAT_PROGRAMMER.md](GREAT_PROGRAMMER.md): code is read 10×–50× more than it is written, and consistent style keeps every file predictable to scan.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Flat Controller-Style Control Flow & Step-by-Step Structure
|
|
8
|
+
|
|
9
|
+
Write handlers, plugins, hooks, middlewares, and services so they read **top-to-bottom like a controller** with flat guard clauses and single-line early exits — never nested `if`/`else` pyramids or nested ternaries.
|
|
10
|
+
|
|
11
|
+
- **Early exits over nesting:** reject invalid/empty states at the top and keep the main path flat at the bottom.
|
|
12
|
+
- **No nested ternaries:** a single short ternary is fine; branching ternaries belong in a small helper, lookup map, or flat `if` returns.
|
|
13
|
+
- **Step-by-step orchestration:** when a function performs multiple distinct phases (collect, load, transform, link, persist), extract focused named helpers so the entry point reads top-to-bottom as a short sequence of steps instead of a 100-line nested loop.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
// Good — flat early exits, obvious happy path at the bottom
|
|
17
|
+
if (!user) throw makeError({ status: 404, message: 'User not found' });
|
|
18
|
+
if (!session.verified) return c.json({ requiresTwoFactor: true }, 403);
|
|
19
|
+
if (!valid) return null;
|
|
20
|
+
|
|
21
|
+
return issueToken(user);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// Bad — nested branches force the reader to hold a stack in their head
|
|
26
|
+
if (user) {
|
|
27
|
+
if (session.verified) {
|
|
28
|
+
if (valid) {
|
|
29
|
+
return issueToken(user);
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
return c.json({ requiresTwoFactor: true }, 403);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 2. Atomic Files (No Grab-Bag Modules)
|
|
40
|
+
|
|
41
|
+
- **One file, one concern, one named export** (internal private helpers stay unexported in the same file).
|
|
42
|
+
- Never build multi-hundred-line grab-bag `service.ts` / `utils.ts` files exporting a dozen unrelated functions; split by distinct responsibility when a module grows multiple coherent sub-stages.
|
|
43
|
+
- Never duplicate an existing flow inline beside a helper; extract once and call from both sites.
|
|
44
|
+
- **Minimal index files:** barrels live only at package or module root, never nested in internal subdirectories.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 3. Standard Library Utilities Over Hand-Rolled Transforms
|
|
49
|
+
|
|
50
|
+
Prefer `lodash-es` (`omit`, `pick`, `pickBy`, `omitBy`, `mapValues`, `mapKeys`, `keyBy`, `zipObject`, `groupBy`, `uniqBy`) over hand-rolled `Object.fromEntries(Object.entries(...).filter/map(...))` chains or manual object-cloning loops. Hand-rolled object plumbing is harder to scan and easy to get subtly wrong.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 4. Comments: Default to Zero
|
|
55
|
+
|
|
56
|
+
- **Do not write comments explaining *what* the code does.** Rename variables/functions or restructure the code instead. Comments rot, drift out of sync, and make files harder to scan.
|
|
57
|
+
- The **only** permitted comments are:
|
|
58
|
+
1. Structured `@atlas` / doc-tool annotation blocks at the top of a file (or public JSDoc on exported library APIs where required).
|
|
59
|
+
2. Rarely (~1% of files), a single short `// why: ...` line capturing a non-obvious constraint the code cannot express (an external bug workaround, a cross-process invariant, a subtle ordering requirement). Never multi-paragraph narration.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 5. Errors, Validation, and No Defensive Theater
|
|
64
|
+
|
|
65
|
+
- **Just throw — no Go-isms.** Never return `{ ok: true | false }` result unions alongside `*OrThrow` twins, and never make callers write `if (!verified) throw ...` when the called function owns the failure. Throw a structured domain error directly.
|
|
66
|
+
- **Check once, at the entry point.** Validate at the controller, hook, or boundary entry; inner services trust their typed inputs instead of re-checking the same invariant.
|
|
67
|
+
- **Let existing boundaries own their errors.** Never wrap schema validation in `safeParse` + a hand-built error when the error handler already maps validation errors, and never write manual duplicate pre-checks where a unique constraint already enforces uniqueness.
|
|
68
|
+
- **A `catch` that doesn't rethrow is a bug unless it acts on the failure.** Logging and continuing hides broken state. Acting means a real state transition the caller needs (marking a row disabled, translating a library error). Cleanup goes in `finally`. Never wrap calls in `try/catch` or `.catch(log)` just to log.
|
|
69
|
+
- **No defensive-code theater:** don't re-check a library's own contract, and don't add defense-in-depth clamps without a concrete boundary reason.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 6. TypeScript & Formatting
|
|
74
|
+
|
|
75
|
+
Managed uniformly via `@inixiative/config` (`biome/base.json`, `tsconfig/base.json`):
|
|
76
|
+
|
|
77
|
+
- **No `any`.** Type-check tests too; import canonical types from source modules.
|
|
78
|
+
- **Prefer `type` over `interface`** (unless declaration merging is needed).
|
|
79
|
+
- **No TypeScript `enum`** — use `as const` objects / string literal unions.
|
|
80
|
+
- **Named exports over default exports.**
|
|
81
|
+
- **Formatting:** 2-space indent, width 100, single quotes, trailing commas, semicolons, explicit return types on exported functions.
|
|
82
|
+
- **Variable prefixes:** `_` for unused bindings; `__` for private/module-internal state.
|
|
83
|
+
- **Fix CI and lint rules for real** — never disable rules or route around checks.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Engineering Doctrine
|
|
2
|
+
|
|
3
|
+
Shared engineering principles across all inixiative repositories. Pair with [GREAT_PROGRAMMER.md](GREAT_PROGRAMMER.md), [CODE_STYLE.md](CODE_STYLE.md), [NAMING_VOCABULARY.md](NAMING_VOCABULARY.md), and [SKILL_AUTHORING.md](SKILL_AUTHORING.md).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Understand the Why First
|
|
8
|
+
|
|
9
|
+
Before touching the *how* of anything non-trivial, hold the **why**: what the thing is for and the problem it exists to solve. Working a mechanism without holding its purpose produces category errors that feel like progress — stripping the wrong layer, "simplifying" away a load-bearing invariant, or conflating two concerns because they rhyme at the code level.
|
|
10
|
+
|
|
11
|
+
- Ask *"what is this for?"* before *"how does it work?"* If you cannot state the purpose in one sentence, find it (user's words, docs, callers, git history) or ask.
|
|
12
|
+
- Re-anchor after long stretches of plumbing. Repeated *"are you sure?"* pushback means you lost the frame: stop and recover the purpose before continuing.
|
|
13
|
+
- **Record the why, not just the how.** Every doc, plan, decision line, and PR states the problem it solves and the evidence or principle that chose it.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 2. Decomposition by Default
|
|
18
|
+
|
|
19
|
+
Before jumping to implementation, break the problem into its atomic concerns:
|
|
20
|
+
|
|
21
|
+
- Which parts change independently? Those are separate responsibilities.
|
|
22
|
+
- Which parts have different lifecycles (created/deleted at different times, owned by different entities)? Those are separate records.
|
|
23
|
+
- Who owns this data, who controls access to it, and who consumes it? If the answers differ, they are different models.
|
|
24
|
+
|
|
25
|
+
**Lazy instincts to resist:**
|
|
26
|
+
- *"Just add a field"* — is this the same concern or a new concern wearing the same clothes?
|
|
27
|
+
- *"Just copy the logic"* — same operation = shared abstraction; different operation = keep separate even if they look similar.
|
|
28
|
+
- *"Just put it all in one table/function/component"* — convenience now is permanent coupling later.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 3. Look for the Thing Already Doing It (Bridge Analysis)
|
|
33
|
+
|
|
34
|
+
Before adding a function, field, parameter, table, route, store, or module, search by **concept** (not just name) across this repo, sibling repos, and lower-level `@inixiative/*` libraries.
|
|
35
|
+
|
|
36
|
+
- **Make it visible:** every plan, ticket, and PR names, for each concern it touches (auth, permissions, db access, requests, locks, jobs, events, errors), the existing primitive it uses with its path — or explains why none fits.
|
|
37
|
+
- **"Why none fits" requires a bridge analysis:** show what would make the existing primitive fit (extend it, add a parameter, compose two), express and run the case on the existing primitive with output, and show why that bridge fails. *"It doesn't match exactly"* is not a reason.
|
|
38
|
+
- **Overriding an existing system requires explicit acknowledgement.** If an instruction or ticket contradicts an existing system without naming it and saying to replace or bypass it, stop and ask: *"This doesn't match what we have (X); confirm?"*
|
|
39
|
+
- **One repo owns a job; the others consume it.** Never maintain parallel implementations across sibling repos.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 4. YAGNI: Scope Invention vs. Completion
|
|
44
|
+
|
|
45
|
+
The error runs in **both** directions:
|
|
46
|
+
|
|
47
|
+
- **Overbuild (scope invention) — cut it:** extra fields "in case we need them later", wrappers around single-call sites, defensive try/catch that cannot act on the error, backwards-compat shims, dead barrels, redundant comments.
|
|
48
|
+
- **Underbuild (trimming real completion) — finish it:** when the task IS "build primitive X", build what makes X complete and usable (configuration, testability, version awareness, shared abstraction) rather than shipping a stub that forces a v2 next week.
|
|
49
|
+
- **Tiebreaker:** foundations (`packages/shared`, core primitives, `@inixiative/*` libraries) lean build-complete; feature code leans trim. Real judgment calls in either direction are surfaced to the user, never decided silently.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 5. Interrogate Before Proposing (Discovery Work)
|
|
54
|
+
|
|
55
|
+
For work where the shape is not yet settled (design, taxonomy, modeling, naming, architecture):
|
|
56
|
+
|
|
57
|
+
- Lead with questions and surface forks before closing the design space.
|
|
58
|
+
- **Talk through semantic/architectural changes with a concrete code specimen before coding.** For new data models, registries, API shapes, or changes to what a primitive *means* (lenses, gates, layering, new options/modes), bring short plain prose + a **20–40 line concrete code specimen** ("what is it going to look like?" — actual schema, object shape, or call site), concrete test cases, and a history check before writing code. Mechanical work (ports, confirmed bugs, cleanups) executes autonomously.
|
|
59
|
+
- **History first:** check prior rulings, git log, and docs before redesigning something already settled.
|
|
60
|
+
- **Small piece → validate → extend.** Validate one concrete sample before fanning out.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 6. Premise Smell, No Cutouts, No Special Cases
|
|
65
|
+
|
|
66
|
+
- **No cutouts fighting the primitive:** if a fix needs a new bypass flag, option, or mode to paper over a caller mismatch, the premise is wrong. Never add an escape hatch that violates a primitive's own invariants; express what you want through composition or fix the general rule.
|
|
67
|
+
- **No special cases:** a carve-out for one input is a missing general rule. Restate the case another way — if a sibling behaves differently, fix the rule.
|
|
68
|
+
- **No backwards compatibility (pre-users):** make clean hard cuts. No dual-accept shims, deprecated aliases, or transitional code.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 7. Review Team Before Anything Lands (`adversarials`)
|
|
73
|
+
|
|
74
|
+
When asked to run **`adversarials`** — and before reporting or merging any non-trivial change — run all **four independent review passes** (separate agents/mandates; see `.claude/skills/inixiative-review-*/`):
|
|
75
|
+
|
|
76
|
+
1. **Base Correctness, Security & Style Consistency (`review-adversarial`)** — break correctness, security, tenant boundaries, races, data loss, contracts, style consistency (`CODE_STYLE.md`), and flag superseded/stale fallback paths for deletion rather than hardening them. Distinguish real defects from explicitly requested product behavior.
|
|
77
|
+
2. **Architectural Subtractor & Stale Plumbing (`review-subtractor`)** — explicit 30–50% deletion mandate plus a mandatory stale-plumbing & surviving-parts reassessment, run **before coding** (on the 10-line prose/diagram plan), **before merge**, and **after every architectural or refactor round before pushing**.
|
|
78
|
+
3. **Full-Package Duplication Audit (`review-dedupe`)** — whole package, lower-level libraries, and sibling repos.
|
|
79
|
+
4. **Vocabulary & Naming Consistency (`review-naming`)** — against [NAMING_VOCABULARY.md](NAMING_VOCABULARY.md), library `VERBS.md`, retired terms, and **within-diff synonym drift** (one exact term per concept across code, tests, and docs).
|
|
80
|
+
|
|
81
|
+
Paired workflow gates:
|
|
82
|
+
- **Plan & Bridge Review (`review-plan`)** — before coding on semantic/architectural changes (including symmetrical premise falsification when a design assumption is questioned).
|
|
83
|
+
- **Cleanup Scan (`cleanup-scan`)** — full outgoing-diff sweep before push.
|
|
84
|
+
- **Keep attribution honest:** when relaying or posting user feedback, state the user's points accurately — never substitute an agent's own review findings for the user's words.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# What Makes a Great Programmer
|
|
2
|
+
|
|
3
|
+
> "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction."
|
|
4
|
+
> — **E. F. Schumacher**, *Small Is Beautiful* (1973) *(often popularly attributed to Albert Einstein)*
|
|
5
|
+
|
|
6
|
+
Code is read at least ten times as often as it is written. With coding agents reading every file on every task, the real ratio is closer to fifty-to-one.
|
|
7
|
+
|
|
8
|
+
Every extra route, flag, wrapper, parallel store, or nested branch you introduce is not a one-time cost when you type it — it is a permanent tax paid by every human and every agent that has to hold the system in their head to make the next change.
|
|
9
|
+
|
|
10
|
+
Writing code that works is table stakes. A great programmer writes the **smallest, clearest system that solves the whole problem through the primitives already in place**, so the next reader understands it in thirty seconds and cannot misuse it.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## The Craft, in Principles and Tests
|
|
15
|
+
|
|
16
|
+
Platitudes don't change code. Every principle below is paired with a **falsifiable rejection test** you run on your own plan and diff before anyone else reads it.
|
|
17
|
+
|
|
18
|
+
### 1. Simplicity Is Subtraction, Not Restraint
|
|
19
|
+
|
|
20
|
+
> "Perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away."
|
|
21
|
+
> — **Antoine de Saint-Exupéry**, *Wind, Sand and Stars* (1939, trans. Lewis Galantière)
|
|
22
|
+
|
|
23
|
+
> "There are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies."
|
|
24
|
+
> — **C. A. R. Hoare**, Turing Award Lecture (1980)
|
|
25
|
+
|
|
26
|
+
> "Simplicity is prerequisite for reliability."
|
|
27
|
+
> — **Edsger W. Dijkstra**, *How Do We Tell Truths That Might Hurt?* (EWD498, 1975)
|
|
28
|
+
|
|
29
|
+
Adding a layer to solve a local problem feels safe and thorough. It is almost always a failure to see the right place in the existing system. Treat every new abstraction, table, route, store, middleware, and config option as guilty until proven necessary.
|
|
30
|
+
|
|
31
|
+
**Rejection test — The 30–50% Subtraction Pass:**
|
|
32
|
+
Before writing code (from your 10-line prose plan) and again before merge, assume your design has 30–50% too much surface area. Ask of every new file, route, column, store, flag, and layer: *which existing primitive in this repo or its core libraries already owns this job or can absorb it cleanly?* If you cannot show a failed attempt to express it on the existing primitive, delete the new piece and fold it in.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
### 2. Optimize for the Reader, Not the Writer
|
|
37
|
+
|
|
38
|
+
> "Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
|
|
39
|
+
> — **Martin Fowler**, *Refactoring* (1999)
|
|
40
|
+
|
|
41
|
+
> "Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?"
|
|
42
|
+
> — **Brian W. Kernighan & P. J. Plauger**, *The Elements of Programming Style* (2nd ed., 1978)
|
|
43
|
+
|
|
44
|
+
A file should read top-to-bottom like a controller: flat guard clauses, single-line early exits, obvious happy path at the end. No nested `if`/`else` pyramids. No grab-bag service files exporting a dozen unrelated functions. No comments narrating what well-named code already says.
|
|
45
|
+
|
|
46
|
+
**Rejection test — The 30-Second Scan:**
|
|
47
|
+
Open any file you wrote. Can another engineer understand every branch, every error exit, and the single thing this file exports in 30 seconds without scrolling back and forth or opening three sibling helpers? If not, flatten the control flow and split by single responsibility.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### 3. Essential Complexity vs. Accidental Complexity
|
|
52
|
+
|
|
53
|
+
> "The essence of a software entity is a construct of interlocking concepts... Most of the big past gains in software productivity have come from removing artificial barriers that have made the accidental tasks inordinately hard."
|
|
54
|
+
> — **Fred Brooks**, *No Silver Bullet* (1986)
|
|
55
|
+
|
|
56
|
+
> "The critical thing to distinguish it from 'simple', is that easy is relative." — *and:* "Simple means one fold or one braid."
|
|
57
|
+
> — **Rich Hickey**, *Simple Made Easy* (2011)
|
|
58
|
+
|
|
59
|
+
Two concepts that change for different reasons, have different lifecycles, or belong to different owners do not belong in one table, one flag, or one function — even if merging them saves ten lines today. Conversely, one concept split across two parallel paths (two auth checks, two rate limiters, two JWT signers) guarantees they will drift apart and fail silently.
|
|
60
|
+
|
|
61
|
+
**Rejection test — One Concept, One Place:**
|
|
62
|
+
Trace a single rule or invariant across your change. Does it live in **one** structural place (the schema, the boundary, or the owning primitive), or is it re-checked or re-implemented in multiple callers? One concept in two places is a bug waiting to happen.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### 4. Design Before You Type — Explain the Mechanism Plainly
|
|
67
|
+
|
|
68
|
+
> "The best programs are written so that computing machines can perform them quickly and so that human beings can understand them clearly."
|
|
69
|
+
> — **Donald E. Knuth**, *Literate Programming* (1992)
|
|
70
|
+
|
|
71
|
+
A great software designer starts from a clean conceptual model. If you cannot explain how a mechanism works in plain prose and a simple diagram, you do not understand it yet — do not write code.
|
|
72
|
+
|
|
73
|
+
Code written turn-by-turn without a clear mechanism accretes scar tissue: a public route here, a Redis bridge token there, a hand-rolled middleware to patch a gap the first patch created. Each turn feels locally justified; the sum is 3× larger than the clean design.
|
|
74
|
+
|
|
75
|
+
**Rejection test — Prose, Code Specimen, and Diagram Before Code:**
|
|
76
|
+
Before editing code on any non-trivial change (new model, schema, registry, API shape, or architectural refactor), show **what it is going to look like** first: a short ~10-line plain-prose flow plus a concrete **20–40 line code specimen** (the actual object literal, Prisma model, type signature, or call site — not just abstract prose) and, for multi-step mechanisms, a simple diagram (Mermaid or a Blueprint "but… so…" chain where every part earns its place). If a part cannot justify why the simpler version before it failed, cut that part before writing a line of code.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### 5. Deep Modules, Honest Invariants, No Cutouts
|
|
81
|
+
|
|
82
|
+
> "The best modules are those that provide powerful functionality yet have simple interfaces. I use the term deep to describe such modules."
|
|
83
|
+
> — **John Ousterhout**, *A Philosophy of Software Design* (2018)
|
|
84
|
+
|
|
85
|
+
> "Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it."
|
|
86
|
+
> — **Alan Perlis**, *Epigrams on Programming* (1982)
|
|
87
|
+
|
|
88
|
+
Never bolt an escape hatch (a skip-check flag, clamp bypass, legacy mode, or one-off carve-out) onto a primitive to accommodate a clumsy caller. Once a primitive makes an exception to its own guarantees, every caller has to audit the implementation to know whether the invariant still holds.
|
|
89
|
+
|
|
90
|
+
**Rejection test — No Special Cases, No Cutouts:**
|
|
91
|
+
Does your change add a boolean flag, bypass option, or one-off carve-out to an existing primitive? Restate the requirement another way; if a sibling case behaves differently, you have a special case — fix the general rule instead.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### 6. Delete Courageously — and Reassess Every Surviving Part After Refactoring
|
|
96
|
+
|
|
97
|
+
> "If we wish to count lines of code, we should not regard them as 'lines produced' but as 'lines spent'."
|
|
98
|
+
> — **Edsger W. Dijkstra**, *On the Cruelty of Really Teaching Computing Science* (EWD1036, 1988)
|
|
99
|
+
|
|
100
|
+
> "One of my most productive days was throwing away 1,000 lines of code."
|
|
101
|
+
> — **Ken Thompson** *(quoted in Eric S. Raymond, The Art of UNIX Programming, 2003)*
|
|
102
|
+
|
|
103
|
+
The best diff often has a negative line count. After an iterative build, review cycle, or architectural change, step back and inspect the *whole* touched subsystem from scratch as if you were building it fresh with everything you now know — never defend a file, route, fallback, or helper just because it already passed tests on an earlier turn.
|
|
104
|
+
|
|
105
|
+
When an architectural change introduces a new invariant or replaces an earlier mechanism, **superseded plumbing does not delete itself.** Agents wire up the new path and leave old fallbacks, guards, helpers, branches, wrappers, and tests standing next to it, forcing the human reviewer to spend hours reading dead layers to spot what no longer needs to exist.
|
|
106
|
+
|
|
107
|
+
**Rejection test — Fresh-Eyes Rebuild & Superseded-Plumbing Audit:**
|
|
108
|
+
1. **Fresh-eyes rebuild:** Ask: *knowing everything I know now, if I built this from scratch in one pass, what would I leave out?*
|
|
109
|
+
2. **Invariant-replacement trace:** List every invariant or mechanism this change established or replaced. Trace every surviving file, helper, hook, fallback, branch, route, column, test, and doc in the touched subsystem — not only the new diff lines — and ask of each: *does this part still need to exist now that the new invariant holds?*
|
|
110
|
+
3. Delete everything superseded before pushing — on **every** refactor round, not just Round 1.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### 7. Falsify the Premise, Don't Defend Consistency
|
|
115
|
+
|
|
116
|
+
> "It is much easier to prove a flawed system internally consistent than to admit its starting axiom is wrong."
|
|
117
|
+
|
|
118
|
+
**Why this goes wrong:** Once a model is written and passes tests or adversarial reviews, agents treat it as a fixed axiom. Tests and adversarial reviews only prove consistency *inside* the current premise — they never prove the premise itself is right. Holding on to a flawed starting assumption turns every new requirement into local patches and extra machinery, and leads to self-inflicted objections: rejecting a simpler alternative because of a problem that only exists under another assumption already in doubt.
|
|
119
|
+
|
|
120
|
+
**Why we ask for pushback:** Both in architecture and in product, the method is walking through implications — *"if we do it this way, what actually happens?"* Pushback and double-checks exist to surface real failure modes before committing — never to argue back into sunk-cost code, and never to agree uncritically. Sunk-cost defense protects the old model from scrutiny; sycophancy protects the new suggestion from scrutiny. Real listening and real pushback are the exact same move applied symmetrically to both sides.
|
|
121
|
+
|
|
122
|
+
**Rejection test — The Symmetrical Premise Check:**
|
|
123
|
+
Whenever a load-bearing assumption is questioned, walk through the implications of both sides on equal footing before recommending one:
|
|
124
|
+
1. **Name both premises** plainly in one line each (**Current** vs. **Alternative**).
|
|
125
|
+
2. **Trace concrete, competing user intents** — include at least one hard case for the current premise and at least one hard case for the alternative. **Do not confabulate smooth outcomes or hand-wave over gaps — the holes are the whole point.**
|
|
126
|
+
3. **Compare the machinery delta** — what tables, columns, hooks, routes, or branches disappear vs. get added under each premise.
|
|
127
|
+
4. **Check for self-inflicted objections** — verify that no argument against the alternative depends on another assumption currently in doubt; if it does, drop both assumptions together and re-evaluate.
|
|
128
|
+
5. **Decide from exposed holes and trade-offs, never sunk cost** — push back hard when the alternative breaks a concrete scenario or adds real risk, and drop the current model cleanly when it is the one accumulating workarounds. Never cite existing code, green tests, or earlier reviews of the old premise as evidence.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Naming and Vocabulary
|
|
2
|
+
|
|
3
|
+
Universal naming rules across all inixiative repositories. A second name for the same concept is the same failure as a second implementation.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Core Principles
|
|
8
|
+
|
|
9
|
+
- **Sentence-like names:** a name reads like a short sentence saying what the code does, to what, and whether it does I/O, throws, or writes — internal names included, never cryptic shortcuts.
|
|
10
|
+
- **Literal Rails-style labels:** say what the thing *is*, not its mechanism or a metaphor (`check` stays `check`; never invent clever euphemisms).
|
|
11
|
+
- **Full model names in every interface:** exported symbols, parameters, schema fields, and API shapes use full model names (`organization`, not `org`). Short local loop variables are tolerated, not preferred.
|
|
12
|
+
- **Core library `VERBS.md`:** every core library keeps a `docs/VERBS.md` mapping one verb per operation to one implementation and a one-sentence meaning (verified by tests). Read it — and the lower library's `VERBS.md` — before naming anything.
|
|
13
|
+
- **Retired names stay retired:** once a term is retired (see `@inixiative/config` `terms`), it never returns in code, docs, or comments.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 2. Standard Verb Table
|
|
18
|
+
|
|
19
|
+
| Verb / Form | Meaning | Examples |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| `fetch*` | Any I/O read (database, cache, Redis, HTTP, filesystem) | `fetchUserById`, `fetchThroughCache` |
|
|
22
|
+
| Noun phrase (no verb) | Pure in-memory lookup or derived value | `roleOf`, `ownerKeys`, `activeCandidates` |
|
|
23
|
+
| `*OrThrow` | Lookup or fetch where absence throws instead of returning `null`/`undefined` | `fetchUserOrThrow` |
|
|
24
|
+
| `make*` | Returns a function, handler, controller, middleware, or handle | `makeController`, `makeError`, `makeRateLimit` |
|
|
25
|
+
| `create*` | Writes a persisted record or builds an adapter client | `createUser`, `createBillingClient` |
|
|
26
|
+
| `register*` | Adds an entry to a registry | `registerRoute`, `registerHook` |
|
|
27
|
+
| `define*` | Declares metadata/configuration only (no side effect) | `defineSetting`, `defineTransition` |
|
|
28
|
+
| `validate*` / `assert*` | Throws on invalid input or violated invariant | `validateConfig`, `assertTransition` |
|
|
29
|
+
| `is*` / `has*` / `can*` | Pure boolean predicate | `isSuperadmin`, `canGrantEntitlement` |
|
|
30
|
+
|
|
31
|
+
**No new `get*`:** use `fetch*` for I/O or a noun phrase for in-memory lookups.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 3. Polymorphic Side Names
|
|
36
|
+
|
|
37
|
+
Every polymorphic relationship uses the exact role name of its side — **never `referenced*`**:
|
|
38
|
+
|
|
39
|
+
| Side | Meaning | Example |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `owner` | Tenancy / ownership only (`ownerModel`, `ownerId`) | `Token`, `Integration`, `BillingAccount` |
|
|
42
|
+
| `source` / `target` | The two ends of a directed edge (`sourceModel`/`sourceId`, `targetModel`/`targetId`) | `Inquiry`, `RuleReference`, `Entitlement` |
|
|
43
|
+
| `resource` | A one-sided polymorphic slot (`resourceModel`, `resourceId`) | `TagAttachment`, `Setting` |
|
|
44
|
+
| `subject` | The row a log or event is about (`subjectModel`, `subjectId`) | `AuditLog` |
|
|
45
|
+
| `actor` | Who performed the action | Request auth context, audit actor |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 4. Soft-Delete Vocabulary
|
|
50
|
+
|
|
51
|
+
- Standardize strictly on **`deleted`** and **`notDeleted`** (`notDeletedWhere`, `notDeletedIncludes`, `notDeletedScope`, `notDeletedCount`).
|
|
52
|
+
- **Never use `live`** to mean "not soft-deleted" (`deletedAt === null`). Reserve `live` strictly for real-time/running meanings (live streams, live queries, live deploys).
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 5. Field Sensitivity Vocabulary
|
|
57
|
+
|
|
58
|
+
| Term | Meaning |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `sensitive` | Value never leaves the server or logs |
|
|
61
|
+
| `mask` | Hide the value in output while recording that it changed |
|
|
62
|
+
| `redact` | Erase a person's data only |
|
|
63
|
+
| `internal` | Never leaves for privilege / visibility reasons |
|
|
64
|
+
| `no-op` | Change not worth auditing or recording |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 6. Shared-Space Identifiers
|
|
69
|
+
|
|
70
|
+
- IDs in a shared namespace (Redis keys, role IDs, resource names) **always carry a namespace prefix from one central registry** (e.g. `redisNamespace`, `roleNamespace`) — never bare hand-typed strings.
|
|
71
|
+
- Resource names use the model's exact casing (`map:Model`, e.g. `db:Inquiry`, `actor:User`) with no translation table; column and relation names stay `camelCase`.
|
|
72
|
+
- Method names are `camelCase`; structured validation issue codes stay `snake_case`.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Authoring Agent Skills
|
|
2
|
+
|
|
3
|
+
Shared standards for writing and editing `SKILL.md` files across all inixiative repositories.
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
A poorly written skill fails in two opposite ways: either it is too vague to change behavior, or it is stuffed with rigid rules and past-incident examples that make agents **overfit** — pattern-matching last week's bug while missing its cousins in other repositories. Explaining *why* a failure happens, paired with generic, actionable checks, lets the agent generalize cleanly to unfamiliar codebases and edge cases.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. Lead With the Why
|
|
12
|
+
|
|
13
|
+
Start every skill body with a short `## Why` section (2–4 lines) stating:
|
|
14
|
+
|
|
15
|
+
- **What failure mode** this skill exists to prevent,
|
|
16
|
+
- **Why** normal execution or other passes miss it, and
|
|
17
|
+
- **What goes wrong** when it is skipped.
|
|
18
|
+
|
|
19
|
+
When an agent holds the *why*, it makes sound judgment calls on cases the skill never enumerated.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 2. Generic, Actionable, and Free of Incident Overfitting
|
|
24
|
+
|
|
25
|
+
- **Distill the failure class, not last Tuesday's PR.** Never paste repo-specific stack lists or one-off incident anecdotes into a universal skill. If a rule came from a concrete bug, abstract it to the structural invariant that failed.
|
|
26
|
+
- **Keep examples sparse and structural.** Avoid laundry lists of examples — models anchor on surface tokens and narrow their scan to those exact shapes. Use an example only when a boundary would otherwise be genuinely ambiguous, and keep it minimal.
|
|
27
|
+
- **Make every bullet falsifiable and actionable.** Replace passive advice (*"be thorough"*, *"keep it clean"*) with a concrete test the agent can execute and report (*"list the top 2–3 surviving pieces you tried to delete and why each survived"*, *"prove every blocking finding with `file:line` and a trace"*).
|
|
28
|
+
- **Apply a holdout mental check.** Before finalizing a universal skill, ask: *if this runs tomorrow on a completely different repo (a pure TypeScript library, a CLI, a backend service), does every line still apply without referencing stack details that aren't there?*
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 3. Calibrate Degrees of Freedom to Fragility
|
|
33
|
+
|
|
34
|
+
Match instruction strictness to how fragile the task is:
|
|
35
|
+
|
|
36
|
+
- **High freedom (WHY + principles + rejection tests):** for judgment-heavy work (architecture, naming, code review, writing). Give the goal, the failure modes, and the verification bar; let the agent reason.
|
|
37
|
+
- **Medium freedom (patterns + structured output format):** for repeatable workflows where the shape of the deliverable matters (review verdicts, tables of findings, plan specimens).
|
|
38
|
+
- **Low freedom (exact commands or scripts):** only for fragile, deterministic gates where deviation breaks tooling or safety (lock-bounded checks, worktree scripts, scan recording).
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 4. Progressive Disclosure (Three Tiers)
|
|
43
|
+
|
|
44
|
+
Keep context footprints lean so skills trigger reliably and do not drown the working thread:
|
|
45
|
+
|
|
46
|
+
1. **Tier 1 — Discovery (`name` + `description` frontmatter):** always loaded into context. Make `description` crisp, third-person, and explicit about *when* to trigger — including exact user codewords (e.g. `"adversarials"`), since models tend to undertrigger.
|
|
47
|
+
2. **Tier 2 — Activation (`SKILL.md` body):** loaded only when the skill activates. Keep it focused and scannable (prefer under ~120 lines; never past 500 lines): `## Why`, the actionable workflow/checklist, hard rules, and `## Output Format`.
|
|
48
|
+
3. **Tier 3 — Execution (`references/`, `scripts/`):** optional deep-dive reference tables or deterministic scripts kept 1-level deep and loaded only on demand. Never put a `README.md` inside a skill directory.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 5. One Concept, One Owner
|
|
53
|
+
|
|
54
|
+
- Do not duplicate a standard document inside a skill; link to `docs/standards/<DOC>.md` and keep the skill focused on the execution pass.
|
|
55
|
+
- Do not let overlapping skills contradict each other — if one standard requires consistent style, no review skill may tell agents to ignore style.
|
package/versions.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@types/bun"
|
|
14
14
|
],
|
|
15
15
|
"ecosystem": {
|
|
16
|
-
"@inixiative/config": "0.5.
|
|
16
|
+
"@inixiative/config": "0.5.261",
|
|
17
17
|
"@inixiative/field-map": "0.1.1",
|
|
18
18
|
"@inixiative/json-rules": "3.16.0",
|
|
19
19
|
"@inixiative/permissions": "0.25.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@inixiative/signet": "0.29.0",
|
|
29
29
|
"@inixiative/integrations": "0.2.1",
|
|
30
30
|
"@inixiative/infra": "0.1.2",
|
|
31
|
-
"@inixiative/kcp": "0.
|
|
31
|
+
"@inixiative/kcp": "0.3.0",
|
|
32
32
|
"@inixiative/archive": "0.35.2",
|
|
33
33
|
"@inixiative/agent-session": "0.12.0",
|
|
34
34
|
"@inixiative/foundry-core": "0.5.13",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"@inixiative/agent-session": "0.23.1",
|
|
63
63
|
"@inixiative/field-map": "0.1.2",
|
|
64
64
|
"@inixiative/permissions": "0.30.0",
|
|
65
|
-
"@inixiative/integrations": "0.4.
|
|
65
|
+
"@inixiative/integrations": "0.4.3",
|
|
66
66
|
"@inixiative/infra": "0.3.7",
|
|
67
67
|
"@inixiative/rules-builder": "0.36.1",
|
|
68
68
|
"@inixiative/transitions": "0.10.1",
|
|
69
|
-
"@inixiative/signet": "0.
|
|
69
|
+
"@inixiative/signet": "0.31.0"
|
|
70
70
|
}
|
|
71
71
|
}
|