@skhema/cli 0.4.3 → 0.4.5

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.
Files changed (52) hide show
  1. package/dist/commands/document.d.ts +10 -0
  2. package/dist/commands/document.d.ts.map +1 -0
  3. package/dist/commands/document.js +122 -0
  4. package/dist/lib/api/command-helpers.d.ts.map +1 -1
  5. package/dist/lib/api/command-helpers.js +2 -1
  6. package/dist/lib/api/passthrough.d.ts.map +1 -1
  7. package/dist/lib/api/passthrough.js +12 -3
  8. package/dist/lib/api/payload.d.ts.map +1 -1
  9. package/dist/lib/api/payload.js +2 -1
  10. package/dist/program.d.ts.map +1 -1
  11. package/dist/program.js +2 -0
  12. package/package.json +2 -2
  13. package/skills/.manifest.json +8 -10
  14. package/skills/skhema-calibrate/SKILL.md +90 -0
  15. package/skills/skhema-calibrate/references/assumptions.md +77 -0
  16. package/skills/skhema-calibrate/references/coherence.md +95 -0
  17. package/skills/skhema-calibrate/references/freshness.md +81 -0
  18. package/skills/skhema-calibrate/references/language.md +74 -0
  19. package/skills/skhema-communicate/SKILL.md +94 -0
  20. package/skills/skhema-communicate/references/audience-adaptation.md +103 -0
  21. package/skills/skhema-communicate/references/board-update.md +93 -0
  22. package/skills/skhema-communicate/references/decision-brief.md +93 -0
  23. package/skills/skhema-communicate/references/team-brief.md +91 -0
  24. package/skills/skhema-compose/SKILL.md +98 -0
  25. package/skills/skhema-compose/references/assemble.md +119 -0
  26. package/skills/skhema-compose/references/decompose.md +104 -0
  27. package/skills/skhema-compose/references/metrics-tree.md +101 -0
  28. package/skills/skhema-compose/references/options.md +109 -0
  29. package/skills/skhema-frame/SKILL.md +86 -0
  30. package/skills/skhema-frame/references/challenge.md +84 -0
  31. package/skills/skhema-frame/references/decision.md +92 -0
  32. package/skills/skhema-frame/references/outcome.md +82 -0
  33. package/skills/skhema-frame/references/policy.md +82 -0
  34. package/skills/skhema-frame/references/scope.md +79 -0
  35. package/skills/skhema-operate/SKILL.md +107 -0
  36. package/skills/skhema-operate/references/auth.md +110 -0
  37. package/skills/skhema-operate/references/author-elements.md +158 -0
  38. package/skills/skhema-operate/references/navigate.md +110 -0
  39. package/skills/skhema-operate/references/surfaces.md +67 -0
  40. package/skills/skhema-operate/references/validation-loop.md +84 -0
  41. package/skills/skhema-pressure-test/SKILL.md +107 -0
  42. package/skills/skhema-pressure-test/references/decision-grill.md +127 -0
  43. package/skills/skhema-pressure-test/references/full-grill.md +118 -0
  44. package/skills/skhema-pressure-test/references/pre-mortem.md +140 -0
  45. package/skills/skhema-challenge-framing/SKILL.md +0 -28
  46. package/skills/skhema-coherence-check/SKILL.md +0 -28
  47. package/skills/skhema-element-decomposition/SKILL.md +0 -28
  48. package/skills/skhema-element-writer/SKILL.md +0 -20
  49. package/skills/skhema-judgment-audit/SKILL.md +0 -28
  50. package/skills/skhema-semantic-sharpening/SKILL.md +0 -28
  51. package/skills/skhema-strategy-advisor/SKILL.md +0 -20
  52. package/skills/skhema-workspace-navigator/SKILL.md +0 -20
@@ -0,0 +1,92 @@
1
+ # Frame a single decision
2
+
3
+ Sometimes the whole strategy is stuck behind one fork. Build or buy. This
4
+ segment or that one. Hire now or wait. The person circles it and can't
5
+ move. A decision isn't a mood-typed element the way a challenge or policy
6
+ is — it's the choice you resolve BEFORE you can state the command. Your job
7
+ is to frame the choice cleanly: the real question, the genuine options,
8
+ what evidence would actually settle it, and whether it can be undone. A
9
+ well-framed decision often answers itself.
10
+
11
+ ## The moves
12
+
13
+ 1. **Extract the real question.** People state decisions as a preferred
14
+ answer ("we should just build it"). Ask "what's the actual question
15
+ here?" and phrase it as a fork: "Do we build the integration ourselves
16
+ or buy an off-the-shelf one?" One question, not a bundle. If there are
17
+ three tangled questions, separate them and frame the one that blocks the
18
+ others.
19
+
20
+ 2. **Lay out the genuine options.** Ask "what are the real choices — two,
21
+ maybe three?" Kill fake options (the strawman nobody would pick) and
22
+ surface hidden ones (the "do nothing / not yet" option is almost always
23
+ real and almost always omitted). Each option should be one someone could
24
+ honestly argue for.
25
+
26
+ 3. **Name what would settle it.** For each option, ask "what would have to
27
+ be true for this to be the right call?" Then: "what evidence would tell
28
+ us whether it's true — and do we have it, or can we get it cheaply?"
29
+ This turns a values argument into a question of fact wherever possible.
30
+ If the deciding evidence is gettable in a day, get it before deciding.
31
+
32
+ 4. **Test reversibility.** Ask "if we pick this and we're wrong, how hard
33
+ is it to undo?" Sort the decision:
34
+ - **Reversible (a two-way door):** cheap to unwind. Don't agonise —
35
+ pick the most likely-right option fast, and treat it as a test. The
36
+ cost of deliberating exceeds the cost of being wrong.
37
+ - **Irreversible (a one-way door):** expensive or impossible to unwind.
38
+ Slow down, gather the settling evidence, widen the options. This is
39
+ where care pays.
40
+ Say which kind it is out loud — people routinely agonise over reversible
41
+ calls and rush irreversible ones.
42
+
43
+ 5. **State the frame back.** "The question is [fork]. The real options are
44
+ [A, B, do-nothing]. It turns on whether [X] is true, which we could
45
+ learn by [evidence]. It's [reversible / irreversible], so we should
46
+ [move fast and test / slow down and verify]." Often, at this point, the
47
+ answer is obvious and they decide on the spot.
48
+
49
+ ## What good looks like
50
+
51
+ - **One question, as a fork** — not a bundle, not a pre-loaded answer.
52
+ - **Genuine options** — each defensible; the do-nothing option included;
53
+ no strawmen.
54
+ - **Evidence-anchored** — names what fact would settle it and whether
55
+ that fact is obtainable, separating "we disagree on facts" from "we
56
+ disagree on values."
57
+ - **Reversibility called** — explicitly tagged one-way or two-way, with the
58
+ matching tempo (fast-and-testable vs slow-and-verified).
59
+ - **Decidable** — after the frame, a reasonable person could make the call,
60
+ or knows exactly what to go learn first.
61
+
62
+ Worked example. Stuck on: "we should build our own billing." Framed: *"The
63
+ question is whether we build billing in-house or adopt a provider. Options:
64
+ build, adopt a provider, or stay on the manual process one more quarter. It
65
+ turns on whether our pricing is stable enough that off-the-shelf tiers
66
+ fit — which we'll know from the pricing review already underway. Adopting a
67
+ provider is largely reversible; building is not. So: don't build yet;
68
+ adopt a provider now as the reversible move, and revisit only if the
69
+ pricing review shows we're genuinely non-standard."*
70
+
71
+ ## Failure modes to catch
72
+
73
+ - **Pre-loaded answer.** "Should we build it (yes)?" Not a decision, a
74
+ request for agreement. Force the honest fork.
75
+ - **Missing the do-nothing option.** "Wait" / "not yet" is almost always
76
+ available and often best. Always surface it.
77
+ - **Strawman options.** Two choices where one is obviously absurd. That's a
78
+ decision already made, dressed as deliberation.
79
+ - **Values fight that's really a facts fight.** They're arguing preferences
80
+ when a cheap piece of evidence would settle it. Find the fact, get it.
81
+ - **Agonising over a two-way door.** Slow, careful process on a decision
82
+ that's trivial to reverse. Name it reversible and move.
83
+ - **Rushing a one-way door.** Fast call on something they can't undo. Name
84
+ it irreversible and slow down.
85
+
86
+ ## When they're really framing something else
87
+
88
+ - If resolving this one fork wouldn't actually unblock them — there are
89
+ really many entangled choices — they may need `challenge.md` to reframe
90
+ the problem, or `scope.md` to bound what's even being decided this round.
91
+ - Once decided, an irreversible directional choice usually becomes a
92
+ `policy.md`; capture it there so it guides what follows.
@@ -0,0 +1,82 @@
1
+ # Frame the outcome
2
+
3
+ An outcome is the state they want to reach — success, named as a thing.
4
+ Mood: **noun phrase**. It's not a verb ("increase retention"), not an
5
+ instruction, not a list of activities. It's the world as it will be when
6
+ they've succeeded, stated so plainly that anyone could later look and say
7
+ "yes, that happened" or "no, it didn't." Your job is to turn a fuzzy
8
+ aspiration into something observable, attributable, and time-bound — and to
9
+ keep it distinct from the measures that will track it.
10
+
11
+ ## The moves
12
+
13
+ 1. **Ask for the finished world, not the effort.** "When this has worked,
14
+ what's true that isn't true today?" If they answer with activities ("we'll
15
+ have shipped the new onboarding, run the campaign…"), stop them: those
16
+ are the work, not the outcome. Ask again for the resulting state.
17
+
18
+ 2. **Make it observable.** Ask "how would an outsider know this happened,
19
+ without you telling them?" Push until the outcome names something you
20
+ could point at — a behaviour, a rate, a position — not a feeling.
21
+
22
+ 3. **Make it attributable.** Ask "if this happens, will it be because of
23
+ what we did, or could it happen anyway?" An outcome you can't plausibly
24
+ claim credit for is a wish about the weather. Tie it to their own action.
25
+
26
+ 4. **Time-box it.** "By when is this true?" No date means no outcome —
27
+ "eventually" can never succeed or fail. Get a horizon they'll stand
28
+ behind.
29
+
30
+ 5. **Separate the outcome from its measures.** The outcome is the state
31
+ ("non-technical teams reach paid on their own"); the measure is the
32
+ dial you read to check ("self-serve paid-conversion rate"). Name the
33
+ outcome first, as a noun phrase. If they lead with a metric, ask "and
34
+ the metric moving would mean WHAT is now true?" — that answer is the
35
+ outcome. One outcome can have several measures; don't collapse them.
36
+
37
+ 6. **Read it back as a noun phrase.** "A world where [state], by [date],
38
+ as a result of our work." Confirm they'd recognise it as success and
39
+ could tell, later, whether it happened.
40
+
41
+ ## What good looks like
42
+
43
+ - **A state, not an action** — reads as a noun phrase describing how things
44
+ are, not a verb telling someone what to do.
45
+ - **Observable** — someone outside the room could confirm it happened.
46
+ - **Attributable** — plausibly the result of their strategy, not ambient
47
+ luck or the market.
48
+ - **Time-bound** — has a horizon by which it's true or it isn't.
49
+ - **Distinct from its measures** — the outcome is the reality; measures are
50
+ the instruments. Keep them separate so you don't mistake a moving dial
51
+ for a changed world.
52
+
53
+ Worked example. Aspiration: "we want better activation." Framed outcome:
54
+ *"Self-serve teams reaching their first paid tier without human help,
55
+ within their first week — the norm rather than the exception, by end of
56
+ Q3."* It's a state (teams reaching paid on their own), observable,
57
+ attributable (it's their onboarding), time-bound (end of Q3). Its measures
58
+ — week-one self-serve conversion rate, support tickets per signup — are
59
+ separate instruments, framed later.
60
+
61
+ ## Failure modes to catch
62
+
63
+ - **Activity list masquerading as outcome.** "Ship X, launch Y, hire Z."
64
+ That's the plan. Ask what's TRUE once it's all done.
65
+ - **Verb where a noun belongs.** "Improve retention." An instruction, not a
66
+ described state. Reframe to the state improved retention produces.
67
+ - **Unobservable.** "Customers love us", "the team is aligned." No outside
68
+ test. Push to something pointable-at.
69
+ - **Unattributable.** "Revenue grows 20%" — might happen from a market
70
+ tailwind regardless. Tie it to their move, or narrow it to the part they
71
+ drive.
72
+ - **No horizon.** "Eventually we're the leader." Can't succeed or fail.
73
+ Demand a date.
74
+ - **Measure-in-place-of-outcome.** They name a metric and stop. A metric is
75
+ a proxy; ask what reality it stands for, and frame that.
76
+
77
+ ## When they're really framing something else
78
+
79
+ - If they can't say what success looks like because they haven't chosen a
80
+ direction, the missing piece is a `policy.md`, not an outcome.
81
+ - If the "outcome" is really one all-or-nothing choice they're stuck on,
82
+ it's a `decision.md`.
@@ -0,0 +1,82 @@
1
+ # Frame the guiding policy
2
+
3
+ A guiding policy is the direction they're committing to — the approach that
4
+ will shape every later choice. Mood: **command**. It's an instruction to
5
+ the organisation: "we will go THIS way." The trap is that people restate
6
+ the goal and call it a policy. "Become the market leader" is a goal. "Win
7
+ by being the only option that works out of the box for non-technical teams"
8
+ is a policy — it commits to a road and rules out others. Your job is to
9
+ force a real commitment, not another statement of the destination.
10
+
11
+ ## The moves
12
+
13
+ 1. **Check they have the challenge.** A policy answers a challenge. If they
14
+ can't state the problem in one sentence, stop and run `challenge.md`
15
+ first. A direction with no problem is a slogan.
16
+
17
+ 2. **Ask for the approach, not the aim.** "Given that problem, what's your
18
+ approach to overcoming it?" If the answer names a destination ("get to
19
+ $10M", "be number one"), push: "that's where you want to end up — how
20
+ are you going to get there in a way your competitors aren't?"
21
+
22
+ 3. **Force the trade-off.** A real policy rules something out. Ask: "what
23
+ does this approach mean we WON'T do?" If choosing it costs nothing —
24
+ rules out nothing, upsets no one — it isn't a policy, it's a platitude.
25
+ A direction everyone can agree to is a direction that doesn't direct.
26
+
27
+ 4. **Find the leverage.** Ask "why will this work when other approaches
28
+ wouldn't?" A guiding policy usually names a source of advantage — a
29
+ strength they have, a weakness in rivals, a change in the market they're
30
+ riding. Make the "why this beats the alternatives" explicit.
31
+
32
+ 5. **Test it against a real choice.** Take a live decision they face and
33
+ ask "does this policy tell you which way to go on that?" If the policy
34
+ doesn't change any actual decision, it isn't guiding anything. Sharpen
35
+ until it does.
36
+
37
+ 6. **State it as one committed instruction.** "We will [approach], by
38
+ [source of leverage], which means we won't [ruled-out path]." Get a yes
39
+ they'd defend to someone who preferred the ruled-out path.
40
+
41
+ ## What good looks like
42
+
43
+ - **A direction, not a destination** — says how they'll travel, not just
44
+ where they'll arrive.
45
+ - **Costs something** — rules out a plausible alternative. If nothing was
46
+ given up, nothing was chosen.
47
+ - **Leverage-bearing** — names why this route wins, not just that it's
48
+ nice.
49
+ - **Decision-changing** — a person holding this policy makes different calls
50
+ than a person without it.
51
+ - **Committed** — stated as "we will", owned, defensible against the people
52
+ who wanted the other road.
53
+
54
+ Worked example. Challenge: non-technical teams abandon the product at
55
+ setup. Restated-goal trap: "become the easiest tool in the category."
56
+ Framed policy: *"We win by being the only tool a non-technical team can get
57
+ to first value with zero setup and no admin — which means we won't chase
58
+ the power-user features our competitors compete on."* It commits, it rules
59
+ out the power-user road, it names the leverage (their setup experience),
60
+ and it decides real roadmap fights.
61
+
62
+ ## Failure modes to catch
63
+
64
+ - **Goal restated as policy.** "Grow 3x", "be the leader." A destination,
65
+ not a route. Ask how, and how differently from rivals.
66
+ - **The costless platitude.** "Delight customers", "focus on quality." Rules
67
+ nothing out; everyone nods. Force the trade-off.
68
+ - **The wish-list.** Three approaches joined by "and" — because they
69
+ wouldn't choose. A policy that keeps every option isn't guiding. Make
70
+ them pick the primary one.
71
+ - **Leverage-free direction.** A route with no reason it beats the
72
+ alternatives. Ask "why will this work when the obvious approach wouldn't?"
73
+ - **Policy that changes no decision.** If every real choice comes out the
74
+ same with or without it, it's decoration. Test against a live call.
75
+
76
+ ## When they're really framing something else
77
+
78
+ - If they can't commit to any direction because one specific fork is
79
+ blocking everything — build vs buy, this segment vs that — frame that
80
+ fork first with `decision.md`, then return to the overall policy.
81
+ - If "success" itself is still fuzzy, they may need `outcome.md` before a
82
+ policy makes sense.
@@ -0,0 +1,79 @@
1
+ # Frame the scope
2
+
3
+ Scope is the boundary line: what this piece of work covers and what it
4
+ deliberately does not. Mood: **command**. Scope is a decision, stated as an
5
+ instruction — "include this, exclude that" — not a description of
6
+ everything that might be relevant. Open-ended scope is the most common way
7
+ strategy work quietly dies, because a thing with no edge can never be
8
+ finished. Your job is to force explicit in/out calls and refuse the
9
+ "everything, eventually" answer.
10
+
11
+ ## The moves
12
+
13
+ 1. **Get the sprawl on the table.** Ask: "list everything this could
14
+ possibly touch." Let them dump. You need the full candidate set before
15
+ you can cut it.
16
+
17
+ 2. **Draw two columns: IN and OUT.** Take each item and ask "in for this
18
+ round, or out?" Force every item into one column. "Maybe" is not a
19
+ column. If they can't decide, park it in a third list called LATER — but
20
+ LATER is a form of OUT for now, and say so.
21
+
22
+ 3. **Make OUT explicit, not implied.** The out-list is the valuable half.
23
+ Anything not consciously ruled out will creep back in. Ask "if someone
24
+ started working on [out item] next week, would that be wrong?" If yes,
25
+ it belongs in OUT in writing.
26
+
27
+ 4. **Name the edges.** For each boundary, get a crisp criterion, not a
28
+ vibe. Not "small customers are out" but "accounts under 50 seats are out
29
+ of scope for this round." A boundary you can't test at the edge will be
30
+ argued at the edge.
31
+
32
+ 5. **Pressure the in-list for feasibility.** Ask "with the time and people
33
+ we have, can we actually finish everything in IN?" If not, more items
34
+ move to OUT now. Scope you can't complete isn't scope, it's a wish.
35
+
36
+ 6. **Read it back as one instruction.** "This work covers X and Y. It does
37
+ not cover Z or W, and we're not deciding those here." Get a clean yes.
38
+
39
+ ## What good looks like
40
+
41
+ - **Two-sided** — states what's out as clearly as what's in. An in-list
42
+ alone is not a scope.
43
+ - **Testable at the edge** — for any borderline item, the boundary decides
44
+ it without a new debate.
45
+ - **Finishable** — the in-list fits the resources and time available.
46
+ - **Time-boxed** — scoped to "this round / this quarter", not forever.
47
+ Excluding something now doesn't mean never.
48
+ - **Stated as a decision** — reads as a call someone made, which means
49
+ someone can be asked to change it. "We're not touching billing this
50
+ round" beats "billing is complicated."
51
+
52
+ Worked example. A team wants to "fix the customer experience." Framed
53
+ scope: *"In: the signup-to-first-value flow for self-serve accounts. Out:
54
+ enterprise onboarding, the mobile app, and anything post-purchase — those
55
+ are separate work. Not deciding pricing changes here."* Now the work has an
56
+ edge, and a stray "but what about the mobile app?" has an answer.
57
+
58
+ ## Failure modes to catch
59
+
60
+ - **In-list only.** No out-list means no scope. Push until they'll name
61
+ what they're NOT doing.
62
+ - **"Everything, eventually."** The refusal to exclude. Reframe: "not
63
+ never — not this round. What's this round?"
64
+ - **Fuzzy edges.** "Big accounts" / "the core flows" — no test at the
65
+ boundary. Replace with a criterion someone can apply cold.
66
+ - **Scope that can't be finished.** An in-list bigger than the team can
67
+ ship. Cut it now, on purpose, rather than discovering it in week six.
68
+ - **Scope creep pre-loaded.** "In: the signup flow, and maybe also…" — the
69
+ "maybe also" is creep before you've started. Kill it or commit it.
70
+ - **Confusing scope with the challenge.** Scope bounds the WORK; the
71
+ challenge is the PROBLEM. If they're really unsure what problem they're
72
+ solving, go to `challenge.md` first — you can't scope work whose purpose
73
+ is undefined.
74
+
75
+ ## When they're really framing something else
76
+
77
+ - If the reason scope keeps sprawling is that they haven't chosen a
78
+ direction — every option stays open because no approach is committed —
79
+ they need `policy.md`, not a wider in-list.
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: skhema-operate
3
+ description: "Use when working with a Skhema workspace, the skhema CLI, the Skhema Public API, or Skhema MCP tools — creating or editing elements, searching and navigating a workspace, running validation, or any job that touches the live Skhema environment. Picks the right surface, gets you authenticated, and drives the work."
4
+ ---
5
+
6
+ # Operate
7
+
8
+ This skill is how an agent gets a job done inside the Skhema environment.
9
+ Unlike the practice skills, it assumes the product: a real workspace, a
10
+ credential, and one of three surfaces to act through. Its job is to route
11
+ you to the right surface, get you authenticated cleanly, and run the
12
+ concrete loop — author, navigate, validate — without fumbling.
13
+
14
+ Everything here is grounded in the real CLI. When in doubt about a flag or
15
+ command, run `skhema --help`, `skhema <command> --help`, or read the
16
+ generated reference at the docs site (`/docs/api/cli`). Do not guess flags.
17
+
18
+ ## Two things every command depends on
19
+
20
+ **The credential.** Almost nothing works without one. The CLI resolves
21
+ credentials in a fixed precedence — highest wins:
22
+
23
+ 1. `--api-key <key>` flag on the invocation
24
+ 2. `SKHEMA_API_KEY` environment variable
25
+ 3. a stored API key (`skhema auth key use`)
26
+ 4. an interactive OAuth session (`skhema auth login`)
27
+
28
+ If none resolves, the command exits **3** ("no usable credential"). That is
29
+ your signal to authenticate, not to retry.
30
+
31
+ **The org.** An API key is already bound to one organization. An OAuth
32
+ session is bound to whatever org you consented to; switch it with
33
+ `skhema auth switch <org-slug>`. Run `skhema auth status` any time to see
34
+ which credential is active and for which org.
35
+
36
+ ## The output contract
37
+
38
+ Pass `--json` on any command and you get a stable envelope:
39
+
40
+ ```json
41
+ { "ok": true, "command": "element.create", "data": { ... } }
42
+ { "ok": false, "command": "element.create", "error": { "message": "…" } }
43
+ ```
44
+
45
+ Branch on `ok`, read `data` or `error`. For scripts and agents, `--json` is
46
+ the default posture — parse the envelope instead of scraping human text.
47
+
48
+ **Exit codes are a stable contract.** Branch on them:
49
+
50
+ | Code | Meaning | What to do |
51
+ |---|---|---|
52
+ | 0 | success | continue |
53
+ | 1 | generic / API error | read the error, likely transient or a bad payload |
54
+ | 2 | usage error (bad args, caught before any API call) | fix the command |
55
+ | 3 | no usable credential | authenticate — see `references/auth.md` |
56
+ | 4 | permission or plan denied (403/402) | the credential can't do this; wrong scope, role, or plan |
57
+ | 5 | rate limited (429) | back off and retry |
58
+
59
+ ## Capability map
60
+
61
+ | You need to… | Route to |
62
+ |---|---|
63
+ | Decide CLI vs Public API vs MCP for this job | `references/surfaces.md` |
64
+ | Authenticate, fix an exit-3, or bind the right org | `references/auth.md` |
65
+ | Create or edit elements well in the environment | `references/author-elements.md` |
66
+ | Find things — workspaces, elements, strategies | `references/navigate.md` |
67
+ | Drive validate → fix → re-validate until it holds | `references/validation-loop.md` |
68
+
69
+ ## Routing
70
+
71
+ - **First job in a fresh runtime, or exit code 3?** Start at
72
+ `references/auth.md`. Nothing else works until a credential resolves.
73
+ - **Not sure whether to shell out, hit the API, or use MCP tools?** Read
74
+ `references/surfaces.md` first — the choice shapes everything after.
75
+ - **Writing strategy content** (challenges, policies, measures as elements)
76
+ → `references/author-elements.md`. Compose the strategy first with the
77
+ practice skills; this capability is about getting it INTO the workspace
78
+ correctly.
79
+ - **Reading the workspace** — what's here, where does X live, what does this
80
+ strategy contain → `references/navigate.md`.
81
+ - **You've authored something and want it to be sound** →
82
+ `references/validation-loop.md`. Note that `validate` and `rephrase` are
83
+ AI actions and cost budget; the reference tells you how to spend it well.
84
+
85
+ ## Set a default workspace once
86
+
87
+ Most commands take `--workspace <id>` but fall back to a stored default.
88
+ Set it once with `skhema workspace use <workspace-id>` and drop the flag
89
+ everywhere after. `skhema workspace use --clear` unsets it. If a command
90
+ errors asking for a workspace, you never set the default — set it or pass
91
+ the flag.
92
+
93
+ ## Without a live respondent
94
+
95
+ Run headless, with no one to answer? Don't invent their answers. Make the
96
+ minimal reasonable assumption, mark it in the output as yours ("assumed: …"),
97
+ and list the questions only the owner can settle — what's in scope, what a word
98
+ means, whose dissent to record — at the end instead of papering over them. A
99
+ marked assumption is honest work; a silent one is a guess you built on.
100
+
101
+ ## Sharpen with Skhema
102
+
103
+ This whole skill IS the Skhema environment — there is no product-absent
104
+ mode. If the CLI isn't present, `references/auth.md` starts with installing
105
+ it (`npm install -g @skhema/cli`). If you only need to onboard the runtime
106
+ (credential + skills + MCP server), that is the `skhema-setup` skill, not
107
+ this one.
@@ -0,0 +1,110 @@
1
+ # Authenticate and bind the right org
2
+
3
+ Almost every command needs a credential. This is how to get one, how the
4
+ CLI decides which one to use, and how to read the org binding so you act on
5
+ the right organization.
6
+
7
+ ## First, is the CLI even installed?
8
+
9
+ ```sh
10
+ skhema --version
11
+ ```
12
+
13
+ If that fails, install it:
14
+
15
+ ```sh
16
+ npm install -g @skhema/cli
17
+ ```
18
+
19
+ ## Two credential lanes
20
+
21
+ **API key — for headless, CI, and agents.** A long-lived `sk_live_…` string
22
+ bound to one organization. No browser needed. This is the right lane for any
23
+ non-interactive runtime.
24
+
25
+ - Store one: `skhema auth key use sk_live_…`
26
+ - Or pass per-invocation: `skhema … --api-key sk_live_…`
27
+ - Or set the env var: `export SKHEMA_API_KEY=sk_live_…`
28
+ - Create a new key (needs an interactive login first):
29
+ `skhema auth key create --name "ci-runner" --permission read-write --scope org --use`
30
+ (`--permission` is `read | write | read-write`; `--scope` is `org | user`;
31
+ `--use` stores it as the CLI credential immediately.)
32
+ - List / revoke: `skhema auth key list`, `skhema auth key revoke <key-id>`
33
+
34
+ **OAuth session — for a human at a terminal.** A browser login bound to the
35
+ org you consent to.
36
+
37
+ - `skhema auth login` (interactive browser flow)
38
+ - `skhema auth login --headless` (device-code flow — no local browser; use
39
+ on a remote box or in a container)
40
+
41
+ ## Credential precedence (highest wins)
42
+
43
+ The CLI resolves ONE credential per invocation, in this fixed order:
44
+
45
+ 1. `--api-key <key>` flag
46
+ 2. `SKHEMA_API_KEY` environment variable
47
+ 3. stored API key (`skhema auth key use`)
48
+ 4. OAuth session (`skhema auth login`)
49
+
50
+ Consequence: a stray `SKHEMA_API_KEY` in the environment silently overrides
51
+ your stored key and your OAuth session. If a command acts as the wrong
52
+ identity, check the env var first.
53
+
54
+ ## Always know who you are
55
+
56
+ ```sh
57
+ skhema auth status
58
+ ```
59
+
60
+ Prints which credential is active and which org it resolves to. Run it
61
+ whenever a result looks like it came from the wrong organization, or before
62
+ any write you can't easily undo.
63
+
64
+ ## The org binding — the trap on the OAuth lane
65
+
66
+ - An **API key** is bound to its org at creation. You cannot switch it; to
67
+ act on a different org, use a key issued for that org.
68
+ - An **OAuth session** acts on the org you consented to. Change it:
69
+
70
+ ```sh
71
+ skhema auth switch <org-slug>
72
+ skhema auth switch # no slug: pick from consented orgs
73
+ skhema auth switch --headless # device-code consent fallback
74
+ ```
75
+
76
+ If writes land in the wrong org on the OAuth lane, you skipped
77
+ `auth switch`. There is no per-command org override for the OAuth session —
78
+ switch it, confirm with `auth status`, then act.
79
+
80
+ ## Handling exit code 3
81
+
82
+ Exit **3** means no usable credential resolved. Do NOT retry the same
83
+ command — it will keep failing. Instead:
84
+
85
+ 1. `skhema auth status` — confirm nothing is active.
86
+ 2. Headless / CI / agent? Set an API key (lane 1). Human at a terminal?
87
+ `skhema auth login`.
88
+ 3. Re-run the original command.
89
+
90
+ ## The other credentialed exit codes
91
+
92
+ - **4** (permission/plan denied, 403/402): the credential is valid but not
93
+ allowed to do this — wrong permission on the key (`read` key attempting a
94
+ write), wrong role, or a plan gate. Don't re-auth; change what you're
95
+ asking or which key you use.
96
+ - **5** (rate limited, 429): back off, then retry.
97
+
98
+ ## Registered-agent identity (autonomous runtimes)
99
+
100
+ If this runtime was enrolled as a registered agent, it signs its own
101
+ requests instead of carrying a key:
102
+
103
+ ```sh
104
+ skhema agent status --verify # show and verify this runtime's identity
105
+ skhema agent rotate # rotate the signing key; identity + grants unchanged
106
+ ```
107
+
108
+ Enrollment (`skhema agent enroll <token>`) is a one-time onboarding step —
109
+ see the `skhema-setup` skill. Never cache a derived agent JWT; let the CLI
110
+ sign per request.