Skip to content

feat(spec): localhost-first development with progressive stages and mock data templates#4

Merged
vnykmshr merged 4 commits intomainfrom
feature/localhost-first-specs
Feb 24, 2026
Merged

feat(spec): localhost-first development with progressive stages and mock data templates#4
vnykmshr merged 4 commits intomainfrom
feature/localhost-first-specs

Conversation

@vnykmshr
Copy link
Contributor

Summary

Specs now guide AI assistants to build locally-testable apps through three major improvements:

  1. Development Stages (all specs) — Progressive 3-stage pattern: Local (mock), Integration (real API), Polish (optional)
  2. Mock Data Templates (external-data specs) — Context-aware guides for weather/stock/news APIs
  3. Local Development Checklist (data specs) — Pre-flight validation before integrating external services

Plus: Composite KV keys in analytics + persona×tier dashboard matrix for user segmentation insights.

Changes

Part 1: Generator Observations (Quality)

  • Three generator fixes improving spec clarity and reducing noise:
    • Analytics text now conditional on needsWorkerProxy() (static apps don't get "Worker endpoint" noise)
    • Loading/Offline UX states only shown for dynamic apps (not display-only or minimal-tier)
    • Context-aware empty state prompts (weather→location, stock→ticker, news→topics)
  • 8 new tests validating all three fixes

Part 2: Analytics Enhancement

  • Worker generates composite persona:tier KV keys for cross-dimensional analysis
  • Dashboard adds new "Persona × Tier matrix" panel showing user segmentation
  • 1 new test validating composite key generation

Part 3: Localhost-First Development

  • All specs include Development Stages section with clear progression
  • External-data specs get Mock Data templates (auto-generated shapes + implementation guidance)
  • Data-dependent specs get Local Development Checklist (pre-flight validation)
  • 11 new tests covering all scenarios and edge cases

Release Prep

  • Version bumped: 1.3.0 → 1.3.1
  • Service worker cache bumped: gist-v7 → gist-v8
  • CHANGELOG.md updated with v1.3.1 entry

Test Plan

  • All 139 tests passing (128 → 139, +11 new)
  • Linting clean (prettier, astro check)
  • Build successful (no errors)
  • No regressions in existing specs

Why This Matters

The Problem: When users generate specs and hand them to Claude to build, the spec might guide building with hard external dependencies from day 1. This blocks local testing.

The Solution: Specs now explicitly signal the "mock-first, integrate-later" pattern. Developers see:

  1. Build locally with mock data first
  2. Get UI approval with mock data
  3. Then wire real APIs

Result: AI-assisted development becomes smoother and more testable.

Ship Readiness

  • Phase 1: Foundation (tests, linting, build)
  • Phase 2: Specialized reviews (via /pb-review)
  • Phase 3: Final gate (quality passed)
  • Release artifacts: CHANGELOG updated, version bumped
  • Ready for peer review and merge

…, composite KV keys

Three generator observation fixes improve spec quality and reduce noise:
- Analytics text now conditional on needsWorkerProxy() — static apps suggest lightweight service vs Worker endpoint
- Loading/Offline UX states only shown for dynamic apps — removes noise for display-only and minimal-tier specs
- Empty state prompts now context-aware (weather→location, stock→ticker, news→topics) instead of generic

Plus analytics enhancement:
- Worker now generates composite persona:tier KV keys for cross-dimensional dashboard analysis
- New "Persona × Tier matrix" panel shows user segmentation insights
- No breaking changes — composite keys are additive

Tests: +9 (8 generator observation tests + 1 composite key test) = 128 total
All tests pass, linting clean, builds successfully.
…implementation

Three new sections guide AI assistants to build locally-testable apps:

1. Development Stages — Shows three-stage progression:
   - Stage 1 (Local): Mock data only, app works immediately on localhost
   - Stage 2 (Integration): Wire real APIs after UI approved
   - Stage 3 (Polish): Analytics, caching, advanced features (optional)

2. Mock Data Template — Auto-generated based on API type:
   - Weather APIs: location, temp, condition, forecast structure
   - Stock APIs: ticker, price, change fields
   - News APIs: title, description, publishedAt fields
   - Generic: Field names, types, sample values for unknown APIs
   - Guides downstream AI to generate realistic mock data

3. Local Development Checklist — Pre-flight validation:
   - Verify app builds/runs with mock data
   - Test all UX states without real API
   - Get user approval on design before integrating
   - Validate data structure matches real API

All specs now include Development Stages (consistency).
External-data and user-saves-data specs get mock template + checklist.

Tests: +11 new tests covering all sections and conditions (139 total)
Pattern: "Guidepost" approach — static generator signals intent,
downstream AI (Claude) implements with full capability.

Fixes the "hard localhost dependencies" problem: Generated specs
now explicitly encourage mock-first, integrate-later development.
@vnykmshr vnykmshr merged commit c671a45 into main Feb 24, 2026
1 check passed
@vnykmshr vnykmshr deleted the feature/localhost-first-specs branch February 24, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant