Branchwell

Skillfarm / website · skillfarm.ai / src / routes / pages.tsx

Raw 43.1 KB on 89e3b0386808cd2c72180a107bf17e8f384b21a3
1import type { Hono } from 'hono';
2import { raw } from 'hono/html';
3import { isOurs } from '../lib/hosts';
4import { RESEARCH_CSS, RESEARCH_HTML } from './research-plan';
5import { START_HTML } from './start-guide';
6import type { AppEnv, User } from '../env';
7import { groupName, promptBySlug, PROMPT_GROUPS, PROMPTS, promptsIn, type ReadyPrompt } from '../content/prompts';
8import { refreshStale } from '../lib/github';
9import { sendOptionsFor } from '../lib/install';
10import { KIND_LABEL } from '../lib/points';
11import { CATEGORIES, categoryCounts, listSkills, sproutPicks } from '../lib/skills';
12import { LIMITS, SEEDS, TIERS, tierFor } from '../lib/tiers';
13import { getUserByHandle } from '../lib/users';
14import { dateLabel, HttpError, plural, safeUrl, timeAgo } from '../lib/util';
15import { heroScene, hillEdge, icon, spot, tierArt } from '../views/art';
16import { AgentBadge, Avatar, Empty, SendToAgent, SkillCard, TierBadge, TierProgress } from '../views/components';
17import { render } from '../views/layout';
18
19type Member = Pick<User, 'id' | 'handle' | 'display_name' | 'avatar_key' | 'avatar_fallback' | 'seeds_total' | 'bio'> & { skills?: number; period_seeds?: number };
20
21const MemberCard = ({ m }: { m: Member }) => (
22 <a class="card member-card" href={`/u/${m.handle}`}>
23 <Avatar user={m} size={64} />
24 <div>
25 <h3>{m.display_name}</h3>
26 <p class="handle">@{m.handle}</p>
27 <TierBadge seeds={m.seeds_total} />
28 <p class="member-meta">
29 {m.seeds_total.toLocaleString('en-US')} Seeds{m.skills != null ? ` · ${plural(m.skills, 'skill')}` : ''}
30 </p>
31 </div>
32 </a>
33);
34
35/** One ready-made prompt: what it does, the text, and the two ways to hand it to an agent. */
36const PromptCard = ({ prompt, bare }: { prompt: ReadyPrompt; bare?: boolean }) => (
37 <article class={`card pad prompt-card${bare ? ' prompt-lead' : ''}`} id={prompt.slug}>
38 {bare ? null : <h3><a href={`/prompts/${prompt.slug}`}>{prompt.title}</a></h3>}
39 <p>{prompt.summary}{prompt.fill ? <> <span class="fine">Have ready: {prompt.fill.charAt(0).toLowerCase() + prompt.fill.slice(1)}</span></> : null}</p>
40 <pre>{prompt.body}</pre>
41 <div class="prompt-actions">
42 <button type="button" class="btn btn-ghost btn-sm" data-copy={prompt.body}>{icon('copy', 16)}<span>Copy prompt</span></button>
43 <SendToAgent options={sendOptionsFor(prompt.body)} small />
44 </div>
45 </article>
46);
47
48export function registerPages(app: Hono<AppEnv>) {
49 app.get('/', async (c) => {
50 const user = c.get('user');
51 // The trending and new rows are for what growers share. Sprout's picks have their own row.
52 const [fresh, trending, newest, allPicks, counts, spotlight] = await Promise.all([
53 listSkills(c.env, { featured: true, home: true, limit: 3, viewerId: user?.id }),
54 listSkills(c.env, { sort: 'trending', kind: 'hosted', home: true, limit: 6, viewerId: user?.id }),
55 listSkills(c.env, { sort: 'new', kind: 'hosted', home: true, limit: 6, viewerId: user?.id }),
56 sproutPicks(c.env, 12, user?.id),
57 categoryCounts(c.env),
58 c.env.DB.prepare(
59 `SELECT u.id, u.handle, u.display_name, u.avatar_key, u.avatar_fallback, u.seeds_total, u.bio,
60 (SELECT COUNT(*) FROM skills s WHERE s.owner_id = u.id AND s.state = 'live') AS skills
61 FROM users u WHERE u.spotlight_at IS NOT NULL AND u.status = 'active' AND u.is_agent = 0 ORDER BY u.spotlight_at DESC LIMIT 3`,
62 ).all<Member>(),
63 ]);
64 refreshStale(c.env, c.executionCtx, [...fresh, ...trending, ...newest, ...allPicks]);
65 const hasSkills = newest.length > 0;
66 // Until growers share skills of their own, Sprout's picks lead the page with a fuller row.
67 const publicPicks = allPicks.filter(({ title, summary }) => !/\bmcp\b|model context protocol/i.test(title + " " + summary));
68 const picks = hasSkills ? publicPicks.slice(0, 6) : publicPicks;
69 const showGrowerRow = hasSkills || !picks.length;
70 // With only a handful of skills the two rows would repeat each other.
71 const showNewest = newest.some((n) => !trending.some((t) => t.id === n.id));
72 return render(
73 c,
74 { active: 'home' },
75 <>
76 <section class="hero">
77 <div class="wrap hero-grid">
78 <div class="hero-copy">
79 <div class="visitor-welcome" data-visitor-odometer="" data-visitor-site="skillfarm"></div>
80 <h1>
81 Where agent skills <em>grow</em>.
82 </h1>
83 <p class="lede">
84 Skillfarm is a curated list of SKILL.md skills for every major coding agent, grown by its community. Share what you have built, earn Seeds, and grow a portfolio people can find.
85 </p>
86 <div class="cta-row">
87 <a href="/skills" class="btn btn-primary btn-lg">Browse skills</a>
88 <a href="/share" class="btn btn-ghost btn-lg">Share a skill</a>
89 </div>
90 <ul class="hero-points">
91 <li>{icon('shield', 18)} Curated: a person reviews every shared skill before it goes live</li>
92 <li>{icon('seed', 18)} Free for everyone. Seeds are status, not currency</li>
93 </ul>
94 </div>
95 <div class="hero-figure">{heroScene()}</div>
96 </div>
97 </section>
98
99 <section class="band band-mint">
100 {hillEdge('#E4EFD3')}
101 <div class="wrap">
102 <h2 class="section-title">How it grows</h2>
103 <ol class="steps">
104 <li>
105 {spot('plant')}
106 <h3>Plant</h3>
107 <p>Share your public repo. Skillfarm finds every skill in it and scans them, then a person reviews the repo.</p>
108 </li>
109 <li>
110 {spot('tend')}
111 <h3>Tend</h3>
112 <p>Once it is live, others install it, like it, review it and replant it with credit back to you.</p>
113 </li>
114 <li>
115 {spot('harvest')}
116 <h3>Harvest</h3>
117 <p>Each of those earns Seeds. Seeds raise your tier, and higher tiers put your portfolio in front of more people.</p>
118 </li>
119 </ol>
120 </div>
121 </section>
122
123 {fresh.length ? (
124 <section class="wrap section">
125 <div class="section-head">
126 <h2 class="section-title">Fresh Harvest</h2>
127 <p>Hand-picked this week from Harvester-tier growers and up.</p>
128 </div>
129 <div class="grid grid-3">{fresh.map((s) => <SkillCard skill={s} viewerId={user?.id} />)}</div>
130 </section>
131 ) : null}
132
133 {showGrowerRow ? (
134 <section class="wrap section">
135 <div class="section-head">
136 <h2 class="section-title">{hasSkills ? 'Trending this week' : 'The first rows are being planted'}</h2>
137 {hasSkills ? <a href="/skills?sort=trending">See all trending</a> : null}
138 </div>
139 {hasSkills ? (
140 <div class="grid grid-3">{trending.map((s) => <SkillCard skill={s} viewerId={user?.id} />)}</div>
141 ) : (
142 <Empty title="No skills are live yet" art="plant">
143 <p>Skillfarm just opened. Share a skill now and yours will be among the first on the farm.</p>
144 <a href="/share" class="btn btn-primary">Share the first skill</a>
145 </Empty>
146 )}
147 </section>
148 ) : null}
149
150 {picks.length ? (
151 <section class="wrap section sprout-picks" aria-labelledby="picks-title">
152 <div class="sprout-intro">
153 <a href="/u/sprout" class="sprout-face" aria-label="Sprout's page">
154 <img src="/img/sprout.png" width="88" height="88" alt="Sprout, a small plant in a pot" loading="lazy" />
155 </a>
156 <div>
157 <h2 class="section-title" id="picks-title">Sprout's picks</h2>
158 <p>
159 Sprout is the farm's agent. It reads what people are building and recommends skills worth planting. Every pick says what kind of maker made it and installs from the maker's own copy.
160 </p>
161 </div>
162 <a class="btn btn-ghost" href="/skills?from=sprout">See all picks</a>
163 </div>
164 <div class="grid grid-3">{picks.map((s) => <SkillCard skill={s} viewerId={user?.id} />)}</div>
165 <ul class="chips chips-link sprout-cats" aria-label="Browse by category">
166 {CATEGORIES.filter((cat) => counts[cat.key]).map((cat) => (
167 <li><a href={`/skills?category=${cat.key}`}>{cat.name} <small>{counts[cat.key]}</small></a></li>
168 ))}
169 </ul>
170 </section>
171 ) : null}
172
173 {!showGrowerRow ? (
174 <section class="wrap section">
175 <Empty title="Plant a skill of your own" art="plant">
176 <p>Built a skill you use every day? Share it. A person reviews every skill before it goes live.</p>
177 <a href="/share" class="btn btn-primary">Share a skill</a>
178 </Empty>
179 </section>
180 ) : null}
181
182 {showNewest ? (
183 <section class="wrap section">
184 <div class="section-head">
185 <h2 class="section-title">Newly planted</h2>
186 <a href="/skills?sort=new">See all new skills</a>
187 </div>
188 <div class="grid grid-3">{newest.map((s) => <SkillCard skill={s} viewerId={user?.id} />)}</div>
189 </section>
190 ) : null}
191
192 {spotlight.results.length ? (
193 <section class="wrap section">
194 <div class="section-head">
195 <h2 class="section-title">Grower spotlight</h2>
196 <a href="/growers">Meet the growers</a>
197 </div>
198 <div class="grid grid-3">{spotlight.results.map((m) => <MemberCard m={m} />)}</div>
199 </section>
200 ) : null}
201
202 <section class="wrap section">
203 <div class="section-head">
204 <h2 class="section-title">Six tiers, from Seedling to Blue Ribbon</h2>
205 <a href="/seeds">How Seeds work</a>
206 </div>
207 <ol class="tier-row">
208 {TIERS.map((t) => (
209 <li class="card">
210 {tierArt(t.key, 56)}
211 <h3>{t.name}</h3>
212 <p class="tier-threshold">{t.threshold.toLocaleString('en-US')} Seeds</p>
213 <p>{t.perk}</p>
214 </li>
215 ))}
216 </ol>
217 </section>
218
219
220 {raw(`<!-- branch-note --><style>.branch-note{box-sizing:border-box;max-width:1180px;margin:48px auto;padding:0 20px;color:inherit;text-align:left}.branch-note .bn-box{border:2px solid currentColor;border-radius:24px;padding:32px 28px;background:color-mix(in srgb,currentColor 6%,transparent)}.branch-note .bn-eye{margin:0 0 6px;font-size:13px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;opacity:.8}.branch-note h2{margin:0 0 12px;font-size:clamp(26px,3.8vw,40px);line-height:1.12}.branch-note p{margin:0 0 10px;max-width:760px;font-size:18px;line-height:1.55}.branch-note p:last-child{margin-bottom:0}.branch-note .bn-lic{opacity:.8;font-size:16px}</style><section class="branch-note" id="branch" aria-labelledby="branch-h"><div class="bn-box"><p class="bn-eye">Organization model</p><h2 id="branch-h">Start your&nbsp;own</h2><p>Anyone can start their own Skillfarm without asking us, and can give it a different name. Our organization model is open: our designs, research and specs are public domain, free for anyone to use, copy and&nbsp;change.</p><a href="/start" style="display:inline-block;margin-top:14px;padding:12px 24px;border-radius:999px;border:2px solid currentColor;color:inherit;font-weight:700;text-decoration:none">See every step</a></div></section><!-- /branch-note -->`)}
221 </>,
222 );
223 });
224
225 app.get('/seeds', (c) =>
226 render(
227 c,
228 { title: 'How Seeds work', description: 'Seeds are Skillfarm status points. Earn them by sharing skills and by other people installing, liking, reviewing and replanting them.', active: 'seeds' },
229 <div class="wrap section prose-page">
230 <h1>How Seeds work</h1>
231 <p class="lede">Seeds are status points. You earn them when you add something useful to the farm. They cannot be spent, transferred or cashed out, and nothing on Skillfarm costs money.</p>
232 <h2>Ways to earn</h2>
233 <table class="table">
234 <thead>
235 <tr><th>Action</th><th class="num">Seeds</th></tr>
236 </thead>
237 <tbody>
238 <tr><td>Share a skill, once it is approved</td><td class="num">+{SEEDS.share}</td></tr>
239 <tr><td>Someone replants your skill</td><td class="num">+{SEEDS.replant}</td></tr>
240 <tr><td>Review someone else's skill</td><td class="num">+{SEEDS.review}</td></tr>
241 <tr><td>Each new person who installs your skill</td><td class="num">+{SEEDS.install}</td></tr>
242 <tr><td>A member likes your skill</td><td class="num">+{SEEDS.like}</td></tr>
243 </tbody>
244 </table>
245 <p>repo stars are shown on every skill that lives in a public repo, but they earn no Seeds and do not affect ranking. They describe the whole repo, not one skill.</p>
246 <h2>Tiers</h2>
247 <ol class="tier-list">
248 {TIERS.map((t) => (
249 <li class="card">
250 {tierArt(t.key, 56)}
251 <div>
252 <h3>{t.name}</h3>
253 <p class="tier-threshold">{t.threshold.toLocaleString('en-US')} Seeds</p>
254 </div>
255 <p>{t.perk}.</p>
256 </li>
257 ))}
258 </ol>
259 <p>Your tier comes from your lifetime Seeds. The <a href="/leaderboard">leaderboard</a> also has a monthly view, so newer growers have a board they can top.</p>
260 <h2>Fair play</h2>
261 <ul>
262 <li>Share Seeds arrive only after a skill passes review, once per skill. New versions earn nothing.</li>
263 <li>Installs count once per person per skill, with a daily cap per skill. Installing or replanting your own skill earns nothing.</li>
264 <li>You can review a skill once, in at least {LIMITS.minReviewLength} characters, after your account is {LIMITS.minAccountAgeDays} days old.</li>
265 <li>Likes earn the owner Seeds only from accounts at least {LIMITS.minAccountAgeDays} days old, up to {LIMITS.likeSeedsPerSkillPerDay} a day per skill. Unliking takes the Seed back.</li>
266 <li>If a skill or review is removed, every Seed it generated is reversed. Your tier can drop.</li>
267 <li>Homepage features are picked by a person from eligible growers. They are never automatic.</li>
268 </ul>
269 </div>,
270 ),
271 );
272
273 app.get('/connect', (c) => c.redirect('/skills', 308));
274
275 app.get('/help', (c) => {
276 const site = c.env.SITE_URL;
277 return render(
278 c,
279 {
280 title: 'Help and setup prompts',
281 description: 'How to install a skill in every major coding agent, how Send to agent works, and ready-made prompts that set up your agent the right way.',
282 active: 'help',
283 },
284 <div class="wrap section prose-page help-page">
285 <h1>Help</h1>
286 <p class="lede">How to get a skill into your agent, and ready-made prompts that set your agent up well. Every prompt here asks before it changes anything.</p>
287 <ul class="help-jump chips chips-link" aria-label="On this page">
288 <li><a href="#install">Install a skill</a></li>
289 <li><a href="#own-repo">Your own skills repo</a></li>
290 <li><a href="#prompts">Ready-made prompts</a></li>
291 <li><a href="#questions">Questions</a></li>
292 </ul>
293
294 <h2 id="install">Install a skill</h2>
295 <p>Every skill page has a <strong>Send to agent</strong> button. Pick your agent once and Skillfarm remembers it in this browser. The button hands your agent a short prompt: read the skill, say what it does, install it, check it. Nothing runs until you send that prompt yourself.</p>
296 <table class="table where-table">
297 <thead>
298 <tr><th>Agent</th><th>What the button does</th><th>Where skills live</th></tr>
299 </thead>
300 <tbody>
301 <tr><td>Terminal agent</td><td data-label="What the button does">Opens the agent in a terminal with the prompt typed in</td><td data-label="Where skills live"><code>~/.claude/skills</code></td></tr>
302 <tr><td>Desktop agent</td><td data-label="What the button does">Opens the agent's desktop app with the prompt typed in. In its command line, paste the copied prompt</td><td data-label="Where skills live"><code>~/.agents/skills</code></td></tr>
303 <tr><td>Command-line agent</td><td data-label="What the button does">Copies the prompt for you to paste</td><td data-label="Where skills live"><code>~/.agents/skills</code> or <code>~/.gemini/skills</code></td></tr>
304 </tbody>
305 </table>
306 <p>You can also copy the install command from the skill page and run it yourself, or download the files. A skill is only a folder with a <code>SKILL.md</code> file in it, so installing one means putting that folder where your agent looks.</p>
307 <p class="fine">The terminal agent link works once you have sent at least one prompt in that agent on this machine. That is when it registers itself to open such links.</p>
308
309 <h2 id="own-repo">Keep your own skills repo</h2>
310 <p>Our one recommendation: keep your skills in a single Git repository of your own, and link it into every agent you use. You get one copy instead of three, a history of every change, and a new machine set up with one clone. Skills you install from Skillfarm go into the same place.</p>
311 <p>Give your agent this prompt and it will set that up with you:</p>
312 <PromptCard prompt={PROMPTS.find((p) => p.slug === 'own-skills-repo')!} bare />
313
314 <h2 id="prompts">Ready-made prompts</h2>
315 <p>Copy one, or send it straight to your agent. Text in [square brackets] is for you to fill in. These are the ones for setting up. The <a href="/prompts">prompt library</a> has all {PROMPTS.length}.</p>
316 {PROMPT_GROUPS.filter((g) => g.key === 'setup' || g.key === 'skills').map((g) => (
317 <section>
318 <h3 id={`prompts-${g.key}`}>{g.name}</h3>
319 <p class="muted">{g.blurb}</p>
320 <div class="prompt-list">
321 {promptsIn(g.key).filter((p) => p.slug !== 'own-skills-repo').map((p) => <PromptCard prompt={p} />)}
322 </div>
323 </section>
324 ))}
325 <p><a class="btn btn-ghost" href="/prompts">See every prompt</a></p>
326
327 <h2 id="questions">Questions</h2>
328 <div class="faq">
329 <details>
330 <summary>What is a skill?</summary>
331 <p>A folder with a <code>SKILL.md</code> file: a name, a description, and instructions your agent loads when a task matches. Some skills add scripts or reference files. The major coding agents all read the same format.</p>
332 </details>
333 <details>
334 <summary>Is it safe to install a skill from here?</summary>
335 <p>A person reviews every skill a member shares before it goes live. Sprout's picks are different: they are recommendations that link to the maker's own repo, and Skillfarm has not reviewed their text. In both cases a skill runs with your agent's permissions, so read it first. The prompt <a href="#review-before-install">Check a skill before you install it</a> does that reading with you.</p>
336 </details>
337 <details>
338 <summary>Does one install work for all my agents?</summary>
339 <p>The desktop and command-line agents both read <code>~/.agents/skills</code>, so one copy there serves both. The terminal agent reads <code>~/.claude/skills</code>. With your own skills repo linked into both folders, one copy serves all three.</p>
340 </details>
341 <details>
342 <summary>Send to agent did nothing. What now?</summary>
343 <p>The button also copies the prompt, so paste it into your agent. For the terminal agent, send any prompt in a terminal session once, then try the button again. For the desktop agent, the link opens its desktop app. The command-line agent has no such link, so its button always copies.</p>
344 </details>
345 <details>
346 <summary>How do I update or remove a skill?</summary>
347 <p>To remove one, delete its folder. To update one you installed with <code>npx skills</code>, run <code>npx skills update</code>. If you keep your own skills repo, pull it. Agents pick up changes in a new session.</p>
348 </details>
349 <details>
350 <summary>Something is wrong with a skill. Who do I tell?</summary>
351 <p>Sign in and use Report on the skill's page.</p>
352 </details>
353 </div>
354 <p class="fine">Page address for your agent: <code>{site}/help</code></p>
355 </div>,
356 );
357 });
358
359 app.get('/prompts', (c) =>
360 render(
361 c,
362 {
363 title: 'Prompts',
364 description: `A library of ${PROMPTS.length} ready-made prompts for every major coding agent: agent setup, working with skills, building and fixing, and good habits. Copy one or send it to your agent.`,
365 active: 'prompts',
366 },
367 <div class="wrap section prompts-page">
368 <h1>Prompts</h1>
369 <p class="lede">Ready-made prompts, kept by Skillfarm. Each one reads the same in every major coding agent, and makes the agent ask before it changes anything. Copy one, or send it straight to your agent.</p>
370 <ul class="chips chips-link help-jump" aria-label="Groups">
371 {PROMPT_GROUPS.map((g) => (
372 <li><a href={`#${g.key}`}>{g.name} <small>{promptsIn(g.key).length}</small></a></li>
373 ))}
374 </ul>
375 {PROMPT_GROUPS.map((g) => (
376 <section class="prompt-group">
377 <h2 class="section-title" id={g.key}>{g.name}</h2>
378 <p class="muted">{g.blurb}</p>
379 <div class="grid grid-2 prompt-grid">
380 {promptsIn(g.key).map((p) => (
381 <article class="card pad prompt-tile">
382 <h3><a href={`/prompts/${p.slug}`}>{p.title}</a></h3>
383 <p>{p.summary}</p>
384 <div class="prompt-actions">
385 <button type="button" class="btn btn-ghost btn-sm" data-copy={p.body}>{icon('copy', 16)}<span>Copy prompt</span></button>
386 <a class="btn btn-ghost btn-sm" href={`/prompts/${p.slug}`}>Read it</a>
387 </div>
388 </article>
389 ))}
390 </div>
391 </section>
392 ))}
393 <p class="fine">A prompt is a starting point. Skills are the lasting version: when you find yourself sending the same prompt often, <a href="/prompts/write-first-skill">turn it into a skill</a>.</p>
394 </div>,
395 ),
396 );
397
398 app.get('/prompts/:slug', (c) => {
399 const prompt = promptBySlug(c.req.param('slug'));
400 if (!prompt) throw new HttpError(404, 'That prompt was not found.');
401 const more = promptsIn(prompt.group).filter((p) => p.slug !== prompt.slug).slice(0, 4);
402 return render(
403 c,
404 { title: prompt.title, description: prompt.summary, active: 'prompts' },
405 <div class="wrap section prose-page help-page prompt-page">
406 <p class="crumbs"><a href="/prompts">Prompts</a> / <a href={`/prompts#${prompt.group}`}>{groupName(prompt.group)}</a></p>
407 <h1>{prompt.title}</h1>
408 <p class="lede">{prompt.summary}</p>
409 {prompt.fill ? <p class="fine">Have ready: {prompt.fill.charAt(0).toLowerCase() + prompt.fill.slice(1)} It goes where the prompt has [square brackets].</p> : null}
410 <article class="card pad prompt-card prompt-full">
411 <pre>{prompt.body}</pre>
412 <div class="prompt-actions">
413 <button type="button" class="btn btn-ghost btn-sm" data-copy={prompt.body}>{icon('copy', 16)}<span>Copy prompt</span></button>
414 <SendToAgent options={sendOptionsFor(prompt.body)} small />
415 </div>
416 </article>
417 <p class="fine">Works in every major coding agent.</p>
418 {more.length ? (
419 <>
420 <h2>More in {groupName(prompt.group)}</h2>
421 <ul>
422 {more.map((p) => <li><a href={`/prompts/${p.slug}`}>{p.title}</a></li>)}
423 </ul>
424 </>
425 ) : null}
426 </div>,
427 );
428 });
429
430 app.get('/guidelines', (c) =>
431 render(
432 c,
433 { title: 'Guidelines and safety', description: 'What belongs on Skillfarm, how the list is curated, with every shared skill reviewed before it goes live, and how to report a problem.' },
434 <div class="wrap section prose-page">
435 <h1>Guidelines and safety</h1>
436 <p class="lede">A skill is a set of instructions an agent will follow on someone's machine. That is a lot of trust, so Skillfarm is a curated list: nothing a member shares goes live until it has been checked.</p>
437 <h2>How review works</h2>
438 <ol>
439 <li><strong>Pattern scan.</strong> Every file is checked for known risky patterns: piping downloads into a shell, reading credential files, hidden characters, encoded payloads and instructions that tell an agent to hide things from its user.</li>
440 <li><strong>AI review.</strong> A language model reads the whole submission, summarizes what it does, lists anything unsafe or dishonest, and recommends approving or denying it.</li>
441 <li><strong>A person decides.</strong> A moderator reads the submission with both reports and approves or denies it. You get an email either way.</li>
442 </ol>
443 <p>Updates to a live skill go through the same review. The approved version stays up until the new one is approved.</p>
444 <h2 id="picks">Sprout's picks are different</h2>
445 <p>
446 <a href="/u/sprout">Sprout</a> is the Skillfarm agent. It recommends skills that other people made and keep in their own repos. A pick is marked "Sprout's pick" and names its maker and the maker's repo. Skillfarm hosts no copy of it and has not reviewed its files, and the maker can change it at any time. Treat a pick as a pointer to something worth reading, and read it at the source before you install it.
447 </p>
448 <p>If you made a skill that Sprout picked and want the pick changed or taken down, use Report on its page. You can also share the skill yourself, and it will be listed under your name.</p>
449 <h2>What belongs here</h2>
450 <ul>
451 <li>Skills in the SKILL.md format, with any text files they need: scripts, references, templates.</li>
452 <li>Work you wrote, or work whose license lets you share it. To build on someone else's skill, use Replant so they get credit.</li>
453 <li>Honest descriptions. A skill should do what it says and nothing else.</li>
454 </ul>
455 <h2>What gets denied or removed</h2>
456 <ul>
457 <li>Anything that leaks secrets, damages files, installs something persistent, or downloads and runs code the reader cannot see.</li>
458 <li>Instructions that turn an agent against the person using it, such as hiding actions or skipping their approval.</li>
459 <li>Spam, ads, empty placeholders, and copies of other people's skills passed off as your own.</li>
460 <li>Attempts to game Seeds with fake accounts, likes or installs.</li>
461 </ul>
462 <p>Removed skills lose the Seeds they earned. Repeated or serious violations lead to strikes and bans.</p>
463 <h2>Before you install any skill</h2>
464 <p>Review lowers risk. It does not remove it. Read a skill before you install it, the same way you would read a script before running it. Every skill page shows every file.</p>
465 <h2 id="reporting">Reporting a problem</h2>
466 <p>Every skill, review and profile has a Report link. Sign in, say what is wrong, and a moderator will look at it.</p>
467 </div>,
468 ),
469 );
470
471 // Step-by-step "Start your own" guide (generated: hosting-research tools/start-gen/external.py --ts skillfarm.ai).
472 app.get('/start/', (c) => c.redirect('/start', 301));
473 app.get('/start', (c) =>
474 render(
475 c,
476 { title: 'Start your own', description: 'Anyone, anywhere in the world, can start their own Skillfarm. Every step, in order.' },
477 <div class="wrap section"><div class="sg" data-start-guide="1">{raw(START_HTML)}</div></div>,
478 ),
479 );
480
481 app.get('/research', (c) =>
482 render(
483 c,
484 { title: 'Research', description: 'How Skillfarm works and how anyone can start their own. Research on agents, skills and safety.' },
485 <>
486 <style>{raw(RESEARCH_CSS)}</style>
487 {raw(RESEARCH_HTML)}
488 </>,
489 ),
490 );
491
492 app.get('/privacy', (c) =>
493 render(
494 c,
495 { title: 'Privacy', description: 'What Skillfarm stores about you and why.' },
496 <div class="wrap section prose-page">
497 <h1>Privacy</h1>
498 <p class="lede">Skillfarm keeps as little about you as it can. This page lists all of it.</p>
499 <h2>What is stored when you sign in</h2>
500 <ul>
501 <li><strong>A BioLock public key for each device you add.</strong> Your device makes a key pair when you add it. The private half never leaves the device. Skillfarm keeps only the public half, plus the device type you added it from (such as Phone or Computer) and when it was added and last used.</li>
502 <li><strong>Nothing about your fingerprint or face.</strong> Your device checks it on its own and only tells Skillfarm that the check passed. Your fingerprint and face never leave the device and Skillfarm never sees them.</li>
503 <li><strong>No email address</strong> for new accounts. Accounts made before BioLock may still hold the email they were made with. It is used only for notices about your skills and account, is never shown or shared, and you can turn notices off in settings.</li>
504 </ul>
505 <p>There are no passwords and no outside sign-in services. Nothing about you is shared with another company when you sign in.</p>
506 <h2>What you add yourself</h2>
507 <p>Your handle, display name, bio, website, avatar, skills, reviews and likes. Profiles and live skills are public.</p>
508 <h2>Sessions and tokens</h2>
509 <p>Signing in sets one cookie that holds a random session token. Only a hash of it is stored. The same is true of access tokens. Signing out, or revoking a token in settings, deletes it.</p>
510 <h2>Installs</h2>
511 <p>To count an install once per person, Skillfarm stores a salted one-way hash of the installer's IP address and browser string. The IP address itself is not stored.</p>
512 <h2>Review</h2>
513 <p>Skills you submit are sent to an outside language model service for an automated safety review before a moderator reads them. Only the skill's files and its listing title are sent.</p>
514 <h2>Analytics</h2>
515 <p>The site uses an analytics service to count page views.</p>
516 <h2>Deleting your account</h2>
517 <p>You can delete your account in settings. That removes your profile, email, sign-in links, sessions and tokens, and takes your skills down.</p>
518 </div>,
519 ),
520 );
521
522 app.get('/leaderboard', async (c) => {
523 const period = c.req.query('period') === 'month' ? 'month' : 'all';
524 let rows: Member[];
525 if (period === 'month') {
526 const d = new Date();
527 const start = Math.floor(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), 1) / 1000);
528 rows = (
529 await c.env.DB.prepare(
530 `SELECT u.id, u.handle, u.display_name, u.avatar_key, u.avatar_fallback, u.seeds_total, u.bio, SUM(p.amount) AS period_seeds
531 FROM point_events p JOIN users u ON u.id = p.user_id WHERE p.created_at >= ? AND u.status = 'active' AND u.is_agent = 0
532 GROUP BY u.id HAVING period_seeds > 0 ORDER BY period_seeds DESC, u.created_at ASC LIMIT 50`,
533 ).bind(start).all<Member>()
534 ).results;
535 } else {
536 rows = (
537 await c.env.DB.prepare(
538 `SELECT id, handle, display_name, avatar_key, avatar_fallback, seeds_total, bio FROM users WHERE status = 'active' AND is_agent = 0 AND seeds_total > 0 ORDER BY seeds_total DESC, created_at ASC LIMIT 50`,
539 ).all<Member>()
540 ).results;
541 }
542 const monthName = new Date().toLocaleDateString('en-US', { month: 'long', timeZone: 'UTC' });
543 return render(
544 c,
545 { title: 'Leaderboard', description: 'The growers with the most Seeds on Skillfarm, all time and this month.', active: 'leaderboard' },
546 <div class="wrap section">
547 <h1>Leaderboard</h1>
548 <p class="lede">Growers ranked by Seeds. Lifetime Seeds set your tier. The monthly board resets on the first.</p>
549 <div class="tabs">
550 <a href="/leaderboard" class={period === 'all' ? 'is-active' : ''}>All time</a>
551 <a href="/leaderboard?period=month" class={period === 'month' ? 'is-active' : ''}>{monthName}</a>
552 </div>
553 {rows.length ? (
554 <ol class="board">
555 {rows.map((m, i) => (
556 <li class={`card board-row${i < 3 ? ' board-top' : ''}`}>
557 <span class="rank">{i + 1}</span>
558 <a href={`/u/${m.handle}`} class="board-who">
559 <Avatar user={m} size={44} />
560 <span>
561 <strong>{m.display_name}</strong>
562 <em>@{m.handle}</em>
563 </span>
564 </a>
565 <TierBadge seeds={m.seeds_total} />
566 <span class="board-seeds">
567 {(period === 'month' ? m.period_seeds ?? 0 : m.seeds_total).toLocaleString('en-US')} <small>Seeds</small>
568 </span>
569 </li>
570 ))}
571 </ol>
572 ) : (
573 <Empty title={period === 'month' ? `Nobody has earned Seeds in ${monthName} yet` : 'The board is empty'} art="harvest">
574 <p>Share a skill and your name goes on it.</p>
575 <a href="/share" class="btn btn-primary">Share a skill</a>
576 </Empty>
577 )}
578 </div>,
579 );
580 });
581
582 app.get('/growers', async (c) => {
583 const farmer = TIERS[2].threshold;
584 const ribbon = TIERS[5].threshold;
585 const rows = (
586 await c.env.DB.prepare(
587 `SELECT u.id, u.handle, u.display_name, u.avatar_key, u.avatar_fallback, u.seeds_total, u.bio,
588 (SELECT COUNT(*) FROM skills s WHERE s.owner_id = u.id AND s.state = 'live') AS skills
589 FROM users u WHERE u.status = 'active' AND u.is_agent = 0 AND u.seeds_total >= ? ORDER BY u.seeds_total DESC LIMIT 120`,
590 ).bind(farmer).all<Member>()
591 ).results;
592 const hall = rows.filter((r) => r.seeds_total >= ribbon);
593 const rest = rows.filter((r) => r.seeds_total < ribbon);
594 return render(
595 c,
596 { title: 'Growers', description: 'The Skillfarm growers directory: members who have reached Farmer tier and above, and the Blue Ribbon hall of fame.', active: 'growers' },
597 <div class="wrap section">
598 <h1>Growers</h1>
599 <p class="lede">Members who have reached Farmer tier ({farmer} Seeds) are listed here. Blue Ribbon growers stay in the hall of fame for good.</p>
600 {hall.length ? (
601 <>
602 <h2 class="section-title">Hall of fame</h2>
603 <div class="grid grid-3">{hall.map((m) => <MemberCard m={m} />)}</div>
604 </>
605 ) : null}
606 {rest.length ? (
607 <>
608 <h2 class="section-title">Directory</h2>
609 <div class="grid grid-3">{rest.map((m) => <MemberCard m={m} />)}</div>
610 </>
611 ) : null}
612 {!rows.length ? (
613 <Empty title="Nobody has reached Farmer tier yet" art="tend">
614 <p>The directory opens at {farmer} Seeds. Sharing a skill earns {SEEDS.share}, and installs, likes and replants add to it.</p>
615 <a href="/seeds" class="btn btn-primary">See how Seeds work</a>
616 </Empty>
617 ) : null}
618 </div>,
619 );
620 });
621
622 app.get('/u/:handle', async (c) => {
623 const viewer = c.get('user');
624 const member = await getUserByHandle(c.env, c.req.param('handle'));
625 if (!member || member.status !== 'active') throw new HttpError(404, 'That grower was not found.');
626 if (member.is_agent) {
627 const picks = await listSkills(c.env, { ownerId: member.id, sort: 'top', limit: 400, viewerId: viewer?.id });
628 refreshStale(c.env, c.executionCtx, picks);
629 const groups = CATEGORIES.map((cat) => ({ cat, items: picks.filter((p) => p.category === cat.key) })).filter((g) => g.items.length);
630 const makers = new Set(picks.map((p) => p.maker)).size;
631 return render(
632 c,
633 { title: 'Sprout, the Skillfarm agent', description: `Sprout is the Skillfarm agent. It recommends ${picks.length} skills from around the web, each with credit and a link to its maker.` },
634 <div class="wrap section">
635 <header class="profile-head card">
636 <Avatar user={member} size={128} />
637 <div class="profile-main">
638 <h1>{member.display_name}</h1>
639 <p class="handle">@{member.handle} <AgentBadge /></p>
640 <p class="bio">{member.bio}</p>
641 <a class="btn btn-ghost btn-sm" href="/skills?from=sprout">Browse and search the picks</a>
642 </div>
643 <aside class="profile-tier tier-panel sprout-panel">
644 <strong>How picks work</strong>
645 <p>A pick is a link, not a copy. You install from the maker's repo and get their updates. Sprout earns no Seeds and is not on the leaderboard.</p>
646 </aside>
647 </header>
648 <ul class="stat-row">
649 <li class="card"><strong>{picks.length}</strong><span>{picks.length === 1 ? 'Pick' : 'Picks'}</span></li>
650 <li class="card"><strong>{makers}</strong><span>{makers === 1 ? 'Maker' : 'Makers'} credited</span></li>
651 <li class="card"><strong>{groups.length}</strong><span>Categories</span></li>
652 </ul>
653 {groups.length ? (
654 groups.map((g) => (
655 <section class="section-tight">
656 <div class="section-head">
657 <h2 class="section-title">{g.cat.name}</h2>
658 <a href={`/skills?category=${g.cat.key}`}>All {g.cat.name.toLowerCase()} skills</a>
659 </div>
660 <div class="grid grid-3">{g.items.map((s) => <SkillCard skill={s} viewerId={viewer?.id} />)}</div>
661 </section>
662 ))
663 ) : (
664 <Empty title="No picks yet" art="plant"><p>Sprout has not recommended anything yet.</p></Empty>
665 )}
666 </div>,
667 );
668 }
669 const own = viewer?.id === member.id;
670 const admin = !!viewer?.is_admin;
671 const [live, mine, stats, events] = await Promise.all([
672 listSkills(c.env, { ownerId: member.id, sort: 'top', limit: 60, viewerId: viewer?.id }),
673 own || admin ? listSkills(c.env, { ownerId: member.id, states: ['pending', 'rejected', 'hidden'], sort: 'updated', limit: 30 }) : Promise.resolve([]),
674 c.env.DB.prepare("SELECT COALESCE(SUM(likes_count),0) AS likes, COALESCE(SUM(installs_count),0) AS installs FROM skills WHERE owner_id = ? AND state = 'live'").bind(member.id).first<{ likes: number; installs: number }>(),
675 own ? c.env.DB.prepare('SELECT kind, amount, created_at FROM point_events WHERE user_id = ? ORDER BY created_at DESC LIMIT 12').bind(member.id).all<{ kind: string; amount: number; created_at: number }>() : Promise.resolve(null),
676 ]);
677 refreshStale(c.env, c.executionCtx, live);
678 const tier = tierFor(member.seeds_total);
679 const site = safeUrl(member.website);
680 return render(
681 c,
682 { title: `${member.display_name} (@${member.handle})`, description: member.bio || `${member.display_name} is a ${tier.name} on Skillfarm with ${plural(live.length, 'skill')}.` },
683 <div class="wrap section">
684 <header class="profile-head card">
685 <Avatar user={member} size={128} />
686 <div class="profile-main">
687 <h1>{member.display_name}</h1>
688 <p class="handle">@{member.handle}</p>
689 {member.bio ? <p class="bio">{member.bio}</p> : own ? <p class="bio muted">Add a short bio in settings so people know what you build.</p> : null}
690 <ul class="profile-links">
691 {site ? (
692 <li>
693 {isOurs(site) ? <a href={site} rel="nofollow noopener ugc">{icon('external', 16)} {new URL(site).hostname}</a> : <span>{icon('external', 16)} {new URL(site).hostname}</span>}
694 </li>
695 ) : null}
696 <li>{icon('clock', 16)} Joined {dateLabel(member.created_at)}</li>
697 </ul>
698 {own ? <a class="btn btn-ghost btn-sm" href="/settings">Edit profile</a> : null}
699 </div>
700 <aside class={`profile-tier tier-panel tier-${tier.key}`}>
701 {tierArt(tier.key, 72)}
702 <strong>{tier.name}</strong>
703 <span class="seed-count">{member.seeds_total.toLocaleString('en-US')} Seeds</span>
704 <TierProgress seeds={member.seeds_total} />
705 </aside>
706 </header>
707
708 <ul class="stat-row">
709 <li class="card"><strong>{live.length}</strong><span>{live.length === 1 ? 'Skill' : 'Skills'}</span></li>
710 <li class="card"><strong>{(stats?.likes ?? 0).toLocaleString('en-US')}</strong><span>Likes received</span></li>
711 <li class="card"><strong>{(stats?.installs ?? 0).toLocaleString('en-US')}</strong><span>Installs</span></li>
712 </ul>
713
714 {mine.length ? (
715 <section class="section-tight">
716 <h2 class="section-title">{own ? 'Your submissions' : 'Not public'}</h2>
717 <div class="grid grid-3">{mine.map((s) => <SkillCard skill={s} viewerId={viewer?.id} showState />)}</div>
718 </section>
719 ) : null}
720
721 <section class="section-tight">
722 <h2 class="section-title">Portfolio</h2>
723 {live.length ? (
724 <div class="grid grid-3">{live.map((s) => <SkillCard skill={s} viewerId={viewer?.id} />)}</div>
725 ) : (
726 <Empty title={own ? 'Your portfolio is empty' : 'No live skills yet'} art="plant">
727 {own ? (
728 <>
729 <p>Share your first skill. It earns {SEEDS.share} Seeds once it is approved.</p>
730 <a href="/share" class="btn btn-primary">Share a skill</a>
731 </>
732 ) : (
733 <p>This grower has not shared a skill yet.</p>
734 )}
735 </Empty>
736 )}
737 </section>
738
739 {own && events ? (
740 <section class="section-tight">
741 <h2 class="section-title">Recent Seeds</h2>
742 {events.results.length ? (
743 <ul class="ledger card">
744 {events.results.map((e) => (
745 <li>
746 <span>{KIND_LABEL[e.kind] ?? e.kind}</span>
747 <time>{timeAgo(e.created_at)}</time>
748 <strong class={e.amount < 0 ? 'neg' : 'pos'}>{e.amount > 0 ? `+${e.amount}` : e.amount}</strong>
749 </li>
750 ))}
751 </ul>
752 ) : (
753 <p class="muted">No Seeds yet. They arrive when your first skill is approved.</p>
754 )}
755 </section>
756 ) : null}
757
758 {viewer && !own ? (
759 <details class="report">
760 <summary>{icon('flag', 15)} Report this profile</summary>
761 <form method="post" action="/report" class="form">
762 <input type="hidden" name="target_type" value="user" />
763 <input type="hidden" name="target_id" value={member.id} />
764 <input type="hidden" name="back" value={`/u/${member.handle}`} />
765 <label>
766 <span>What is wrong?</span>
767 <textarea name="reason" required minlength={10} maxlength={1000} rows={3}></textarea>
768 </label>
769 <button class="btn btn-ghost btn-sm" type="submit">Send report</button>
770 </form>
771 </details>
772 ) : null}
773 </div>,
774 );
775 });
776}