$npx -y skills add Codagent-AI/agent-skills --skill initInitializes Agent Skills in a project by checking prerequisites and verifying the validator configuration. Use when the user says "init", "set up agent-skills", or "initialize agent-skills".
| 1 | # Init |
| 2 | |
| 3 | Set up Agent Skills in the current project. This skill is idempotent — safe to re-run. |
| 4 | |
| 5 | **Announce at start:** "Initializing Agent Skills in this project." |
| 6 | |
| 7 | ## Steps |
| 8 | |
| 9 | ### 1. Check Prerequisites |
| 10 | |
| 11 | Check that the Agent Validator CLI is installed. If missing, tell the user what to install and stop. |
| 12 | |
| 13 | - `agent-validator` — run `agent-validator --version`. |
| 14 | - If not found: "Agent Validator CLI is required. Install with `npm install -g agent-validator`, then run `agent-validator init` in your project, then re-run `/codagent:init`." |
| 15 | - If found, extract the version number and verify it is **≥ 0.15**. If too old: "agent-validator 0.15 or higher is required (found \<version\>). Upgrade with `npm install -g agent-validator@latest`, then re-run `/codagent:init`." |
| 16 | |
| 17 | Use this shell snippet to compare versions: |
| 18 | ```bash |
| 19 | version_gte() { [ "$(printf '%s\n' "$2" "$1" | sort -V | head -1)" = "$2" ]; } |
| 20 | ``` |
| 21 | Example: `version_gte "$installed_version" "0.15"` returns true if `$installed_version` ≥ 0.15. |
| 22 | |
| 23 | If the CLI is missing or out of date, stop. The user must resolve it first, then resume `/codagent:init`. |
| 24 | |
| 25 | **Validator config (check after CLI passes):** |
| 26 | - `.validator/config.yml` must exist. If not found: "Validator config not found. Run `agent-validator init` in your project first, then re-run `/codagent:init`." Stop. |
| 27 | |
| 28 | ### 2. Print Success |
| 29 | |
| 30 | Print a summary: |
| 31 | |
| 32 | ``` |
| 33 | Agent Skills initialized successfully. |
| 34 | |
| 35 | Available skills: |
| 36 | - /codagent:propose — evaluate an idea and write a proposal |
| 37 | - /codagent:spec — interview-driven requirement discovery |
| 38 | - /codagent:design — brainstorm architecture and write a design doc |
| 39 | - /codagent:plan-tasks — break a change into scoped task files |
| 40 | - /codagent:implement-and-validate — implement a single task and verify with the validator |
| 41 | - /codagent:finalize-pr — push PR, wait for CI, fix failures |
| 42 | ``` |
| 43 | |
| 44 | ### 3. Commit |
| 45 | |
| 46 | Invoke `/agent-validator:validator-commit skip` to commit any scaffolding changes. Checks are skipped because init only writes boilerplate. |
| 47 | |
| 48 | ## Guardrails |
| 49 | |
| 50 | - Stop on missing or outdated prerequisites — tell user what to install/run and resume with `/codagent:init` |
| 51 | - Never overwrite `.validator/config.yml` — only add/update entry points and reviews |
| 52 | - Use the hosting runtime's native mechanism to locate the plugin's root directory |