AGENT SKILL

speckit-companion-after-specify

Capture the current spec-kit step into .spec-context.json for the Companion GUI

License 许可
MIT
所属仓库
mictlanix/mbe-ui
最近更新
2026-11-15
Stars
★ 0
Forks
0

01 前言 Front Matter

name
speckit-companion-after-specify
metadata
{ "author": "github-spec-kit", "source": "companion:commands/speckit.companion.after-specify.md" }
description
Capture the current spec-kit step into .spec-context.json for the Companion GUI
compatibility
Requires spec-kit project structure with .specify/ directory

03 SKILL.md 正文

Capture Spec Context

Record the active feature's current pipeline step into .spec-context.json so the SpecKit Companion GUI re-renders with the correct step and status. This command runs as the after_specify lifecycle hook — state-writing only; the spec directory and files are created by the core speckit.specify workflow.

Prerequisites

  • Verify Python is available by running python3 --version.
  • If python3 is not available, warn the user and skip the capture: [companion] Warning: python3 not detected; skipped .spec-context.json capture. Do not fail the host command.

Execution

Run the writer script from the repository root, twice.

First the start, only if the before_specify hook had you read the clock when this step began. Pass exactly the time it printed:

python3 .specify/extensions/companion/scripts/write-context.py --step specify --status specifying --kind start --by extension --at <the time you read>

Skip that call when you read no time. A start the GUI already recorded makes it a no-op.

Then the finish, every time:

python3 .specify/extensions/companion/scripts/write-context.py --step specify --status specified --kind complete --by extension

The script resolves the active feature directory on its own, in this order: --feature-dir → SPECIFY_FEATURE_DIRECTORY env → SPECIFY_FEATURE env → .specify/feature.json → current git branch prefix.

If you already know the feature directory (e.g. the one speckit.specify just created), pass --feature-dir specs/<NNN>-<slug> on both calls so resolution is unambiguous.

Graceful Degradation

The script is best-effort and never fails the host command:

  • If python3 is missing, skip with the warning above.
  • If the active feature directory cannot be resolved, the script prints a warning to stderr and exits 0 without writing.

Output

On success the script prints the path it updated and the values written, e.g.: [companion] Updated specs/<NNN>-<slug>/.spec-context.json (currentStep=specify, status=specified, by=extension). The write is atomic (temp file + rename) and appends to the canonical history[] without rewriting existing entries.

04 同仓库更多 Skills