sgai-goal
Use when starting a new feature, project, or bug fix in a repository that uses SGAI for AI-driven development
What this skill does
# SGAI Goal Authoring
Compose GOAL.md files for SGAI workspaces through interactive conversation.
## When to Use
- User says "start a new feature/project/fix"
- User describes work to be done in an SGAI-managed repo
- User asks to "create a goal" or "set up SGAI"
## Process
```mermaid
flowchart TB
detect["Detect tech stack"]
prefs["Load/ask model preferences"]
describe["Ask: What do you want to accomplish?"]
criteria["Draft success criteria"]
confirm["Show preview, ask for confirmation"]
backup["Backup existing GOAL.md if present"]
write["Write GOAL.md"]
detect --> prefs --> describe --> criteria --> confirm --> backup --> write
```
### 1. Detect Tech Stack
Scan the repository for files and choose appropriate agents:
| Detection | Stack | Developer Agent | Reviewer Agent |
|-----------|-------|-----------------|----------------|
| `go.mod` | Go backend | backend-go-developer | go-readability-reviewer |
| `package.json` + react deps | React | react-developer | react-reviewer |
| `package.json` + htmx deps | HTMX | htmx-picocss-frontend-developer | htmx-picocss-frontend-reviewer |
| `*.sh`, `Makefile`, or CLI tool | Shell | shell-script-coder | shell-script-reviewer |
| `wrangler.toml` | Cloudflare Worker | general-purpose | cloudflare-worker-deployer |
| `vercel.json` or Next.js | Vercel | react-developer | vercel-deployer |
| Python + Claude SDK | Agent SDK | general-purpose | agent-sdk-verifier-py |
| TypeScript + Claude SDK | Agent SDK | general-purpose | agent-sdk-verifier-ts |
| Python + OpenAI SDK | OpenAI Agent | general-purpose | openai-sdk-verifier-py |
| TypeScript + OpenAI SDK | OpenAI Agent | general-purpose | openai-sdk-verifier-ts |
| None detected | General | general-purpose | — |
Multiple stacks combine (e.g., Go + React = both agent chains).
**Special-purpose agents** (add when relevant):
- `c4-code`, `c4-component`, `c4-container`, `c4-context` - Architecture documentation
- `skill-writer` - Creating SGAI skills
- `snippet-writer` - Reusable code patterns
- `webmaster` - Marketing sites and landing pages
- `project-critic-council` - Multi-model consensus review
### 2. Load or Ask Model Preferences
Check `.sgai/preferences.json` for saved preferences:
```json
{
"models": {
"coordinator": "anthropic/claude-opus-4-6 (max)",
"default": "anthropic/claude-opus-4-6"
}
}
```
If no preferences exist, ask:
> "What model should I use for SGAI agents? (e.g., anthropic/claude-opus-4-6)"
Save response to `.sgai/preferences.json` for future use.
### 3. Ask for Goal Description
Ask conversationally:
> "What do you want to accomplish?"
Listen for:
- **Feature**: "add", "build", "create", "implement"
- **Fix**: "bug", "fix", "broken", "error", "issue"
- **Project**: "new project", "set up", "initialize"
If unclear, ask:
> "Is this a new feature, a bug fix, or a new project?"
### 4. Draft Success Criteria
Transform the description into outcome-based success criteria:
**User says:** "Add user authentication with OAuth"
**Draft as:**
```markdown
- [ ] Users can sign in with OAuth providers
- [ ] Authenticated sessions persist across browser restarts
- [ ] Unauthenticated users are redirected to login
```
**Do NOT write implementation steps** like:
- ~~Install passport.js~~
- ~~Create auth middleware~~
- ~~Add login route~~
Ask: "Does this capture what success looks like?"
### 5. Build Flow Graph
Compose flow based on detected stack. Pattern: `developer -> reviewer -> stpa-analyst`
**Go backend:**
```yaml
flow: |
"backend-go-developer" -> "go-readability-reviewer"
"go-readability-reviewer" -> "stpa-analyst"
```
**React frontend:**
```yaml
flow: |
"react-developer" -> "react-reviewer"
"react-reviewer" -> "stpa-analyst"
```
**HTMX frontend:**
```yaml
flow: |
"htmx-picocss-frontend-developer" -> "htmx-picocss-frontend-reviewer"
"htmx-picocss-frontend-reviewer" -> "stpa-analyst"
```
**Go + React (full stack):**
```yaml
flow: |
"backend-go-developer" -> "go-readability-reviewer"
"go-readability-reviewer" -> "stpa-analyst"
"react-developer" -> "react-reviewer"
"react-reviewer" -> "stpa-analyst"
```
**Shell/CLI tools:**
```yaml
flow: |
"shell-script-coder" -> "shell-script-reviewer"
"shell-script-reviewer" -> "stpa-analyst"
```
**Python/general with shell:**
```yaml
flow: |
"general-purpose" -> "stpa-analyst"
"shell-script-coder" -> "shell-script-reviewer"
"shell-script-reviewer" -> "stpa-analyst"
```
**Architecture documentation:**
```yaml
flow: |
"c4-code" -> "c4-component"
"c4-component" -> "c4-container"
"c4-container" -> "c4-context"
```
**General (no stack detected):**
```yaml
flow: |
"general-purpose" -> "stpa-analyst"
```
Always include `stpa-analyst` as terminal node for safety analysis (except pure documentation flows).
### 6. Detect Completion Gate
Look for test commands:
| File | Gate Script |
|------|-------------|
| `go.mod` | `go test ./...` |
| `package.json` with test script | `npm test` |
| `Makefile` with test target | `make test` |
| None | Omit `completionGateScript` |
### 7. Show Preview
Display the complete GOAL.md and ask:
> "Here's the goal file. Ready to write it?"
### 8. Backup and Write
If `GOAL.md` exists:
1. Rename to `GOAL.md.YYYY-MM-DD-HHMMSS.bak`
2. Inform user of backup
Write new `GOAL.md` to repository root.
## GOAL.md Format
```yaml
---
flow: |
"agent-a" -> "agent-b"
"agent-b" -> "stpa-analyst"
models:
"coordinator": "anthropic/claude-opus-4-6 (max)"
"agent-a": "anthropic/claude-opus-4-6"
"agent-b": "anthropic/claude-opus-4-6"
"stpa-analyst": "anthropic/claude-opus-4-6"
interactive: yes
completionGateScript: go test ./...
---
Brief description of the goal in 1-2 sentences.
## Success Criteria
- [ ] Outcome-based criterion 1
- [ ] Outcome-based criterion 2
- [ ] Outcome-based criterion 3
```
## Available Agents
### Development Agents
| Agent | Use For |
|-------|---------|
| backend-go-developer | Go APIs, CLIs, services |
| react-developer | React frontends |
| htmx-picocss-frontend-developer | Lightweight HTMX + PicoCSS UIs |
| shell-script-coder | Shell scripts, CLI tools |
| general-purpose | Multi-domain tasks, Python, other languages |
| webmaster | Marketing sites, landing pages |
### Review Agents
| Agent | Use For |
|-------|---------|
| go-readability-reviewer | Go code style and idioms |
| react-reviewer | React code review |
| htmx-picocss-frontend-reviewer | HTMX/Pico visual consistency |
| shell-script-reviewer | Shell script correctness |
| stpa-analyst | Safety/hazard analysis (terminal node) |
| project-critic-council | Multi-model consensus evaluation |
| cli-output-style-adjuster | Unix-philosophy CLI compliance |
### Verification Agents
| Agent | Use For |
|-------|---------|
| agent-sdk-verifier-py | Validate Python Claude Agent SDK apps |
| agent-sdk-verifier-ts | Validate TypeScript Claude Agent SDK apps |
| openai-sdk-verifier-py | Validate Python OpenAI Agents SDK apps |
| openai-sdk-verifier-ts | Validate TypeScript OpenAI Agents SDK apps |
### Deployment Agents
| Agent | Use For |
|-------|---------|
| cloudflare-worker-deployer | Deploy Cloudflare Workers |
| vercel-deployer | Deploy to Vercel |
| exe-dev-deployer | Deploy executable dev environments |
### Documentation Agents (C4 Model)
| Agent | Use For |
|-------|---------|
| c4-code | Code-level documentation with Mermaid |
| c4-component | Logical component architecture |
| c4-container | Deployment units and containers |
| c4-context | High-level system context diagrams |
### Meta Agents
| Agent | Use For |
|-------|---------|
| coordinator | Workflow orchestration (implicit) |
| skill-writer | Create validated SGAI skills |
| snippet-writer | Create reusable code snippets |
| retrospective | Analyze completed sessions |
## File References
To include context like screenshots or specs, add files to the repo and reference them:
```markdown
See `docs/mockup.png` for the desired layout.
Refer tRelated in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.