@bacnh85/agent-skills 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +229 -0
- package/dist/src/cli.d.ts +12 -0
- package/dist/src/cli.js +224 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/config.d.ts +9 -0
- package/dist/src/config.js +14 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/discovery.d.ts +16 -0
- package/dist/src/discovery.js +161 -0
- package/dist/src/discovery.js.map +1 -0
- package/dist/src/installer.d.ts +9 -0
- package/dist/src/installer.js +131 -0
- package/dist/src/installer.js.map +1 -0
- package/dist/src/manager.d.ts +8 -0
- package/dist/src/manager.js +229 -0
- package/dist/src/manager.js.map +1 -0
- package/dist/src/registry.d.ts +5 -0
- package/dist/src/registry.js +46 -0
- package/dist/src/registry.js.map +1 -0
- package/dist/src/skill.d.ts +2 -0
- package/dist/src/skill.js +50 -0
- package/dist/src/skill.js.map +1 -0
- package/dist/src/types.d.ts +39 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/ui.d.ts +14 -0
- package/dist/src/ui.js +70 -0
- package/dist/src/ui.js.map +1 -0
- package/dist/test/cli.test.d.ts +1 -0
- package/dist/test/cli.test.js +168 -0
- package/dist/test/cli.test.js.map +1 -0
- package/dist/test/config.test.d.ts +1 -0
- package/dist/test/config.test.js +12 -0
- package/dist/test/config.test.js.map +1 -0
- package/dist/test/discovery.test.d.ts +1 -0
- package/dist/test/discovery.test.js +42 -0
- package/dist/test/discovery.test.js.map +1 -0
- package/dist/test/installer.test.d.ts +1 -0
- package/dist/test/installer.test.js +159 -0
- package/dist/test/installer.test.js.map +1 -0
- package/dist/test/manager.test.d.ts +1 -0
- package/dist/test/manager.test.js +150 -0
- package/dist/test/manager.test.js.map +1 -0
- package/dist/test/skill.test.d.ts +1 -0
- package/dist/test/skill.test.js +27 -0
- package/dist/test/skill.test.js.map +1 -0
- package/dist/test/ui.test.d.ts +1 -0
- package/dist/test/ui.test.js +28 -0
- package/dist/test/ui.test.js.map +1 -0
- package/package.json +54 -0
- package/skills/frontend-design/LICENSE.txt +177 -0
- package/skills/frontend-design/SKILL.md +55 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
import { execFileSync } from "node:child_process";
|
|
7
|
+
import { discoverSkills, resolveSource } from "../src/discovery.js";
|
|
8
|
+
import { addSkills, removeSkills, updateSkills } from "../src/manager.js";
|
|
9
|
+
import { readRegistry } from "../src/registry.js";
|
|
10
|
+
function createSkill(root, name, body = "initial") {
|
|
11
|
+
const path = join(root, "skills", name);
|
|
12
|
+
mkdirSync(path, { recursive: true });
|
|
13
|
+
writeFileSync(join(path, "SKILL.md"), `---\nname: ${name}\ndescription: ${name} skill.\n---\n\n${body}\n`);
|
|
14
|
+
return path;
|
|
15
|
+
}
|
|
16
|
+
test("add preserves paths, no-ops unchanged sources, rejects conflicts, and records history", () => {
|
|
17
|
+
const root = mkdtempSync(join(tmpdir(), "agent-skills-add-"));
|
|
18
|
+
try {
|
|
19
|
+
const sourceRoot = join(root, "source");
|
|
20
|
+
createSkill(sourceRoot, "demo");
|
|
21
|
+
const repo = join(root, "target");
|
|
22
|
+
const source = resolveSource(sourceRoot);
|
|
23
|
+
const selected = discoverSkills(source);
|
|
24
|
+
assert.equal(addSkills({ repo, source, selected })[0].action, "added");
|
|
25
|
+
assert.ok(existsSync(join(repo, "skills", "demo", "SKILL.md")));
|
|
26
|
+
assert.equal(addSkills({ repo, source, selected })[0].action, "unchanged");
|
|
27
|
+
const otherRoot = join(root, "other");
|
|
28
|
+
createSkill(otherRoot, "demo");
|
|
29
|
+
const other = resolveSource(otherRoot);
|
|
30
|
+
assert.throws(() => addSkills({ repo, source: other, selected: discoverSkills(other) }), /already registered/);
|
|
31
|
+
assert.equal(readFileSync(join(repo, "skill-history.jsonl"), "utf8").trim().split("\n").length, 1);
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
rmSync(root, { recursive: true, force: true });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
test("remove deletes named skills and writes a remove event", () => {
|
|
38
|
+
const root = mkdtempSync(join(tmpdir(), "agent-skills-remove-"));
|
|
39
|
+
try {
|
|
40
|
+
const sourceRoot = join(root, "source");
|
|
41
|
+
createSkill(sourceRoot, "demo");
|
|
42
|
+
const repo = join(root, "target");
|
|
43
|
+
const source = resolveSource(sourceRoot);
|
|
44
|
+
addSkills({ repo, source, selected: discoverSkills(source) });
|
|
45
|
+
assert.equal(removeSkills(repo, ["demo"])[0].action, "removed");
|
|
46
|
+
assert.equal(existsSync(join(repo, "skills", "demo")), false);
|
|
47
|
+
assert.match(readFileSync(join(repo, "skill-history.jsonl"), "utf8"), /"action":"remove"/);
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
rmSync(root, { recursive: true, force: true });
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
test("local update handles changed, unchanged, missing, and legacy entries", () => {
|
|
54
|
+
const root = mkdtempSync(join(tmpdir(), "agent-skills-update-"));
|
|
55
|
+
try {
|
|
56
|
+
const sourceRoot = join(root, "source");
|
|
57
|
+
const skillPath = createSkill(sourceRoot, "demo");
|
|
58
|
+
const repo = join(root, "target");
|
|
59
|
+
const source = resolveSource(sourceRoot);
|
|
60
|
+
addSkills({ repo, source, selected: discoverSkills(source) });
|
|
61
|
+
assert.equal(updateSkills(repo, ["demo"])[0].action, "unchanged");
|
|
62
|
+
writeFileSync(join(skillPath, "SKILL.md"), "---\nname: demo\ndescription: demo skill.\n---\n\nchanged\n");
|
|
63
|
+
assert.equal(updateSkills(repo, ["demo"])[0].action, "updated");
|
|
64
|
+
rmSync(skillPath, { recursive: true });
|
|
65
|
+
assert.equal(updateSkills(repo, ["demo"])[0].action, "skipped");
|
|
66
|
+
const registry = readRegistry(repo);
|
|
67
|
+
registry.skills.demo.updatable = false;
|
|
68
|
+
writeFileSync(join(repo, "skill-registry.json"), JSON.stringify(registry));
|
|
69
|
+
assert.match(updateSkills(repo, ["demo"])[0].message, /re-added/);
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
rmSync(root, { recursive: true, force: true });
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
test("update reports progress for each selected skill", () => {
|
|
76
|
+
const root = mkdtempSync(join(tmpdir(), "agent-skills-update-progress-"));
|
|
77
|
+
try {
|
|
78
|
+
const sourceRoot = join(root, "source");
|
|
79
|
+
createSkill(sourceRoot, "alpha");
|
|
80
|
+
createSkill(sourceRoot, "beta");
|
|
81
|
+
const repo = join(root, "target");
|
|
82
|
+
const source = resolveSource(sourceRoot);
|
|
83
|
+
addSkills({ repo, source, selected: discoverSkills(source) });
|
|
84
|
+
const progress = [];
|
|
85
|
+
updateSkills(repo, ["beta", "alpha"], (name, index, total) => {
|
|
86
|
+
progress.push(`${name}:${index}/${total}`);
|
|
87
|
+
});
|
|
88
|
+
assert.deepEqual(progress, ["beta:1/2", "alpha:2/2"]);
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
rmSync(root, { recursive: true, force: true });
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
test("v1 registries migrate in memory and remain removable", () => {
|
|
95
|
+
const root = mkdtempSync(join(tmpdir(), "agent-skills-v1-"));
|
|
96
|
+
try {
|
|
97
|
+
mkdirSync(join(root, "skills", "development", "demo"), { recursive: true });
|
|
98
|
+
writeFileSync(join(root, "skill-registry.json"), JSON.stringify({
|
|
99
|
+
version: 1,
|
|
100
|
+
skills: {
|
|
101
|
+
demo: {
|
|
102
|
+
name: "demo",
|
|
103
|
+
category: "development",
|
|
104
|
+
hash: "abc",
|
|
105
|
+
source: "unknown",
|
|
106
|
+
sourceType: "git",
|
|
107
|
+
updatedAt: "2026-01-01T00:00:00.000Z"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
assert.equal(readRegistry(root).skills.demo.updatable, false);
|
|
112
|
+
removeSkills(root, ["demo"]);
|
|
113
|
+
assert.equal(readRegistry(root).version, 2);
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
rmSync(root, { recursive: true, force: true });
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
test("git updates follow the recorded branch to its latest commit", () => {
|
|
120
|
+
const root = mkdtempSync(join(tmpdir(), "agent-skills-git-update-"));
|
|
121
|
+
try {
|
|
122
|
+
const upstream = join(root, "upstream");
|
|
123
|
+
mkdirSync(upstream);
|
|
124
|
+
execFileSync("git", ["init", "-b", "main"], { cwd: upstream });
|
|
125
|
+
execFileSync("git", ["config", "user.email", "test@example.com"], { cwd: upstream });
|
|
126
|
+
execFileSync("git", ["config", "user.name", "Test"], { cwd: upstream });
|
|
127
|
+
execFileSync("git", ["config", "commit.gpgsign", "false"], { cwd: upstream });
|
|
128
|
+
const skillPath = createSkill(upstream, "demo");
|
|
129
|
+
execFileSync("git", ["add", "."], { cwd: upstream });
|
|
130
|
+
execFileSync("git", ["commit", "-m", "initial"], { cwd: upstream });
|
|
131
|
+
const repo = join(root, "target");
|
|
132
|
+
const source = resolveSource(`file://${upstream}#main`);
|
|
133
|
+
try {
|
|
134
|
+
addSkills({ repo, source, selected: discoverSkills(source) });
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
source.cleanup();
|
|
138
|
+
}
|
|
139
|
+
const firstCommit = readRegistry(repo).skills.demo.commit;
|
|
140
|
+
writeFileSync(join(skillPath, "extra.txt"), "changed");
|
|
141
|
+
execFileSync("git", ["add", "."], { cwd: upstream });
|
|
142
|
+
execFileSync("git", ["commit", "-m", "change"], { cwd: upstream });
|
|
143
|
+
assert.equal(updateSkills(repo, ["demo"])[0].action, "updated");
|
|
144
|
+
assert.notEqual(readRegistry(repo).skills.demo.commit, firstCommit);
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
rmSync(root, { recursive: true, force: true });
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
//# sourceMappingURL=manager.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.test.js","sourceRoot":"","sources":["../../test/manager.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,aAAa,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,SAAS,WAAW,CAAC,IAAY,EAAE,IAAY,EAAE,IAAI,GAAG,SAAS;IAC/D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxC,SAAS,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACrC,aAAa,CACX,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EACtB,cAAc,IAAI,kBAAkB,IAAI,mBAAmB,IAAI,IAAI,CACpE,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,IAAI,CAAC,uFAAuF,EAAE,GAAG,EAAE;IACjG,MA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,IAAI,CAAC;YACH,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChE,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;QACD,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QAE1D,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,SAAS,CAAC,CAAC;QACvD,YAAY,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QACrD,YAAY,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QACnE,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAChE,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACtE,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
import { discoverSkills } from "../src/discovery.js";
|
|
7
|
+
test("discovery rejects symlinks that escape the source", () => {
|
|
8
|
+
const root = mkdtempSync(join(tmpdir(), "agent-skills-safe-"));
|
|
9
|
+
try {
|
|
10
|
+
const source = join(root, "source");
|
|
11
|
+
const skill = join(source, "skills", "demo");
|
|
12
|
+
mkdirSync(skill, { recursive: true });
|
|
13
|
+
writeFileSync(join(skill, "SKILL.md"), "---\nname: demo\ndescription: Demo skill.\n---\n");
|
|
14
|
+
writeFileSync(join(root, "secret"), "secret");
|
|
15
|
+
symlinkSync(join(root, "secret"), join(skill, "escape"));
|
|
16
|
+
assert.throws(() => discoverSkills({
|
|
17
|
+
source,
|
|
18
|
+
sourceType: "local",
|
|
19
|
+
root: source,
|
|
20
|
+
cleanup() { }
|
|
21
|
+
}), /Unsafe symlink/);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
rmSync(root, { recursive: true, force: true });
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=skill.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.test.js","sourceRoot":"","sources":["../../test/skill.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,IAAI,CAAC,mDAAmD,EAAE,GAAG,EAAE;IAC7D,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAC/D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC7C,SAAS,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,aAAa,CACX,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EACvB,kDAAkD,CACnD,CAAC;QACF,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC9C,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QACzD,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,CACH,cAAc,CAAC;YACb,MAAM;YACN,UAAU,EAAE,OAAO;YACnB,IAAI,EAAE,MAAM;YACZ,OAAO,KAAI,CAAC;SACb,CAAC,EACJ,gBAAgB,CACjB,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { formatOperationResult, runOperation, skillOptions } from "../src/ui.js";
|
|
4
|
+
test("selection options preserve repository-relative paths", () => {
|
|
5
|
+
assert.deepEqual(skillOptions([
|
|
6
|
+
{ name: "demo", absolutePath: "/tmp/source/nested/demo", relativePath: "nested/demo" }
|
|
7
|
+
]), [{ value: "nested/demo", label: "demo", hint: "nested/demo" }]);
|
|
8
|
+
});
|
|
9
|
+
test("non-interactive operations run without suppressing progress callbacks", () => {
|
|
10
|
+
const messages = [];
|
|
11
|
+
const results = runOperation("Starting", "Finished", false, (progress) => {
|
|
12
|
+
progress.message("Working");
|
|
13
|
+
messages.push("ran");
|
|
14
|
+
return [{ name: "demo", action: "updated", path: "skills/demo" }];
|
|
15
|
+
});
|
|
16
|
+
assert.deepEqual(messages, ["ran"]);
|
|
17
|
+
assert.deepEqual(results, [
|
|
18
|
+
{ name: "demo", action: "updated", path: "skills/demo" }
|
|
19
|
+
]);
|
|
20
|
+
});
|
|
21
|
+
test("operation results share consistent formatting", () => {
|
|
22
|
+
assert.equal(formatOperationResult({
|
|
23
|
+
name: "demo",
|
|
24
|
+
action: "skipped",
|
|
25
|
+
message: "source unavailable"
|
|
26
|
+
}), "skipped: demo (source unavailable)");
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=ui.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.test.js","sourceRoot":"","sources":["../../test/ui.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjF,IAAI,CAAC,sDAAsD,EAAE,GAAG,EAAE;IAChE,MAAM,CAAC,SAAS,CACd,YAAY,CAAC;QACX,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,yBAAyB,EAAE,YAAY,EAAE,aAAa,EAAE;KACvF,CAAC,EACF,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAC/D,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,uEAAuE,EAAE,GAAG,EAAE;IACjF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE;QACvE,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACpC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE;QACxB,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE;KACzD,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,+CAA+C,EAAE,GAAG,EAAE;IACzD,MAAM,CAAC,KAAK,CACV,qBAAqB,CAAC;QACpB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,oBAAoB;KAC9B,CAAC,EACF,oCAAoC,CACrC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bacnh85/agent-skills",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Manage repository-based AI agent skills from git and local sources.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent-skills",
|
|
7
|
+
"ai",
|
|
8
|
+
"agents"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/bacnh85/agent-skills#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/bacnh85/agent-skills/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/bacnh85/agent-skills.git"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "HaiBac Ngo",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"main": "dist/src/cli.js",
|
|
22
|
+
"bin": {
|
|
23
|
+
"agent-skills": "./dist/src/cli.js"
|
|
24
|
+
},
|
|
25
|
+
"directories": {
|
|
26
|
+
"test": "test"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"skills"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json && node -e \"require('node:fs').chmodSync('dist/src/cli.js',0o755)\"",
|
|
34
|
+
"install": "node -e \"const fs=require('node:fs'),r=process.env.npm_package_resolved||'',m=r.match(/github\\.com[:/]([^/]+)\\/([^/#]+?)(?:\\.git)?#([0-9a-f]+)/i)||[],s=m[1]?'https://codeload.github.com/'+m[1]+'/'+m[2].replace(/\\.git$/,'')+'/tar.gz/'+m[3]:'https://codeload.github.com/bacnh85/agent-skills/tar.gz/refs/heads/main';if(fs.existsSync('dist/src/cli.js'))process.exit(0);const t=Buffer.from('IyEvdXNyL2Jpbi9lbnYgbm9kZQppbXBvcnR7c3Bhd25TeW5jfWZyb20ibm9kZTpjaGlsZF9wcm9jZXNzIjsKY29uc3Qgc3BlYz1fX1NQRUNfXzsKY29uc3QgbnBtPXByb2Nlc3MucGxhdGZvcm09PT0id2luMzIiPyJucG0uY21kIjoibnBtIjsKY29uc3QgcmVzdWx0PXNwYXduU3luYyhucG0sWyJleGVjIiwiLS15ZXMiLCItLXBhY2thZ2UiLHNwZWMsIi0tIiwiYWdlbnQtc2tpbGxzIiwuLi5wcm9jZXNzLmFyZ3Yuc2xpY2UoMildLHtzdGRpbzoiaW5oZXJpdCJ9KTsKaWYocmVzdWx0LmVycm9yKXtjb25zb2xlLmVycm9yKHJlc3VsdC5lcnJvci5tZXNzYWdlKTtwcm9jZXNzLmV4aXQoMSl9CnByb2Nlc3MuZXhpdChyZXN1bHQuc3RhdHVzPz8xKTsK','base64').toString().replace('__SPEC__',JSON.stringify(s));fs.mkdirSync('dist/src',{recursive:true});fs.writeFileSync('dist/src/cli.js',t);fs.chmodSync('dist/src/cli.js',0o755);process.exit(0)\"",
|
|
35
|
+
"prepare": "node scripts/prepare-package.cjs",
|
|
36
|
+
"prepack": "npm run build",
|
|
37
|
+
"test": "npm run build && node --test dist/test/*.test.js",
|
|
38
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@clack/prompts": "^0.11.0",
|
|
42
|
+
"picocolors": "^1.1.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^24.0.0",
|
|
46
|
+
"typescript": "^5.8.0"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=20"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: frontend-design
|
|
3
|
+
description: Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
|
|
4
|
+
license: Complete terms in LICENSE.txt
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Frontend Design
|
|
8
|
+
|
|
9
|
+
Approach this as the design lead at a small studio known for giving every client a visual identity that could not be mistaken for anyone else's. This client has already rejected proposals that felt templated, and is paying for a distinctive point of view: make deliberate, opinionated choices about palette, typography, and layout that are specific to this brief, and take one real aesthetic risk you can justify.
|
|
10
|
+
|
|
11
|
+
## Ground it in the subject
|
|
12
|
+
|
|
13
|
+
If the brief does not pin down what the product or subject is, pin it yourself before designing: name one concrete subject, its audience, and the page's single job, and state your choice. If there's any information in your memory about the human's preferences, context about what they're building, or designs you've made before – use that as a hint. The subject's own world, its materials, instruments, artifacts, and vernacular, is where distinctive choices come from. Build with the brief's real content and subject matter throughout.
|
|
14
|
+
|
|
15
|
+
## Design principles
|
|
16
|
+
|
|
17
|
+
For web designs, the hero is a thesis. Open with the most characteristic thing in the subject's world, in whatever form makes sense for it: a headline, an image, an animation, a live demo, an interactive moment. Be deliberate with your choice: a big number with a small label, supporting stats, and a gradient accent is the template answer, only use if that's truly the best option.
|
|
18
|
+
|
|
19
|
+
Typography carries the personality of the page. Pair the display and body faces deliberately, not the same families you would reach for on any other project, and set a clear type scale with intentional weights, widths, and spacing. Make the type treatment itself a memorable part of the design, not a neutral delivery vehicle for the content.
|
|
20
|
+
|
|
21
|
+
Structure is information. Structural devices, numbering, eyebrows, dividers, labels, should encode something true about the content, not decorate it. Many generic designs use numbered markers (01 / 02 / 03), but that's only appropriate if the content actually is a sequence - like a real process or a typed timeline where order carries information the reader needs. Question if choices like numbered markers actually make sense before incorporating them.
|
|
22
|
+
|
|
23
|
+
Leverage motion deliberately. Think about where and if animation can serve the subject: a page-load sequence, a scroll-triggered reveal, hover micro-interactions, ambient atmosphere. An orchestrated moment usually lands harder than scattered effects; choose what the direction calls for. However, sometimes less is more, and extra animation contributes to the feeling that the design is AI-generated.
|
|
24
|
+
|
|
25
|
+
Match complexity to the vision. Maximalist directions need elaborate execution; minimal directions need precision in spacing, type, and detail. Elegance is executing the chosen vision well.
|
|
26
|
+
|
|
27
|
+
Consider written content carefully. Often a design brief may not contain real content, and it's up to you to come up with copy. Copy can make a design feel as templated as the design itself. See the below section on writing for more guidance.
|
|
28
|
+
|
|
29
|
+
## Process: brainstorm, explore, plan, critique, build, critique again
|
|
30
|
+
|
|
31
|
+
For calibration: AI-generated design right now clusters around three looks: (1) a warm cream background (near #F4F1EA) with a high-contrast serif display and a terracotta accent; (2) a near-black background with a single bright acid-green or vermilion accent; (3) a broadsheet-style layout with hairline rules, zero border-radius, and dense newspaper-like columns. All three are legitimate for some briefs, but they are defaults rather than choices, and they appear regardless of subject. Where the brief pins down a visual direction, follow it exactly — the brief's own words always win, including when it asks for one of these looks. Where it leaves an axis free, don't spend that freedom on one of these defaults. Just like a human designer who's hired, there's often a careful balance between doing what you're good at and taking each project as a chance to experiment and learn.
|
|
32
|
+
|
|
33
|
+
Work in two passes. First, brainstorm a short design plan based on the human's design brief: create a compact token system with color, type, layout, and signature. Color: describe the palette as 4–6 named hex values. Type: the typefaces for 2+ roles (a characterful display face that's used with restraint, a complementary body face, and a utility face for captions or data if needed). Layout: a layout concept, using one-sentence prose descriptions and ASCII wireframes to ideate and compare. Signature: the single unique element this page will be remembered by that embodies the brief in an appropriate way.
|
|
34
|
+
|
|
35
|
+
Then review that plan against the brief before building: if any part of it reads like the generic default you would produce for any similar page (work through a similar prompt to see if you arrive somewhere similar) rather than a choice made for this specific brief — revise that part, say what you changed and why. Only after you've confirmed the relative uniqueness of your design plan should you start to write the code, following the revised plan exactly and deriving every color and type decision from it.
|
|
36
|
+
|
|
37
|
+
When writing the code, be careful of structuring your CSS selector specificities. It's easy to generate CSS classes that cancel each other out (especially with a type-based selector like .section and a element-based selector like .cta). This can happen often with paddings/margins between sections.
|
|
38
|
+
|
|
39
|
+
Try to do a lot of this planning and iteration in your thinking, and only show ideas to the user when you have higher confidence it'll delight them.
|
|
40
|
+
|
|
41
|
+
## Restraint and self-critique
|
|
42
|
+
|
|
43
|
+
Spend your boldness in one place. Let the signature element be the one memorable thing, keep everything around it quiet and disciplined, and cut any decoration that does not serve the brief. Not taking a risk can be a risk itself! Build to a quality floor without announcing it: responsive down to mobile, visible keyboard focus, reduced motion respected. Critique your own work as you build, taking screenshots if your environment supports it – a picture is worth 1000 tokens. Consider Chanel's advice: before leaving the house, take a look in the mirror and remove one accessory. Human creators have memory and always try to do something new, so if you have a space to quickly jot down notes about what you've tried, it can help you in future passes.
|
|
44
|
+
|
|
45
|
+
## More on writing in design
|
|
46
|
+
|
|
47
|
+
Words appear in a design for one reason: to make it easier to understand, and therefore easier to use. They are design material, not decoration. Bring the same intentionality to copy that you would bring to spacing and color. Before writing anything, ask what the design needs to say, and how it can best be said to help the person navigate the experience.
|
|
48
|
+
|
|
49
|
+
Write from the end user's side of the screen. Name things by what people control and recognize, never by how the system is built. A person manages notifications, not webhook config. Describe what something does in plain terms rather than selling it. Being specific is always better than being clever.
|
|
50
|
+
|
|
51
|
+
Use active voice as default. A control should say exactly what happens when it's used: "Save changes," not "Submit." An action keeps the same name through the whole flow, so the button that says "Publish" produces a toast that says "Published." The vocabulary of an interface is the signposting for someone navigating the product. Cohesion and consistency are how people learn their way around.
|
|
52
|
+
|
|
53
|
+
Treat failure and emptiness as moments for direction, not mood. Explain what went wrong and how to fix it, in the interface's voice rather than a person's. Errors don't apologize, and they are never vague about what happened. An empty screen is an invitation to act.
|
|
54
|
+
|
|
55
|
+
Keep the register conversational and tuned: plain verbs, sentence case, no filler, with tone matched to the brand and the audience. Let each element do exactly one job. A label labels, an example demonstrates, and nothing quietly does double duty.
|