qualia-framework 6.2.10 → 6.3.0

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 (58) hide show
  1. package/AGENTS.md +1 -0
  2. package/CLAUDE.md +1 -0
  3. package/README.md +16 -23
  4. package/bin/cli.js +49 -2
  5. package/bin/command-surface.js +71 -0
  6. package/bin/harness-eval.js +296 -0
  7. package/bin/install.js +17 -20
  8. package/bin/knowledge-flush.js +21 -10
  9. package/bin/knowledge.js +1 -1
  10. package/bin/project-snapshot.js +20 -0
  11. package/bin/report-payload.js +18 -0
  12. package/bin/runtime-manifest.js +3 -0
  13. package/bin/state.js +31 -0
  14. package/bin/trust-score.js +3 -11
  15. package/bin/work-packet.js +228 -0
  16. package/docs/erp-contract.md +81 -1
  17. package/docs/onboarding.html +0 -11
  18. package/guide.md +14 -15
  19. package/hooks/fawzi-approval-guard.js +143 -0
  20. package/hooks/pre-deploy-gate.js +74 -1
  21. package/hooks/session-start.js +29 -1
  22. package/package.json +1 -1
  23. package/qualia-design/frontend.md +2 -2
  24. package/rules/codex-goal.md +1 -1
  25. package/rules/one-opinion.md +2 -2
  26. package/rules/speed.md +0 -1
  27. package/skills/qualia/SKILL.md +4 -4
  28. package/skills/qualia-feature/SKILL.md +1 -1
  29. package/skills/qualia-fix/SKILL.md +4 -4
  30. package/skills/qualia-learn/SKILL.md +1 -1
  31. package/skills/qualia-polish/REFERENCE.md +1 -1
  32. package/skills/qualia-polish/SKILL.md +19 -4
  33. package/skills/{qualia-vibe/scripts/extract.mjs → qualia-polish/scripts/vibe-extract.mjs} +4 -4
  34. package/skills/{qualia-vibe/scripts/tokens.mjs → qualia-polish/scripts/vibe-tokens.mjs} +6 -6
  35. package/skills/qualia-road/SKILL.md +15 -20
  36. package/skills/qualia-ship/SKILL.md +12 -5
  37. package/skills/qualia-verify/SKILL.md +9 -1
  38. package/templates/help.html +1 -12
  39. package/tests/bin.test.sh +144 -72
  40. package/tests/hooks.test.sh +81 -1
  41. package/tests/install-smoke.test.sh +13 -3
  42. package/tests/lib.test.sh +145 -3
  43. package/tests/published-install-smoke.test.sh +4 -3
  44. package/tests/refs.test.sh +9 -4
  45. package/tests/runner.js +29 -28
  46. package/tests/state.test.sh +68 -0
  47. package/skills/qualia-debug/SKILL.md +0 -193
  48. package/skills/qualia-flush/SKILL.md +0 -198
  49. package/skills/qualia-help/SKILL.md +0 -74
  50. package/skills/qualia-hook-gen/SKILL.md +0 -206
  51. package/skills/qualia-idk/SKILL.md +0 -166
  52. package/skills/qualia-issues/SKILL.md +0 -151
  53. package/skills/qualia-pause/SKILL.md +0 -68
  54. package/skills/qualia-resume/SKILL.md +0 -52
  55. package/skills/qualia-skill-new/SKILL.md +0 -173
  56. package/skills/qualia-triage/SKILL.md +0 -152
  57. package/skills/qualia-vibe/SKILL.md +0 -229
  58. package/skills/qualia-zoom/SKILL.md +0 -51
@@ -1,166 +0,0 @@
1
- ---
2
- name: qualia-idk
3
- description: "Diagnostic intelligence for 'I don't know what's going on.' Runs two isolated scans (.planning/ vs codebase), cross-references against the user's confusion, then explains the situation in plain language with a concrete recommended next step. Use whenever the user says 'I don't know', 'something feels off', 'not sure what to do', 'am I doing this right', 'what's happening', 'help me understand'."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- - Grep
8
- - Glob
9
- - Agent
10
- ---
11
-
12
- # /qualia-idk — "I Don't Know What's Going On"
13
-
14
- Not a router. A **diagnostician**. Use when the user isn't stuck on a command — they're stuck on *understanding*.
15
-
16
- ## How This Differs from `/qualia`
17
-
18
- | `/qualia` | `/qualia-idk` |
19
- |---|---|
20
- | Mechanical: reads state.js, returns `/qualia-X` | Interpretive: reads the project + the code + the confusion |
21
- | "What command do I run next?" | "What is actually going on here?" |
22
- | Always returns a skill name | Returns an explanation + a recommendation |
23
- | Cheap, instant | Spawns 2 isolated agents, ~30s |
24
-
25
- Run `/qualia` first when the user knows what they're trying to do. Run `/qualia-idk` when the user's confusion is about the *situation itself*.
26
-
27
- ## Process
28
-
29
- ### Step 0. Banner
30
-
31
- ```bash
32
- node ${QUALIA_BIN}/qualia-ui.js banner router
33
- node ${QUALIA_BIN}/qualia-ui.js spawn "diagnostic" "Reading planning and codebase in isolation..."
34
- ```
35
-
36
- Say: **"Let me take a proper look."**
37
-
38
- ### Step 1. Gather the User's Confusion
39
-
40
- Look at the conversation context (if any). Note:
41
- - What did the user just say or ask?
42
- - Any recent errors, failed commands, surprising output?
43
- - Any mismatch between what they expected and what happened?
44
-
45
- If there's nothing in conversation context yet, ask:
46
- - header: "What's unclear?"
47
- - question: "Where are you stuck? (one sentence is fine)"
48
- - Free text.
49
-
50
- Store this as `<user_confusion>`.
51
-
52
- ### Step 2. Spawn Two Isolated Scans (Parallel)
53
-
54
- Two fresh subagents. Each sees ONLY its respective scope — no cross-contamination.
55
-
56
- ```
57
- Agent(prompt="
58
- You are a read-only diagnostic scanner for the .planning/ folder only.
59
-
60
- Read ALL of the following if present:
61
- - .planning/PROJECT.md
62
- - .planning/JOURNEY.md
63
- - .planning/REQUIREMENTS.md
64
- - .planning/ROADMAP.md
65
- - .planning/STATE.md
66
- - .planning/tracking.json
67
- - .planning/phase-*-plan.md (latest 1-2)
68
- - .planning/phase-*-verification.md (latest 1-2)
69
- - .planning/DESIGN.md (skim)
70
- - .continue-here.md (if present)
71
-
72
- DO NOT read any source code — no src/, app/, components/, lib/, etc.
73
- DO NOT run any build tools.
74
-
75
- Produce a 'Plan View' report answering:
76
- 1. What is this project? (one sentence from PROJECT.md)
77
- 2. Where does the plan say we ARE? (current milestone + phase + status)
78
- 3. What does the plan say should be TRUE right now? (current phase's acceptance criteria / success criteria)
79
- 4. What does the plan say is UNFINISHED? (upcoming phases or unresolved gaps from latest verification)
80
- 5. Any plan-level inconsistencies? (e.g. tracking.json says phase 3 but STATE.md says phase 2, JOURNEY.md missing, roadmap out of sync)
81
-
82
- Keep it under 250 words. Be specific. No filler.
83
- ", subagent_type="Explore", description="Plan-view scan")
84
-
85
- Agent(prompt="
86
- You are a read-only diagnostic scanner for the source code only.
87
-
88
- DO NOT read anything in .planning/ — skip it entirely.
89
-
90
- Scan the repo:
91
- - Package/framework detection (package.json, requirements.txt, etc.)
92
- - Entry points (app/, src/, pages/, index.*)
93
- - Key files referenced in recent commits (git log --oneline -5, then inspect)
94
- - Run quick static checks if applicable: 'npx tsc --noEmit' output, lint errors, test status
95
- - Look for stubs: grep for TODO, FIXME, 'not implemented', empty catch blocks, unused exports
96
-
97
- Produce a 'Code View' report answering:
98
- 1. What does the code look like it's BUILDING? (inferred from structure + imports, not from docs)
99
- 2. What ACTUALLY WORKS right now? (compile status, recent commit messages, any obvious smoke signals)
100
- 3. What's STUBBED or INCOMPLETE? (concrete file:line citations)
101
- 4. What's RUNNING locally or deployed? (if there's a dev server log, vercel link, supabase project — flag it)
102
- 5. Any code-level inconsistencies? (imports that don't resolve, routes referenced but not defined, schema mismatches)
103
-
104
- Keep it under 250 words. Cite specific files/lines. No filler.
105
- ", subagent_type="Explore", description="Code-view scan")
106
- ```
107
-
108
- Wait for both. Don't proceed to synthesis until you have both reports.
109
-
110
- ### Step 3. Synthesize
111
-
112
- With both reports + the user's confusion in hand, cross-reference:
113
-
114
- **Produce a structured diagnosis** (use this exact shape):
115
-
116
- ```
117
- ## What I see
118
-
119
- **The plan says:** {1-2 sentences — current milestone/phase/status, what should be true}
120
-
121
- **The code says:** {1-2 sentences — what actually exists, what works, what's stubbed}
122
-
123
- **The mismatch (if any):** {1-2 sentences — where plan and code disagree. If no mismatch, say "plan and code are consistent".}
124
-
125
- ## What I think is happening
126
-
127
- {3-5 sentences, plain language. Tie the user's confusion to what you found. Avoid jargon. If the user said "the login is broken", don't say "the auth middleware has a type inference issue" — say "you're seeing the login fail because the signin function isn't actually imported into the login page, even though the plan says it should be. Someone wrote the helper but forgot to wire it up."}
128
-
129
- ## What to do next
130
-
131
- 1. **{concrete action}** — {one sentence why}
132
- 2. **{concrete action}** — {one sentence why}
133
- 3. **{optional third}** — {one sentence why}
134
-
135
- If one of these maps to an existing Qualia command, use it:
136
- - `/qualia-plan {N} --gaps` if the mismatch is "plan says X but code has stubs"
137
- - `/qualia-verify {N}` if the mismatch is "code says built but no verification exists"
138
- - `/qualia-debug` if a specific error is the block
139
- - `/qualia-map` if the plan and code have drifted far apart
140
- - `/qualia-pause` if the user is overwhelmed and should step away
141
- ```
142
-
143
- ### Step 4. Close
144
-
145
- ```bash
146
- node ${QUALIA_BIN}/qualia-ui.js divider
147
- node ${QUALIA_BIN}/qualia-ui.js end "DIAGNOSED" "{top-recommended action if it's a command, else leave blank}"
148
- ```
149
-
150
- ## Rules
151
-
152
- 1. **Two isolated scans, always.** Plan view never peeks at code, code view never peeks at planning. This is what keeps the diagnosis honest — each agent sees one side of the story, and the synthesis catches the delta.
153
- 2. **Plain language over jargon.** If you can't explain it to a non-dev, rewrite it.
154
- 3. **No fake certainty.** If the scans come back thin (e.g., brand new repo), say "I don't have enough signal yet — here's what I'd do to gather more."
155
- 4. **Never invent facts.** If the code-view scan didn't find something, don't say it exists. Cite files.
156
- 5. **One recommendation primary, two backups.** Decision fatigue is the problem — give the user a lead option.
157
- 6. **Don't re-run if state.js already knows.** If the user's confusion is purely "what's my next command", `/qualia` already handles that — gently suggest it instead of spawning agents.
158
-
159
- ## When NOT to Use
160
-
161
- - User knows what they're doing and just wants the next command → `/qualia`
162
- - User has a specific error message → `/qualia-debug`
163
- - User wants to review code quality → `/qualia-review`
164
- - User wants to pause and come back → `/qualia-pause`
165
-
166
- `/qualia-idk` is specifically for **"I'm not sure what I'm even looking at"** situations. Route to sharper tools when the question is sharper.
@@ -1,151 +0,0 @@
1
- ---
2
- name: qualia-issues
3
- description: "Break a phase plan into independent vertical-slice GitHub issues with needs-triage label. Each issue is demoable end-to-end (schema → API → UI → tests). Dependency-ordered. Externalizes Qualia work to the open queue so other agents, sessions, or human contributors can pull from it. Use when user says 'create issues from this plan', 'externalize the phase', 'turn this into GitHub issues', 'qualia-issues', 'split into tickets', or after /qualia-plan when the work should be parallelizable. Hard dependency: requires tracker config — run /qualia-map first if .planning/agents/tracker.md is missing."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- - Write
8
- - Edit
9
- - Grep
10
- - Glob
11
- - AskUserQuestion
12
- ---
13
-
14
- # /qualia-issues — Phase Plan → Independent Vertical-Slice GH Issues
15
-
16
- Externalizes a phase plan to the GitHub issue queue. Each issue is a thin slice that delivers a complete demoable behavior end-to-end. Other Qualia sessions, autonomous agents, or human contributors can then pull from the queue.
17
-
18
- ## Why vertical slices
19
-
20
- ANTI-PATTERN: chop the plan horizontally (issue 1 = "all schema work", issue 2 = "all API work", issue 3 = "all UI"). This creates dependencies that block parallelism, and no single issue is demoable on its own.
21
-
22
- CORRECT: each issue traverses every layer (schema → API → UI → tests) for one narrow user-facing behavior. Many thin slices > few thick ones.
23
-
24
- ## Hard dependencies (per Matt Pocock's ADR-0001)
25
-
26
- This skill cannot work meaningfully without:
27
- - `.planning/agents/tracker.md` — tells it where to file issues (GH, GL, local)
28
- - `.planning/agents/labels.md` — tells it the canonical-role-to-existing-label mapping
29
- - `gh` CLI authenticated (if tracker is GitHub)
30
-
31
- **If any are missing, halt and tell the user:** "Run `/qualia-map` first — it scans your repo and writes the adapter config so Qualia honors your existing tracker conventions."
32
-
33
- ## Process
34
-
35
- ### 1. Determine phase
36
-
37
- Phase number from `$ARGUMENTS` if provided, else current from `node ${QUALIA_BIN}/state.js check`.
38
-
39
- ### 2. Load substrate
40
-
41
- ```bash
42
- cat .planning/agents/tracker.md
43
- cat .planning/agents/labels.md
44
- cat .planning/phase-{N}-plan.md
45
- cat .planning/CONTEXT.md 2>/dev/null
46
- cat .planning/PROJECT.md
47
- ```
48
-
49
- If `phase-{N}-plan.md` is missing, halt: "No plan exists for phase {N}. Run `/qualia-plan {N}` first."
50
-
51
- ### 3. Decompose into vertical slices
52
-
53
- Read the phase plan tasks. Group/split into slices where each slice:
54
- - Delivers ONE user-facing behavior end-to-end
55
- - Touches every relevant layer (schema, server, client, tests) needed for that behavior
56
- - Is independently demoable or verifiable
57
- - Has explicit blocking-dependencies on other slices (kept minimal)
58
-
59
- Use **CONTEXT.md domain language** in titles and descriptions. Don't say "user table" if the glossary says "AuthUser" or "Customer."
60
-
61
- ### 4. Show proposed slices to user
62
-
63
- ```
64
- Proposed slices for phase {N}:
65
-
66
- Slice 1: {title in domain language}
67
- Behavior: {one sentence}
68
- Touches: schema, server-action, page route, test
69
- Blocks: none
70
-
71
- Slice 2: ...
72
- Blocks: Slice 1 (needs the schema migration)
73
- ```
74
-
75
- Use `AskUserQuestion`:
76
- - header: "Approve slices?"
77
- - question: "File these {N} issues?"
78
- - options: "File them" / "Re-decompose" / "Cancel"
79
-
80
- ### 5. File issues in dependency order
81
-
82
- For each approved slice (in dependency order so blocking slices exist when blockees are filed):
83
-
84
- ```bash
85
- # Write the body to a temp file FIRST — never heredoc-interpolate user content into shell.
86
- # Plan content (titles, behaviors, criteria) is user-controlled; shell metacharacters or a
87
- # rogue 'EOF' line in the plan would break out of the heredoc. --body-file eliminates the risk.
88
- BODY_FILE=$(mktemp -t qualia-issue.XXXXXX.md)
89
- cat > "$BODY_FILE" <<EOF_TEMPLATE
90
- ## End-to-end behavior
91
- {one paragraph}
92
-
93
- ## Acceptance criteria
94
- - [ ] {criterion 1 — observable behavior, not implementation detail}
95
- - [ ] {criterion 2}
96
- - [ ] tests pass for the slice
97
-
98
- ## Blocks
99
- - {issue # of any blocking slice, or "none"}
100
-
101
- ## Domain terms touched
102
- {terms from CONTEXT.md this slice involves}
103
-
104
- ## Phase context
105
- Part of phase {N} ({phase name}). Plan: .planning/phase-{N}-plan.md.
106
- EOF_TEMPLATE
107
-
108
- gh issue create \
109
- --title "{title in domain language}" \
110
- --body-file "$BODY_FILE" \
111
- --label "needs-triage,enhancement"
112
-
113
- rm -f "$BODY_FILE"
114
- ```
115
-
116
- Capture the returned issue number for use in subsequent slices' "Blocks" fields.
117
-
118
- **Why temp file, not heredoc:** plan files (`.planning/phase-{N}-plan.md`) and CONTEXT.md are project repo content — anyone with commit access can write them. A crafted plan with shell metacharacters or a literal `EOF` line in the content could break out of an inline heredoc and execute arbitrary shell. `--body-file` reads the body as raw bytes, no shell expansion. The `EOF_TEMPLATE` token (vs the standard `EOF`) is also more resistant to accidental collisions.
119
-
120
- ### 6. Write summary
121
-
122
- `.planning/phase-{N}-issues.md`:
123
-
124
- ```markdown
125
- # Phase {N} — Issue Queue
126
-
127
- Filed {date}. Status: open queue.
128
-
129
- | # | Slice | Issue | Blocks |
130
- |---|---|---|---|
131
- | 1 | {title} | #123 | none |
132
- | 2 | {title} | #124 | #123 |
133
- ```
134
-
135
- ### 7. Commit and route
136
-
137
- ```bash
138
- git add .planning/phase-{N}-issues.md
139
- git commit -m "docs(phase-{N}): externalize {N_slices} slices to GH issue queue"
140
-
141
- node ${QUALIA_BIN}/qualia-ui.js end "QUEUE FILED" "/qualia-triage"
142
- ```
143
-
144
- ## Rules
145
-
146
- 1. **Each issue is demoable on its own.** If a "completed" issue can't be shown as working behavior, the slicing was wrong.
147
- 2. **CONTEXT.md language is mandatory.** Issue titles use domain terms, not implementation jargon.
148
- 3. **No file paths or line numbers in issue bodies.** Issues describe behavior. Implementation details live in the phase plan.
149
- 4. **Acceptance criteria are observable behaviors.** "Form validates email format" not "regex.test() returns true".
150
- 5. **Dependencies kept minimal.** If slice A blocks slice B blocks slice C blocks slice D, the slicing collapsed to horizontal — re-decompose.
151
- 6. **`needs-triage` is the default label.** `/qualia-triage` will route from there.
@@ -1,68 +0,0 @@
1
- ---
2
- name: qualia-pause
3
- description: "Save session context for seamless handoff. Creates .continue-here.md so the next session picks up exactly where you left off. Trigger on 'pause', 'stop for now', 'save progress', 'continue later', 'pick up tomorrow'."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- - Write
8
- - Edit
9
- ---
10
-
11
- # /qualia-pause — Session Handoff
12
-
13
- Save context so the next session picks up where you left off.
14
-
15
- ## Process
16
-
17
- ```bash
18
- node ${QUALIA_BIN}/qualia-ui.js banner pause
19
- ```
20
-
21
- ### 1. Read State
22
-
23
- ```bash
24
- cat .planning/STATE.md 2>/dev/null
25
- git status --short 2>/dev/null
26
- git log --oneline -5 2>/dev/null
27
- ```
28
-
29
- ### 2. Create `.continue-here.md`
30
-
31
- ```markdown
32
- # Continue Here
33
-
34
- ## Session Summary
35
- {What was accomplished — from conversation context + git log}
36
-
37
- ## Current Phase
38
- Phase {N}: {name} — {status}
39
-
40
- ## In Progress
41
- - {What's partially done}
42
- - {Where exactly work stopped}
43
-
44
- ## Next Steps
45
- 1. {Immediate next action}
46
- 2. {Following action}
47
-
48
- ## Decisions Made
49
- - {Decision and rationale}
50
-
51
- ## Blockers
52
- - {Any unresolved issues}
53
-
54
- ## Files Modified
55
- - {List from git status/diff}
56
- ```
57
-
58
- ### 3. Commit
59
-
60
- ```bash
61
- git add .continue-here.md {any uncommitted work files}
62
- git commit -m "WIP: {phase name} — session handoff"
63
- ```
64
-
65
- ```bash
66
- node ${QUALIA_BIN}/state.js transition --to note --notes "Session paused — see .continue-here.md"
67
- ```
68
- Do NOT manually edit STATE.md or tracking.json — state.js handles both.
@@ -1,52 +0,0 @@
1
- ---
2
- name: qualia-resume
3
- description: "Restore context from a previous session. Reads .continue-here.md or STATE.md, summarizes where you left off, routes to next action. Trigger on 'resume', 'continue', 'pick up where I left off', 'what was I doing'."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- ---
8
-
9
- # /qualia-resume — Resume Work
10
-
11
- Restore context and route to the right next action.
12
-
13
- ## Process
14
-
15
- ### 1. Find Context (priority order)
16
-
17
- 1. `.continue-here.md` — richest source, from `/qualia-pause`
18
- 2. `.planning/STATE.md` — project state
19
- 3. Git history — `git log --oneline -10` + `git diff --stat`
20
-
21
- ### 2. Restore
22
-
23
- **If `.continue-here.md` exists:** Read fully. Summarize: what was done, what's in progress, next steps, blockers.
24
-
25
- **If only STATE.md:** Read STATE.md + tracking.json. Show current phase and status.
26
-
27
- **If neither:** Reconstruct from git. Present findings, ask user to confirm.
28
-
29
- ### 3. Detect Incomplete Work
30
-
31
- - Phase has plan but no verification → execution may be incomplete
32
- - Uncommitted changes → `git status --short`
33
- - Phase marked in-progress in STATE.md
34
-
35
- ### 4. Present and Route
36
-
37
- ```bash
38
- node ${QUALIA_BIN}/qualia-ui.js banner resume
39
- node ${QUALIA_BIN}/qualia-ui.js info "Last session: {summary}"
40
- ```
41
-
42
- If uncommitted changes:
43
- ```bash
44
- node ${QUALIA_BIN}/qualia-ui.js warn "{N} uncommitted files"
45
- ```
46
-
47
- End with the next command:
48
- ```bash
49
- node ${QUALIA_BIN}/qualia-ui.js next "{next command}"
50
- ```
51
-
52
- Clean up `.continue-here.md` after restoration (or offer to keep it).
@@ -1,173 +0,0 @@
1
- ---
2
- name: qualia-skill-new
3
- description: "Author a new Qualia skill or agent. Use when the user says 'create a new skill', 'add a skill', 'I want to build a skill', 'make this a reusable command', 'turn this into a skill'. Generates the SKILL.md, registers it in the right location, and optionally ships to the framework repo."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- - Write
8
- - Edit
9
- - AskUserQuestion
10
- ---
11
-
12
- # /qualia-skill-new — Author a New Skill
13
-
14
- You are about to create a reusable slash command. Skills are the leverage of the Qualia framework — if the team does something twice, it probably belongs here.
15
-
16
- ## Process
17
-
18
- ```bash
19
- node ${QUALIA_BIN}/qualia-ui.js banner skill-new
20
- ```
21
-
22
- ### 1. Scope Decision
23
-
24
- Ask the user with AskUserQuestion:
25
-
26
- ```
27
- question: "Where should this skill live?"
28
- header: "Scope"
29
- options:
30
- - label: "Framework skill (ships to the team)"
31
- description: "Edit qualia-framework repo. Everyone gets it on next update."
32
- - label: "Local skill (just me)"
33
- description: "Lives only in ${QUALIA_SKILLS}/. Not shared."
34
- - label: "Agent instead of a skill"
35
- description: "This is a subagent role, not a slash command. Creates agents/{name}.md."
36
- ```
37
-
38
- ### 1a. Resolve framework directory
39
-
40
- If the user chose **Framework skill** or a framework-scoped **Agent**, resolve `${FRAMEWORK_DIR}` — the checkout path of this user's qualia-framework repo — BEFORE computing any target paths. Never hardcode `/home/<user>/...`; different teammates and operating systems have different paths.
41
-
42
- ```bash
43
- # Priority order: env var → git detection → ask user
44
- FRAMEWORK_DIR="${QUALIA_FRAMEWORK_DIR:-}"
45
- if [ -z "$FRAMEWORK_DIR" ] && git -C . rev-parse --show-toplevel >/dev/null 2>&1; then
46
- ORIGIN=$(git -C . config --get remote.origin.url 2>/dev/null)
47
- case "$ORIGIN" in
48
- *qualia-framework*) FRAMEWORK_DIR=$(git -C . rev-parse --show-toplevel) ;;
49
- esac
50
- fi
51
- echo "${FRAMEWORK_DIR:-UNRESOLVED}"
52
- ```
53
-
54
- If the command prints `UNRESOLVED`, ask the user: *"Where is your qualia-framework checkout? (absolute path, or type 'local' to save only to ${QUALIA_HOME}/)"*. If they type `local`, downgrade the scope to Local. Otherwise store the answer as `${FRAMEWORK_DIR}` for the rest of the session.
55
-
56
- **Framework** → target: `${FRAMEWORK_DIR}/skills/{name}/SKILL.md`
57
- **Local** → target: `${QUALIA_SKILLS}/{name}/SKILL.md`
58
- **Agent** → target: `${FRAMEWORK_DIR}/agents/{name}.md` (framework) or `${QUALIA_AGENTS}/{name}.md` (local)
59
-
60
- ### 2. Gather Requirements
61
-
62
- Ask the user — one question at a time, natural conversation:
63
-
64
- 1. **"What's the name?"** — kebab-case, prefix with `qualia-` for framework skills. E.g., `qualia-seed-db`.
65
- 2. **"What does it do?"** — one sentence, used as the description.
66
- 3. **"How does the user invoke it?"** — trigger phrases they'd naturally say. E.g., "seed the database", "load test data", "populate dev db".
67
- 4. **"Does it need planning / building / verification?"** — if yes, it probably should spawn an agent. If no, it's a direct-action skill.
68
- 5. **"What files does it read or write?"** — tells you what tools to restrict to.
69
-
70
- ### 3. Read Reference Skills
71
-
72
- Before writing, read two existing skills that are structurally similar:
73
-
74
- ```bash
75
- # Short direct-action skill reference:
76
- cat ${QUALIA_SKILLS}/qualia-learn/SKILL.md
77
-
78
- # Skill-that-spawns-an-agent reference:
79
- cat ${QUALIA_SKILLS}/qualia-plan/SKILL.md
80
-
81
- # Interactive wizard reference:
82
- cat ${QUALIA_SKILLS}/qualia-new/SKILL.md
83
- ```
84
-
85
- Pick the closest pattern and copy its structure.
86
-
87
- ### 4. Write the SKILL.md
88
-
89
- Every SKILL.md MUST have:
90
-
91
- ```markdown
92
- ---
93
- name: {kebab-case-name}
94
- description: "{one sentence}. {trigger phrases}"
95
- ---
96
-
97
- # /{name} — {Human Title}
98
-
99
- {one-paragraph explanation}
100
-
101
- ## Usage
102
-
103
- `/{name}` — {default behavior}
104
- `/{name} {arg}` — {with argument}
105
-
106
- ## Process
107
-
108
- ### 1. {First Step}
109
- {specifics}
110
-
111
- ### 2. {Second Step}
112
- {specifics}
113
-
114
- ### N. Update State (only if this skill changes project state)
115
-
116
- ```bash
117
- node ${QUALIA_BIN}/state.js transition --to {status} ...
118
- ```
119
- Do NOT manually edit STATE.md or tracking.json.
120
- ```
121
-
122
- **Description field rules:**
123
- - MUST include trigger phrases the user would naturally say
124
- - The Claude Code router matches user messages against descriptions — if you don't list triggers, the skill never fires
125
- - Bad: `"Manages database seeding."` (no triggers)
126
- - Good: `"Seed the database with test data. Trigger on 'seed db', 'load test data', 'populate dev'."`
127
-
128
- ### 5. Test the Skill
129
-
130
- Spawn a fresh subagent to simulate running the skill — does it make sense without the context you have right now?
131
-
132
- ```
133
- Agent(prompt="
134
- Read this skill: @${QUALIA_SKILLS}/{name}/SKILL.md
135
-
136
- Pretend the user just said '{one of the trigger phrases}'. Walk through what you would do, step by step. Flag anything ambiguous or missing.
137
- ", subagent_type="general-purpose", description="Test skill {name}")
138
- ```
139
-
140
- Fix any ambiguity the test agent found.
141
-
142
- ### 6. Install (if framework skill)
143
-
144
- ```bash
145
- # Framework skill — copy to local .claude for immediate testing
146
- mkdir -p ${QUALIA_SKILLS}/{name}
147
- cp "${FRAMEWORK_DIR}/skills/{name}/SKILL.md" ${QUALIA_SKILLS}/{name}/SKILL.md
148
-
149
- # Verify it parses
150
- node -e "const fs=require('fs');const os=require('os');const path=require('path');const c=fs.readFileSync(path.join(os.homedir(),'.claude/skills/{name}/SKILL.md'),'utf8');if(!c.includes('---'))throw new Error('missing frontmatter');if(!c.match(/^name:\s*\S/m))throw new Error('missing name');if(!c.match(/^description:\s*\S/m))throw new Error('missing description');console.log('OK')"
151
- ```
152
-
153
- ### 7. Commit (framework skills only)
154
-
155
- Do NOT commit unless the user explicitly says "commit" or "ship it".
156
-
157
- When they do:
158
- ```bash
159
- cd "${FRAMEWORK_DIR}"
160
- git add skills/{name}/
161
- git commit -m "feat: add /{name} skill"
162
- ```
163
-
164
- Remind the user to run `npx qualia-framework@latest update` on their other machines (always pin `@latest` — npx caches aggressively), or bump the version and `npm publish`.
165
-
166
- ## Anti-Patterns
167
-
168
- - ❌ **Description without triggers** — the skill won't fire
169
- - ❌ **Multiple commands in one skill** — split into two skills
170
- - ❌ **Direct file writes instead of state.js** — always use state.js for STATE.md/tracking.json
171
- - ❌ **Hardcoded project paths** — use `.planning/` relative or `${QUALIA_HOME}/` absolute, never `/home/specific-user/`
172
- - ❌ **Skills that spawn agents without passing PROJECT.md and STATE.md context** — agents are blind by default
173
- - ❌ **Skills longer than ~150 lines** — split or move logic to an agent