skills/codebase-spec/SKILL.md
Use this skill whenever the user wants to analyze a codebase and generate a detailed product spec document. Triggers for: "analyze this codebase", "generate a spec", "document this project", "reverse engineer this app", "what does this system do", "create product documentation", "map out the features", "extract product rules from code", "what does this codebase do", "generate product spec from code", "document this app", "spec out this repo", "read this code and tell me what it does", "create a product spec", "reverse engineer the product", "what features does this app have", "document the flows", "extract the prompts from this code", or any request to extract product knowledge from source code. Supports any input method: file uploads, pasted code, filesystem paths, or zip archives. Always use this skill when the user shares code AND wants to understand what the product does — even if they don't explicitly say "spec" or "documentation".
npx skillsauth add renatocaliari/agent-sync-public-skills codebase-specInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a senior product analyst reverse-engineering a product from its source code. Your job: produce a living product specification that is completely tech-stack-agnostic — so thorough that another team could rebuild the product in any language or framework.
Accept codebase via any of:
find + cat to readIf the input is a zip file:
unzip -o <file> -d /tmp/codebase-spec-input
find /tmp/codebase-spec-input -type f | sort
# or for uploads: ls -R /mnt/user-data/uploads/
Look for: package.json, pyproject.toml, go.mod, Gemfile, pom.xml, *.csproj,
Dockerfile, docker-compose.yml, *.env.example, CI configs, README files.
Search for:
grep -r "openai\|anthropic\|claude\|gpt\|gemini\|mistral\|llama\|ollama\|langchain\|llamaindex\|huggingface\|transformers\|replicate\|groq\|cohere\|bedrock\|vertex" \
--include="*.js" --include="*.ts" --include="*.py" --include="*.go" \
--include="*.rb" --include="*.java" --include="*.cs" -l -i /tmp/codebase-spec-input 2>/dev/null
Then read every file that matches to extract:
gpt-4o, claude-3-5-sonnet, gemini-1.5-pro)These reveal every feature the product has.
DB models, Zod/Pydantic schemas, GraphQL types, Prisma schema, etc.
Especially forms, modals, pages — they reveal exact fields, validations, and UX flows.
Services, hooks, utilities, middleware — where the rules live.
REST routes, GraphQL resolvers, tRPC routers, gRPC protos.
After reading everything, synthesize the full picture before writing. Ask yourself:
Output a single Markdown document with the sections below, in the same language the user wrote in (if user wrote in Portuguese, spec is in Portuguese; if English, spec is in English).
Save as /mnt/user-data/outputs/<project-name>-spec.md
# [Product Name] — Product Spec
> Reverse-engineered from source code. Tech-stack agnostic.
> Generated: [date]
## 1. Product Overview
## 2. Tech Stack Summary (context only)
## 3. User Roles & Permissions
## 4. Features & Product Rules
## 5. User Flows (with ASCII art)
## 6. Screens & Components (with ASCII art)
## 7. Data Models
## 8. API Surface
## 9. AI / LLM Integration (detailed)
## 10. Business Rules Catalog
## 11. Open Questions / Inferred Behavior
One paragraph: what is this, who uses it, what core problem it solves.
| Layer | Technology | Notes |
|--------------|-----------------|--------------------------|
| Frontend | React + Next.js | App Router |
| Backend | Node / Express | REST API |
| Database | PostgreSQL | via Prisma ORM |
| AI | OpenAI SDK | GPT-4o, streaming |
| Auth | NextAuth.js | Google + email/password |
| Infra | Vercel + Railway | |
Note: This section exists for context only. The rest of the spec is tech-agnostic.
List every role found in the code (admin, user, guest, etc.) and what each can do.
For each major feature:
### Feature: [Name]
**Description:** What it does in plain English.
**Rules:**
- Rule 1 (extracted from validation / business logic)
- Rule 2
- ...
**Edge cases handled:**
- ...
Use ASCII art to draw every major flow. Examples:
Navigation flow:
[Login] ──► [Dashboard]
│
┌─────────┼──────────┐
▼ ▼ ▼
[Projects] [Settings] [Profile]
│
▼
[Project Detail] ──► [Edit Project]
│
[Save] / [Cancel]
Decision flow:
User submits form
│
▼
[Validate input]
│
┌───┴───┐
PASS FAIL
│ │
▼ ▼
[Save] [Show errors]
│
▼
[Send confirmation email]
│
▼
[Redirect to dashboard]
Sequence / interaction flow:
User Frontend Backend AI (LLM)
│ │ │ │
│──send msg─────►│ │ │
│ │──POST /chat─►│ │
│ │ │──prompt─────►│
│ │ │◄─stream──────│
│ │◄─SSE stream──│ │
│◄─render tokens─│ │ │
Draw wireframe-level ASCII for every distinct screen. Be thorough — include labels, fields, buttons, states.
Example — Dashboard screen:
┌─────────────────────────────────────────────────────┐
│ 🏠 MyApp [Notifications 🔔] [User ▼] │
├──────────────┬──────────────────────────────────────┤
│ │ Welcome back, João! │
│ 📊 Dashboard│ │
│ 📁 Projects │ ┌──────────┐ ┌──────────┐ │
│ ⚙️ Settings │ │ 12 │ │ 3 │ │
│ 👤 Profile │ │ Projects │ │ Active │ │
│ │ └──────────┘ └──────────┘ │
│ │ │
│ │ Recent Activity │
│ │ ┌─────────────────────────────────┐ │
│ │ │ • Project X updated 2min ago │ │
│ │ │ • New comment on Y 1hr ago │ │
│ │ └─────────────────────────────────┘ │
│ │ │
│ │ [+ New Project] │
└──────────────┴──────────────────────────────────────┘
For each screen, also list:
For each entity:
### Entity: User
| Field | Type | Rules / Notes |
|---------------|-----------|----------------------------------|
| id | UUID | auto-generated |
| email | string | unique, required, validated |
| role | enum | user | admin | guest |
| created_at | timestamp | auto |
Relations:
- User has many Projects
- User has many Comments
### POST /api/auth/login
**Purpose:** Authenticate user
**Auth:** Public
**Body:** { email: string, password: string }
**Returns:** { token: string, user: User }
**Rules:**
- Rate limited: 5 attempts / 15min
- Returns 401 if credentials invalid
- Logs failed attempts
This is the most important section for AI-powered products.
### AI Feature: [Name] (e.g. "Chat Assistant", "Document Summarizer")
**Provider:** OpenAI / Anthropic / etc.
**Model:** gpt-4o / claude-3-5-sonnet-20241022 / etc.
**Endpoint:** /api/chat or similar
**Streaming:** yes/no
**System Prompt:**
\`\`\`
[exact system prompt extracted from code]
\`\`\`
**User Prompt Template:**
\`\`\`
[exact template, with {variable} placeholders shown]
\`\`\`
**Few-shot Examples (if any):**
\`\`\`
[extracted examples]
\`\`\`
**Inference Parameters:**
| Param | Value |
|---------------|--------|
| temperature | 0.7 |
| max_tokens | 2000 |
| top_p | 1.0 |
**Input:** What is passed to the model (user message, context, retrieved docs, etc.)
**Output:** What the model returns and how it's used
**Post-processing:** Any parsing, validation, or transformation applied to the response
**RAG / Context injection (if any):**
- Vector DB: Pinecone / Chroma / pgvector / etc.
- Embedding model: text-embedding-3-small / etc.
- Chunking: [strategy extracted from code]
- Top-k: [number]
- What documents are indexed
**Tool / Function calling (if any):**
\`\`\`json
[exact tool definitions extracted from code]
\`\`\`
**Error handling:**
- What happens on API failure
- Fallback behavior
- Retry logic
A numbered, exhaustive list of every rule found in the codebase:
BR-001: Users cannot delete a project with active subscriptions.
BR-002: Email must be verified before accessing paid features.
BR-003: AI features are disabled for free tier users.
BR-004: Messages are truncated to 4000 tokens before sending to LLM.
BR-005: Admin can impersonate any user account.
...
Be honest about what was inferred vs. explicitly coded:
⚠️ INFERRED: The onboarding flow appears to be optional based on a `skip` button,
but no skip logic was found in the backend — unclear if this is tracked.
⚠️ INCOMPLETE: Payment webhook handler exists but only handles `payment_succeeded`.
No handler found for `payment_failed` or `subscription_cancelled`.
❓ UNCLEAR: The `legacy_mode` flag appears in the user model but is never set anywhere
in the current codebase. Possibly dead code or migrated feature.
Before saving, verify:
Simple: +-------+ Rounded: ╭───────╮ Heavy: ┏━━━━━━━┓
| text | │ text │ ┃ text ┃
+-------+ ╰───────╯ ┗━━━━━━━┛
Double: ╔═══════╗ Dotted: ┌╌╌╌╌╌╌╌┐
║ text ║ ╎ text ╎
╚═══════╝ └╌╌╌╌╌╌╌┘
Flow: ──► ◄── ──►──► ═══►
Vertical: │ ▲ ▼
Conditional: ─┬─ ─┤ └──
┌─────────┐
│ Action │
└────┬────┘
│
┌────▼────┐
│Decision?│
└────┬────┘
┌───┴───┐
YES NO
│ │
Actor A Actor B Actor C
│ │ │
│──action─────►│ │
│ │──action─────►│
│ │◄─response────│
│◄─response────│ │
Always save the final spec to:
/mnt/user-data/outputs/<project-name>-spec.md
Then use present_files to share it with the user.
Finish with a brief summary: number of features documented, screens drawn, AI integrations found, and business rules catalogued.
tools
Extrai métricas estruturadas, cálculos e estimativas de transcripts de entrevistas com clientes do Sommelier de IA. Produz um JSON com dores, frequências, tempo gasto, pessoas envolvidas, economia potencial, ROI e recomendações financeiras. Projetado para alimentar o cali-degustia-diagnostico ou integrar com dashboards/planilhas.
tools
Guia a coleta de depoimentos de clientes do Sommelier de IA no momento certo do processo, usando a abordagem de Hormozi: pedir depois da primeira evidência de resultado, nunca na entrega. Gera depoimentos mais autênticos e reduz a sensação de que o cliente está sendo "solicitado".
development
[stelow] Full UX critique for visual interfaces. Accepts a live URL, source code directory, or screenshot image. Evaluates accessibility (WCAG AA), Nielsen's 10 heuristics, visual hierarchy, cognitive load, consistency, mobile responsiveness, AI slop, emotional journey, and design personas — then generates a classified gap report. Standalone or integrated into stelow and stelow-product-testing-execution.
development
Building trust through perception and guarantee mechanisms. Covers ten pillars to materialize trust, guarantee types from unconditional to anti-guarantees, and strategic approaches for different contexts.