---
name: gsd-to-autocoder-spec
description: |
Convert GSD codebase mapping to Autocoder app_spec.txt. This skill should be used when
the user has run /gsd:map-codebase and wants to use Autocoder on an existing project.
Triggers: "convert to autocoder", "gsd to spec", "create app_spec from codebase",
"use autocoder on existing project", after /gsd:map-codebase completion.
---
# GSD to Autocoder Spec Converter
Converts `.planning/codebase/*.md` (GSD mapping output) to `prompts/app_spec.txt` (Autocoder format).
## When to Use
- After running `/gsd:map-codebase` on an existing project
- When onboarding an existing codebase to Autocoder
- User wants Autocoder to continue development on existing code
## Prerequisites
The project must have `.planning/codebase/` with these files:
- `STACK.md` - Technology stack (required)
- `ARCHITECTURE.md` - Code architecture (required)
- `STRUCTURE.md` - Directory layout (required)
- `CONVENTIONS.md` - Code conventions (optional)
- `INTEGRATIONS.md` - External services (optional)
## Process
### Step 1: Verify GSD Mapping Exists
```bash
ls -la .planning/codebase/
```
**Required files:** STACK.md, ARCHITECTURE.md, STRUCTURE.md
If `.planning/codebase/` doesn't exist:
```
GSD codebase mapping not found.
Run /gsd:map-codebase first to analyze the existing codebase.
```
Stop workflow.
### Step 2: Read Codebase Documentation
Read all available GSD documents:
```bash
cat .planning/codebase/STACK.md
cat .planning/codebase/ARCHITECTURE.md
cat .planning/codebase/STRUCTURE.md
cat .planning/codebase/CONVENTIONS.md 2>/dev/null || true
cat .planning/codebase/INTEGRATIONS.md 2>/dev/null || true
```
Extract key information:
- **From STACK.md:** Languages, frameworks, dependencies, runtime, ports
- **From ARCHITECTURE.md:** Patterns, layers, data flow, entry points
- **From STRUCTURE.md:** Directory layout, key file locations, naming conventions
- **From INTEGRATIONS.md:** External APIs, services, databases
### Step 3: Extract Project Metadata
```bash
cat package.json 2>/dev/null | head -20 || echo "No package.json"
```
Extract:
- Project name
- Version
- Main dependencies
### Step 4: Generate app_spec.txt
Create `prompts/` directory:
```bash
mkdir -p prompts
```
**Mapping GSD Documents to Autocoder Spec:**
| GSD Source | Autocoder Target |
|------------|------------------|
| STACK.md Languages | `` |
| STACK.md Frameworks | ``, `` |
| STACK.md Dependencies | `` |
| ARCHITECTURE.md Layers | `` categories |
| ARCHITECTURE.md Data Flow | `` |
| ARCHITECTURE.md Entry Points | `` |
| STRUCTURE.md Layout | `` (if frontend) |
| INTEGRATIONS.md APIs | `` |
| INTEGRATIONS.md Services | `` |
**Feature Generation Guidelines:**
1. Analyze existing code structure to infer implemented features
2. Each feature must be testable: "User can...", "System displays...", "API returns..."
3. Group features by category matching architecture layers
4. Target feature counts by complexity:
- Simple CLI/utility: ~100-150 features
- Medium web app: ~200-250 features
- Complex full-stack: ~300-400 features
**Write the spec file** using the XML format from [references/app-spec-format.md](references/app-spec-format.md):
```bash
cat > prompts/app_spec.txt << 'EOF'
{from package.json or directory}
{Synthesized from ARCHITECTURE.md overview}
{from STACK.md}
{from STACK.md}
{from STACK.md or default 3000}
{from STACK.md}
{from STACK.md or INTEGRATIONS.md}
{from STACK.md or default 3001}
{from STACK.md Runtime + INTEGRATIONS.md requirements}
<{layer_name}>
- {Feature derived from code analysis}
- {Feature derived from code analysis}
{layer_name}>
{from INTEGRATIONS.md or inferred from STRUCTURE.md routes/}
{from ARCHITECTURE.md Data Flow}
- All existing features continue working
- New features integrate seamlessly
- No regression in core functionality
EOF
```
### Step 5: Verify Generated Spec
```bash
head -100 prompts/app_spec.txt
echo "---"
grep -c "User can\|System\|API\|Feature" prompts/app_spec.txt || echo "0"
```
**Validation checklist:**
- [ ] `` root tag present
- [ ] `` matches actual project
- [ ] `` reflects STACK.md
- [ ] `` has categorized features
- [ ] Features are specific and testable
### Step 6: Report Completion
Output:
```
app_spec.txt generated from GSD codebase mapping.
Source: .planning/codebase/*.md
Output: prompts/app_spec.txt
Next: Start Autocoder
cd {project_dir}
python ~/projects/autocoder/start.py
Or via UI:
~/projects/autocoder/start_ui.sh
The Initializer will create features.db from this spec.
```
## XML Format Reference
See [references/app-spec-format.md](references/app-spec-format.md) for complete XML structure with all sections.
## Error Handling
| Error | Resolution |
|-------|------------|
| No .planning/codebase/ | Run `/gsd:map-codebase` first |
| Missing required files | Re-run GSD mapping |
| Cannot infer features | Ask user for clarification |