--- name: spar-init description: >- After install or on demand, complete the repo-local spar-kit setup by checking version freshness, relevant local tools, and AGENTS.md; recommend tools and offer needed installs or updates, then finish with a short handoff to spar-specify. --- # Init Run after `spar-kit` is installed in a project, or when the user wants a setup check. Treat this as a post-install verification and light repair pass for the repo-local SPAR bundle. ## What this skill delivers Work through these areas in order unless blocked: 1. **Version check** - compare upstream `VERSION` to local `.spar-kit/VERSION`. 2. **Tool assessment and recommendations** - check relevant local tools and offer needed installations or updates. 3. **`AGENTS.md` recommendation** - encourage a short, effective `AGENTS.md` for lower token usage and clearer agent behavior. 4. **Closeout** - a short summary and a recommendation to use `spar-specify`. --- ## 1. Version check First confirm repository root and note `.spar-kit/VERSION`. - **Canonical:** fetch `https://raw.githubusercontent.com/Jed-Tech/spar-kit/main/VERSION` - **Local:** `/.spar-kit/VERSION` - Compare using SemVer ordering, not string sorting. - If local is missing, invalid, unreadable, or behind upstream: treat the install as stale. - If canonical cannot be fetched: warn that the version check was skipped and continue the rest of init. When stale: - Do **not** hand-edit `.spar-kit/VERSION`. - Recommend rerunning the current install path: - `npx @spar-kit/install` - If the user wants help, explain that reinstall is the supported way to refresh the repo-local SPAR bundle. --- ## 2. Tool assessment and recommendations Assess tools relevant to the repository, operating system, and workflow. Summarize findings and recommendations in chat, and offer to install or update needed tools. ### Tools to consider | Tool | Purpose and relevance | | --- | --- | | `git` | Recommend for version control when working in a Git repository. | | `npm` | Recommend for the `npx @spar-kit/install` install path and repositories using npm tooling. | | `gh`, `glab`, `bb` | Recommend the forge CLI matching the repository host: `gh` for GitHub issues, PRs, and Actions; `glab` for GitLab issues, MRs, and pipelines; `bb` for Bitbucket workflows. | | `winget`, `brew` | Recommend `winget` on Windows or Homebrew (`brew`) on macOS when useful for installing or updating needed tools. | | `uv` | Recommend for Python package and environment management when the repository uses Python tooling. | | `rg` | Recommended optional tool for fast shell-based searching. | | `jq` | Optional tool for JSON-heavy workflows. | | `just` | Recommend based on repo justfile usage, for running repo-defined commands. | ### Checks and offers - Use repository files, remotes, and command usage to select relevant tools from the table. - Run read-only availability and version checks for the selected tools, batching checks when practical. Continue checking the remaining relevant tools if one is missing or fails; distinguish missing tools from failed or unavailable checks. - Summarize actionable findings in chat, explaining each recommendation. Present optional tools as suggestions and identify missing tools needed for specific repository commands as prerequisites for those commands. - Offer to install missing relevant tools or update tools to meet repository requirements or resolve a concrete compatibility problem. Explain the tool and reason for each offer. - Use the user's authorization to carry out installations or updates. Honor authorization already given in the conversation; otherwise present the proposed action and ask before executing it. - After an authorized installation or update, re-check the affected tools and report the outcome, including anything still requiring user action. --- ## 3. `AGENTS.md` recommendation `AGENTS.md` includes a brief description of how to use spar-kit. That guidance is essential and should be kept. Check how many lines `AGENTS.md` contains. If it is longer than 60 lines, give this lightweight recommendation (using natural language): - shorter `AGENTS.md` files are usually better for agent focus and lower token usage - keep instructions crisp, specific, non-redundant, and relevant to most agent communications. - avoid turning `AGENTS.md` into a long instruction list. If `AGENTS.md` is longer than 60 lines, surface this recommendation when found instead of saving it only for closeout, and ask whether the user wants help trimming it. If the user wants help optimizing `AGENTS.md`, keep the guidance brief and preserve the intended SPAR instructions. --- ## 4. Closeout Keep the wrap-up short: - what was verified or fixed - what still needs user action, if anything - state whether SPAR is ready, note any remaining prerequisites or optional tool offers, and recommend `spar-specify` for the next change Example shape: SPAR initialization checks are complete. Checked version freshness and `AGENTS.md` length, assessed relevant local tools, and summarized recommendations and any remaining prerequisites. Mention **`spar-specify`** when starting your next feature or change. --- ## Stop conditions Stop and ask when: - `.spar-kit/VERSION` cannot be checked and the repo-local SPAR bundle is obviously incomplete - `AGENTS.md` is missing or malformed and a safe repair source is not available; explain the issue with an enthusiastic, constructive recommendation for the safest next step Do not use destructive workarounds. ## Completion Initialization is complete when: - version check ran or was skipped with warning - `AGENTS.md` length was checked and a recommendation was given when useful - relevant tools were assessed and recommendations, install/update offers, and any remaining prerequisites were summarized - the closeout is short and points to `spar-specify`