Skillfarm / website · skillfarm.ai / src / routes / pages.tsx
| 1 | import type { Hono } from 'hono'; |
| 2 | import { raw } from 'hono/html'; |
| 3 | import { isOurs } from '../lib/hosts'; |
| 4 | import { RESEARCH_CSS, RESEARCH_HTML } from './research-plan'; |
| 5 | import { START_HTML } from './start-guide'; |
| 6 | import type { AppEnv, User } from '../env'; |
| 7 | import { groupName, promptBySlug, PROMPT_GROUPS, PROMPTS, promptsIn, type ReadyPrompt } from '../content/prompts'; |
| 8 | import { refreshStale } from '../lib/github'; |
| 9 | import { sendOptionsFor } from '../lib/install'; |
| 10 | import { KIND_LABEL } from '../lib/points'; |
| 11 | import { CATEGORIES, categoryCounts, listSkills, sproutPicks } from '../lib/skills'; |
| 12 | import { LIMITS, SEEDS, TIERS, tierFor } from '../lib/tiers'; |
| 13 | import { getUserByHandle } from '../lib/users'; |
| 14 | import { dateLabel, HttpError, plural, safeUrl, timeAgo } from '../lib/util'; |
| 15 | import { heroScene, hillEdge, icon, spot, tierArt } from '../views/art'; |
| 16 | import { AgentBadge, Avatar, Copy, Empty, SendToAgent, SkillCard, TierBadge, TierProgress } from '../views/components'; |
| 17 | import { render } from '../views/layout'; |
| 18 | |
| 19 | type Member = Pick<User, 'id' | 'handle' | 'display_name' | 'avatar_key' | 'avatar_fallback' | 'seeds_total' | 'bio'> & { skills?: number; period_seeds?: number }; |
| 20 | |
| 21 | const 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. */ |
| 36 | const 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 | |
| 48 | export 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 picks = hasSkills ? allPicks.slice(0, 6) : allPicks; |
| 68 | const showGrowerRow = hasSkills || !picks.length; |
| 69 | // With only a handful of skills the two rows would repeat each other. |
| 70 | const showNewest = newest.some((n) => !trending.some((t) => t.id === n.id)); |
| 71 | return render( |
| 72 | c, |
| 73 | { active: 'home' }, |
| 74 | <> |
| 75 | <section class="hero"> |
| 76 | <div class="wrap hero-grid"> |
| 77 | <div class="hero-copy"> |
| 78 | <div class="visitor-welcome" data-visitor-odometer="" data-visitor-site="skillfarm"></div> |
| 79 | <h1> |
| 80 | Where agent skills <em>grow</em>. |
| 81 | </h1> |
| 82 | <p class="lede"> |
| 83 | 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. |
| 84 | </p> |
| 85 | <div class="cta-row"> |
| 86 | <a href="/skills" class="btn btn-primary btn-lg">Browse skills</a> |
| 87 | <a href="/share" class="btn btn-ghost btn-lg">Share a skill</a> |
| 88 | </div> |
| 89 | <ul class="hero-points"> |
| 90 | <li>{icon('shield', 18)} Curated: a person reviews every shared skill before it goes live</li> |
| 91 | <li>{icon('seed', 18)} Free for everyone. Seeds are status, not currency</li> |
| 92 | </ul> |
| 93 | </div> |
| 94 | <div class="hero-figure">{heroScene()}</div> |
| 95 | </div> |
| 96 | </section> |
| 97 | |
| 98 | <section class="band band-mint"> |
| 99 | {hillEdge('#E4EFD3')} |
| 100 | <div class="wrap"> |
| 101 | <h2 class="section-title">How it grows</h2> |
| 102 | <ol class="steps"> |
| 103 | <li> |
| 104 | {spot('plant')} |
| 105 | <h3>Plant</h3> |
| 106 | <p>Share your public repo. Skillfarm finds every skill in it and scans them, then a person reviews the repo.</p> |
| 107 | </li> |
| 108 | <li> |
| 109 | {spot('tend')} |
| 110 | <h3>Tend</h3> |
| 111 | <p>Once it is live, others install it, like it, review it and replant it with credit back to you.</p> |
| 112 | </li> |
| 113 | <li> |
| 114 | {spot('harvest')} |
| 115 | <h3>Harvest</h3> |
| 116 | <p>Each of those earns Seeds. Seeds raise your tier, and higher tiers put your portfolio in front of more people.</p> |
| 117 | </li> |
| 118 | </ol> |
| 119 | </div> |
| 120 | </section> |
| 121 | |
| 122 | {fresh.length ? ( |
| 123 | <section class="wrap section"> |
| 124 | <div class="section-head"> |
| 125 | <h2 class="section-title">Fresh Harvest</h2> |
| 126 | <p>Hand-picked this week from Harvester-tier growers and up.</p> |
| 127 | </div> |
| 128 | <div class="grid grid-3">{fresh.map((s) => <SkillCard skill={s} viewerId={user?.id} />)}</div> |
| 129 | </section> |
| 130 | ) : null} |
| 131 | |
| 132 | {showGrowerRow ? ( |
| 133 | <section class="wrap section"> |
| 134 | <div class="section-head"> |
| 135 | <h2 class="section-title">{hasSkills ? 'Trending this week' : 'The first rows are being planted'}</h2> |
| 136 | {hasSkills ? <a href="/skills?sort=trending">See all trending</a> : null} |
| 137 | </div> |
| 138 | {hasSkills ? ( |
| 139 | <div class="grid grid-3">{trending.map((s) => <SkillCard skill={s} viewerId={user?.id} />)}</div> |
| 140 | ) : ( |
| 141 | <Empty title="No skills are live yet" art="plant"> |
| 142 | <p>Skillfarm just opened. Share a skill now and yours will be among the first on the farm.</p> |
| 143 | <a href="/share" class="btn btn-primary">Share the first skill</a> |
| 144 | </Empty> |
| 145 | )} |
| 146 | </section> |
| 147 | ) : null} |
| 148 | |
| 149 | {picks.length ? ( |
| 150 | <section class="wrap section sprout-picks" aria-labelledby="picks-title"> |
| 151 | <div class="sprout-intro"> |
| 152 | <a href="/u/sprout" class="sprout-face" aria-label="Sprout's page"> |
| 153 | <img src="/img/sprout.png" width="88" height="88" alt="Sprout, a small plant in a pot" loading="lazy" /> |
| 154 | </a> |
| 155 | <div> |
| 156 | <h2 class="section-title" id="picks-title">Sprout's picks</h2> |
| 157 | <p> |
| 158 | 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. |
| 159 | </p> |
| 160 | </div> |
| 161 | <a class="btn btn-ghost" href="/skills?from=sprout">See all picks</a> |
| 162 | </div> |
| 163 | <div class="grid grid-3">{picks.map((s) => <SkillCard skill={s} viewerId={user?.id} />)}</div> |
| 164 | <ul class="chips chips-link sprout-cats" aria-label="Browse by category"> |
| 165 | {CATEGORIES.filter((cat) => counts[cat.key]).map((cat) => ( |
| 166 | <li><a href={`/skills?category=${cat.key}`}>{cat.name} <small>{counts[cat.key]}</small></a></li> |
| 167 | ))} |
| 168 | </ul> |
| 169 | </section> |
| 170 | ) : null} |
| 171 | |
| 172 | {!showGrowerRow ? ( |
| 173 | <section class="wrap section"> |
| 174 | <Empty title="Plant a skill of your own" art="plant"> |
| 175 | <p>Built a skill you use every day? Share it. A person reviews every skill before it goes live.</p> |
| 176 | <a href="/share" class="btn btn-primary">Share a skill</a> |
| 177 | </Empty> |
| 178 | </section> |
| 179 | ) : null} |
| 180 | |
| 181 | {showNewest ? ( |
| 182 | <section class="wrap section"> |
| 183 | <div class="section-head"> |
| 184 | <h2 class="section-title">Newly planted</h2> |
| 185 | <a href="/skills?sort=new">See all new skills</a> |
| 186 | </div> |
| 187 | <div class="grid grid-3">{newest.map((s) => <SkillCard skill={s} viewerId={user?.id} />)}</div> |
| 188 | </section> |
| 189 | ) : null} |
| 190 | |
| 191 | {spotlight.results.length ? ( |
| 192 | <section class="wrap section"> |
| 193 | <div class="section-head"> |
| 194 | <h2 class="section-title">Grower spotlight</h2> |
| 195 | <a href="/growers">Meet the growers</a> |
| 196 | </div> |
| 197 | <div class="grid grid-3">{spotlight.results.map((m) => <MemberCard m={m} />)}</div> |
| 198 | </section> |
| 199 | ) : null} |
| 200 | |
| 201 | <section class="wrap section"> |
| 202 | <div class="section-head"> |
| 203 | <h2 class="section-title">Six tiers, from Seedling to Blue Ribbon</h2> |
| 204 | <a href="/seeds">How Seeds work</a> |
| 205 | </div> |
| 206 | <ol class="tier-row"> |
| 207 | {TIERS.map((t) => ( |
| 208 | <li class="card"> |
| 209 | {tierArt(t.key, 56)} |
| 210 | <h3>{t.name}</h3> |
| 211 | <p class="tier-threshold">{t.threshold.toLocaleString('en-US')} Seeds</p> |
| 212 | <p>{t.perk}</p> |
| 213 | </li> |
| 214 | ))} |
| 215 | </ol> |
| 216 | </section> |
| 217 | |
| 218 | <section class="band band-soil"> |
| 219 | {hillEdge('#3A1F0F')} |
| 220 | <div class="wrap mcp-band"> |
| 221 | <div> |
| 222 | <h2 class="section-title">Bring Skillfarm into your agent</h2> |
| 223 | <p>Skillfarm runs an MCP server. Any agent can search and read skills with no account. Sign in from your MCP client and it can share skills for you too. Submissions still go through review.</p> |
| 224 | <Copy text="https://skillfarm.ai/mcp" label="Copy URL" /> |
| 225 | <a class="btn btn-sun" href="/connect">Set up MCP</a> |
| 226 | </div> |
| 227 | {spot('mcp')} |
| 228 | </div> |
| 229 | </section> |
| 230 | |
| 231 | {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 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 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 -->`)} |
| 232 | </>, |
| 233 | ); |
| 234 | }); |
| 235 | |
| 236 | app.get('/seeds', (c) => |
| 237 | render( |
| 238 | c, |
| 239 | { 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' }, |
| 240 | <div class="wrap section prose-page"> |
| 241 | <h1>How Seeds work</h1> |
| 242 | <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> |
| 243 | <h2>Ways to earn</h2> |
| 244 | <table class="table"> |
| 245 | <thead> |
| 246 | <tr><th>Action</th><th class="num">Seeds</th></tr> |
| 247 | </thead> |
| 248 | <tbody> |
| 249 | <tr><td>Share a skill, once it is approved</td><td class="num">+{SEEDS.share}</td></tr> |
| 250 | <tr><td>Someone replants your skill</td><td class="num">+{SEEDS.replant}</td></tr> |
| 251 | <tr><td>Review someone else's skill</td><td class="num">+{SEEDS.review}</td></tr> |
| 252 | <tr><td>Each new person who installs your skill</td><td class="num">+{SEEDS.install}</td></tr> |
| 253 | <tr><td>A member likes your skill</td><td class="num">+{SEEDS.like}</td></tr> |
| 254 | </tbody> |
| 255 | </table> |
| 256 | <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> |
| 257 | <h2>Tiers</h2> |
| 258 | <ol class="tier-list"> |
| 259 | {TIERS.map((t) => ( |
| 260 | <li class="card"> |
| 261 | {tierArt(t.key, 56)} |
| 262 | <div> |
| 263 | <h3>{t.name}</h3> |
| 264 | <p class="tier-threshold">{t.threshold.toLocaleString('en-US')} Seeds</p> |
| 265 | </div> |
| 266 | <p>{t.perk}.</p> |
| 267 | </li> |
| 268 | ))} |
| 269 | </ol> |
| 270 | <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> |
| 271 | <h2>Fair play</h2> |
| 272 | <ul> |
| 273 | <li>Share Seeds arrive only after a skill passes review, once per skill. New versions earn nothing.</li> |
| 274 | <li>Installs count once per person per skill, with a daily cap per skill. Installing or replanting your own skill earns nothing.</li> |
| 275 | <li>You can review a skill once, in at least {LIMITS.minReviewLength} characters, after your account is {LIMITS.minAccountAgeDays} days old.</li> |
| 276 | <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> |
| 277 | <li>If a skill or review is removed, every Seed it generated is reversed. Your tier can drop.</li> |
| 278 | <li>Homepage features are picked by a person from eligible growers. They are never automatic.</li> |
| 279 | </ul> |
| 280 | </div>, |
| 281 | ), |
| 282 | ); |
| 283 | |
| 284 | app.get('/connect', (c) => { |
| 285 | const site = c.env.SITE_URL; |
| 286 | return render( |
| 287 | c, |
| 288 | { title: 'Connect over MCP', description: 'Skillfarm runs an MCP server. Search and read skills from any agent, and share skills from your own account after you sign in.', active: 'connect' }, |
| 289 | <div class="wrap section prose-page"> |
| 290 | <h1>Connect your agent over MCP</h1> |
| 291 | <p class="lede">Skillfarm runs a Model Context Protocol server, so your agent can find and read skills without leaving your editor. Signed-in agents can also share skills for you.</p> |
| 292 | <div class="grid grid-2 connect-grid"> |
| 293 | <div class="card pad"> |
| 294 | <h2>Browse without an account</h2> |
| 295 | <p>Read-only. Search, read and download any live skill.</p> |
| 296 | <Copy text={`${site}/mcp`} label="Copy URL" /> |
| 297 | <h3>From a terminal agent</h3> |
| 298 | <Copy text={`claude mcp add --transport http skillfarm ${site}/mcp`} /> |
| 299 | </div> |
| 300 | <div class="card pad"> |
| 301 | <h2>Use your account</h2> |
| 302 | <p>Everything above, plus sharing, liking and reviewing as you. Your client opens Skillfarm to sign you in.</p> |
| 303 | <Copy text={`${site}/mcp/account`} label="Copy URL" /> |
| 304 | <h3>From a terminal agent</h3> |
| 305 | <Copy text={`claude mcp add --transport http skillfarm-account ${site}/mcp/account`} /> |
| 306 | </div> |
| 307 | </div> |
| 308 | <h2>What your agent can do</h2> |
| 309 | <table class="table"> |
| 310 | <thead> |
| 311 | <tr><th>Tool</th><th>What it does</th><th>Needs sign-in</th></tr> |
| 312 | </thead> |
| 313 | <tbody> |
| 314 | <tr><td><code>search_skills</code></td><td>Search live skills by words, category, agent, member, maker, repo or licence, including Sprout's picks</td><td>No</td></tr> |
| 315 | <tr><td><code>list_categories</code></td><td>The categories and agents, with how many skills each category holds</td><td>No</td></tr> |
| 316 | <tr><td><code>get_prompt</code></td><td>The ready-made prompt library: the list, or the full text of one prompt</td><td>No</td></tr> |
| 317 | <tr><td><code>get_skill</code></td><td>Read a skill's details and its SKILL.md</td><td>No</td></tr> |
| 318 | <tr><td><code>install_skill</code></td><td>The steps to install a skill for your agent. A skill that lives in a public repo installs straight from its public repo</td><td>No</td></tr> |
| 319 | <tr><td><code>download_skill</code></td><td>Fetch every file of a skill that Skillfarm holds, exactly as reviewed</td><td>No</td></tr> |
| 320 | <tr><td><code>get_profile</code></td><td>Look up a grower and their portfolio</td><td>No</td></tr> |
| 321 | <tr><td><code>leaderboard</code></td><td>Top growers, all time or this month</td><td>No</td></tr> |
| 322 | <tr><td><code>whoami</code></td><td>Your account, Seeds and tier</td><td>Yes</td></tr> |
| 323 | <tr><td><code>my_skills</code></td><td>Your skills and where each one is in review</td><td>Yes</td></tr> |
| 324 | <tr><td><code>share_skill</code></td><td>Submit a new skill or a new version for review</td><td>Yes, write</td></tr> |
| 325 | <tr><td><code>like_skill</code>, <code>unlike_skill</code></td><td>Like or unlike a skill</td><td>Yes, write</td></tr> |
| 326 | <tr><td><code>review_skill</code></td><td>Leave a review</td><td>Yes, write</td></tr> |
| 327 | </tbody> |
| 328 | </table> |
| 329 | <h2>How permissions work</h2> |
| 330 | <ul> |
| 331 | <li>An agent can only ever act as the account that signed in. There is no way to write as someone else.</li> |
| 332 | <li>Access is scoped. <code>skills:read</code> covers your own account details. <code>skills:write</code> covers sharing, liking and reviewing. You choose what to grant on the consent screen.</li> |
| 333 | <li>Nothing an agent submits goes public on its own. Every submission is scanned and then approved or denied by a person, the same as on the website.</li> |
| 334 | <li>The same limits apply as on the site: weekly share limits by tier, and hourly limits on likes.</li> |
| 335 | <li>You can see and revoke every connected app and token in your <a href="/settings#access">settings</a>.</li> |
| 336 | </ul> |
| 337 | <h2>Tokens for scripts</h2> |
| 338 | <p>For CI or a client without OAuth support, create a personal access token in <a href="/settings#access">settings</a> and send it as a bearer token:</p> |
| 339 | <Copy text={`Authorization: Bearer sf_pat_…`} /> |
| 340 | </div>, |
| 341 | ); |
| 342 | }); |
| 343 | |
| 344 | app.get('/help', (c) => { |
| 345 | const site = c.env.SITE_URL; |
| 346 | return render( |
| 347 | c, |
| 348 | { |
| 349 | title: 'Help and setup prompts', |
| 350 | 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.', |
| 351 | active: 'help', |
| 352 | }, |
| 353 | <div class="wrap section prose-page help-page"> |
| 354 | <h1>Help</h1> |
| 355 | <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> |
| 356 | <ul class="help-jump chips chips-link" aria-label="On this page"> |
| 357 | <li><a href="#install">Install a skill</a></li> |
| 358 | <li><a href="#own-repo">Your own skills repo</a></li> |
| 359 | <li><a href="#prompts">Ready-made prompts</a></li> |
| 360 | <li><a href="#questions">Questions</a></li> |
| 361 | </ul> |
| 362 | |
| 363 | <h2 id="install">Install a skill</h2> |
| 364 | <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> |
| 365 | <table class="table where-table"> |
| 366 | <thead> |
| 367 | <tr><th>Agent</th><th>What the button does</th><th>Where skills live</th></tr> |
| 368 | </thead> |
| 369 | <tbody> |
| 370 | <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> |
| 371 | <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> |
| 372 | <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> |
| 373 | </tbody> |
| 374 | </table> |
| 375 | <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> |
| 376 | <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> |
| 377 | |
| 378 | <h2 id="own-repo">Keep your own skills repo</h2> |
| 379 | <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> |
| 380 | <p>Give your agent this prompt and it will set that up with you:</p> |
| 381 | <PromptCard prompt={PROMPTS.find((p) => p.slug === 'own-skills-repo')!} bare /> |
| 382 | |
| 383 | <h2 id="prompts">Ready-made prompts</h2> |
| 384 | <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> |
| 385 | {PROMPT_GROUPS.filter((g) => g.key === 'setup' || g.key === 'skills').map((g) => ( |
| 386 | <section> |
| 387 | <h3 id={`prompts-${g.key}`}>{g.name}</h3> |
| 388 | <p class="muted">{g.blurb}</p> |
| 389 | <div class="prompt-list"> |
| 390 | {promptsIn(g.key).filter((p) => p.slug !== 'own-skills-repo').map((p) => <PromptCard prompt={p} />)} |
| 391 | </div> |
| 392 | </section> |
| 393 | ))} |
| 394 | <p><a class="btn btn-ghost" href="/prompts">See every prompt</a></p> |
| 395 | |
| 396 | <h2 id="questions">Questions</h2> |
| 397 | <div class="faq"> |
| 398 | <details> |
| 399 | <summary>What is a skill?</summary> |
| 400 | <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> |
| 401 | </details> |
| 402 | <details> |
| 403 | <summary>Is it safe to install a skill from here?</summary> |
| 404 | <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> |
| 405 | </details> |
| 406 | <details> |
| 407 | <summary>Does one install work for all my agents?</summary> |
| 408 | <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> |
| 409 | </details> |
| 410 | <details> |
| 411 | <summary>Send to agent did nothing. What now?</summary> |
| 412 | <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> |
| 413 | </details> |
| 414 | <details> |
| 415 | <summary>How do I update or remove a skill?</summary> |
| 416 | <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> |
| 417 | </details> |
| 418 | <details> |
| 419 | <summary>Can my agent search Skillfarm itself?</summary> |
| 420 | <p>Yes. <a href="/connect">Connect it over MCP</a> and it can search by words, category, maker or licence, and fetch the install steps for any skill.</p> |
| 421 | </details> |
| 422 | <details> |
| 423 | <summary>Something is wrong with a skill. Who do I tell?</summary> |
| 424 | <p>Sign in and use Report on the skill's page.</p> |
| 425 | </details> |
| 426 | </div> |
| 427 | <p class="fine">Page address for your agent: <code>{site}/help</code></p> |
| 428 | </div>, |
| 429 | ); |
| 430 | }); |
| 431 | |
| 432 | app.get('/prompts', (c) => |
| 433 | render( |
| 434 | c, |
| 435 | { |
| 436 | title: 'Prompts', |
| 437 | 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.`, |
| 438 | active: 'prompts', |
| 439 | }, |
| 440 | <div class="wrap section prompts-page"> |
| 441 | <h1>Prompts</h1> |
| 442 | <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> |
| 443 | <ul class="chips chips-link help-jump" aria-label="Groups"> |
| 444 | {PROMPT_GROUPS.map((g) => ( |
| 445 | <li><a href={`#${g.key}`}>{g.name} <small>{promptsIn(g.key).length}</small></a></li> |
| 446 | ))} |
| 447 | </ul> |
| 448 | {PROMPT_GROUPS.map((g) => ( |
| 449 | <section class="prompt-group"> |
| 450 | <h2 class="section-title" id={g.key}>{g.name}</h2> |
| 451 | <p class="muted">{g.blurb}</p> |
| 452 | <div class="grid grid-2 prompt-grid"> |
| 453 | {promptsIn(g.key).map((p) => ( |
| 454 | <article class="card pad prompt-tile"> |
| 455 | <h3><a href={`/prompts/${p.slug}`}>{p.title}</a></h3> |
| 456 | <p>{p.summary}</p> |
| 457 | <div class="prompt-actions"> |
| 458 | <button type="button" class="btn btn-ghost btn-sm" data-copy={p.body}>{icon('copy', 16)}<span>Copy prompt</span></button> |
| 459 | <a class="btn btn-ghost btn-sm" href={`/prompts/${p.slug}`}>Read it</a> |
| 460 | </div> |
| 461 | </article> |
| 462 | ))} |
| 463 | </div> |
| 464 | </section> |
| 465 | ))} |
| 466 | <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> |
| 467 | </div>, |
| 468 | ), |
| 469 | ); |
| 470 | |
| 471 | app.get('/prompts/:slug', (c) => { |
| 472 | const prompt = promptBySlug(c.req.param('slug')); |
| 473 | if (!prompt) throw new HttpError(404, 'That prompt was not found.'); |
| 474 | const more = promptsIn(prompt.group).filter((p) => p.slug !== prompt.slug).slice(0, 4); |
| 475 | return render( |
| 476 | c, |
| 477 | { title: prompt.title, description: prompt.summary, active: 'prompts' }, |
| 478 | <div class="wrap section prose-page help-page prompt-page"> |
| 479 | <p class="crumbs"><a href="/prompts">Prompts</a> / <a href={`/prompts#${prompt.group}`}>{groupName(prompt.group)}</a></p> |
| 480 | <h1>{prompt.title}</h1> |
| 481 | <p class="lede">{prompt.summary}</p> |
| 482 | {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} |
| 483 | <article class="card pad prompt-card prompt-full"> |
| 484 | <pre>{prompt.body}</pre> |
| 485 | <div class="prompt-actions"> |
| 486 | <button type="button" class="btn btn-ghost btn-sm" data-copy={prompt.body}>{icon('copy', 16)}<span>Copy prompt</span></button> |
| 487 | <SendToAgent options={sendOptionsFor(prompt.body)} small /> |
| 488 | </div> |
| 489 | </article> |
| 490 | <p class="fine">Works in every major coding agent. Your agent can also fetch it over <a href="/connect">MCP</a> as <code>{prompt.slug}</code>.</p> |
| 491 | {more.length ? ( |
| 492 | <> |
| 493 | <h2>More in {groupName(prompt.group)}</h2> |
| 494 | <ul> |
| 495 | {more.map((p) => <li><a href={`/prompts/${p.slug}`}>{p.title}</a></li>)} |
| 496 | </ul> |
| 497 | </> |
| 498 | ) : null} |
| 499 | </div>, |
| 500 | ); |
| 501 | }); |
| 502 | |
| 503 | app.get('/guidelines', (c) => |
| 504 | render( |
| 505 | c, |
| 506 | { 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.' }, |
| 507 | <div class="wrap section prose-page"> |
| 508 | <h1>Guidelines and safety</h1> |
| 509 | <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> |
| 510 | <h2>How review works</h2> |
| 511 | <ol> |
| 512 | <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> |
| 513 | <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> |
| 514 | <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> |
| 515 | </ol> |
| 516 | <p>Updates to a live skill go through the same review. The approved version stays up until the new one is approved.</p> |
| 517 | <h2 id="picks">Sprout's picks are different</h2> |
| 518 | <p> |
| 519 | <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. |
| 520 | </p> |
| 521 | <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> |
| 522 | <h2>What belongs here</h2> |
| 523 | <ul> |
| 524 | <li>Skills in the SKILL.md format, with any text files they need: scripts, references, templates.</li> |
| 525 | <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> |
| 526 | <li>Honest descriptions. A skill should do what it says and nothing else.</li> |
| 527 | </ul> |
| 528 | <h2>What gets denied or removed</h2> |
| 529 | <ul> |
| 530 | <li>Anything that leaks secrets, damages files, installs something persistent, or downloads and runs code the reader cannot see.</li> |
| 531 | <li>Instructions that turn an agent against the person using it, such as hiding actions or skipping their approval.</li> |
| 532 | <li>Spam, ads, empty placeholders, and copies of other people's skills passed off as your own.</li> |
| 533 | <li>Attempts to game Seeds with fake accounts, likes or installs.</li> |
| 534 | </ul> |
| 535 | <p>Removed skills lose the Seeds they earned. Repeated or serious violations lead to strikes and bans.</p> |
| 536 | <h2>Before you install any skill</h2> |
| 537 | <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> |
| 538 | <h2 id="reporting">Reporting a problem</h2> |
| 539 | <p>Every skill, review and profile has a Report link. Sign in, say what is wrong, and a moderator will look at it.</p> |
| 540 | </div>, |
| 541 | ), |
| 542 | ); |
| 543 | |
| 544 | // Step-by-step "Start your own" guide (generated: hosting-research tools/start-gen/external.py --ts skillfarm.ai). |
| 545 | app.get('/start/', (c) => c.redirect('/start', 301)); |
| 546 | app.get('/start', (c) => |
| 547 | render( |
| 548 | c, |
| 549 | { title: 'Start your own', description: 'Anyone, anywhere in the world, can start their own Skillfarm. Every step, in order.' }, |
| 550 | <div class="wrap section"><div class="sg" data-start-guide="1">{raw(START_HTML)}</div></div>, |
| 551 | ), |
| 552 | ); |
| 553 | |
| 554 | app.get('/research', (c) => |
| 555 | render( |
| 556 | c, |
| 557 | { title: 'Research', description: 'How Skillfarm works and how anyone can start their own. Research on agents, skills and safety.' }, |
| 558 | <> |
| 559 | <style>{raw(RESEARCH_CSS)}</style> |
| 560 | {raw(RESEARCH_HTML)} |
| 561 | </>, |
| 562 | ), |
| 563 | ); |
| 564 | |
| 565 | app.get('/privacy', (c) => |
| 566 | render( |
| 567 | c, |
| 568 | { title: 'Privacy', description: 'What Skillfarm stores about you and why.' }, |
| 569 | <div class="wrap section prose-page"> |
| 570 | <h1>Privacy</h1> |
| 571 | <p class="lede">Skillfarm keeps as little about you as it can. This page lists all of it.</p> |
| 572 | <h2>What is stored when you sign in</h2> |
| 573 | <ul> |
| 574 | <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> |
| 575 | <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> |
| 576 | <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> |
| 577 | </ul> |
| 578 | <p>There are no passwords and no outside sign-in services. Nothing about you is shared with another company when you sign in.</p> |
| 579 | <h2>What you add yourself</h2> |
| 580 | <p>Your handle, display name, bio, website, avatar, skills, reviews and likes. Profiles and live skills are public.</p> |
| 581 | <h2>Sessions and tokens</h2> |
| 582 | <p>Signing in sets one cookie that holds a random session token. Only a hash of it is stored. The same is true of personal access tokens and MCP tokens. Signing out, or revoking a token in settings, deletes it.</p> |
| 583 | <h2>Installs</h2> |
| 584 | <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> |
| 585 | <h2>Review</h2> |
| 586 | <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> |
| 587 | <h2>Analytics</h2> |
| 588 | <p>The site uses an analytics service to count page views.</p> |
| 589 | <h2>Deleting your account</h2> |
| 590 | <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> |
| 591 | </div>, |
| 592 | ), |
| 593 | ); |
| 594 | |
| 595 | app.get('/leaderboard', async (c) => { |
| 596 | const period = c.req.query('period') === 'month' ? 'month' : 'all'; |
| 597 | let rows: Member[]; |
| 598 | if (period === 'month') { |
| 599 | const d = new Date(); |
| 600 | const start = Math.floor(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), 1) / 1000); |
| 601 | rows = ( |
| 602 | await c.env.DB.prepare( |
| 603 | `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 |
| 604 | 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 |
| 605 | GROUP BY u.id HAVING period_seeds > 0 ORDER BY period_seeds DESC, u.created_at ASC LIMIT 50`, |
| 606 | ).bind(start).all<Member>() |
| 607 | ).results; |
| 608 | } else { |
| 609 | rows = ( |
| 610 | await c.env.DB.prepare( |
| 611 | `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`, |
| 612 | ).all<Member>() |
| 613 | ).results; |
| 614 | } |
| 615 | const monthName = new Date().toLocaleDateString('en-US', { month: 'long', timeZone: 'UTC' }); |
| 616 | return render( |
| 617 | c, |
| 618 | { title: 'Leaderboard', description: 'The growers with the most Seeds on Skillfarm, all time and this month.', active: 'leaderboard' }, |
| 619 | <div class="wrap section"> |
| 620 | <h1>Leaderboard</h1> |
| 621 | <p class="lede">Growers ranked by Seeds. Lifetime Seeds set your tier. The monthly board resets on the first.</p> |
| 622 | <div class="tabs"> |
| 623 | <a href="/leaderboard" class={period === 'all' ? 'is-active' : ''}>All time</a> |
| 624 | <a href="/leaderboard?period=month" class={period === 'month' ? 'is-active' : ''}>{monthName}</a> |
| 625 | </div> |
| 626 | {rows.length ? ( |
| 627 | <ol class="board"> |
| 628 | {rows.map((m, i) => ( |
| 629 | <li class={`card board-row${i < 3 ? ' board-top' : ''}`}> |
| 630 | <span class="rank">{i + 1}</span> |
| 631 | <a href={`/u/${m.handle}`} class="board-who"> |
| 632 | <Avatar user={m} size={44} /> |
| 633 | <span> |
| 634 | <strong>{m.display_name}</strong> |
| 635 | <em>@{m.handle}</em> |
| 636 | </span> |
| 637 | </a> |
| 638 | <TierBadge seeds={m.seeds_total} /> |
| 639 | <span class="board-seeds"> |
| 640 | {(period === 'month' ? m.period_seeds ?? 0 : m.seeds_total).toLocaleString('en-US')} <small>Seeds</small> |
| 641 | </span> |
| 642 | </li> |
| 643 | ))} |
| 644 | </ol> |
| 645 | ) : ( |
| 646 | <Empty title={period === 'month' ? `Nobody has earned Seeds in ${monthName} yet` : 'The board is empty'} art="harvest"> |
| 647 | <p>Share a skill and your name goes on it.</p> |
| 648 | <a href="/share" class="btn btn-primary">Share a skill</a> |
| 649 | </Empty> |
| 650 | )} |
| 651 | </div>, |
| 652 | ); |
| 653 | }); |
| 654 | |
| 655 | app.get('/growers', async (c) => { |
| 656 | const farmer = TIERS[2].threshold; |
| 657 | const ribbon = TIERS[5].threshold; |
| 658 | const rows = ( |
| 659 | await c.env.DB.prepare( |
| 660 | `SELECT u.id, u.handle, u.display_name, u.avatar_key, u.avatar_fallback, u.seeds_total, u.bio, |
| 661 | (SELECT COUNT(*) FROM skills s WHERE s.owner_id = u.id AND s.state = 'live') AS skills |
| 662 | FROM users u WHERE u.status = 'active' AND u.is_agent = 0 AND u.seeds_total >= ? ORDER BY u.seeds_total DESC LIMIT 120`, |
| 663 | ).bind(farmer).all<Member>() |
| 664 | ).results; |
| 665 | const hall = rows.filter((r) => r.seeds_total >= ribbon); |
| 666 | const rest = rows.filter((r) => r.seeds_total < ribbon); |
| 667 | return render( |
| 668 | c, |
| 669 | { title: 'Growers', description: 'The Skillfarm growers directory: members who have reached Farmer tier and above, and the Blue Ribbon hall of fame.', active: 'growers' }, |
| 670 | <div class="wrap section"> |
| 671 | <h1>Growers</h1> |
| 672 | <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> |
| 673 | {hall.length ? ( |
| 674 | <> |
| 675 | <h2 class="section-title">Hall of fame</h2> |
| 676 | <div class="grid grid-3">{hall.map((m) => <MemberCard m={m} />)}</div> |
| 677 | </> |
| 678 | ) : null} |
| 679 | {rest.length ? ( |
| 680 | <> |
| 681 | <h2 class="section-title">Directory</h2> |
| 682 | <div class="grid grid-3">{rest.map((m) => <MemberCard m={m} />)}</div> |
| 683 | </> |
| 684 | ) : null} |
| 685 | {!rows.length ? ( |
| 686 | <Empty title="Nobody has reached Farmer tier yet" art="tend"> |
| 687 | <p>The directory opens at {farmer} Seeds. Sharing a skill earns {SEEDS.share}, and installs, likes and replants add to it.</p> |
| 688 | <a href="/seeds" class="btn btn-primary">See how Seeds work</a> |
| 689 | </Empty> |
| 690 | ) : null} |
| 691 | </div>, |
| 692 | ); |
| 693 | }); |
| 694 | |
| 695 | app.get('/u/:handle', async (c) => { |
| 696 | const viewer = c.get('user'); |
| 697 | const member = await getUserByHandle(c.env, c.req.param('handle')); |
| 698 | if (!member || member.status !== 'active') throw new HttpError(404, 'That grower was not found.'); |
| 699 | if (member.is_agent) { |
| 700 | const picks = await listSkills(c.env, { ownerId: member.id, sort: 'top', limit: 400, viewerId: viewer?.id }); |
| 701 | refreshStale(c.env, c.executionCtx, picks); |
| 702 | const groups = CATEGORIES.map((cat) => ({ cat, items: picks.filter((p) => p.category === cat.key) })).filter((g) => g.items.length); |
| 703 | const makers = new Set(picks.map((p) => p.maker)).size; |
| 704 | return render( |
| 705 | c, |
| 706 | { 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.` }, |
| 707 | <div class="wrap section"> |
| 708 | <header class="profile-head card"> |
| 709 | <Avatar user={member} size={128} /> |
| 710 | <div class="profile-main"> |
| 711 | <h1>{member.display_name}</h1> |
| 712 | <p class="handle">@{member.handle} <AgentBadge /></p> |
| 713 | <p class="bio">{member.bio}</p> |
| 714 | <a class="btn btn-ghost btn-sm" href="/skills?from=sprout">Browse and search the picks</a> |
| 715 | </div> |
| 716 | <aside class="profile-tier tier-panel sprout-panel"> |
| 717 | <strong>How picks work</strong> |
| 718 | <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> |
| 719 | </aside> |
| 720 | </header> |
| 721 | <ul class="stat-row"> |
| 722 | <li class="card"><strong>{picks.length}</strong><span>{picks.length === 1 ? 'Pick' : 'Picks'}</span></li> |
| 723 | <li class="card"><strong>{makers}</strong><span>{makers === 1 ? 'Maker' : 'Makers'} credited</span></li> |
| 724 | <li class="card"><strong>{groups.length}</strong><span>Categories</span></li> |
| 725 | </ul> |
| 726 | {groups.length ? ( |
| 727 | groups.map((g) => ( |
| 728 | <section class="section-tight"> |
| 729 | <div class="section-head"> |
| 730 | <h2 class="section-title">{g.cat.name}</h2> |
| 731 | <a href={`/skills?category=${g.cat.key}`}>All {g.cat.name.toLowerCase()} skills</a> |
| 732 | </div> |
| 733 | <div class="grid grid-3">{g.items.map((s) => <SkillCard skill={s} viewerId={viewer?.id} />)}</div> |
| 734 | </section> |
| 735 | )) |
| 736 | ) : ( |
| 737 | <Empty title="No picks yet" art="plant"><p>Sprout has not recommended anything yet.</p></Empty> |
| 738 | )} |
| 739 | </div>, |
| 740 | ); |
| 741 | } |
| 742 | const own = viewer?.id === member.id; |
| 743 | const admin = !!viewer?.is_admin; |
| 744 | const [live, mine, stats, events] = await Promise.all([ |
| 745 | listSkills(c.env, { ownerId: member.id, sort: 'top', limit: 60, viewerId: viewer?.id }), |
| 746 | own || admin ? listSkills(c.env, { ownerId: member.id, states: ['pending', 'rejected', 'hidden'], sort: 'updated', limit: 30 }) : Promise.resolve([]), |
| 747 | 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 }>(), |
| 748 | 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), |
| 749 | ]); |
| 750 | refreshStale(c.env, c.executionCtx, live); |
| 751 | const tier = tierFor(member.seeds_total); |
| 752 | const site = safeUrl(member.website); |
| 753 | return render( |
| 754 | c, |
| 755 | { title: `${member.display_name} (@${member.handle})`, description: member.bio || `${member.display_name} is a ${tier.name} on Skillfarm with ${plural(live.length, 'skill')}.` }, |
| 756 | <div class="wrap section"> |
| 757 | <header class="profile-head card"> |
| 758 | <Avatar user={member} size={128} /> |
| 759 | <div class="profile-main"> |
| 760 | <h1>{member.display_name}</h1> |
| 761 | <p class="handle">@{member.handle}</p> |
| 762 | {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} |
| 763 | <ul class="profile-links"> |
| 764 | {site ? ( |
| 765 | <li> |
| 766 | {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>} |
| 767 | </li> |
| 768 | ) : null} |
| 769 | <li>{icon('clock', 16)} Joined {dateLabel(member.created_at)}</li> |
| 770 | </ul> |
| 771 | {own ? <a class="btn btn-ghost btn-sm" href="/settings">Edit profile</a> : null} |
| 772 | </div> |
| 773 | <aside class={`profile-tier tier-panel tier-${tier.key}`}> |
| 774 | {tierArt(tier.key, 72)} |
| 775 | <strong>{tier.name}</strong> |
| 776 | <span class="seed-count">{member.seeds_total.toLocaleString('en-US')} Seeds</span> |
| 777 | <TierProgress seeds={member.seeds_total} /> |
| 778 | </aside> |
| 779 | </header> |
| 780 | |
| 781 | <ul class="stat-row"> |
| 782 | <li class="card"><strong>{live.length}</strong><span>{live.length === 1 ? 'Skill' : 'Skills'}</span></li> |
| 783 | <li class="card"><strong>{(stats?.likes ?? 0).toLocaleString('en-US')}</strong><span>Likes received</span></li> |
| 784 | <li class="card"><strong>{(stats?.installs ?? 0).toLocaleString('en-US')}</strong><span>Installs</span></li> |
| 785 | </ul> |
| 786 | |
| 787 | {mine.length ? ( |
| 788 | <section class="section-tight"> |
| 789 | <h2 class="section-title">{own ? 'Your submissions' : 'Not public'}</h2> |
| 790 | <div class="grid grid-3">{mine.map((s) => <SkillCard skill={s} viewerId={viewer?.id} showState />)}</div> |
| 791 | </section> |
| 792 | ) : null} |
| 793 | |
| 794 | <section class="section-tight"> |
| 795 | <h2 class="section-title">Portfolio</h2> |
| 796 | {live.length ? ( |
| 797 | <div class="grid grid-3">{live.map((s) => <SkillCard skill={s} viewerId={viewer?.id} />)}</div> |
| 798 | ) : ( |
| 799 | <Empty title={own ? 'Your portfolio is empty' : 'No live skills yet'} art="plant"> |
| 800 | {own ? ( |
| 801 | <> |
| 802 | <p>Share your first skill. It earns {SEEDS.share} Seeds once it is approved.</p> |
| 803 | <a href="/share" class="btn btn-primary">Share a skill</a> |
| 804 | </> |
| 805 | ) : ( |
| 806 | <p>This grower has not shared a skill yet.</p> |
| 807 | )} |
| 808 | </Empty> |
| 809 | )} |
| 810 | </section> |
| 811 | |
| 812 | {own && events ? ( |
| 813 | <section class="section-tight"> |
| 814 | <h2 class="section-title">Recent Seeds</h2> |
| 815 | {events.results.length ? ( |
| 816 | <ul class="ledger card"> |
| 817 | {events.results.map((e) => ( |
| 818 | <li> |
| 819 | <span>{KIND_LABEL[e.kind] ?? e.kind}</span> |
| 820 | <time>{timeAgo(e.created_at)}</time> |
| 821 | <strong class={e.amount < 0 ? 'neg' : 'pos'}>{e.amount > 0 ? `+${e.amount}` : e.amount}</strong> |
| 822 | </li> |
| 823 | ))} |
| 824 | </ul> |
| 825 | ) : ( |
| 826 | <p class="muted">No Seeds yet. They arrive when your first skill is approved.</p> |
| 827 | )} |
| 828 | </section> |
| 829 | ) : null} |
| 830 | |
| 831 | {viewer && !own ? ( |
| 832 | <details class="report"> |
| 833 | <summary>{icon('flag', 15)} Report this profile</summary> |
| 834 | <form method="post" action="/report" class="form"> |
| 835 | <input type="hidden" name="target_type" value="user" /> |
| 836 | <input type="hidden" name="target_id" value={member.id} /> |
| 837 | <input type="hidden" name="back" value={`/u/${member.handle}`} /> |
| 838 | <label> |
| 839 | <span>What is wrong?</span> |
| 840 | <textarea name="reason" required minlength={10} maxlength={1000} rows={3}></textarea> |
| 841 | </label> |
| 842 | <button class="btn btn-ghost btn-sm" type="submit">Send report</button> |
| 843 | </form> |
| 844 | </details> |
| 845 | ) : null} |
| 846 | </div>, |
| 847 | ); |
| 848 | }); |
| 849 | } |