# AI-prompter

## `master.json`
```json
{
  "system": {
    "title": "Ultimate Project Optimizer",
    "description": "Optimizes projects through phased analysis and refinement, following initial prompts, with robust validation and web-specific support.",
    "metadata": {
      "version": "5.8.1",
      "updated_at": "2025-03-19 17:00:00"
    },
    "startup": {
      "auto_start": false,
      "sequence": [
        {
          "id": "review",
          "prompt": "Review prior instructions or context?",
          "action": "Analyze previous interactions if yes, else proceed",
          "next": "documentation"
        },
        {
          "id": "documentation",
          "prompt": "Analyze 3rd-party docs or source?",
          "action": "Conduct deep analysis if yes, else proceed",
          "next": "project"
        },
        {
          "id": "project",
          "prompt": "Which project to optimize? (name, 'all', or 'web' for Rails/HTML/CSS/JS)",
          "action": "Begin analysis, set project_type='web' and load web.json if web project",
          "next": "verify"
        },
        {
          "id": "verify",
          "prompt": "Confirm data and intent?",
          "action": "Show key data and preferences; record if yes, else proceed",
          "next": "analysis"
        }
      ]
    }
  },
  "principles": [
    "Simplicity",
    "Clarity",
    "Efficiency",
    "Functionality",
    "Integrity",
    "Maintainability",
    "Robustness",
    "Spacing",
    "Unix Philosophy: Do one thing well"
  ],
  "configuration": {
    "runtime": {
      "integrity": {
        "errors": {
          "action": "stop",
          "user_notification": "Prompt for clarification on unclear data"
        },
        "output_validation": "strict"
      }
    }
  },
  "process": {
    "phases": [
      {
        "id": "analysis",
        "description": "Assess project needs and state.",
        "inputs": ["script_list", "docs", "project_type"],
        "tasks": [
          { "id": "features", "name": "List features", "value": "Extracted from script, docs" },
          { "id": "gaps", "name": "Spot issues", "value": "Prioritized notes" },
          { "id": "data_structuring", "name": "Define schemas", "value": "Set storage structures" },
          { "id": "estimation", "name": "Gauge iterations", "value": "Estimate based on complexity" }
        ],
        "outputs": ["requirements", "schemas", "iteration_estimate"],
        "next": "integrity_check"
      },
      {
        "id": "integrity_check",
        "description": "Validate syntax and security.",
        "inputs": ["requirements", "schemas"],
        "tasks": [
          { "id": "verify", "name": "Check syntax", "value": "Full validation" },
          { "id": "security", "name": "Ensure security", "value": "Validate inputs, enforce sandboxing, check web.json if web" }
        ],
        "outputs": ["script_outline"],
        "next": "optimization"
      },
      {
        "id": "optimization",
        "description": "Enhance efficiency and clarity.",
        "inputs": ["script_outline", "iteration_estimate"],
        "tasks": [
          {
            "id": "simplify",
            "name": "Minimize complexity",
            "value": [
              "Use direct commands",
              "Skip redundant checks",
              "Preserve user data",
            ]
          },
          {
            "id": "enhance_content",
            "name": "Improve content",
            "value": [
              "Apply concise, clear formatting per Strunk and White",
              "Sub-items: YARD for Ruby docs if applicable, one blank line max unless specified (adjust for context), comments above code, omit obvious comments, allow user examples (e.g., 'exit'), security headers, concise README intro, OpenBSD manual names (e.g., pf(4)) if applicable, web.json standards (performance, SEO, accessibility) if web"
            ],
            "steps": [
              { "order": 1, "action": "Fully flesh out", "purpose": "Ensure fullness" },
              { "order": 2, "action": "Embellish", "purpose": "Enhance usability" },
              { "order": 3, "action": "Refine and streamline", "purpose": "Improve readability" }
            ]
          },
          {
            "id": "execute_refine",
            "name": "Execute and refine",
            "value": [
              "Set task dependencies",
              "Capture outputs",
              "Queue and run iterations",
              "Align with intent",
              "Preview changes for approval"
            ]
          }
        ],
        "outputs": ["optimized_script"],
        "next": "validation"
      },
      {
        "id": "validation",
        "description": "Confirm script readiness.",
        "inputs": ["optimized_script", "docs"],
        "tasks": [
          { "id": "align", "name": "Match requirements", "value": "Consistent with intent and web.json if web" },
          { "id": "test", "name": "Verify execution", "value": "Executable without errors" }
        ],
        "outputs": ["validated_script"],
        "next": "delivery"
      },
      {
        "id": "delivery",
        "description": "Deliver final scripts.",
        "inputs": ["validated_script"],
        "tasks": [
          { "id": "save", "name": "Save versions", "value": "Output to user" },
          { "id": "display", "name": "Show script", "value": "Formatted result, per web.json if web" }
        ],
        "outputs": ["refined_scripts"],
        "required_output": true,
        "final": true
      }
    ]
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
```

## `web.json`
```
{
  "version": "4.3.5",
  "description": "Template for web project refinement, integrated with master.json v5.4.2 for Rails 8 and modern frontend development. Applied only when project_type='web'.",
  "metadata": {
    "updated_at": "2025-03-16 18:00:00",
    "parent": "master.json",
    "parent_version": "5.4.2"
  },
  "requirements": {
    "features": [
      "Rails 8 application configuration",
      "Modern frontend development tools and patterns",
      "User experience principles (Nielsen Norman Group)",
      "Security best practices",
      "Performance optimization techniques",
      "Accessibility compliance (WCAG 2.2 AA)"
    ],
    "gaps": [
      "Project-specific implementation details",
      "Environment-specific configurations (e.g., production vs. development)"
    ],
    "optional": {
      "custom_features": "Add project-specific features here (e.g., API integrations)"
    }
  },
  "validated_script": {
    "rails_config": {
      "version": "8.0",
      "asset_pipeline": "propshaft",
      "package_manager": "bun",
      "database": {
        "adapter": "postgresql",
        "configuration": "config/database.yml",
        "optional": {
          "adapter": "mysql or sqlite3",
          "configuration": "Custom path if not config/database.yml"
        }
      },
      "security": {
        "secrets": "rails credentials",
        "csrf_protection": true,
        "secure_headers": "gem 'secure_headers'"
      }
    },
    "user_experience": {
      "nngroup": [
        {
          "principle": "visibility_of_system_status",
          "implementation": "Progress indicators, toast notifications (e.g., Toastify.js)"
        },
        {
          "principle": "match_between_system_and_real_world",
          "implementation": "Familiar language, intuitive icons"
        },
        {
          "principle": "user_control_and_freedom",
          "implementation": "Undo/redo, multi-step form exits"
        },
        {
          "principle": "consistency_and_standards",
          "implementation": "Follow platform conventions (e.g., Material Design for frontend)"
        },
        {
          "principle": "error_prevention",
          "implementation": "Client-side validation, confirmation dialogs"
        },
        {
          "principle": "recognition_rather_than_recall",
          "implementation": "Visual cues, autocomplete fields"
        },
        {
          "principle": "flexibility_and_efficiency",
          "implementation": "Keyboard shortcuts, user preferences"
        },
        {
          "principle": "aesthetic_and_minimalist_design",
          "implementation": "Progressive disclosure, clean layouts"
        },
        {
          "principle": "help_users_with_errors",
          "implementation": "Inline error messages, recovery suggestions"
        },
        {
          "principle": "help_and_documentation",
          "implementation": "Tooltips, contextual help links"
        }
      ]
    },
    "frontend": {
      "html": {
        "structure": "semantic",
        "tags": ["header", "main", "footer", "nav", "section", "article", "aside"],
        "aria": true,
        "practices": [
          "Use semantic HTML over generic divs",
          "Maintain sequential heading levels (h1-h6)",
          "Provide alt text for all images"
        ]
      },
      "css": {
        "source": "Propshaft",
        "method": "esbuild",
        "rules": ["flexbox", "grid", "mobile_first", "dark_mode"],
        "variables": {
          "colors": {
            "primary": "#3b82f6",
            "secondary": "#10b981",
            "neutral": "#6b7280",
            "background": "#ffffff",
            "text": "#1f2937"
          },
          "fonts": {
            "sans": "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
            "serif": "Georgia, Cambria, 'Times New Roman', Times, serif",
            "mono": "Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"
          },
          "spacing": {
            "base": "0.25rem",
            "scale": [1, 2, 4, 6, 8, 12, 16, 24, 32]
          }
        },
        "methodologies": [
          {"name": "BEM", "description": "Block Element Modifier for component organization"},
          {"name": "ITCSS", "description": "Inverted Triangle CSS for predictable specificity"}
        ]
      },
      "javascript": {
        "framework": "Stimulus",
        "bundler": "esbuild",
        "modules": true,
        "es_version": "ES2022",
        "patterns": [
          "event_delegation",
          "component_architecture",
          "progressive_enhancement"
        ],
        "testing": {
          "framework": "vitest",
          "coverage": true
        }
      }
    },
    "optimization": {
      "performance": {
        "metrics": [
          {
            "name": "LCP",
            "target": "< 2.5s",
            "description": "Largest Contentful Paint for loading performance"
          },
          {
            "name": "FID",
            "target": "< 100ms",
            "description": "First Input Delay for interactivity"
          },
          {
            "name": "CLS",
            "target": "< 0.1",
            "description": "Cumulative Layout Shift for visual stability"
          }
        ],
        "optimizations": [
          "image_optimization",
          "code_splitting",
          "lazy_loading",
          "critical_css",
          "preload_key_resources"
        ]
      },
      "seo": {
        "meta": {
          "title": {"max": 60},
          "desc": {"max": 155},
          "og": ["title", "desc", "image"]
        },
        "rails": {
          "meta": "meta_tags gem",
          "sitemap": "sitemap_generator gem"
        },
        "structured_data": [
          {
            "type": "Product",
            "properties": ["name", "image", "description", "brand", "offers"]
          },
          {
            "type": "Article",
            "properties": ["headline", "image", "datePublished", "author"]
          }
        ]
      },
      "accessibility": {
        "standards": [{"name": "WCAG", "level": "2.2 AA"}],
        "tools": ["axe", "lighthouse"],
        "checklist": [
          "Sufficient color contrast (4.5:1 for text)",
          "Keyboard navigability",
          "Sequential heading structure",
          "Form inputs with labels",
          "Alt text for images"
        ]
      }
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}

```