🪄 PromptCraft for Antigravity
Turn short, lazy prompts like "make a navbar" into senior-engineer specifications before they reach your AI agent.
PromptCraft is an Antigravity IDE extension that eliminates the frustrating "short prompt → generic output → multiple correction rounds" loop. It lives directly inside Antigravity as a button next to your chat input, ready to expand any brief command into a comprehensive, production-grade technical specification.
⚡ The Problem vs. The Fix
| Without PromptCraft (The Problem) |
With PromptCraft (The Fix) |
You type: "make a navbar" |
You type: "make a navbar" and click 🪄 |
| Agent guesses: Wrong framework, plain CSS, missing mobile menu, no accessibility, hardcoded links. |
PromptCraft analyzes: Detects your Next.js 14 App Router, Tailwind CSS, and lucide-react stack. |
| Result: Generic, broken code requiring 4 rounds of corrections. |
Agent receives: A 250-word Senior Architect specification with responsive breakpoints, mobile slide-over sheet, ARIA accessibility, active route detection, loading states, and strict TypeScript types. |
🌟 Key Features
Integrated Right Where You Type:
- Contributes a sparkle button
$(sparkle) directly to workbench/chat/inputAction in Antigravity IDE (right next to the send button).
- Also accessible via keyboard shortcut (
Alt + Enter in chat, Alt + C globally) or @craft chat participant.
Workspace Context Grounding:
- Scans
package.json, tsconfig.json, and project directory structure in real-time.
- Automatically detects frameworks (Next.js, React + Vite, Vue 3, SvelteKit, Express), styling systems (Tailwind CSS, CSS Modules, Styled Components), icon libraries, and state managers.
- Prevents the agent from hallucinating libraries you don't have installed.
Multi-Stage Cognitive Expansion:
- Classifies requests into UI Components, Backend APIs, Bugfixes, Refactoring, or General Tasks.
- Expands lazy prompts into 6 critical facets: Objective, Technical Context, Functional Breakdown, Interactive States & Edge Cases, Accessibility (WCAG 2.1 AA), and Acceptance Criteria.
Self-Critique & Double-Check Loop:
- Evaluates the generated specification before handoff.
- Prunes conversational fluff and subjective buzzwords ("make it modern").
- Automatically injects missing edge cases (loading skeletons, empty states, error boundaries, mobile viewport handling).
PromptCraft Studio (Companion Sidebar Panel):
- Live "Before & After" diff viewer with expansion ratio metrics (e.g.
12w → 240w (20x)).
- Quality score gauge (
Score: 95/100) and critique breakdown card.
- Detected workspace technology pills.
- One-click "Send to Agent" button.
Pluggable & Resilient:
- Works with the Gemini API for cloud intelligence.
- Features an Intelligent Offline Heuristic Engine that runs with zero network and zero API keys required.
🚀 Quick Start
Installation in Antigravity IDE
- Clone or open this repository in Antigravity:
cd /Users/aalok/Developer/tree/promptcraft
npm install
npm run build
- Press
F5 or run the extension in Antigravity IDE to launch a development extension host.
Usage Options
- Option A (Chat Input Button):
Type your prompt in the Antigravity chat input box, then click the PromptCraft sparkle button next to the input.
- Option B (Keyboard Shortcut):
Press
Alt + C anywhere in the editor to open the PromptCraft Quick Craft HUD.
- Option C (Chat Participant):
In the Antigravity chat panel, type:
@craft make a navbar
- Option D (PromptCraft Studio):
Click the PromptCraft icon in the Activity Bar to open the Studio panel for live prompt tuning and side-by-side inspection.
⚙️ Configuration Settings
Customize PromptCraft in your settings.json:
{
"promptcraft.specDepth": "Senior Architect",
"promptcraft.autoSendToAgent": false,
"promptcraft.includeA11y": true,
"promptcraft.includeEdgeCases": true,
"promptcraft.modelProvider": "gemini",
"promptcraft.geminiApiKey": ""
}
promptcraft.specDepth: Detail depth (Senior Architect, Standard Spec, Concise Directive).
promptcraft.autoSendToAgent: When true, automatically dispatches the polished prompt straight to the agent without manual confirmation.
promptcraft.includeA11y: Enforces WCAG 2.1 AA and ARIA standards in generated specs.
promptcraft.includeEdgeCases: Guarantees inclusion of loading skeletons, empty states, and error handling.
🧪 Testing
PromptCraft includes a comprehensive automated test suite testing context detection, expansion heuristics, and self-critique rules:
npm run test:build
🏛️ Architecture
For deep-dive architectural specifications, please refer to ARCHITECTURE.md.
| |