|
| 1 | +# 03 · Claude Code skill (with public score lookup) |
| 2 | + |
| 3 | +**Status**: planned |
| 4 | + |
| 5 | +## Goal |
| 6 | + |
| 7 | +Ship a Claude Code skill that fetches the active repo's score and recommends a model, plus the public lookup endpoint it depends on and a UI page that explains the integration. Bundled because the endpoint has no other consumer in 0.4.0 and the three pieces only make sense together. |
| 8 | + |
| 9 | +Installable via `npx skills add hsnice16/agent-friendly-code` (the [vercel-labs/skills](https://github.com/vercel-labs/skills) CLI auto-discovers a top-level `skills/` directory). |
| 10 | + |
| 11 | +## Pieces |
| 12 | + |
| 13 | +### 1. Public lookup endpoint |
| 14 | + |
| 15 | +`GET /api/score?host=github&repo=<owner>/<name>` |
| 16 | + |
| 17 | +- 200 with `{ repo, signals, modelScores }` — same shape as `/api/repo/[id]` so consumers share a type. |
| 18 | +- 404 with `{ error: "not_indexed" }` when not found — explicit so the skill can branch on it cleanly. |
| 19 | +- 400 on malformed `repo`. `host` defaults to `github`. |
| 20 | +- Thin wrapper around `getRepoByHostOwnerName` in `lib/db.ts`. No on-demand scoring; no GitHub token usage at request time. |
| 21 | + |
| 22 | +### 2. The skill |
| 23 | + |
| 24 | +```text |
| 25 | +skills/ |
| 26 | + agent-friendly/ |
| 27 | + SKILL.md |
| 28 | +``` |
| 29 | + |
| 30 | +Frontmatter (per vercel-labs/skills convention): |
| 31 | + |
| 32 | +```yaml |
| 33 | +--- |
| 34 | +name: agent-friendly |
| 35 | +description: Check the active repo's agent-friendliness score and recommend a Claude model. Use when the user asks "is this repo a mess?", "which model should I use here?", or invokes /agent-friendly. |
| 36 | +--- |
| 37 | +``` |
| 38 | + |
| 39 | +Body: instructions for Claude to (a) resolve `owner/name` from the git remote, (b) `GET /api/score` against the deployed instance, (c) on 200, render score + recommended model, (d) on 404, say so plainly and skip the recommendation, (e) on first invocation, surface the SessionStart hook snippet so the user can opt into automatic checks. Score → model mapping lives in this file (high score → Opus / Sonnet, low score → Haiku); exact thresholds and model IDs land during implementation. |
| 40 | + |
| 41 | +### 3. UI page |
| 42 | + |
| 43 | +New route (e.g. `/skill` or `/integrations/claude-code`): |
| 44 | + |
| 45 | +- One-paragraph pitch. |
| 46 | +- Install command: `npx skills add hsnice16/agent-friendly-code`. |
| 47 | +- Manual invocation: `/agent-friendly`. |
| 48 | +- Copy-paste `SessionStart` hook snippet for `.claude/settings.json` that `curl`s `/api/score` and prints score + recommendation into the session context. |
| 49 | +- Linked from the homepage and added to `lib/roadmap.ts`. |
| 50 | + |
| 51 | +The hook snippet on the UI page and the skill's first-invocation nudge must stay in sync — same content, two surfaces. |
| 52 | + |
| 53 | +## Acceptance |
| 54 | + |
| 55 | +- `GET /api/score?host=github&repo=owner/name` returns the documented shape; 404 body distinguishes `not_indexed` from generic errors. |
| 56 | +- `npx skills add hsnice16/agent-friendly-code` installs into `.claude/skills/agent-friendly/`. |
| 57 | +- `/agent-friendly` in a Claude Code session inside a git repo prints the score + model recommendation, or a clean "not indexed" message. |
| 58 | +- UI page is reachable from the homepage; install command + hook snippet match the skill's output. |
| 59 | +- README gains a short "Public API" section pointing skill / hook authors at `/api/score`. |
| 60 | + |
| 61 | +## Out of scope |
| 62 | + |
| 63 | +- On-demand scoring of unindexed repos. |
| 64 | +- Programmatic model switching. The skill recommends; the user runs `/model` themselves. |
0 commit comments