/shaktra:init — Project Initialization
Prerequisites
- Must be run from the root of a project directory
.shaktra/ directory must NOT already exist (prevents double-init)
Execution Steps
Step 0: Verify Prerequisites
Run python3 -c "import yaml" via Bash.
If the command fails (non-zero exit code), stop and report:
"Shaktra requires PyYAML for its hook scripts.
Install with: pip install pyyaml
Then run /shaktra:init again."
Do not proceed to Step 1 until PyYAML is confirmed installed.
Step 1: Guard Against Double Initialization
Check if .shaktra/ directory exists in the current working directory.
- If it exists: stop immediately and report — "Shaktra is already initialized in this project. To reinitialize, remove the
.shaktra/ directory first."
- If it does not exist: proceed.
Step 2: Gather Project Information
Ask the user for the following project details. Present these as a single prompt, offering sensible defaults where possible:
| Field |
Prompt |
Default |
Valid Values |
name |
Project name? |
Current directory name |
Any string |
type |
Greenfield or brownfield? |
greenfield |
greenfield, brownfield |
language |
Primary language? |
(none) |
python, typescript, javascript, go, java, rust, ruby, php, csharp, other |
architecture |
Architecture style? |
(none) |
layered, hexagonal, clean, mvc, feature-based, event-driven, or blank |
test_framework |
Test framework? |
Infer from language |
pytest, jest, vitest, mocha, go test, junit, rspec, phpunit, xunit, or custom |
coverage_tool |
Coverage tool? |
Infer from language |
coverage.py, istanbul/nyc, c8, go cover, jacoco, simplecov, phpunit, coverlet, or custom |
package_manager |
Package manager? |
Infer from language |
pip, poetry, uv, npm, yarn, pnpm, go mod, maven, gradle, cargo, bundler, composer, dotnet, or custom |
Inference rules for defaults:
python → pytest, coverage.py, pip
typescript / javascript → jest, istanbul/nyc, npm
go → go test, go cover, go mod
java → junit, jacoco, maven
rust → cargo test, cargo-tarpaulin, cargo
ruby → rspec, simplecov, bundler
php → phpunit, phpunit, composer
csharp → xunit, coverlet, dotnet
Step 3: Create Directory Structure
Create the following directories:
.shaktra/
.shaktra/memory/
.shaktra/stories/
.shaktra/designs/
.shaktra/analysis/
Step 4: Copy and Populate Templates
Read template files from ${CLAUDE_PLUGIN_ROOT}/templates/ and write them into .shaktra/:
All 7 template files must be copied. Read each from ${CLAUDE_PLUGIN_ROOT}/templates/ and write to .shaktra/:
templates/settings.yml → .shaktra/settings.yml — Replace empty project: fields with user's answers from Step 2
templates/principles.yml → .shaktra/memory/principles.yml — Copy as-is
templates/anti-patterns.yml → .shaktra/memory/anti-patterns.yml — Copy as-is
templates/procedures.yml → .shaktra/memory/procedures.yml — Copy as-is
templates/sprints.yml → .shaktra/sprints.yml — Copy as-is
templates/analysis-manifest.yml → .shaktra/analysis/manifest.yml — Copy as-is
templates/shaktra-CLAUDE.md → .shaktra/CLAUDE.md — Copy as-is (project state documentation — describes what .shaktra/ contains)
For settings.yml, populate the project: section with the gathered values:
project:
name: "<user's project name>"
type: "<greenfield or brownfield>"
language: "<user's language>"
architecture: "<user's architecture style, or empty>"
test_framework: "<user's test framework>"
coverage_tool: "<user's coverage tool>"
package_manager: "<user's package manager>"
Architecture field notes:
- For greenfield: ask user to choose an architecture style. If unsure, leave blank — the architect agent will propose one in the first design doc and it gets recorded in
principles.yml.
- For brownfield: leave blank at init. The
/shaktra:analyze workflow detects the existing architecture (D1: structure.yml) and the user can populate this field after analysis.
All other sections (tdd, quality, analysis, sprints, memory) retain their template defaults.
Step 5: Handle Project CLAUDE.md
Read the project CLAUDE.md template from ${CLAUDE_PLUGIN_ROOT}/templates/CLAUDE.md.
This template is a generic project documentation wireframe — no Shaktra-specific content. It includes:
- Project overview section with placeholders for name, purpose, technologies
- Development workflow and code style guidance
- Architecture section with component descriptions
- Quality standards and testing requirements
- Deployment and operations procedures
- Decision log
- Contributing guidelines
Note: A separate .shaktra/CLAUDE.md file is also created to document the .shaktra/ directory structure and how Shaktra agents use it.
If no CLAUDE.md exists in the project root:
- Create
CLAUDE.md with the template content.
If CLAUDE.md already exists in the project root:
- Do NOT overwrite the existing file.
- Report to user: "CLAUDE.md already exists. Shaktra initialization complete. You can update CLAUDE.md with your project-specific information, or run
/init CLAUDE.md to have Claude fill it in."
Step 5b: Handle Legacy Migration (Upgrade Path)
If .shaktra/memory/decisions.yml or .shaktra/memory/lessons.yml already exist (upgrading from a previous Shaktra version):
- Inform the user: "Legacy memory files detected (decisions.yml, lessons.yml). These have been replaced by the new principles-based memory system."
- Offer to run migration: "Run the migration script to convert existing decisions and lessons into principles? (recommended)"
- If yes: execute
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/migrate_memory.py <project_root>
- If no: inform user they can run it later manually
Step 6: Report Results
Display a summary of what was created:
Shaktra initialized successfully!
Project: <name> (<type>)
Language: <language>
Test Framework: <test_framework>
Coverage Tool: <coverage_tool>
Package Manager: <package_manager>
Created:
.shaktra/CLAUDE.md # Project state documentation (.shaktra/ structure and contents)
.shaktra/settings.yml
.shaktra/sprints.yml
.shaktra/memory/principles.yml
.shaktra/memory/anti-patterns.yml
.shaktra/memory/procedures.yml
.shaktra/analysis/manifest.yml
.shaktra/memory/
.shaktra/stories/
.shaktra/designs/
.shaktra/analysis/
CLAUDE.md (created | already exists)
Next steps:
1. Update CLAUDE.md with your project-specific information
2. Review .shaktra/settings.yml and adjust thresholds if needed
3. For brownfield projects: run /shaktra:analyze to understand the existing codebase
4. Run /shaktra:tpm to create design docs and stories
5. Run /shaktra:help for available commands and workflows
1---2name: shaktra-init3description: Initialize the Shaktra framework in the current project. Creates the .shaktra/ directory structure, populates configuration from templates, and sets up the project CLAUDE.md.4---56# /shaktra:init — Project Initialization78## Prerequisites910- Must be run from the root of a project directory11- `.shaktra/` directory must NOT already exist (prevents double-init)1213## Execution Steps1415### Step 0: Verify Prerequisites1617Run `python3 -c "import yaml"` via Bash.1819If the command fails (non-zero exit code), stop and report:20 "Shaktra requires PyYAML for its hook scripts.21 Install with: pip install pyyaml22 Then run /shaktra:init again."2324Do not proceed to Step 1 until PyYAML is confirmed installed.2526### Step 1: Guard Against Double Initialization2728Check if `.shaktra/` directory exists in the current working directory.2930- If it exists: stop immediately and report — "Shaktra is already initialized in this project. To reinitialize, remove the `.shaktra/` directory first."31- If it does not exist: proceed.3233### Step 2: Gather Project Information3435Ask the user for the following project details. Present these as a single prompt, offering sensible defaults where possible:3637| Field | Prompt | Default | Valid Values |38|---|---|---|---|39| `name` | Project name? | Current directory name | Any string |40| `type` | Greenfield or brownfield? | greenfield | `greenfield`, `brownfield` |41| `language` | Primary language? | _(none)_ | `python`, `typescript`, `javascript`, `go`, `java`, `rust`, `ruby`, `php`, `csharp`, `other` |42| `architecture` | Architecture style? | _(none)_ | `layered`, `hexagonal`, `clean`, `mvc`, `feature-based`, `event-driven`, or blank |43| `test_framework` | Test framework? | Infer from language | `pytest`, `jest`, `vitest`, `mocha`, `go test`, `junit`, `rspec`, `phpunit`, `xunit`, or custom |44| `coverage_tool` | Coverage tool? | Infer from language | `coverage.py`, `istanbul/nyc`, `c8`, `go cover`, `jacoco`, `simplecov`, `phpunit`, `coverlet`, or custom |45| `package_manager` | Package manager? | Infer from language | `pip`, `poetry`, `uv`, `npm`, `yarn`, `pnpm`, `go mod`, `maven`, `gradle`, `cargo`, `bundler`, `composer`, `dotnet`, or custom |4647**Inference rules for defaults:**48- `python` → `pytest`, `coverage.py`, `pip`49- `typescript` / `javascript` → `jest`, `istanbul/nyc`, `npm`50- `go` → `go test`, `go cover`, `go mod`51- `java` → `junit`, `jacoco`, `maven`52- `rust` → `cargo test`, `cargo-tarpaulin`, `cargo`53- `ruby` → `rspec`, `simplecov`, `bundler`54- `php` → `phpunit`, `phpunit`, `composer`55- `csharp` → `xunit`, `coverlet`, `dotnet`5657### Step 3: Create Directory Structure5859Create the following directories:6061```62.shaktra/63.shaktra/memory/64.shaktra/stories/65.shaktra/designs/66.shaktra/analysis/67```6869### Step 4: Copy and Populate Templates7071Read template files from `${CLAUDE_PLUGIN_ROOT}/templates/` and write them into `.shaktra/`:7273**All 7 template files must be copied.** Read each from `${CLAUDE_PLUGIN_ROOT}/templates/` and write to `.shaktra/`:74751. `templates/settings.yml` → `.shaktra/settings.yml` — Replace empty `project:` fields with user's answers from Step 2762. `templates/principles.yml` → `.shaktra/memory/principles.yml` — Copy as-is773. `templates/anti-patterns.yml` → `.shaktra/memory/anti-patterns.yml` — Copy as-is784. `templates/procedures.yml` → `.shaktra/memory/procedures.yml` — Copy as-is795. `templates/sprints.yml` → `.shaktra/sprints.yml` — Copy as-is806. `templates/analysis-manifest.yml` → `.shaktra/analysis/manifest.yml` — Copy as-is817. `templates/shaktra-CLAUDE.md` → `.shaktra/CLAUDE.md` — Copy as-is (project state documentation — describes what `.shaktra/` contains)8283For `settings.yml`, populate the `project:` section with the gathered values:8485```yaml86project:87 name: "<user's project name>"88 type: "<greenfield or brownfield>"89 language: "<user's language>"90 architecture: "<user's architecture style, or empty>"91 test_framework: "<user's test framework>"92 coverage_tool: "<user's coverage tool>"93 package_manager: "<user's package manager>"94```9596**Architecture field notes:**97- For **greenfield**: ask user to choose an architecture style. If unsure, leave blank — the architect agent will propose one in the first design doc and it gets recorded in `principles.yml`.98- For **brownfield**: leave blank at init. The `/shaktra:analyze` workflow detects the existing architecture (D1: structure.yml) and the user can populate this field after analysis.99100All other sections (`tdd`, `quality`, `analysis`, `sprints`, `memory`) retain their template defaults.101102### Step 5: Handle Project CLAUDE.md103104Read the project CLAUDE.md template from `${CLAUDE_PLUGIN_ROOT}/templates/CLAUDE.md`.105106This template is a generic project documentation wireframe — no Shaktra-specific content. It includes:107- Project overview section with placeholders for name, purpose, technologies108- Development workflow and code style guidance109- Architecture section with component descriptions110- Quality standards and testing requirements111- Deployment and operations procedures112- Decision log113- Contributing guidelines114115**Note:** A separate `.shaktra/CLAUDE.md` file is also created to document the `.shaktra/` directory structure and how Shaktra agents use it.116117**If no CLAUDE.md exists** in the project root:118- Create `CLAUDE.md` with the template content.119120**If CLAUDE.md already exists** in the project root:121- Do NOT overwrite the existing file.122- Report to user: "CLAUDE.md already exists. Shaktra initialization complete. You can update CLAUDE.md with your project-specific information, or run `/init CLAUDE.md` to have Claude fill it in."123124### Step 5b: Handle Legacy Migration (Upgrade Path)125126If `.shaktra/memory/decisions.yml` or `.shaktra/memory/lessons.yml` already exist (upgrading from a previous Shaktra version):1271281. Inform the user: "Legacy memory files detected (decisions.yml, lessons.yml). These have been replaced by the new principles-based memory system."1292. Offer to run migration: "Run the migration script to convert existing decisions and lessons into principles? (recommended)"1303. If yes: execute `python3 ${CLAUDE_PLUGIN_ROOT}/scripts/migrate_memory.py <project_root>`1314. If no: inform user they can run it later manually132133### Step 6: Report Results134135Display a summary of what was created:136137```138Shaktra initialized successfully!139140Project: <name> (<type>)141Language: <language>142Test Framework: <test_framework>143Coverage Tool: <coverage_tool>144Package Manager: <package_manager>145146Created:147 .shaktra/CLAUDE.md # Project state documentation (.shaktra/ structure and contents)148 .shaktra/settings.yml149 .shaktra/sprints.yml150 .shaktra/memory/principles.yml151 .shaktra/memory/anti-patterns.yml152 .shaktra/memory/procedures.yml153 .shaktra/analysis/manifest.yml154 .shaktra/memory/155 .shaktra/stories/156 .shaktra/designs/157 .shaktra/analysis/158 CLAUDE.md (created | already exists)159160Next steps:161 1. Update CLAUDE.md with your project-specific information162 2. Review .shaktra/settings.yml and adjust thresholds if needed163 3. For brownfield projects: run /shaktra:analyze to understand the existing codebase164 4. Run /shaktra:tpm to create design docs and stories165 5. Run /shaktra:help for available commands and workflows166```