--- name: generate-feature-spec description: Generates features_spec.txt files for use with auto-code extension mode. Analyzes existing codebase and creates structured feature specifications based on user requirements. allowed-tools: Read, Glob, Grep, Bash(find:*), Bash(tree:*), Bash(ls:*), Write, AskUserQuestion --- # Generate Feature Specification Create `features_spec.txt` files for use with the `auto-code` package in extension mode. This skill analyzes an existing codebase and generates a structured XML specification of features to implement. ## When to Use - Before running `auto-code extend ./features_spec.txt` - When you want precise control over which features to add - When extending an existing TypeScript/JavaScript project - When you have specific requirements and don't want agent-generated recommendations ## Output Format Generate XML with a `` element for each feature: ```xml Project Name 2026-01-05 Manual specification development Feature Name new-feature normal Description of what this feature should do. Any additional context, requirements, or acceptance criteria. - Add new component logic here First implementation step Second implementation step Feature works as expected Verify feature works in browser ``` ## Workflow ### Step 1: Analyze Existing Codebase First, understand the current project: ```bash # Check project type and dependencies cat package.json 2>/dev/null || cat pyproject.toml 2>/dev/null # Get directory structure find . -type f -name "*.ts" -o -name "*.tsx" | head -30 # Check for existing app_spec.txt cat app_spec.txt 2>/dev/null ``` Document: - Technology stack (React, Next.js, Express, etc.) - Existing features and components - Code patterns and conventions - Database schema if applicable ### Step 2: Gather Requirements Ask the user what features they want to add: 1. **If app_spec.txt exists**: Reference it and ask which features from the spec should be implemented 2. **If no app_spec.txt**: Ask the user to describe the features they want Use `AskUserQuestion` to clarify: - Feature priorities - Specific requirements or constraints - Integration points with existing code - Any technical preferences ### Step 3: Generate features_spec.txt Create the file with: - One `` element per feature - Clear, actionable descriptions - Relevant technical context - Affected files with specific issues/changes needed - Implementation steps - Acceptance criteria ### Step 4: Review with User Present the generated spec and ask if any adjustments are needed before finalizing. ## XML Schema Reference ### Root Element ```xml ``` ### Metadata Section ```xml Project Name YYYY-MM-DD Where features came from (Linear, manual, etc.) development ``` ### Feature Element | Element | Required | Description | |---------|----------|-------------| | `id` | Yes | Unique identifier (e.g., "PROJ-123", "feature-1") | | `title` | Yes | Human-readable title | | `type` | Yes | bug-fix, ui-enhancement, improvement, new-feature | | `priority` | No | low, normal, high, urgent (default: normal) | | `labels` | No | Comma-separated labels | | `linear_url` | No | Link to issue tracker | | `branch` | No | Pre-created branch name | | `description` | Yes | Detailed description | | `affected_files` | No | Files to modify with issues | | `implementation_steps` | No | Ordered steps | | `acceptance_criteria` | No | What "done" looks like | | `testing` | No | How to verify the feature | ### Feature Types - **bug-fix**: Fixing broken functionality - **ui-enhancement**: Visual/UX improvements - **improvement**: Enhancing existing features - **new-feature**: Adding new functionality ## Quality Guidelines - **Be specific**: Include file paths, line numbers where possible - **Be realistic**: Each feature should be implementable in 1-3 sessions - **Be ordered**: Put foundational features first, dependent features after - **Reference existing code**: Use `` to point to specific locations - **Include acceptance criteria**: What does "done" look like for each feature? - **Add testing steps**: How should the agent verify the implementation? ## Example Output ```xml My Portal App 2026-01-05 Manual specification development User Authentication new-feature high Add login and logout functionality using NextAuth.js. Support email/password authentication with secure session handling. - Create NextAuth configuration - Create login page matching existing UI style - Add protected route middleware Install next-auth and configure providers Create login and signup pages Add session provider to _app.tsx Implement protected route middleware Add user context to navigation Users can sign up with email/password Users can log in and log out Protected routes redirect to login Session persists across page refreshes Complete signup and login flow Verify protected routes redirect Verify logout clears session Dashboard Analytics Widget new-feature normal Add a new widget to the dashboard showing user activity metrics. Follow existing widget pattern and use recharts for visualization. - Create new widget component - Create API endpoint for metrics - Add widget to dashboard grid Create /api/analytics endpoint Create AnalyticsWidget following existing pattern Add recharts line/bar chart Add loading and error states Integrate into dashboard Widget displays activity metrics Chart renders correctly with data Loading state shows skeleton Error state shows retry button View dashboard with analytics widget Verify chart updates with new data Export to CSV improvement low Allow users to export their data to CSV format. Support filtering before export and handle large datasets with streaming. - Add export button to table header - Create CSV generation utility Create CSV generation utility Add export button to DataTable component Implement streaming for large datasets Add progress indicator Export button visible in data table CSV file downloads with current filter applied Large exports show progress Export small dataset Export with filters applied Test export with 10k+ rows ``` ## Integration with auto-code After generating `features_spec.txt`, the user can run: ```bash auto-code extend ./features_spec.txt ``` Or if working from an app spec instead: ```bash auto-code extend --app-spec ./app_spec.txt ``` The autonomous agent will: 1. Read `features_spec.txt` 2. Create one `feature_list.json` entry per `` element 3. Implement ONLY the features listed (no additional recommendations) 4. Use the provided context (affected_files, steps, criteria) to guide implementation ## Completion Message When you finish generating the features_spec.txt file, show the user: ``` Done! I've generated features_spec.txt with [N] features. The spec is ready to use: auto-code extend ./features_spec.txt ``` IMPORTANT: Do NOT use the old command format `autonomous-coding --mode extend --features-spec`. The correct command is `auto-code extend` (the package binary is `auto-code`, not `autonomous-coding`, and it uses subcommands, not `--mode` flags)