@chankov/agent-skills 0.3.0 → 0.3.2

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 (159) hide show
  1. package/.versions/0.3.2/.claude/commands/build.md +18 -0
  2. package/.versions/0.3.2/.claude/commands/code-simplify.md +22 -0
  3. package/.versions/0.3.2/.claude/commands/design-agent.md +14 -0
  4. package/.versions/0.3.2/.claude/commands/doctor-agent-skills.md +13 -0
  5. package/.versions/0.3.2/.claude/commands/plan.md +16 -0
  6. package/.versions/0.3.2/.claude/commands/prime.md +22 -0
  7. package/.versions/0.3.2/.claude/commands/review.md +16 -0
  8. package/.versions/0.3.2/.claude/commands/setup-agent-skills.md +19 -0
  9. package/.versions/0.3.2/.claude/commands/ship.md +17 -0
  10. package/.versions/0.3.2/.claude/commands/spec.md +15 -0
  11. package/.versions/0.3.2/.claude/commands/test.md +19 -0
  12. package/.versions/0.3.2/.opencode/commands/as-build.md +17 -0
  13. package/.versions/0.3.2/.opencode/commands/as-code-simplify.md +16 -0
  14. package/.versions/0.3.2/.opencode/commands/as-design-agent.md +15 -0
  15. package/.versions/0.3.2/.opencode/commands/as-doctor-agent-skills.md +11 -0
  16. package/.versions/0.3.2/.opencode/commands/as-plan.md +16 -0
  17. package/.versions/0.3.2/.opencode/commands/as-prime.md +22 -0
  18. package/.versions/0.3.2/.opencode/commands/as-review.md +15 -0
  19. package/.versions/0.3.2/.opencode/commands/as-setup-agent-skills.md +11 -0
  20. package/.versions/0.3.2/.opencode/commands/as-ship.md +16 -0
  21. package/.versions/0.3.2/.opencode/commands/as-spec.md +16 -0
  22. package/.versions/0.3.2/.opencode/commands/as-test.md +21 -0
  23. package/.versions/0.3.2/.pi/agents/agent-chain.yaml +49 -0
  24. package/.versions/0.3.2/.pi/agents/bowser.md +19 -0
  25. package/.versions/0.3.2/.pi/agents/pi-pi/agent-expert.md +98 -0
  26. package/.versions/0.3.2/.pi/agents/pi-pi/cli-expert.md +41 -0
  27. package/.versions/0.3.2/.pi/agents/pi-pi/config-expert.md +63 -0
  28. package/.versions/0.3.2/.pi/agents/pi-pi/ext-expert.md +43 -0
  29. package/.versions/0.3.2/.pi/agents/pi-pi/keybinding-expert.md +134 -0
  30. package/.versions/0.3.2/.pi/agents/pi-pi/pi-orchestrator.md +57 -0
  31. package/.versions/0.3.2/.pi/agents/pi-pi/prompt-expert.md +70 -0
  32. package/.versions/0.3.2/.pi/agents/pi-pi/skill-expert.md +42 -0
  33. package/.versions/0.3.2/.pi/agents/pi-pi/theme-expert.md +40 -0
  34. package/.versions/0.3.2/.pi/agents/pi-pi/tui-expert.md +85 -0
  35. package/.versions/0.3.2/.pi/agents/teams.yaml +31 -0
  36. package/.versions/0.3.2/.pi/damage-control-rules.yaml +278 -0
  37. package/.versions/0.3.2/.pi/extensions/agent-skills-update-check/README.md +58 -0
  38. package/.versions/0.3.2/.pi/extensions/agent-skills-update-check/index.ts +161 -0
  39. package/.versions/0.3.2/.pi/extensions/agent-skills-update-check/package.json +6 -0
  40. package/.versions/0.3.2/.pi/extensions/chrome-devtools-mcp/README.md +39 -0
  41. package/.versions/0.3.2/.pi/extensions/chrome-devtools-mcp/index.ts +61 -0
  42. package/.versions/0.3.2/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  43. package/.versions/0.3.2/.pi/extensions/compact-and-continue/README.md +42 -0
  44. package/.versions/0.3.2/.pi/extensions/compact-and-continue/index.ts +120 -0
  45. package/.versions/0.3.2/.pi/extensions/compact-and-continue/package.json +6 -0
  46. package/.versions/0.3.2/.pi/extensions/mcp-bridge/README.md +46 -0
  47. package/.versions/0.3.2/.pi/extensions/mcp-bridge/index.ts +206 -0
  48. package/.versions/0.3.2/.pi/extensions/mcp-bridge/package.json +6 -0
  49. package/.versions/0.3.2/.pi/extensions/package-lock.json +1143 -0
  50. package/.versions/0.3.2/.pi/extensions/package.json +9 -0
  51. package/.versions/0.3.2/.pi/harnesses/agent-chain/README.md +37 -0
  52. package/.versions/0.3.2/.pi/harnesses/agent-chain/index.ts +795 -0
  53. package/.versions/0.3.2/.pi/harnesses/agent-chain/package.json +6 -0
  54. package/.versions/0.3.2/.pi/harnesses/agent-team/README.md +38 -0
  55. package/.versions/0.3.2/.pi/harnesses/agent-team/index.ts +732 -0
  56. package/.versions/0.3.2/.pi/harnesses/agent-team/package.json +6 -0
  57. package/.versions/0.3.2/.pi/harnesses/coms/README.md +36 -0
  58. package/.versions/0.3.2/.pi/harnesses/coms/index.ts +1595 -0
  59. package/.versions/0.3.2/.pi/harnesses/coms/package.json +6 -0
  60. package/.versions/0.3.2/.pi/harnesses/coms-net/README.md +46 -0
  61. package/.versions/0.3.2/.pi/harnesses/coms-net/index.ts +1637 -0
  62. package/.versions/0.3.2/.pi/harnesses/coms-net/package.json +6 -0
  63. package/.versions/0.3.2/.pi/harnesses/damage-control/README.md +38 -0
  64. package/.versions/0.3.2/.pi/harnesses/damage-control/index.ts +207 -0
  65. package/.versions/0.3.2/.pi/harnesses/damage-control/package.json +6 -0
  66. package/.versions/0.3.2/.pi/harnesses/damage-control-continue/README.md +37 -0
  67. package/.versions/0.3.2/.pi/harnesses/damage-control-continue/index.ts +234 -0
  68. package/.versions/0.3.2/.pi/harnesses/damage-control-continue/package.json +6 -0
  69. package/.versions/0.3.2/.pi/harnesses/minimal/README.md +27 -0
  70. package/.versions/0.3.2/.pi/harnesses/minimal/index.ts +32 -0
  71. package/.versions/0.3.2/.pi/harnesses/minimal/package.json +6 -0
  72. package/.versions/0.3.2/.pi/harnesses/package-lock.json +35 -0
  73. package/.versions/0.3.2/.pi/harnesses/package.json +9 -0
  74. package/.versions/0.3.2/.pi/harnesses/pi-pi/README.md +39 -0
  75. package/.versions/0.3.2/.pi/harnesses/pi-pi/index.ts +631 -0
  76. package/.versions/0.3.2/.pi/harnesses/pi-pi/package.json +6 -0
  77. package/.versions/0.3.2/.pi/harnesses/purpose-gate/README.md +27 -0
  78. package/.versions/0.3.2/.pi/harnesses/purpose-gate/index.ts +82 -0
  79. package/.versions/0.3.2/.pi/harnesses/purpose-gate/package.json +6 -0
  80. package/.versions/0.3.2/.pi/harnesses/session-replay/README.md +28 -0
  81. package/.versions/0.3.2/.pi/harnesses/session-replay/index.ts +214 -0
  82. package/.versions/0.3.2/.pi/harnesses/session-replay/package.json +6 -0
  83. package/.versions/0.3.2/.pi/harnesses/subagent-widget/README.md +36 -0
  84. package/.versions/0.3.2/.pi/harnesses/subagent-widget/index.ts +479 -0
  85. package/.versions/0.3.2/.pi/harnesses/subagent-widget/package.json +6 -0
  86. package/.versions/0.3.2/.pi/harnesses/system-select/README.md +39 -0
  87. package/.versions/0.3.2/.pi/harnesses/system-select/index.ts +165 -0
  88. package/.versions/0.3.2/.pi/harnesses/system-select/package.json +6 -0
  89. package/.versions/0.3.2/.pi/harnesses/tilldone/README.md +35 -0
  90. package/.versions/0.3.2/.pi/harnesses/tilldone/index.ts +724 -0
  91. package/.versions/0.3.2/.pi/harnesses/tilldone/package.json +6 -0
  92. package/.versions/0.3.2/.pi/harnesses/tool-counter/README.md +31 -0
  93. package/.versions/0.3.2/.pi/harnesses/tool-counter/index.ts +100 -0
  94. package/.versions/0.3.2/.pi/harnesses/tool-counter/package.json +6 -0
  95. package/.versions/0.3.2/.pi/harnesses/tool-counter-widget/README.md +27 -0
  96. package/.versions/0.3.2/.pi/harnesses/tool-counter-widget/index.ts +66 -0
  97. package/.versions/0.3.2/.pi/harnesses/tool-counter-widget/package.json +6 -0
  98. package/.versions/0.3.2/.pi/prompts/build.md +24 -0
  99. package/.versions/0.3.2/.pi/prompts/code-simplify.md +22 -0
  100. package/.versions/0.3.2/.pi/prompts/doctor-agent-skills.md +13 -0
  101. package/.versions/0.3.2/.pi/prompts/plan.md +16 -0
  102. package/.versions/0.3.2/.pi/prompts/review.md +16 -0
  103. package/.versions/0.3.2/.pi/prompts/setup-agent-skills.md +19 -0
  104. package/.versions/0.3.2/.pi/prompts/ship.md +17 -0
  105. package/.versions/0.3.2/.pi/prompts/spec.md +15 -0
  106. package/.versions/0.3.2/.pi/prompts/test.md +19 -0
  107. package/.versions/0.3.2/.pi/skills/bowser/SKILL.md +114 -0
  108. package/.versions/0.3.2/.version +1 -0
  109. package/.versions/0.3.2/agents/builder.md +6 -0
  110. package/.versions/0.3.2/agents/code-reviewer.md +93 -0
  111. package/.versions/0.3.2/agents/documenter.md +6 -0
  112. package/.versions/0.3.2/agents/plan-reviewer.md +22 -0
  113. package/.versions/0.3.2/agents/planner.md +6 -0
  114. package/.versions/0.3.2/agents/scout.md +6 -0
  115. package/.versions/0.3.2/agents/security-auditor.md +97 -0
  116. package/.versions/0.3.2/agents/test-engineer.md +89 -0
  117. package/.versions/0.3.2/hooks/SIMPLIFY-IGNORE.md +90 -0
  118. package/.versions/0.3.2/hooks/hooks.json +14 -0
  119. package/.versions/0.3.2/hooks/session-start.sh +74 -0
  120. package/.versions/0.3.2/hooks/simplify-ignore-test.sh +247 -0
  121. package/.versions/0.3.2/hooks/simplify-ignore.sh +302 -0
  122. package/.versions/0.3.2/references/accessibility-checklist.md +159 -0
  123. package/.versions/0.3.2/references/performance-checklist.md +121 -0
  124. package/.versions/0.3.2/references/prompting-patterns.md +380 -0
  125. package/.versions/0.3.2/references/security-checklist.md +134 -0
  126. package/.versions/0.3.2/references/testing-patterns.md +236 -0
  127. package/.versions/0.3.2/skills/api-and-interface-design/SKILL.md +294 -0
  128. package/.versions/0.3.2/skills/browser-testing-with-devtools/SKILL.md +335 -0
  129. package/.versions/0.3.2/skills/ci-cd-and-automation/SKILL.md +390 -0
  130. package/.versions/0.3.2/skills/code-review-and-quality/SKILL.md +347 -0
  131. package/.versions/0.3.2/skills/code-simplification/SKILL.md +331 -0
  132. package/.versions/0.3.2/skills/context-engineering/SKILL.md +291 -0
  133. package/.versions/0.3.2/skills/debugging-and-error-recovery/SKILL.md +300 -0
  134. package/.versions/0.3.2/skills/deprecation-and-migration/SKILL.md +206 -0
  135. package/.versions/0.3.2/skills/designing-agents/SKILL.md +394 -0
  136. package/.versions/0.3.2/skills/designing-agents/pi-harness-authoring.md +213 -0
  137. package/.versions/0.3.2/skills/documentation-and-adrs/SKILL.md +278 -0
  138. package/.versions/0.3.2/skills/frontend-ui-engineering/SKILL.md +322 -0
  139. package/.versions/0.3.2/skills/git-workflow-and-versioning/SKILL.md +316 -0
  140. package/.versions/0.3.2/skills/guided-workspace-setup/SKILL.md +345 -0
  141. package/.versions/0.3.2/skills/idea-refine/SKILL.md +178 -0
  142. package/.versions/0.3.2/skills/idea-refine/examples.md +238 -0
  143. package/.versions/0.3.2/skills/idea-refine/frameworks.md +99 -0
  144. package/.versions/0.3.2/skills/idea-refine/refinement-criteria.md +113 -0
  145. package/.versions/0.3.2/skills/idea-refine/scripts/idea-refine.sh +15 -0
  146. package/.versions/0.3.2/skills/incremental-implementation/SKILL.md +279 -0
  147. package/.versions/0.3.2/skills/performance-optimization/SKILL.md +350 -0
  148. package/.versions/0.3.2/skills/planning-and-task-breakdown/SKILL.md +237 -0
  149. package/.versions/0.3.2/skills/security-and-hardening/SKILL.md +349 -0
  150. package/.versions/0.3.2/skills/shipping-and-launch/SKILL.md +309 -0
  151. package/.versions/0.3.2/skills/source-driven-development/SKILL.md +194 -0
  152. package/.versions/0.3.2/skills/spec-driven-development/SKILL.md +237 -0
  153. package/.versions/0.3.2/skills/test-driven-development/SKILL.md +379 -0
  154. package/.versions/0.3.2/skills/using-agent-skills/SKILL.md +176 -0
  155. package/CHANGELOG.md +36 -0
  156. package/bin/lib/bootstrap.js +56 -1
  157. package/docs/npm-install.md +30 -0
  158. package/package.json +1 -1
  159. package/skills/guided-workspace-setup/SKILL.md +16 -2
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: using-agent-skills
3
+ description: Discovers and invokes agent skills. Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.
4
+ ---
5
+
6
+ # Using Agent Skills
7
+
8
+ ## Overview
9
+
10
+ Agent Skills is a collection of engineering workflow skills organized by development phase. Each skill encodes a specific process that senior engineers follow. This meta-skill helps you discover and apply the right skill for your current task.
11
+
12
+ ## Skill Discovery
13
+
14
+ When a task arrives, identify the development phase and apply the corresponding skill:
15
+
16
+ ```
17
+ Task arrives
18
+
19
+ ├── Vague idea/need refinement? ──→ idea-refine
20
+ ├── New project/feature/change? ──→ spec-driven-development
21
+ ├── Have a spec, need tasks? ──────→ planning-and-task-breakdown
22
+ ├── Implementing code? ────────────→ incremental-implementation
23
+ │ ├── UI work? ─────────────────→ frontend-ui-engineering
24
+ │ ├── API work? ────────────────→ api-and-interface-design
25
+ │ ├── Need better context? ─────→ context-engineering
26
+ │ └── Need doc-verified code? ───→ source-driven-development
27
+ ├── Writing/running tests? ────────→ test-driven-development
28
+ │ └── Browser-based? ───────────→ browser-testing-with-devtools
29
+ ├── Something broke? ──────────────→ debugging-and-error-recovery
30
+ ├── Reviewing code? ───────────────→ code-review-and-quality
31
+ │ ├── Security concerns? ───────→ security-and-hardening
32
+ │ └── Performance concerns? ────→ performance-optimization
33
+ ├── Committing/branching? ─────────→ git-workflow-and-versioning
34
+ ├── CI/CD pipeline work? ──────────→ ci-cd-and-automation
35
+ ├── Writing docs/ADRs? ───────────→ documentation-and-adrs
36
+ ├── Authoring a new skill/persona? ─→ designing-agents
37
+ └── Deploying/launching? ─────────→ shipping-and-launch
38
+ ```
39
+
40
+ ## Core Operating Behaviors
41
+
42
+ These behaviors apply at all times, across all skills. They are non-negotiable.
43
+
44
+ ### 1. Surface Assumptions
45
+
46
+ Before implementing anything non-trivial, explicitly state your assumptions:
47
+
48
+ ```
49
+ ASSUMPTIONS I'M MAKING:
50
+ 1. [assumption about requirements]
51
+ 2. [assumption about architecture]
52
+ 3. [assumption about scope]
53
+ → Correct me now or I'll proceed with these.
54
+ ```
55
+
56
+ Don't silently fill in ambiguous requirements. The most common failure mode is making wrong assumptions and running with them unchecked. Surface uncertainty early — it's cheaper than rework.
57
+
58
+ ### 2. Manage Confusion Actively
59
+
60
+ When you encounter inconsistencies, conflicting requirements, or unclear specifications:
61
+
62
+ 1. **STOP.** Do not proceed with a guess.
63
+ 2. Name the specific confusion.
64
+ 3. Present the tradeoff or ask the clarifying question.
65
+ 4. Wait for resolution before continuing.
66
+
67
+ **Bad:** Silently picking one interpretation and hoping it's right.
68
+ **Good:** "I see X in the spec but Y in the existing code. Which takes precedence?"
69
+
70
+ ### 3. Push Back When Warranted
71
+
72
+ You are not a yes-machine. When an approach has clear problems:
73
+
74
+ - Point out the issue directly
75
+ - Explain the concrete downside (quantify when possible — "this adds ~200ms latency" not "this might be slower")
76
+ - Propose an alternative
77
+ - Accept the human's decision if they override with full information
78
+
79
+ Sycophancy is a failure mode. "Of course!" followed by implementing a bad idea helps no one. Honest technical disagreement is more valuable than false agreement.
80
+
81
+ ### 4. Enforce Simplicity
82
+
83
+ Your natural tendency is to overcomplicate. Actively resist it.
84
+
85
+ Before finishing any implementation, ask:
86
+ - Can this be done in fewer lines?
87
+ - Are these abstractions earning their complexity?
88
+ - Would a staff engineer look at this and say "why didn't you just..."?
89
+
90
+ If you build 1000 lines and 100 would suffice, you have failed. Prefer the boring, obvious solution. Cleverness is expensive.
91
+
92
+ ### 5. Maintain Scope Discipline
93
+
94
+ Touch only what you're asked to touch.
95
+
96
+ Do NOT:
97
+ - Remove comments you don't understand
98
+ - "Clean up" code orthogonal to the task
99
+ - Refactor adjacent systems as a side effect
100
+ - Delete code that seems unused without explicit approval
101
+ - Add features not in the spec because they "seem useful"
102
+
103
+ Your job is surgical precision, not unsolicited renovation.
104
+
105
+ ### 6. Verify, Don't Assume
106
+
107
+ Every skill includes a verification step. A task is not complete until verification passes. "Seems right" is never sufficient — there must be evidence (passing tests, build output, runtime data).
108
+
109
+ ## Failure Modes to Avoid
110
+
111
+ These are the subtle errors that look like productivity but create problems:
112
+
113
+ 1. Making wrong assumptions without checking
114
+ 2. Not managing your own confusion — plowing ahead when lost
115
+ 3. Not surfacing inconsistencies you notice
116
+ 4. Not presenting tradeoffs on non-obvious decisions
117
+ 5. Being sycophantic ("Of course!") to approaches with clear problems
118
+ 6. Overcomplicating code and APIs
119
+ 7. Modifying code or comments orthogonal to the task
120
+ 8. Removing things you don't fully understand
121
+ 9. Building without a spec because "it's obvious"
122
+ 10. Skipping verification because "it looks right"
123
+
124
+ ## Skill Rules
125
+
126
+ 1. **Check for an applicable skill before starting work.** Skills encode processes that prevent common mistakes.
127
+
128
+ 2. **Skills are workflows, not suggestions.** Follow the steps in order. Don't skip verification steps.
129
+
130
+ 3. **Multiple skills can apply.** A feature implementation might involve `idea-refine` → `spec-driven-development` → `planning-and-task-breakdown` → `incremental-implementation` → `test-driven-development` → `code-review-and-quality` → `shipping-and-launch` in sequence.
131
+
132
+ 4. **When in doubt, start with a spec.** If the task is non-trivial and there's no spec, begin with `spec-driven-development`.
133
+
134
+ ## Lifecycle Sequence
135
+
136
+ For a complete feature, the typical skill sequence is:
137
+
138
+ ```
139
+ 1. idea-refine → Refine vague ideas
140
+ 2. spec-driven-development → Define what we're building
141
+ 3. planning-and-task-breakdown → Break into verifiable chunks
142
+ 4. context-engineering → Load the right context
143
+ 5. source-driven-development → Verify against official docs
144
+ 6. incremental-implementation → Build slice by slice
145
+ 7. test-driven-development → Prove each slice works
146
+ 8. code-review-and-quality → Review before merge
147
+ 9. git-workflow-and-versioning → Clean commit history
148
+ 10. documentation-and-adrs → Document decisions
149
+ 11. shipping-and-launch → Deploy safely
150
+ ```
151
+
152
+ Not every task needs every skill. A bug fix might only need: `debugging-and-error-recovery` → `test-driven-development` → `code-review-and-quality`.
153
+
154
+ ## Quick Reference
155
+
156
+ | Phase | Skill | One-Line Summary |
157
+ |-------|-------|-----------------|
158
+ | Define | idea-refine | Refine ideas through structured divergent and convergent thinking |
159
+ | Define | spec-driven-development | Requirements and acceptance criteria before code |
160
+ | Plan | planning-and-task-breakdown | Decompose into small, verifiable tasks |
161
+ | Build | incremental-implementation | Thin vertical slices, test each before expanding |
162
+ | Build | source-driven-development | Verify against official docs before implementing |
163
+ | Build | context-engineering | Right context at the right time |
164
+ | Build | frontend-ui-engineering | Production-quality UI with accessibility |
165
+ | Build | api-and-interface-design | Stable interfaces with clear contracts |
166
+ | Verify | test-driven-development | Failing test first, then make it pass |
167
+ | Verify | browser-testing-with-devtools | Chrome DevTools MCP for runtime verification |
168
+ | Verify | debugging-and-error-recovery | Reproduce → localize → fix → guard |
169
+ | Review | code-review-and-quality | Five-axis review with quality gates |
170
+ | Review | security-and-hardening | OWASP prevention, input validation, least privilege |
171
+ | Review | performance-optimization | Measure first, optimize only what matters |
172
+ | Ship | git-workflow-and-versioning | Atomic commits, clean history |
173
+ | Ship | ci-cd-and-automation | Automated quality gates on every change |
174
+ | Ship | documentation-and-adrs | Document the why, not just the what |
175
+ | Ship | shipping-and-launch | Pre-launch checklist, monitoring, rollback plan |
176
+ | Author | designing-agents | Author a persona, workflow skill, or pi harness |
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # agent-skills changelog
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix: skill resolved the wrong source root on dev machines that have a
8
+ local clone of `agent-skills`.
9
+
10
+ Before this fix, `init` bootstrapped the `guided-workspace-setup` SKILL.md
11
+ into the workspace at `.pi/skills/...` (or `.claude/skills/...`). When the
12
+ slash command later loaded the skill, the skill's Step 2 used a "two levels
13
+ above this file" heuristic to find the source package — but that path
14
+ resolved to the _workspace_, not the npm package. The skill then fell back
15
+ to scanning the user's filesystem with `find`, which on a dev machine
16
+ matched the user's own git clone of `agent-skills`. The clone could be
17
+ on a different version, mid-edit, or contain experimental skills the user
18
+ hadn't intended to install.
19
+
20
+ The fix:
21
+
22
+ 1. **`init` now writes `.ai/.agent-skills-bootstrap.json`** containing the
23
+ absolute path to the source package (the npm cache path, the global
24
+ install path, or the symlinked clone — whatever `init` was run from).
25
+ 2. **The skill reads this marker first** when resolving the source root.
26
+ The marker is authoritative; it overrides any older source reference in
27
+ the install record.
28
+ 3. **The skill never scans the filesystem.** If the marker is missing or
29
+ stale (path no longer exists), it asks the user for the path explicitly.
30
+ `find /media/...`, `find ~/repos/...`, etc. are explicitly listed as red
31
+ flags in the skill's anti-pattern table.
32
+ 4. **The marker file is removed** by Step 10b cleanup alongside the
33
+ slash commands.
34
+
35
+ Affects only the skill's behaviour after `init` — no user-facing CLI
36
+ changes. Workspaces upgraded from 0.2.x get the marker on their next
37
+ `npx @chankov/agent-skills init`.
38
+
3
39
  ## 0.3.0
4
40
 
5
41
  ### Minor Changes
@@ -25,9 +25,38 @@
25
25
  // (global install / git clone). Warning printed if the
26
26
  // source path looks like an npx cache.
27
27
 
28
- import { existsSync, mkdirSync, copyFileSync, symlinkSync, unlinkSync, lstatSync, rmSync, readdirSync, rmdirSync } from "node:fs";
28
+ import { existsSync, mkdirSync, copyFileSync, symlinkSync, unlinkSync, lstatSync, rmSync, readdirSync, rmdirSync, writeFileSync, readFileSync } from "node:fs";
29
29
  import { dirname, join, relative } from "node:path";
30
30
 
31
+ // Marker file the skill reads to find the authoritative source root. Written
32
+ // by bootstrap, deleted by cleanupInstaller. Without this, the skill would
33
+ // have to guess the source root from its own SKILL.md location — but bootstrap
34
+ // copies SKILL.md into the workspace, so that heuristic always lies.
35
+ const BOOTSTRAP_MARKER = join(".ai", ".agent-skills-bootstrap.json");
36
+
37
+ function writeMarker({ workspace, sourceRoot, agent, method }) {
38
+ const path = join(workspace, BOOTSTRAP_MARKER);
39
+ const version = readPackageVersion(sourceRoot);
40
+ const payload = {
41
+ sourceRoot,
42
+ version,
43
+ agent,
44
+ method,
45
+ bootstrappedAt: new Date().toISOString(),
46
+ _comment: "Written by `npx @chankov/agent-skills init`. Read by the guided-workspace-setup skill to locate the source package. Safe to delete; will be regenerated on next init.",
47
+ };
48
+ mkdirSync(dirname(path), { recursive: true });
49
+ writeFileSync(path, JSON.stringify(payload, null, 2) + "\n", "utf8");
50
+ return path;
51
+ }
52
+
53
+ function readPackageVersion(sourceRoot) {
54
+ try {
55
+ const pkg = JSON.parse(readFileSync(join(sourceRoot, "package.json"), "utf8"));
56
+ return pkg.version;
57
+ } catch { return null; }
58
+ }
59
+
31
60
  // (agent → list of {kind, src, dest}) — kind is just for the report.
32
61
  //
33
62
  // All installer slash commands are namespaced with `-agent-skills` so they
@@ -184,6 +213,20 @@ export function bootstrap({ agent, sourceRoot, workspace, method, dryRun = false
184
213
  }
185
214
  }
186
215
 
216
+ // Write the marker file as the LAST step — only after all the bootstrap
217
+ // files landed successfully. If the marker exists, the skill trusts it
218
+ // absolutely; if it does not, the skill falls back to safer paths.
219
+ if (!dryRun && written.length > 0) {
220
+ try {
221
+ const markerPath = writeMarker({ workspace, sourceRoot, agent, method });
222
+ written.push({ kind: "marker", dest: markerPath, method: "write" });
223
+ } catch (err) {
224
+ warnings.push(`could not write bootstrap marker: ${err.message}`);
225
+ }
226
+ } else if (dryRun) {
227
+ written.push({ kind: "marker", dest: join(workspace, BOOTSTRAP_MARKER), method: "write" });
228
+ }
229
+
187
230
  return { written, skipped, removed, warnings };
188
231
  }
189
232
 
@@ -206,6 +249,18 @@ export function cleanupInstaller({ agent, workspace, dryRun = false }) {
206
249
  const planned = plan({ agent, sourceRoot: workspace, workspace });
207
250
  const removed = [], kept = [], warnings = [];
208
251
 
252
+ // Marker file goes too — it pointed at a source root that no longer
253
+ // matters once the install is done.
254
+ const markerPath = join(workspace, BOOTSTRAP_MARKER);
255
+ if (existsSync(markerPath)) {
256
+ if (dryRun) {
257
+ removed.push(markerPath);
258
+ } else {
259
+ try { unlinkSync(markerPath); removed.push(markerPath); }
260
+ catch (err) { warnings.push(`could not remove ${relative(workspace, markerPath)}: ${err.message}`); }
261
+ }
262
+ }
263
+
209
264
  for (const item of planned) {
210
265
  if (!existsSync(item.dest) && !isSymlink(item.dest)) {
211
266
  kept.push(item.dest); // already gone — count it as a no-op, not an error
@@ -67,6 +67,36 @@ list. Re-run `npx @chankov/agent-skills init` whenever you want
67
67
  to the Step 9 confirmation prompt — the skill will record
68
68
  `keep-installer: true` in `.ai/agent-skills-setup.md`.
69
69
 
70
+ ### How the skill finds the source package
71
+
72
+ `init` writes one extra file alongside the bootstrap: `.ai/.agent-skills-bootstrap.json`.
73
+ This is the **authoritative** record of where the npm package lives:
74
+
75
+ ```json
76
+ {
77
+ "sourceRoot": "/home/you/.npm/_npx/<hash>/node_modules/@chankov/agent-skills",
78
+ "version": "0.3.0",
79
+ "agent": "pi",
80
+ "method": "copy",
81
+ "bootstrappedAt": "2026-05-24T..."
82
+ }
83
+ ```
84
+
85
+ When `/setup-agent-skills` runs inside your agent, it reads this marker
86
+ *first* to find the source package. This matters on dev machines where you
87
+ may also have a git clone of `agent-skills` elsewhere — the marker prevents
88
+ the skill from accidentally using that clone instead of the version the
89
+ user just installed via npm.
90
+
91
+ If the marker is missing or its `sourceRoot` no longer exists (e.g. npx
92
+ cleaned its cache), the skill **asks you explicitly** for the path. It
93
+ never scans your filesystem for other agent-skills repos — that would
94
+ silently pick up forks, stale checkouts, or dev clones that aren't what
95
+ you installed.
96
+
97
+ The marker is removed by the same Step 10b cleanup that removes the
98
+ slash commands.
99
+
70
100
  | Flag | Default | Purpose |
71
101
  |------|---------|---------|
72
102
  | `--agent <claude-code\|opencode\|pi>` | auto-detect | Skip the agent prompt |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chankov/agent-skills",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Production-grade engineering skills for AI coding agents. Ships skills, agent personas, slash commands, and pi extensions, with a thin CLI that hands off to the LLM-driven guided setup.",
5
5
  "keywords": [
6
6
  "ai",
@@ -34,9 +34,16 @@ Determine which interaction mode this runtime supports, in order of preference:
34
34
 
35
35
  ### 2. Resolve inputs
36
36
 
37
- Resolve four things. Accept any already supplied in the invocation (the `npx agent-skills init` CLI passes the first three as flags); otherwise ask.
37
+ Resolve four things. Accept any already supplied in the invocation (the `npx @chankov/agent-skills init` CLI passes the first three as flags); otherwise ask.
38
+
39
+ - **Source root** — the agent-skills package. **Resolution priority (use the first that works; never fall through silently):**
40
+
41
+ 1. **Bootstrap marker** — read `<workspace>/.ai/.agent-skills-bootstrap.json` if present. Its `sourceRoot` field is authoritative; the CLI wrote it during `init` and it points at the exact package the user's install came from (npm cache, global install, or symlinked clone). Verify the path still exists and contains a `package.json` whose `name` is `@chankov/agent-skills`; if so, use it and **stop**. If the path no longer exists (e.g. npx cache was cleaned), warn the user and continue to step 2.
42
+ 2. **SKILL.md realpath** — only if the marker is missing. If this `SKILL.md` is a symlink, follow it with `readlink`/`realpath` and use the resolved package root. **Do not** use the SKILL.md's *workspace* location (e.g. `.pi/skills/guided-workspace-setup/`) — bootstrap copies the file there, so that path is the workspace, not the source. The realpath only helps in symlink mode.
43
+ 3. **Ask the user explicitly.** Print: *"Source root not found. Run `npx @chankov/agent-skills@latest init` to bootstrap, or paste an absolute path to the package."* Verify the answer is a directory whose `package.json#name` is `@chankov/agent-skills`. **Do not scan the user's filesystem** for other agent-skills repos — that is invasive and produces wrong answers (it will pick up dev clones, forks, or stale copies).
44
+
45
+ The install record's `## install-status` may *also* mention an older source root from a previous setup pass; ignore it for resolution. The bootstrap marker overrides it because it reflects what the user just ran. Note the divergence in the Step 9 summary so the user sees the change.
38
46
 
39
- - **Source root** — the agent-skills package. Derive it from this `SKILL.md`'s own location: `skills/guided-workspace-setup/` sits two levels below the package root. When installed via npm, the package root is `node_modules/agent-skills/` or the `npx` cache.
40
47
  - **Workspace path** — the target project to configure. Confirm the path exists and is a directory; stop and ask again if it does not.
41
48
  - **Coding agent** — `claude-code`, `opencode`, or `pi`. Detect the running agent from the runtime, show it to the user, and let them choose a different one.
42
49
  - **Package version** — read `version` from the source root's `package.json`. This is the version that will be stamped into the install record in Step 10, and the right-hand side of every version-aware diff in Step 6.
@@ -266,6 +273,8 @@ Close the report with one line explaining the installer-cleanup outcome:
266
273
  | "There's an unfamiliar skill in `.claude/skills/` — the user must have forgotten to uncheck it, I'll remove it." | The removal scope rule exists exactly to prevent this. If the name is not in the agent-skills inventory or not in `## install-status`, it is user-owned; leave it alone and log it as skipped. |
267
274
  | "The user wants a clean workspace — I'll prune custom hooks and unrelated MCP entries from `settings.json` too." | Setting-file edits are limited to agent-skills' own hook registrations. Touching anything else silently deletes work that does not belong to this skill. |
268
275
  | "`/setup-agent-skills` and `/doctor-agent-skills` are useful — I'll re-install them at the end of apply so the user can re-run them locally." | They are installer commands that the CLI bootstraps and the skill itself cleans up in Step 10b by default. Keeping them is opt-in via `keep` in Step 9. Re-installing them silently undoes the cleanup the user implicitly chose. |
276
+ | "The bootstrap marker is missing — I'll search the user's `~/repos/`, `~/projects/`, and `/media/` for any clone of `agent-skills` to use as the source root." | Scanning the user's filesystem picks up dev clones, forks, half-edited working trees, and stale checkouts that are NOT the package the user installed from. The npm-installed copy is the only authoritative source after `init`. Without the marker, ask the user explicitly — never guess. |
277
+ | "This `SKILL.md` is two levels below the workspace's `.pi/skills/`, so the workspace root must be the source root." | Bootstrap copies `SKILL.md` into the workspace precisely so the slash command can load it. The workspace is the *target* of the install, not the source. Use the marker file to find the real source; resolving from `SKILL.md`'s workspace location always lies. |
269
278
  | "The recorded version differs from the current — I'll just refresh everything to the new source without showing the diff." | Conflicting upgrades (user-modified copy + source changed upstream) require the three-way diff to be shown in Step 6, with the row pre-unchecked. Refreshing silently overwrites work the user did between versions. |
270
279
  | "The `.versions/<recorded>/` snapshot is missing — I'll pretend the installed copy matches the recorded source and refresh anyway." | A missing snapshot means we cannot compute the three-way diff. The skill must fall back to "treat installed copy as canonical" and surface the missing snapshot in the row's status so the user can decide — never pretend a diff exists. |
271
280
  | "The workspace has no `version:` line — I'll silently stamp the current version and move on." | A pre-versioning workspace must be flagged in Step 4 and the user prompted: stamp the current version (assume copies match) or wipe and reinstall. Silent stamping hides a real decision. |
@@ -297,6 +306,9 @@ Close the report with one line explaining the installer-cleanup outcome:
297
306
  - A pre-versioning workspace stamped with the current version without prompting the user first.
298
307
  - The post-apply `version:` line not matching the package version from Step 2.
299
308
  - Step 9 summary missing the installer-cleanup line, or the line stated `keep` as the default.
309
+ - Source root resolved by scanning the filesystem for `agent-skills` repos (`find`, `fd`, `grep -r`, …) instead of using `.ai/.agent-skills-bootstrap.json` or asking the user.
310
+ - Source root resolved by treating `SKILL.md`'s workspace location (`.pi/skills/...` or `.claude/skills/...`) as the package root.
311
+ - The bootstrap marker file (`.ai/.agent-skills-bootstrap.json`) ignored when present, or trusted blindly when the path it names no longer exists.
300
312
  - Installer files (`setup-agent-skills`, `doctor-agent-skills`, the `guided-workspace-setup` skill body) left in place without a recorded `keep-installer: true`.
301
313
  - `setup-agent-skills` or `doctor-agent-skills` shown as install-menu rows.
302
314
  - Step 11 report omitting the one-line installer-cleanup outcome.
@@ -322,6 +334,8 @@ After completing the workflow, confirm:
322
334
  - [ ] When the version delta was non-empty, Step 9's summary led with the "Changes since v<recorded> → v<current>" block sourced from `CHANGELOG.md`.
323
335
  - [ ] Every `conflicting upgrade` row was rendered with its three-way diff in Step 6 and was not pre-checked.
324
336
  - [ ] A pre-versioning workspace was flagged in Step 4 and the user was prompted to stamp or wipe — not silently stamped.
337
+ - [ ] Source root was resolved from `.ai/.agent-skills-bootstrap.json` if present, or from `SKILL.md`'s realpath (symlink mode), or by asking the user — **never** by scanning the filesystem.
338
+ - [ ] If the bootstrap marker named a path that no longer exists, the user was warned and asked for a new path — not silently ignored.
325
339
  - [ ] Step 9 summary ended with the installer-cleanup line: states remove-by-default and offers `keep` as the opt-out.
326
340
  - [ ] Step 10b ran (or was explicitly skipped because `keep-installer: true`); the installer files are absent from the workspace unless the user opted to keep them.
327
341
  - [ ] Step 11 report includes the one-line installer-cleanup outcome.