Nanowave pipeline development

From moasq/nanowave · View interactive version

Nanowave pipeline development is an AI agent skill from the GitHub repository moasq/nanowave. Nanowave build pipeline architecture covering the 6-phase flow (Intent → Analyze → Plan → Build → Fix → Finalize), type contracts parsed via parseClaudeJSON[T], prompt composition with ComposeAgenticSystemPrompt, and Claude client integration. Use when modifying the build pipeline, adding new phases

How to use this skill

Skill file

Pipeline Development Guide

6-Phase Pipeline

The build pipeline processes a user prompt through six sequential phases:

User Prompt
    ↓
1. Intent Router  → IntentDecision (advisory: operation, platform, device_family)
    ↓
2. Analyzer       → AnalysisResult (app_name, description, features, core_flow)
    ↓
3. Planner        → PlannerResult (design, files, models, permissions, extensions, rule_keys, build_order)
    ↓
4. Builder        → Generates code (streaming, up to 6 completion passes)
    ↓
5. Fixer          → Fixes build errors (iterative)
    ↓
6. Finalize       → Git init + commit

Type Contracts

All phase outputs are parsed via parseClaudeJSON[T]() in helpers.go:

// Generic parser: extracts JSON from markdown fences, unmarshals to T
func parseClaudeJSON[T any](result string, label string) (*T, error)

// JSON extraction: handles ```json fences and thinking text
func extractJSON(s string) string

Phase-Specific Parsers

Prompt Composition

Located in phase_prompts.go:

// Analyzer/Planner: full SystemPrompt (standalone phases)
composeAnalyzerSystemPrompt(intent) → base + constraints + phase skill + intent hints
composePlannerSystemPrompt(intent)  → base + constraints + phase skill + intent hints

// Builder/Fixer/Completion: AppendSystemPrompt (runs in workspace with CLAUDE.md)
composeCoderAppendPrompt(phaseSkillName) → coder base + shared constraints + phase skill

Key helper:

func appendPromptSection(b *strings.Builder, title, content string)

Why AppendSystemPrompt for Build Phase

The build phase runs inside the generated project workspace which has its own CLAUDE.md with design tokens, architecture rules, and memory modules. Using AppendSystemPrompt adds pipeline instructions without overriding the workspace CLAUDE.md.

Claude Client Integration

type GenerateOpts struct {
    SystemPrompt       string   // Full system prompt (analyzer, planner)
    AppendSystemPrompt string   // Appended to workspace CLAUDE.md (builder, fixer)
    MaxTurns           int
    Model              string
    WorkDir            string
    AllowedTools       []string // e.g., agenticTools
    SessionID          string   // For multi-pass session continuity
}

// Streaming generation with progress callback
client.GenerateStreaming(ctx, prompt, opts, progressCallback)

Build Phase Details

In pipeline.go:

In build_prompts.go:

Adding a New Phase

  1. Create skill directory: internal/orchestration/skills/phases/{phase-name}/
  2. Add SKILL.md with Anthropic frontmatter + phase instructions
  3. Add references/ for workflow, output-format, common-mistakes, examples
  4. Create compose function in phase_prompts.go:

```go

func composeNewPhasePrompt() (string, error) {

phaseSkill, err := loadPhaseSkillContent("phase-name")

// ...

}

```

  1. Wire into pipeline.go — add method to Pipeline struct
  2. Define output type in types.go if needed
  3. Add parser in helpers.go using parseClaudeJSON[T]()
  4. Run make skills-source-validate and make test

Available Tools for Build Phase

Defined as agenticTools in pipeline.go:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.