Skip to content

Commit b116e30

Browse files
committed
feat: add task 03 in 0.4.0
1 parent 87eaf37 commit b116e30

7 files changed

Lines changed: 77 additions & 6 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ bun run test # unit tests (node --test + tsx) — requires Node ≥20.
3737

3838
## Layout
3939

40-
```txt
40+
```text
4141
app/
4242
layout.tsx # root layout (nav + footer) — defines root metadata + OG / Twitter cards
4343
page.tsx # leaderboard

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Keep it short. `feat/postgres-migration` is better than `feat/add-postgres-migra
3030

3131
One logical change per commit. Short imperative subject (≤72 chars), body only if the change needs explanation.
3232

33-
```txt
33+
```text
3434
Add license signal — scores repos by SPDX ID presence
3535
3636
Reads LICENSE, LICENSE.md, or COPYING at repo root. If `license:` is

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Run the unit tests with `bun run test` (uses `node --test` + `tsx`; requires Nod
133133

134134
## Layout
135135

136-
```txt
136+
```text
137137
app/ Next.js App Router — pages + API + SEO
138138
layout.tsx root layout, root metadata (OG + Twitter cards)
139139
page.tsx leaderboard

lib/roadmap.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ export const ROADMAP: RoadmapVersion[] = [
2828
taskFile: "tasks/0.4.0/02-score-diff-on-pr.md",
2929
summary: "GitHub Action that comments score delta on every PR.",
3030
},
31+
{
32+
title: "Claude Code skill",
33+
taskFile: "tasks/0.4.0/03-claude-code-skill.md",
34+
summary:
35+
"Skill (installable via npx skills add) that checks the active repo's score and recommends a Claude model. Ships with the /api/score lookup endpoint and a UI integration page with a SessionStart hook snippet.",
36+
},
3137
],
3238
},
3339
{
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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.

tasks/0.4.0/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
**Status**: planned
44

5-
The cheapest two items on the roadmap, paired so they can ship in one cut. History-aware signals extend the existing host-API clients with ~3 new signal files; the PR-diff GitHub Action is a thin wrapper that calls the badge / API endpoints we already ship. No new infra, no new deps of consequence — high-impact additions that don't need a heavy release.
5+
The cheapest items on the roadmap, paired so they can ship in one cut. History-aware signals extend the existing host-API clients with ~3 new signal files; the PR-diff GitHub Action is a thin wrapper that calls the badge / API endpoints we already ship; the Claude Code skill bundles a small lookup endpoint, a `SKILL.md` shipped from this repo, and a UI integration page. No new infra, no new deps of consequence — high-impact additions that don't need a heavy release.
66

77
## Tasks
88

99
- [01-history-aware-signals.md](./01-history-aware-signals.md) — extend the scorer with maintenance recency, commit velocity, and contributor activity. Hybrid fetch (shallow clone for files, host API for history) — degrades gracefully without a token.
1010
- [02-score-diff-on-pr.md](./02-score-diff-on-pr.md) — GitHub Action that comments the score delta on every PR using the existing `/api/repo/:id` and `/badge/...svg` endpoints.
11+
- [03-claude-code-skill.md](./03-claude-code-skill.md) — Claude Code skill (installable via `npx skills add`) that fetches the active repo's score and recommends a model, bundled with the public `/api/score` lookup endpoint it depends on and a UI integration page with the SessionStart hook snippet.

tasks/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Per-version work breakdown, readable by any agent (Claude Code, Cursor, Codex, D
44

55
## Structure
66

7-
```txt
7+
```text
88
tasks/
99
README.md <- this file
1010
<MAJOR.MINOR.PATCH>/ <- one folder per version, e.g. 0.1.0, 0.2.0
@@ -24,7 +24,7 @@ Each task file has a `**Status**: …` line:
2424

2525
Starting a session, point the agent at a specific task:
2626

27-
```txt
27+
```text
2828
Work on tasks/0.2.0/01-tests.md.
2929
```
3030

0 commit comments

Comments
 (0)