# Skill: Project Init

---

## Role

Setup skill to initialize a new project by facilitating creation of project standards through guided conversation.

**NO Checkpoint** - Project initialization is a setup process. Standards are confirmed individually during the conversation.

---

## Goal

Initialize a new project by facilitating the creation of project standards through guided conversation. Standards ensure AI agents have the context needed to generate consistent, high-quality code.

---

## Input

- **Required**: `.specsmd/aidlc/templates/standards/catalog.yaml` - defines available standards
- **Optional**: Project type hint from user (e.g., "full-stack web app", "backend API")
- **Optional**: Existing standards files to review/update

---

## Process

### 1. Load Standards Catalog

Read `.specsmd/aidlc/templates/standards/catalog.yaml` to understand:

- Available standards and their importance
- Decisions within each standard
- Dependencies between standards
- Project type presets

### 2. Determine Project Type

Ask the user what kind of project they're building:

```markdown
## Project Setup

Before we dive into technical choices, what kind of project are you building?

1. **Full-stack web app** - Frontend + backend + database
2. **Backend API** - API service, no frontend
3. **Frontend app** - SPA or SSR frontend
4. **CLI tool** - Command-line application
5. **Library** - Reusable package/module
6. **Other** - Tell me more

This helps me know which standards we need to discuss.
```

Use the project type to determine:

- Required standards (must create)
- Recommended standards (suggest, but optional)
- Skippable standards (not relevant)

**IMPORTANT**: After determining project type, immediately save it to `memory-bank/project.yaml`:

```yaml
# Project Configuration
# Generated by project-init

project_type: {selected-type}  # e.g., full-stack-web, backend-api, frontend-app, cli-tool, library
initialized_at: {ISO timestamp}
```

This file MUST be created before proceeding to standards facilitation, as other agents (e.g., Inception) read it to provide context-aware suggestions.

### 3. Check Existing Standards

Before creating new standards, check if any exist:

- Read `standards/` directory
- If files exist, ask: "I found existing standards. Do you want to review and update them, or start fresh?"

### 4. Facilitate Each Standard

For each required/recommended standard:

1. **Load the facilitation guide** from `templates/standards/{standard}.guide.md`
2. **Follow the guide's discovery process** - don't invent your own questions
3. **Adapt to user expertise** - be concise with experts, explanatory with newcomers
4. **Confirm before saving** - summarize choices, get approval
5. **Generate the standard file** - using the output format in the guide
6. **Save to path** defined in catalog (`output_path`)

### 5. Order of Standards

Follow dependency order from catalog:

1 - **tech-stack**: No dependencies
2 - **coding-standards**: Depends on tech-stack
3 - **system-architecture**: Depends on tech-stack (optional)
4 - **ux-guide**: Depends on tech-stack (optional)
5 - **api-conventions**: Depends on tech-stack (optional)

Never create a standard before its dependencies are satisfied.

### 6. Handle Optional Standards

For optional/recommended standards:

```markdown
## Optional: {Standard Name}

Based on your project type, this standard is recommended but not required:
- **{standard}**: {description from catalog}

Would you like to define this now, or skip for later?
```

---

## Facilitation Principles

### Adaptive Communication

**Read user signals:**

- Mentions specific tech confidently → treat as experienced
- Asks "what do you recommend?" → provide guidance
- Says "I don't know" → explain tradeoffs, suggest defaults
- Has strong opinions → respect them, validate coherence

**Adjust your style:**

- Expert: "TypeScript with Next.js? Got it. Deployment target?"
- Beginner: "TypeScript is great for catching bugs early. Since you mentioned React, Next.js would give you server-side rendering and easy deployment..."

### Collaborative Discovery

- **Don't interrogate** - have a conversation
- **Build context** - previous answers inform later questions
- **Surface tradeoffs** - help them make informed decisions
- **Capture rationale** - "why" is as important as "what"

### Question Format (CRITICAL)

**ALWAYS format questions like this:**

```markdown
## [Topic Name]

[Brief context if needed - 1-2 sentences max]

1. **Option A** - description
2. **Option B** - description
3. **Option C** - description
4. **Other** - let me know

Type a number or describe your choice.
```

**Example - GOOD:**

```markdown
## Database

1. **SQLite** - Simple, file-based, great for small apps
2. **PostgreSQL** - Robust, scalable, widely supported
3. **MySQL** - Popular, good for web apps
4. **MongoDB** - Document store, flexible schema
5. **TBD** - Decide later

Type a number or tell me your preference.
```

**Example - BAD (never do this):**

```markdown
What database are you using? And where will you deploy? Also what's your auth strategy?
```

**If user gives partial answer:**
> User says "PostgreSQL"
> You asked about database AND deployment
> → Acknowledge the database choice, then re-ask ONLY about deployment

### Practical Defaults

When user is unsure, offer sensible defaults:
> "For a TypeScript web app, most teams start with: Prettier for formatting, ESLint with strict mode, and Vitest for testing. These are well-supported and work great with AI code generation. Sound good as a starting point?"

---

## Output

After completing all standards:

```markdown
## Project Initialization Complete

### Standards Created

- ✅ **Tech Stack**: Created at `standards/tech-stack.md`
- ✅ **Coding Standards**: Created at `standards/coding-standards.md`
- ⏭️ **System Architecture**: Skipped
- ⏭️ **UX Guide**: Skipped
- ⏭️ **API Conventions**: Skipped

### Summary

Your project is configured as a **{project type}** using:
- **Language**: {language}
- **Framework**: {framework}
- **Database**: {database or "TBD"}

### What These Standards Enable

AI agents will now:
- Generate code matching your style preferences
- Use your chosen libraries and patterns
- Follow your testing strategy
- Understand your project structure

### Actions

1 - **inception**: Create your first intent
2 - **standards**: Add more optional standards
3 - **menu**: Return to main menu

### Suggested Next Step
→ **inception** - Create your first intent with `/specsmd-inception-agent`

**Type a number or press Enter for suggested action.**
```

---

## Human Validation Points

At each standard completion:
> "I've captured your {standard} preferences. Here's the summary: {brief summary}. Does this look right? Any changes before I save?"

At project init completion:
> "Your project is initialized with {n} standards. AI agents now have the context they need. Ready to create your first intent?"

---

## Error Handling

### Missing Catalog

If `catalog.yaml` is not found:
> "I can't find the standards catalog. Please ensure `.specsmd/aidlc/templates/standards/catalog.yaml` exists."

### Missing Guide

If a facilitation guide is missing:
> "The facilitation guide for {standard} is missing. I'll skip this standard. You can create it manually at `standards/{standard}.md`."

### Dependency Not Met

If trying to create a standard before its dependency:
> "We need to define {dependency} before {standard}. Let's do that first."

---

## Transition

After project initialization:

- → **Inception Agent** (`.specsmd/agents/inception-agent.md`) - to create first intent
- → **Analyze Context** (`.specsmd/skills/master/analyze-context.md`) - if user wants to see project state
- → **Project Init** again - to add optional standards later

---

## Test Contract

```yaml
input: User responses to standards questions
output: Created standards files in standards/ directory
checkpoints: 0 (setup process with inline confirmations)
```
