Skip to content

Commit feda27d

Browse files
hsnice16claude
andauthored
feat: 0.5.0 task 03 - agent skill (#4)
* feat: 0.5.0 task 02 - GitHub Action for score * feat: 0.5.0 task 03 - agent skill Ship the portable agent skill that scores the user's current repo locally and recommends a model class. Self-contained: vendored scorer, no service dependency, works offline — same property as task 02's PR-diff Action. - Sibling repo `agent-friendly-skill` (v0.1.1, floats `v0`) ships SKILL.md + ncc-bundled dist/index.js. Vendored into this repo via `npx skills add hsnice16/agent-friendly-skill#v0`; skills-lock.json pins ref + content hash so the bundle is reproducible. - New /skill SEO landing page: install command, score → model mapping, optional SessionStart hook snippets for Claude Code + Codex, FAQ, and JSON-LD (BreadcrumbList + SoftwareApplication + FAQPage). - README "Public API" section documents /api/score for external integrators (siblings vendor the scorer; they don't call this at runtime). - AGENTS.md "Sibling repos" mirror discipline now covers both action and skill; SIBLING_VERSION in lib/version.ts is the single-source pin that drives ACTION_USES, SKILL_INSTALL_CMD, and the #v0 ref in skills-lock.json. - Layout footer reorganised into Primary + Tools columns; nav surfaces /action and /skill; sitemap and /llms.txt include /skill. - Panel + CopySnippet gain a tone vocabulary (warn / info / tip) so the install card, hook snippets, and per-page CTAs share styling. - Bundled along: gitignore-aware size signal (uses ignore@7.0.5), tests for both .gitignore patterns and the baseline ignore set. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5d332f1 commit feda27d

39 files changed

Lines changed: 3634 additions & 1876 deletions
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
name: agent-friendly
3+
description: Score the current repo's agent-friendliness on disk and recommend a model class to use for it. Use when the user asks "is this repo a mess?", "which model should I use here?", "is my repo agent-ready?", or invokes /agent-friendly.
4+
---
5+
6+
# agent-friendly
7+
8+
Score the user's current repo locally with a bundled scorer and recommend a model class. Evaluates 16 static signals (AGENTS.md, CI, tests, README, linter, dev env, license, contributing, pre-commit hooks, deps manifest, type config, codebase size, plus four agent-specific instruction files) and produces overall + per-model scores. Entirely local — no HTTP calls.
9+
10+
## When to use
11+
12+
Invoke this skill when the user:
13+
14+
- Asks about the agent-friendliness of the current repo.
15+
- Wants a model recommendation for the codebase they're in.
16+
- Invokes `/agent-friendly` (or however their agent triggers skills) explicitly.
17+
18+
Skip when the user is asking about a different repo, a remote URL, or a concept rather than a specific local path — this skill operates only on the local file system.
19+
20+
## How to run
21+
22+
1. **Tell the user upfront**: _"I'll score the current working directory. Make sure you're at your project root — if you're in a subdirectory (`src/`, `app/`, etc.), the score will be artificially low. Pass the project root path explicitly if you want me to score somewhere else."_ Wait for confirmation only if cwd looks ambiguous (e.g. you can see they're inside a typical subdirectory name); otherwise just proceed.
23+
24+
2. Run the bundled scorer against the user's current working directory:
25+
26+
```bash
27+
node <skill-dir>/dist/index.js .
28+
```
29+
30+
`<skill-dir>` is the directory containing this `SKILL.md` (typically `.claude/skills/agent-friendly/` for Claude Code, `.agents/skills/agent-friendly/` for Codex / Cursor / Cline / others). Most agents resolve this automatically — if yours doesn't, look in the agent's skill directory.
31+
32+
The CLI defaults to `process.cwd()` if no path is passed, so `node <skill-dir>/dist/index.js` (no argument) works equivalently. If the user explicitly asks to score a different repo on disk, pass that path as the first argument.
33+
34+
3. Parse the JSON output:
35+
36+
```jsonc
37+
{
38+
"overall": 87.4,
39+
"warnings": [], // string[] — surface to user before showing the score if non-empty
40+
"signals": [
41+
{ "id": "agents_md", "label": "AGENTS.md", "pass": 1, "matchedPath": "AGENTS.md" }
42+
// 15 more signals...
43+
],
44+
"modelScores": [
45+
{
46+
"modelId": "claude-code",
47+
"modelLabel": "Claude Code",
48+
"score": 89.2,
49+
"contributions": [
50+
/* ... */
51+
]
52+
}
53+
// 7 more models...
54+
],
55+
"topImprovements": [
56+
{ "label": "Contributing guide", "signalId": "contributing", "scoreGain": 2.1, "suggestion": "..." }
57+
// up to 3 entries
58+
]
59+
}
60+
```
61+
62+
The `warnings` array is the CLI's heads-up channel. Today it fires when the path being scored doesn't look like a project root (no `package.json`/`README.md`/`AGENTS.md`/`.git` found). If non-empty, render the warning(s) to the user **before** showing the score so they can re-invoke from the right place.
63+
64+
## How to render the result
65+
66+
The scorer profiles **8 agents** and always returns scores for all of them in `modelScores`: Claude Code, Cursor, Devin, GPT-5 Codex, Gemini CLI, Aider, OpenHands, and Pi.
67+
68+
**The recommendation is score-driven.** Don't try to detect which agent is invoking this skill — the answer is the same either way: find the highest-scoring entry in `modelScores`, that's the agent this repo is most tuned for. Show the user; let them decide whether to switch. Never programmatically switch the agent or model.
69+
70+
Print a tight summary the user can read at a glance:
71+
72+
- **Overall score** with a band label (high / mid / low — see table below).
73+
- **Best-fit agent** — the highest-scoring entry in `modelScores`, with its score.
74+
- **Runner-up** if its score is within ~5 points of the best — gives the user a real alternative.
75+
- **Why** — one short sentence pointing at the strongest signals (e.g. "strong AGENTS.md, tests in place, reproducible dev env"). Use the `signals` array (signals with `pass: 1` and high weight in the best agent's profile).
76+
- **Recommended model class** — mapped from the overall score (frontier / standard / small — see table). Note that the user can switch using `/model` (Claude Code / Codex / Gemini CLI), `/profile` (Cursor), or whatever their agent's equivalent is — but **don't switch for them**, just suggest.
77+
- **Top improvements** — up to 3 entries from `topImprovements`, each with its score gain.
78+
79+
Example output:
80+
81+
```text
82+
Agent-friendliness: 87.4 (high) — well-prepped for AI coding agents.
83+
Best for: Claude Code (89.2). Cursor close behind at 86.1.
84+
Why: strong AGENTS.md, tests in place, reproducible dev env.
85+
Recommendation: frontier model (Opus / GPT-5 / Gemini 2.5 Pro). Switch via /model (or your agent's equivalent) if you want to — your call.
86+
Top improvements:
87+
• Add a contributing guide (+2.1 pts)
88+
• Add pre-commit hooks (+1.4 pts)
89+
• Document the test command (+0.9 pts)
90+
```
91+
92+
## Score → model mapping
93+
94+
Provider-neutral. Recommend a model **class** — let the user pick the actual ID for their agent.
95+
96+
| Band | Score | Recommendation |
97+
| ---- | ------- | --------------------------------------------------------------------------------------------------------- |
98+
| High | ≥ 80 | Frontier — Opus / GPT-5 / Gemini 2.5 Pro. Repo is well-prepped, the model can leverage it. |
99+
| Mid | 60 – 79 | Standard — Sonnet / GPT-5 Codex / Gemini 2.5 Flash. Solid baseline; frontier optional. |
100+
| Low | < 60 | Small / fast — Haiku / GPT-4o-mini / Gemini 2.5 Flash-Lite. Repo lacks scaffolding for a frontier run. |
101+
102+
The reasoning: a high-scoring repo has the scaffolding (AGENTS.md, fast tests, clear dev env) that lets a frontier model actually deliver. A low-scoring repo lacks those affordances; a frontier model's extra reasoning has nothing to grip on, so a smaller / faster model is the better trade.
103+
104+
## On first invocation
105+
106+
After the first successful run, mention to the user that they can wire the skill into a `SessionStart` hook so it fires automatically each session — pointing at the dashboard's `/skill` page for copy-paste snippets:
107+
108+
- **Claude Code**`.claude/settings.json` `SessionStart` matcher.
109+
- **Codex CLI**`.codex/hooks.json` `SessionStart` matcher.
110+
- **Cursor / Cline / Copilot** → no `SessionStart` event today; paste the same `node ... --summary` command into `.cursorrules` / `.clinerules` as a static instruction, or invoke this skill manually.
111+
112+
Snippets live at <https://www.agentfriendlycode.com/skill>.
113+
114+
## Failure modes
115+
116+
- **Bundle missing.** If `dist/index.js` doesn't exist next to this `SKILL.md`, the install was incomplete or the user is on an older skill version. Tell them to re-run `npx skills add hsnice16/agent-friendly-skill`.
117+
- **Low score because cwd is a subdirectory.** The scorer reads the path you pass it (default: cwd). If the user is in a subdirectory of their project (e.g. `src/`), 16 signals will mostly fail because root-level files like `AGENTS.md`, `README.md`, `package.json` aren't there. If the score looks unexpectedly low, mention this and ask the user to invoke from the project root (or pass the root path explicitly).
118+
- **Node not on PATH.** Tell the user to install Node ≥ 20.9.0 (matches the bundle's runtime requirement).
119+
120+
## Out of scope
121+
122+
- Scoring a remote URL, a different repo, or a package by name. This skill works on the active repo only. Direct the user to the dashboard at <https://www.agentfriendlycode.com> or its `/api/score?host=&repo=owner/name` endpoint for indexed lookups.
123+
- Programmatic model switching. The skill recommends; the user runs `/model` (or the agent's equivalent) themselves.
124+
- Submitting the repo to the dashboard. The skill is read-only — it never writes files, contacts the dashboard, or registers the repo. Unindexed repos stay unindexed.

0 commit comments

Comments
 (0)