--- name: autospec-plan description: "Generate YAML implementation plan from feature specification." --- # autospec-plan This Agent Skill is generated from autospec.plan. When the user invokes "$autospec-plan" or "/autospec.plan", load and follow these instructions directly. Treat the text after the skill or command name as "$ARGUMENTS". Do not route back through "autospec plan"; this skill is the prompt for the stage. Project specs directory: ./specs ## User Input ```text $ARGUMENTS ``` You **MUST** consider the user input before proceeding (if not empty). ## Pre-computed Context The following paths have been pre-computed and are available for use: - **FEATURE_DIR**: `{{.FeatureDir}}` - **FEATURE_SPEC**: `{{.FeatureSpec}}` - **AUTOSPEC_VERSION**: `{{.AutospecVersion}}` - **CREATED_DATE**: `{{.CreatedDate}}` ## Outline 1. **Load context**: - Read the spec file at `{{.FeatureSpec}}` - Read project constitution if exists (`.autospec/constitution.yaml` or `AGENTS.md`, falling back to agent-specific file like `CLAUDE.md`) - Extract: feature description, user stories, requirements, constraints 3. **Execute plan workflow**: **Phase 0: Outline & Research** a. Identify technical unknowns from the spec: - For each unclear technology choice → research task - For each dependency → best practices research - For each integration → patterns research b. Resolve unknowns through exploration: - Examine existing codebase patterns - Consider project constraints - Make informed technology decisions c. Document research findings for inclusion in plan **Phase 1: Design & Architecture** a. Define technical context based on spec and research: - Language/framework (detect from existing code or choose) - Primary dependencies - Storage requirements - Testing approach - Target platform b. Design project structure: - Documentation files to create - Source code organization - Test file locations c. Identify data model entities from spec requirements d. Design API contracts if applicable 4. **Generate plan.yaml**: Create the YAML plan file with this structure: ```yaml plan: branch: "" created: "" spec_path: "" summary: | <1-2 paragraph summary of the implementation approach. Explain key technical decisions and how they address the spec requirements.> technical_context: language: "" framework: "" primary_dependencies: - name: "" version: "" purpose: "" storage: "" testing: framework: "" approach: "" target_platform: "" project_type: "" performance_goals: "" constraints: - "" scale_scope: "" constitution_check: constitution_path: "" gates: - name: "" status: "PASS" # or "FAIL" or "N/A" notes: "" research_findings: decisions: - topic: "" decision: "" rationale: "" alternatives_considered: - "" - "" data_model: entities: - name: "" description: "" fields: - name: "" type: "" description: "" constraints: "" relationships: - target: "" type: "" description: "" api_contracts: endpoints: - method: "" path: "" description: "" request: content_type: "" body_schema: "" response: success_code: 200 body_schema: "" errors: - code: 400 description: "" project_structure: documentation: - path: "" description: "" source_code: - path: "" description: "" tests: - path: "" description: "" implementation_phases: - phase: 1 name: "" goal: "" deliverables: - "" - "" - phase: 2 name: "" goal: "" dependencies: - "Phase 1" deliverables: - "" open_questions: - question: "" context: "" proposed_resolution: "" _meta: version: "1.0.0" generator: "autospec" generator_version: "{{.AutospecVersion}}" created: "{{.CreatedDate}}" artifact_type: "plan" ``` 5. **Write the plan** to `{{.FeatureDir}}/plan.yaml` 6. **Validate the artifact**: ```bash autospec artifact {{.FeatureDir}}/plan.yaml ``` - If validation fails: fix schema errors (missing required fields, invalid types) and retry - If validation passes: proceed to report 7. **Report**: Output: - Branch name - Full path to plan.yaml - Summary of technical context - Number of implementation phases - Any constitution gate failures (CRITICAL if any FAIL) - Readiness for `$autospec-tasks` ## Key Rules - Output MUST be valid YAML (use `autospec artifact {{.FeatureDir}}/plan.yaml` to verify schema compliance) - Technical context should reflect actual project setup (detect from existing code) - Constitution gates are mandatory if constitution exists - Research findings should document all significant technical decisions - Data model should be derived from spec requirements - Project structure should follow existing codebase conventions - All YAML arrays use list syntax (not JSON inline) - Multi-line strings use `|` or `>` block scalar style