diff --git a/docs/skills.md b/docs/skills.md index 32cc2a4..ca3de1f 100644 --- a/docs/skills.md +++ b/docs/skills.md @@ -99,7 +99,7 @@ For skills **without** scripts (binary-backed skills like `k8s-incident-triage`) │ LLM Tool Registry │ ├─────────────────┬───────────────────────────────┤ │ Builtins │ web_search, http_request │ -│ Skill Tools │ tavily_research, ... │ ← auto-registered from scripts +│ Skill Tools │ tavily_research, codegen_* │ ← auto-registered from scripts │ read_skill │ load any SKILL.md on demand │ │ cli_execute │ run approved binaries │ ├─────────────────┴───────────────────────────────┤ @@ -143,10 +143,18 @@ forge skills list --tags kubernetes,incident-response ## Built-in Skills -| Skill | Description | Scripts | -|-------|-------------|---------| -| `tavily-research` | Deep multi-source research via Tavily API | `tavily-research.sh`, `tavily-research-poll.sh` | -| `k8s-incident-triage` | Read-only Kubernetes incident triage using kubectl | — (binary-backed) | +| Skill | Category | Description | Scripts | +|-------|----------|-------------|---------| +| `github` | — | Create issues, PRs, and query repositories | — (binary-backed) | +| `weather` | — | Get weather data for a location | — (binary-backed) | +| `tavily-search` | — | Search the web using Tavily AI search API | `tavily-search.sh` | +| `tavily-research` | — | Deep multi-source research via Tavily API | `tavily-research.sh`, `tavily-research-poll.sh` | +| `k8s-incident-triage` | sre | Read-only Kubernetes incident triage using kubectl | — (binary-backed) | +| `code-review` | developer | AI-powered code review for diffs and files | `code-review-diff.sh`, `code-review-file.sh` | +| `code-review-standards` | developer | Initialize and manage code review standards | — (template-based) | +| `code-review-github` | developer | Post code review results to GitHub PRs | — (binary-backed) | +| `codegen-react` | developer | Scaffold and iterate on Vite + React apps | `codegen-react-scaffold.sh`, `codegen-react-read.sh`, `codegen-react-write.sh`, `codegen-react-run.sh` | +| `codegen-html` | developer | Scaffold standalone Preact + HTM apps (zero dependencies) | `codegen-html-scaffold.sh`, `codegen-html-read.sh`, `codegen-html-write.sh` | ### Tavily Research Skill @@ -210,6 +218,65 @@ The skill accepts two input modes: Requires: `kubectl`, optional `KUBECONFIG`, `K8S_API_DOMAIN`, `DEFAULT_NAMESPACE` environment variables. +### Codegen React Skill + +The `codegen-react` skill scaffolds and iterates on **Vite + React** applications with Tailwind CSS: + +```bash +forge skills add codegen-react +``` + +This registers four tools: + +| Tool | Purpose | Behavior | +|------|---------|----------| +| `codegen_react_scaffold` | Create a new project | Generates package.json, Vite config, React components with Tailwind CSS and Forge dark theme | +| `codegen_react_run` | Start the dev server | Runs `npm install` + `npm run dev`, auto-opens browser, returns server URL and PID | +| `codegen_react_read` | Read project files | Returns file content or directory listing (excludes `node_modules/`, `.git/`) | +| `codegen_react_write` | Write/update files | Creates or updates files with path traversal prevention; Vite hot-reloads automatically | + +**Iteration workflow:** + +1. Scaffold the project with `codegen_react_scaffold` +2. Start the dev server with `codegen_react_run` — installs deps, opens browser +3. Read/write files with `codegen_react_read` / `codegen_react_write` — Vite hot-reloads on save +4. Repeat step 3 to iterate on the UI + +**Scaffold output:** `package.json` (React 19, Vite 6), `vite.config.js`, `index.html` (with Tailwind CDN), `src/main.jsx`, `src/App.jsx` (Tailwind utility classes), `src/App.css`, `.gitignore`. + +**Safety:** Output directories must be under `$HOME` or `/tmp`. Path traversal (`..`, absolute paths) is rejected. Non-empty directories require `force: true`. + +Requires: `node`, `npx`, `jq`. Egress: `registry.npmjs.org`, `cdn.jsdelivr.net`, `cdn.tailwindcss.com`. + +### Codegen HTML Skill + +The `codegen-html` skill scaffolds standalone **Preact + HTM** applications with zero local dependencies: + +```bash +forge skills add codegen-html +``` + +This registers three tools: + +| Tool | Purpose | Behavior | +|------|---------|----------| +| `codegen_html_scaffold` | Create a new project | Generates HTML with Preact + HTM via CDN and Tailwind CSS; supports single-file and multi-file modes | +| `codegen_html_read` | Read project files | Returns file content or directory listing | +| `codegen_html_write` | Write/update files | Creates or updates files with path traversal prevention | + +**Two scaffold modes:** + +| Mode | Files | Use Case | +|------|-------|----------| +| `single-file` | One `index.html` with inline JS | Quick prototypes, shareable demos | +| `multi-file` | `index.html`, `app.js`, `components/Counter.js` | Larger apps with component separation | + +**Key differences from codegen-react:** No Node.js required. No build step. No `npm install`. Just open `index.html` in a browser. Uses `class` (not `className`) since HTM maps directly to DOM attributes. + +**Safety:** Same restrictions as codegen-react — output under `$HOME` or `/tmp`, path traversal prevention, `force: true` for non-empty directories. + +Requires: `jq`. Egress: `cdn.tailwindcss.com`, `esm.sh`. + ## Skill Instructions in System Prompt Forge injects the **full body** of each skill's SKILL.md into the LLM system prompt. This means all detailed operational instructions — triage steps, detection heuristics, output structure, safety constraints — are directly available in the LLM's context without requiring an extra `read_skill` tool call. diff --git a/forge-skills/local/embedded/code-review-github/SKILL.md b/forge-skills/local/embedded/code-review-github/SKILL.md index 65129ca..e920a3a 100644 --- a/forge-skills/local/embedded/code-review-github/SKILL.md +++ b/forge-skills/local/embedded/code-review-github/SKILL.md @@ -1,6 +1,6 @@ --- name: code-review-github -category: dev +category: developer tags: - code-review - github diff --git a/forge-skills/local/embedded/code-review-standards/SKILL.md b/forge-skills/local/embedded/code-review-standards/SKILL.md index 4ec419f..2f68fb8 100644 --- a/forge-skills/local/embedded/code-review-standards/SKILL.md +++ b/forge-skills/local/embedded/code-review-standards/SKILL.md @@ -1,6 +1,6 @@ --- name: code-review-standards -category: dev +category: developer tags: - code-review - standards diff --git a/forge-skills/local/embedded/code-review/SKILL.md b/forge-skills/local/embedded/code-review/SKILL.md index cecaf23..6bab179 100644 --- a/forge-skills/local/embedded/code-review/SKILL.md +++ b/forge-skills/local/embedded/code-review/SKILL.md @@ -1,6 +1,6 @@ --- name: code-review -category: dev +category: developer tags: - code-review - diff diff --git a/forge-skills/local/embedded/codegen-html/SKILL.md b/forge-skills/local/embedded/codegen-html/SKILL.md new file mode 100644 index 0000000..4d8b8b4 --- /dev/null +++ b/forge-skills/local/embedded/codegen-html/SKILL.md @@ -0,0 +1,190 @@ +--- +name: codegen-html +category: developer +tags: + - code-generation + - frontend + - html + - preact + - ui + - zero-dependency +description: Scaffold and iterate on standalone Preact + HTM applications with zero build dependencies +metadata: + forge: + requires: + bins: + - jq + env: + required: [] + one_of: [] + optional: [] + egress_domains: + - cdn.tailwindcss.com + - esm.sh + timeout_hint: 60 +--- + +# Codegen HTML Skill + +Scaffold and iteratively build standalone HTML applications using Preact + HTM via CDN. Zero local dependencies — no Node.js, no npm, no build step. Just open the HTML file in a browser. + +## Quick Start + +```bash +# Scaffold a single-file app +./scripts/codegen-html-scaffold.sh '{"project_name": "my-app", "output_dir": "/tmp/my-app", "mode": "single-file"}' + +# Scaffold a multi-file app +./scripts/codegen-html-scaffold.sh '{"project_name": "my-app", "output_dir": "/tmp/my-app", "mode": "multi-file"}' + +# Read a file or list the project +./scripts/codegen-html-read.sh '{"project_dir": "/tmp/my-app", "file_path": "."}' + +# Write/update a file +./scripts/codegen-html-write.sh '{"project_dir": "/tmp/my-app", "file_path": "index.html", "content": "..."}' +``` + +## CRITICAL: Scaffold Conventions (DO NOT VIOLATE) + +These rules prevent runtime errors: + +1. **Use `class` (not `className`)** — HTM maps directly to DOM attributes +2. **Use Tailwind CSS utility classes** for all styling (loaded via CDN in `index.html`) +3. **Do NOT create `