home / skills / laurigates / claude-plugins / blueprint-sync

This skill detects stale or modified generated content and guides you to regenerate, promote, or keep as-is for consistent blueprint synchronization.

npx playbooks add skill laurigates/claude-plugins --skill blueprint-sync

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
4.2 KB
---
model: opus
created: 2025-12-22
modified: 2026-02-07
reviewed: 2025-12-22
description: "Check for stale generated content and offer regeneration or promotion"
args: "[--dry-run]"
argument-hint: "--dry-run to preview sync status without modifying files"
allowed-tools: Read, Bash, Glob, AskUserQuestion
name: blueprint-sync
---

Check the status of generated content and offer options for modified or stale files.

## Flags

| Flag | Description |
|------|-------------|
| `--dry-run` | Preview sync status report without interactive prompts or file modifications |

**Purpose**:
- Detect when generated skills/commands have been manually modified
- Detect when source PRDs have changed (making generated content stale)
- Offer appropriate actions: regenerate, promote to custom, or keep as-is

**Steps**:

1. **Read manifest**:
   ```bash
   cat docs/blueprint/manifest.json
   ```
   - Extract `generated.rules` section
   - If no generated content, report "Nothing to sync"

2. **Check each generated rule**:
   For each rule in `manifest.generated.rules`:

   a. **Verify file exists**:
      ```bash
      test -f .claude/rules/{name}.md
      ```

   b. **Hash current content**:
      ```bash
      sha256sum .claude/rules/{name}.md | cut -d' ' -f1
      ```

   c. **Compare hashes**:
      - If `content_hash` matches → status: `current`
      - If `content_hash` differs → status: `modified`

   d. **Check source freshness** (for rules from PRDs):
      - Hash current PRD content
      - Compare with `source_hash` in manifest
      - If differs → status: `stale`

3. **Display sync report**:
   ```
   Generated Content Sync Status

   Rules (.claude/rules/):
   ✅ architecture-patterns.md: Current
   ⚠️ testing-strategies.md: Modified locally
   🔄 implementation-guides.md: Stale (PRDs changed)
   ✅ quality-standards.md: Current

   Summary:
   - Current: 3 files
   - Modified: 1 file (user edited)
   - Stale: 1 file (source changed)
   ```

4. **If `--dry-run`**: Output the sync report from Step 3 and exit. Skip all remaining steps.

5. **For modified content**, offer options:
   ```
   question: "{name} has been modified locally. What would you like to do?"
   options:
     - label: "Keep modifications"
       description: "Mark as acknowledged, preserve your changes"
     - label: "Discard modifications (regenerate)"
       description: "Overwrite with fresh generation from PRDs"
     - label: "View diff"
       description: "See what changed before deciding"
     - label: "Skip this file"
       description: "Leave as-is for now"
   ```

   **Based on selection:**
   - "Keep modifications" → Update `content_hash` to current, mark as acknowledged
   - "Regenerate" → Regenerate this rule from PRDs
   - "View diff" → Show diff then re-ask
   - "Skip" → Continue to next file

6. **For stale content**, offer options:
   ```
   question: "{name} is stale (PRDs have changed). What would you like to do?"
   options:
     - label: "Regenerate from PRDs (Recommended)"
       description: "Update with latest patterns from docs/prds/"
     - label: "Keep current version"
       description: "Mark as current without regenerating"
     - label: "View what changed in PRDs"
       description: "See PRD changes before deciding"
     - label: "Skip this file"
       description: "Leave stale for now"
   ```

   **Based on selection:**
   - "Regenerate" → Regenerate this rule from PRDs
   - "Keep" → Update `source_hash` to current, mark as current
   - "View" → Show PRD diff then re-ask
   - "Skip" → Continue to next file

7. **Update manifest** after changes:
   - Update `content_hash` for regenerated files
   - Update `source_hash` if PRD changes acknowledged
   - Update `status` field appropriately

8. **Final report**:
   ```
   Sync Complete

   Actions taken:
   - testing-strategies.md: Modifications acknowledged
   - implementation-guides.md: Regenerated from PRDs

   Current state:
   - 4 generated rules (all current)

   Manifest updated.
   ```

**Tips**:
- Run `/blueprint:sync` periodically to check for drift
- Acknowledge modifications you want to keep
- Regenerating will overwrite local changes
- Stale content still works, but may miss new patterns from PRDs

Overview

This skill checks generated content for divergence and offers safe actions to regenerate, promote, or preserve files. It inspects manifest entries and file hashes to detect local modifications and stale outputs when source PRDs change. The tool can run as a dry-run to preview results without making changes.

How this skill works

It reads the manifest (docs/blueprint/manifest.json) and iterates generated.rules to verify each generated file exists and to compute its sha256 content hash. It compares stored content_hash and source_hash values to decide whether a file is current, modified, or stale. The skill prints a sync report; in non-dry-run mode it interactively offers choices per file and updates the manifest based on actions taken.

When to use it

  • Before releasing or merging to ensure generated artifacts match source specs
  • After pulling updates to PRDs or documentation to detect stale generated content
  • When you suspect local edits accidentally modified generated files
  • As a periodic drift check in CI or developer workflows
  • Before running upgrades that depend on up-to-date blueprints

Best practices

  • Run with --dry-run first to preview the sync report without changes
  • Acknowledge intentional local edits to preserve custom work and update hashes
  • Regenerate when PRDs changed to keep generated guidance aligned with source patterns
  • Use the View Diff options to inspect differences before overwriting
  • Integrate the check into regular developer routines or CI gates

Example use cases

  • Detect that .claude/rules/implementation-guides.md is stale after upstream PRD edits and regenerate it
  • Identify a locally edited rule and choose to keep modifications while updating manifest hashes
  • Run blueprint-sync --dry-run in a pull request to report generated-file drift without modifying files
  • Batch-regenerate several rules after doc authors push new patterns to docs/prds/
  • Mark a file as current when you want to keep it despite PRD changes

FAQ

What does --dry-run do?

It prints the full sync report and possible actions without prompting or changing files or the manifest.

If I choose Regenerate, will my edits be lost?

Yes — regenerating overwrites the file. Use View Diff first or choose Keep modifications to preserve edits.