/kibana-dev-workflow-tools:openspec-advisorfrom kibana-dev-workflow-tools
Intelligently decide if a task requires OpenSpec and orchestrate the full spec-driven workflow. OpenSpec is MANDATORY for all change-level specs, planning, and design work -- no exceptions EXCEPT product-level shaping (PRD, tech-stack selection, initial bootstrap), which is upstream of OpenSpec and lives in the product-shaping plugin (/shape-idea, /shape-prd, /shape-tech-stack, /shape-bootstrap). When no context/foundation/prd.md exists yet and the user is shaping a new product, defer to product-shaping. Once a PRD exists and the user is implementing changes against it, OpenSpec takes over. Auto-evaluates complexity signals and seamlessly guides through OpenSpec or direct implementation. Also handles installation guidance when OpenSpec CLI is missing. Triggers on "implement X", "plan this feature", "add feature X", "build Y", "should I use OpenSpec?", "design X", "spec this out".
Ships in kibana-dev-workflow-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Automatically decide if a task requires OpenSpec, then orchestrate the appropriate workflow. OpenSpec is the single source of truth for all spec-driven development.
openspec/ files -- they are local-only planning artifacts and must never appear in PRs or git history.context/foundation/prd.md does not yet exist, defer to the product-shaping plugin (/shape-idea, /shape-prd, /shape-tech-stack, /shape-bootstrap). OpenSpec attaches at the change level — once the product is shaped and scaffolded, every concrete delta against the PRD goes through OpenSpec. PRD shaping never goes inside openspec/.This is the single, narrow exception to "spec work always uses OpenSpec":
| Question | Answer | Tool |
|---|---|---|
| What are we building, for whom, on what kind of stack? | Product-level. One file per product. Lives in context/foundation/. | product-shaping plugin (/shape-idea, /shape-prd, /shape-tech-stack) |
| What's the next concrete change against the product, with spec deltas and tasks? | Change-level. One folder per change. Lives in openspec/changes/. | OpenSpec (this skill) |
Decision rule the advisor must apply at the very top, before any complexity analysis:
If the request is to shape a NEW product or write a PRD AND
context/foundation/prd.md does NOT exist
→ Defer: redirect the user to /shape-idea (or /shape-prd if shape-notes.md exists).
Do NOT invoke OpenSpec. The PRD comes first; OpenSpec changes reference it later.
If context/foundation/prd.md exists AND
the request is for an implementation change against that product
→ This is OpenSpec's territory. Continue with the standard advisor flow below.
If the request is product-shaping work for an EXISTING product
(the user already has a prd.md and is amending / re-shaping it)
→ Defer to /shape-prd or /shape-idea (brownfield mode). PRD revisions are
product-level and don't go through OpenSpec; OpenSpec then references the
updated PRD on the next change.
The triggers /shape-prd, /shape-tech-stack, /shape-idea are never OpenSpec entry points — they are upstream of it. Once the user is past /shape-bootstrap (a scaffolded project exists), every subsequent "implement X" / "design Y" / "spec out Z" against that product is OpenSpec's job.
which openspec && openspec --version
If not installed, guide the user:
npm install -g openspec
Then initialize in the project:
cd <project-root>
openspec init
This creates:
openspec/config.yaml -- project configurationopenspec/specs/ -- finalized specificationsopenspec/changes/ -- active change proposalsopenspec list
If the user gets errors, check:
npm config get prefix + /bin)nvm use 22 && npm install -g openspecUse OpenSpec when ANY of these signals are present:
Spec, planning, or design work -- user says "plan", "design", "spec", "think through", "propose", "architect". Always OpenSpec, no complexity check needed.
Implementation triggers -- user says "implement X", "build X", "add X feature", "create X system", "develop X". Mandatory OpenSpec phase before coding.
File count >= 3 -- glob for related files, count unique files that would be touched.
Architectural scope -- new abstraction/API, pattern change across modules, new capability or system.
Cross-package impact -- changes span multiple @kbn/* packages, shared interfaces/contracts modified.
Trade-offs present -- multiple valid approaches, design decisions needed, performance vs simplicity.
When signals are mixed AND the task is pure implementation (not planning/spec/design):
Use AskUserQuestion to present analysis and let user decide.
Exception: If the user asks for a plan, spec, or design -> always OpenSpec, no asking.
Extract: intent, scope, constraints, unknowns.
# Search for related files in target area
find x-pack/solutions/security -name "*.ts*" -o -name "*.tsx" | wc -l
# Grep for existing patterns that would need updating
grep -r "pattern_to_change" x-pack/solutions/security --include="*.ts" --include="*.tsx" | wc -l
Count: files needing modification + dependents + tests + docs.
Check: new public API? Changed contracts? New abstraction? Core pattern modification? Plugin lifecycle impact?
grep -r "from '@kbn/" path/to/target --include="*.ts" | cut -d"'" -f2 | sort -u
If 2+ distinct @kbn/* packages affected -> cross-package.
Signals detected:
- File count: X files (threshold: 3)
- Architectural: Yes/No
- Cross-package: Yes/No
- Trade-offs: Yes/No
Decision: OPENSPEC / DIRECT / ASK
Choose the mode:
openspec change create --fast-forward) -- user knows what they want, requirements are clearopenspec change create) -- requirements unclear, multiple unknowns, user wants to explore firstComplete ALL artifacts before writing code:
proposal -> specs -> design -> tasks
Use openspec change continue to progress through artifacts one at a time.
If requirements become unclear during artifact creation, use exploration mode to:
After all artifacts are ready, implement using the tasks as a checklist:
Before archiving, verify:
After verification:
openspec archive <change-name>
This syncs delta specs to main specs and moves the change to archive.
yarn test:type_check --project <tsconfig.json>node scripts/eslint --fix $(git diff --name-only)yarn test:jest <path>For OpenSpec work, suggest a worktree if:
# 1. Create worktree
git worktree add ~/Projects/kibana.worktrees/<change-name> -b <change-name>
cd ~/Projects/kibana.worktrees/<change-name>
# 2. Sparse checkout (optional, for speed)
git sparse-checkout init --cone
git sparse-checkout set x-pack/platform/packages/shared/<target-package> scripts .github
# 3. Set up OpenSpec access
MAIN_REPO="$HOME/Projects/kibana"
WT_ROOT="$(pwd)"
if [ -f "$WT_ROOT/.git" ]; then
# Symlink .cursor (shared skills/rules)
[ -e "$WT_ROOT/.cursor" ] || ln -s "$MAIN_REPO/.cursor" "$WT_ROOT/.cursor"
# Create INDEPENDENT openspec directory (NOT a symlink)
# Each worktree gets its own changes/ so work doesn't bleed across worktrees
if [ ! -d "$WT_ROOT/openspec" ]; then
mkdir -p "$WT_ROOT/openspec/changes"
cp "$MAIN_REPO/openspec/config.yaml" "$WT_ROOT/openspec/config.yaml"
# Symlink specs/ to main repo so all finalized specs accumulate in one place
ln -s "$MAIN_REPO/openspec/specs" "$WT_ROOT/openspec/specs"
fi
fi
# 4. Bootstrap
yarn kbn bootstrap
If a worktree already has openspec/ as a full symlink to the main repo, replace it:
WT_ROOT="<worktree-path>"
MAIN_REPO="$HOME/Projects/kibana"
if [ -L "$WT_ROOT/openspec" ]; then
rm "$WT_ROOT/openspec"
mkdir -p "$WT_ROOT/openspec/changes"
cp "$MAIN_REPO/openspec/config.yaml" "$WT_ROOT/openspec/config.yaml"
ln -s "$MAIN_REPO/openspec/specs" "$WT_ROOT/openspec/specs"
fi
cd ~/Projects/kibana
openspec archive <change-name>
git worktree remove ~/Projects/kibana.worktrees/<name>
git branch -d <branch-name>
NEVER stage or commit any files under openspec/ (config, changes, specs, archives). If accidentally staged:
git rm -r --cached openspec/
Ensure .gitignore includes openspec/.
| Item | Path |
|---|---|
| OpenSpec CLI | openspec (globally installed via npm) |
| Changes | openspec/changes/<name>/ |
| Finalized specs | openspec/specs/ |
| Config | openspec/config.yaml |
| OpenSpec repo | https://github.com/openspecio/openspec |
OpenSpec CLI is not installed. To get started:
npm install -g openspec
Then initialize in your project:
cd <project-root>
openspec init
Requirements:
- Node.js >= 18
- npm global bin on PATH
If using nvm:
nvm use 22 && npm install -g openspec
Found active change: <existing-change-name>
Options:
1. Continue existing change (openspec change continue)
2. Create new change
3. Explore existing change first
This is more complex than initially analyzed.
Recommendation:
1. Migrate to OpenSpec workflow
2. Document findings in artifacts
3. Continue with proper planning
User Request
|
v
Is it spec/planning/design work?
|
+--- YES -----------------> OPENSPEC (always)
|
+--- NO: Analyze complexity
|
+--- File count >= 3 OR
+--- Architectural OR
+--- Cross-package OR
+--- Trade-offs present
|
+--- All NO ----------> DIRECT implementation
|
+--- >= 1 YES --------> OPENSPEC workflow
|
+--- Mixed ------------> ASK USER
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub patrykkopycinski/patryks-treadmill-claude-plugins --plugin kibana-dev-workflow-tools7 skills in this plugin
/code-archaeologyUnderstand code history and context through git archaeology to answer "why", "who", and "when" questions about code./cursor-chat-browserSearch and retrieve past Cursor AI conversations across all workspaces. Use when the user asks to find a previous discussion, recall a past decision, check what was discussed before, look up prior implementations, or references "we talked about", "last time", "remember when", "previous conversation", "what did we decide". Also activates on "search conversations", "find chat", "past discussions", "conversation history".
/