Skip to content

Commit 34b9cfc

Browse files
committed
fix: optimize SKILL.md
1 parent cd3990c commit 34b9cfc

1 file changed

Lines changed: 10 additions & 19 deletions

File tree

src/agent/prompts/skill.ts

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,16 @@ function formatShortDate(isoDate: string): string {
6868
return `${months[date.getUTCMonth()]} ${date.getUTCFullYear()}`
6969
}
7070

71-
function generatePackageHeader({ name, description, version, releasedAt, distTags, repoUrl, hasIssues, hasDiscussions, hasReleases, docsType, pkgFiles, packages, eject }: SkillOptions): string {
72-
let title = `# ${name}`
71+
function generatePackageHeader({ name, version, distTags, repoUrl, hasIssues, hasDiscussions, hasReleases, docsType, pkgFiles, packages, eject }: SkillOptions): string {
72+
const versionSuffix = version ? `@${version}` : ''
73+
let title = `# ${name}${versionSuffix}`
7374
if (repoUrl) {
7475
const url = repoUrl.startsWith('http') ? repoUrl : `https://github.com/${repoUrl}`
7576
const repoName = repoUrl.startsWith('http') ? repoUrl.split('/').slice(-2).join('/') : repoUrl
76-
title = `# [${repoName}](${url}) \`${name}\``
77+
title = `# [${repoName}](${url}) \`${name}${versionSuffix}\``
7778
}
7879
const lines: string[] = [title]
7980

80-
if (description)
81-
lines.push('', `> ${description}`)
82-
83-
// Version with release date (absolute to avoid stale relative times in published skills)
84-
if (version) {
85-
const dateStr = releasedAt ? formatShortDate(releasedAt) : ''
86-
const versionStr = dateStr ? `${version} (${dateStr})` : version
87-
lines.push('', `**Version:** ${versionStr}`)
88-
}
89-
9081
if (distTags && Object.keys(distTags).length > 0) {
9182
const tags = Object.entries(distTags)
9283
.sort(([, a], [, b]) => (b.releasedAt ?? '').localeCompare(a.releasedAt ?? ''))
@@ -104,24 +95,24 @@ function generatePackageHeader({ name, description, version, releasedAt, distTag
10495
const refBase = eject ? './references' : './.skilld'
10596
const refs: string[] = []
10697
if (!eject) {
107-
refs.push(`[package.json](${refBase}/pkg/package.json) — exports, entry points`)
98+
refs.push(`[package.json](${refBase}/pkg/package.json)`)
10899
if (packages && packages.length > 1) {
109100
for (const pkg of packages) {
110101
const shortName = pkg.name.split('/').pop()!.toLowerCase()
111102
refs.push(`[pkg-${shortName}](${refBase}/pkg-${shortName}/package.json)`)
112103
}
113104
}
114105
if (pkgFiles?.includes('README.md'))
115-
refs.push(`[README](${refBase}/pkg/README.md) — setup, basic usage`)
106+
refs.push(`[README](${refBase}/pkg/README.md)`)
116107
}
117108
if (docsType && docsType !== 'readme')
118-
refs.push(`[Docs](${refBase}/docs/_INDEX.md) — API reference, guides`)
109+
refs.push(`[Docs](${refBase}/docs/_INDEX.md)`)
119110
if (hasIssues)
120-
refs.push(`[GitHub Issues](${refBase}/issues/_INDEX.md) — bugs, workarounds, edge cases`)
111+
refs.push(`[Issues](${refBase}/issues/_INDEX.md)`)
121112
if (hasDiscussions)
122-
refs.push(`[GitHub Discussions](${refBase}/discussions/_INDEX.md) — Q&A, patterns, recipes`)
113+
refs.push(`[Discussions](${refBase}/discussions/_INDEX.md)`)
123114
if (hasReleases)
124-
refs.push(`[Releases](${refBase}/releases/_INDEX.md) — changelog, breaking changes, new APIs`)
115+
refs.push(`[Releases](${refBase}/releases/_INDEX.md)`)
125116

126117
if (refs.length > 0)
127118
lines.push(`**References:** ${refs.join(' • ')}`)

0 commit comments

Comments
 (0)