@pratikpsl/agent-skills 1.0.0 → 1.2.0
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 +32 -22
- package/dist/cli/index.js +4 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/core/ide-map.js +2 -2
- package/dist/core/ide-map.js.map +1 -1
- package/dist/core/install-template.d.ts +2 -2
- package/dist/core/install-template.d.ts.map +1 -1
- package/dist/core/install-template.js +124 -43
- package/dist/core/install-template.js.map +1 -1
- package/dist/core/resolve-template.d.ts.map +1 -1
- package/dist/core/resolve-template.js +1 -1
- package/dist/core/resolve-template.js.map +1 -1
- package/package.json +2 -2
- package/templates/default/instructions.md +5 -0
- package/templates/shared/AgentSkills/OPERATING.md +2 -2
- package/templates/shared/AgentSkills/agents/reviewer.md +29 -0
- package/templates/shared/AgentSkills/skills/principles/SKILL.md +31 -0
- package/templates/shared/AgentSkills/skills/review/SKILL.md +33 -0
- package/templates/shared/entry-points/instructions.md +12 -7
- package/templates/shared/AgentSkills/agents/reviewer.agent.md +0 -26
- /package/templates/dotnet/AgentSkills/agents/{architect.agent.md → architect.md} +0 -0
- /package/templates/dotnet/AgentSkills/agents/{developer.agent.md → developer.md} +0 -0
- /package/templates/react/AgentSkills/agents/{developer.agent.md → developer.md} +0 -0
- /package/templates/shared/AgentSkills/agents/{architect.agent.md → architect.md} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @pratikpsl/agent-skills
|
|
2
2
|
|
|
3
|
-
> Scaffold and manage AI agent skills across any project — for Cursor, Claude, Codex, Copilot, Antigravity,
|
|
3
|
+
> Scaffold and manage AI agent skills across any project — for Cursor, Claude, Codex, Copilot, Antigravity, and Cline.
|
|
4
4
|
|
|
5
5
|
`@pratikpsl/agent-skills` is a single npm package: a TypeScript CLI plus bundled templates under `templates/`. No runtime network fetch — templates ship inside the package, so setup works offline after install.
|
|
6
6
|
|
|
@@ -10,22 +10,31 @@
|
|
|
10
10
|
|
|
11
11
|
From any project root (Node 18+ or Bun):
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### Shared Agent Skills (Universal Skills & Personas)
|
|
14
14
|
|
|
15
|
-
Running with **
|
|
15
|
+
Running with an **agent name** or `shared` automatically installs shared skills (`AgentSkills/skills/review`, `AgentSkills/skills/principles`, `AgentSkills/skills/standards`, `AgentSkills/skills/security`), agent personas (`AgentSkills/agents/architect.md`, `AgentSkills/agents/reviewer.md`), and the agent's entry point:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
#
|
|
19
|
-
npx @pratikpsl/agent-skills
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
npx @pratikpsl/agent-skills
|
|
23
|
-
npx @pratikpsl/agent-skills
|
|
24
|
-
npx @pratikpsl/agent-skills
|
|
25
|
-
npx @pratikpsl/agent-skills
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
npx @pratikpsl/agent-skills
|
|
18
|
+
# Install shared skills + specific IDE / Agent entry point
|
|
19
|
+
npx @pratikpsl/agent-skills antigravity # → .agents/rules/GEMINI.md + AgentSkills/
|
|
20
|
+
npx @pratikpsl/agent-skills cursor # → .cursor/rules/instructions.md + AgentSkills/
|
|
21
|
+
npx @pratikpsl/agent-skills claude # → CLAUDE.md + AgentSkills/
|
|
22
|
+
npx @pratikpsl/agent-skills code # → AGENTS.md + AgentSkills/
|
|
23
|
+
npx @pratikpsl/agent-skills codex # → AGENTS.md + AgentSkills/
|
|
24
|
+
npx @pratikpsl/agent-skills copilot # → .github/copilot-instructions.md + AgentSkills/
|
|
25
|
+
npx @pratikpsl/agent-skills cline # → .clinerules + AgentSkills/
|
|
26
|
+
|
|
27
|
+
# Install shared skills across all IDE entry points
|
|
28
|
+
npx @pratikpsl/agent-skills shared
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Compact Single-File Instructions
|
|
32
|
+
|
|
33
|
+
To scaffold compact single-file agent instructions without the `AgentSkills/` folder:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx @pratikpsl/agent-skills default
|
|
37
|
+
npx @pratikpsl/agent-skills default --agent antigravity
|
|
29
38
|
```
|
|
30
39
|
|
|
31
40
|
### .NET / C# Template
|
|
@@ -35,7 +44,7 @@ npx @pratikpsl/agent-skills cline # → .clinerules
|
|
|
35
44
|
npx @pratikpsl/agent-skills dotnet
|
|
36
45
|
|
|
37
46
|
# Install .NET agent skills + specific agent entry point only
|
|
38
|
-
npx @pratikpsl/agent-skills dotnet --agent
|
|
47
|
+
npx @pratikpsl/agent-skills dotnet --agent code
|
|
39
48
|
npx @pratikpsl/agent-skills dotnet --agent cursor
|
|
40
49
|
```
|
|
41
50
|
|
|
@@ -60,13 +69,14 @@ npx @pratikpsl/agent-skills react --agent claude
|
|
|
60
69
|
Usage: agent-skills [options] [template]
|
|
61
70
|
|
|
62
71
|
Arguments:
|
|
63
|
-
template Template: default, dotnet, react; agent names install
|
|
72
|
+
template Template: default, dotnet, react, shared; agent names install shared guidance
|
|
64
73
|
|
|
65
74
|
Options:
|
|
66
75
|
-V, --version output the version number
|
|
67
|
-
--agent <name> Install one agent entry point: antigravity, claude, cline, codex, copilot, cursor
|
|
76
|
+
--agent <name> Install one agent entry point: antigravity, claude, cline, code, codex, copilot, cursor
|
|
68
77
|
--force Overwrite installed files (default: false)
|
|
69
|
-
--
|
|
78
|
+
--hardlink Hardlink matching entry points (default: true)
|
|
79
|
+
--no-hardlink Do not hardlink matching entry points
|
|
70
80
|
--path <dir> Target project root (default: current working directory)
|
|
71
81
|
-h, --help display help for command
|
|
72
82
|
```
|
|
@@ -77,10 +87,10 @@ Options:
|
|
|
77
87
|
|
|
78
88
|
| Template | Path | Description |
|
|
79
89
|
| --- | --- | --- |
|
|
80
|
-
| `
|
|
81
|
-
| `dotnet` | `templates/dotnet/` | .NET/C# skills, architecture & developer agents, memory |
|
|
82
|
-
| `react` | `templates/react/` | React & TypeScript skills, frontend testing, developer agent |
|
|
83
|
-
| `
|
|
90
|
+
| `shared` | `templates/shared/` | Base operating contract, core skills (principles, standards, security, review), review & architecture agents (`architect.md`, `reviewer.md`) |
|
|
91
|
+
| `dotnet` | `templates/dotnet/` | .NET/C# skills, architecture & developer agents (`architect.md`, `developer.md`), memory |
|
|
92
|
+
| `react` | `templates/react/` | React & TypeScript skills, frontend testing, developer agent (`developer.md`) |
|
|
93
|
+
| `default` | `templates/default/` | Compact single-file agent instructions without AgentSkills folder |
|
|
84
94
|
|
|
85
95
|
---
|
|
86
96
|
|
package/dist/cli/index.js
CHANGED
|
@@ -11,7 +11,7 @@ function runInstall(template, options) {
|
|
|
11
11
|
if (implicitAgent && options.agent) {
|
|
12
12
|
throw new Error("Choose an agent with either the argument or --agent, not both.");
|
|
13
13
|
}
|
|
14
|
-
const selectedTemplate = implicitAgent ? "
|
|
14
|
+
const selectedTemplate = implicitAgent ? "shared" : template ?? "shared";
|
|
15
15
|
const agent = implicitAgent ?? parseAgentName(options.agent);
|
|
16
16
|
const targetDir = options.path;
|
|
17
17
|
const hardlink = options.hardlink ?? true;
|
|
@@ -37,10 +37,11 @@ program
|
|
|
37
37
|
.name("agent-skills")
|
|
38
38
|
.description("Install shared coding-agent guidance and a framework template")
|
|
39
39
|
.version(version)
|
|
40
|
-
.argument("[template]", `Template: ${TEMPLATE_NAMES.join(", ")}; agent names install
|
|
40
|
+
.argument("[template]", `Template: ${TEMPLATE_NAMES.join(", ")}; agent names install shared guidance`)
|
|
41
41
|
.option("--agent <name>", `Install one agent entry point: ${AGENT_NAMES.join(", ")}`)
|
|
42
42
|
.option("--force", "Overwrite installed files", false)
|
|
43
|
-
.option("--
|
|
43
|
+
.option("--hardlink", "Hardlink matching entry points", true)
|
|
44
|
+
.option("--no-hardlink", "Do not hardlink matching entry points")
|
|
44
45
|
.option("--path <dir>", "Target project root", process.cwd())
|
|
45
46
|
.action((template, options) => runInstall(template, options));
|
|
46
47
|
program.parseAsync(process.argv).catch((error) => {
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAErG,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAwB,CAAC;AASzE,SAAS,UAAU,CAAC,QAA4B,EAAE,OAAmB;IACnE,MAAM,OAAO,GAAG,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IACzE,MAAM,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAErE,IAAI,aAAa,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACpF,CAAC;IAED,MAAM,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,cAAc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C"}
|
package/dist/core/ide-map.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const IDE_ENTRY_POINTS = {
|
|
2
|
-
antigravity: ".agents/GEMINI.md",
|
|
2
|
+
antigravity: ".agents/rules/GEMINI.md",
|
|
3
3
|
claude: "CLAUDE.md",
|
|
4
4
|
cline: ".clinerules",
|
|
5
|
+
code: "AGENTS.md",
|
|
5
6
|
codex: "AGENTS.md",
|
|
6
7
|
copilot: ".github/copilot-instructions.md",
|
|
7
8
|
cursor: ".cursor/rules/instructions.md",
|
|
8
|
-
windsurf: ".windsurfrules",
|
|
9
9
|
};
|
|
10
10
|
export const AGENT_NAMES = Object.keys(IDE_ENTRY_POINTS);
|
|
11
11
|
export function parseAgentName(value) {
|
package/dist/core/ide-map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ide-map.js","sourceRoot":"","sources":["../../src/core/ide-map.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"ide-map.js","sourceRoot":"","sources":["../../src/core/ide-map.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,WAAW,EAAE,yBAAyB;IACtC,MAAM,EAAE,WAAW;IACnB,KAAK,EAAE,aAAa;IACpB,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,WAAW;IAClB,OAAO,EAAE,iCAAiC;IAC1C,MAAM,EAAE,+BAA+B;CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAEzD,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,IAAI,KAAK,IAAI,gBAAgB;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,cAAc,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -5,7 +5,7 @@ export interface InstallResult {
|
|
|
5
5
|
export interface InstallOptions {
|
|
6
6
|
agent?: string;
|
|
7
7
|
force: boolean;
|
|
8
|
-
hardlink
|
|
8
|
+
hardlink?: boolean;
|
|
9
9
|
targetDir: string;
|
|
10
10
|
sharedDir: string;
|
|
11
11
|
templateDir: string;
|
|
@@ -13,7 +13,7 @@ export interface InstallOptions {
|
|
|
13
13
|
export interface InstallDefaultOptions {
|
|
14
14
|
agent?: string;
|
|
15
15
|
force: boolean;
|
|
16
|
-
hardlink
|
|
16
|
+
hardlink?: boolean;
|
|
17
17
|
targetDir: string;
|
|
18
18
|
}
|
|
19
19
|
export declare function installTemplate(options: InstallOptions): InstallResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-template.d.ts","sourceRoot":"","sources":["../../src/core/install-template.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"install-template.d.ts","sourceRoot":"","sources":["../../src/core/install-template.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AA6OD,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG,aAAa,CA0BtE;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,qBAAqB,GAC7B,aAAa,CAUf"}
|
|
@@ -1,6 +1,33 @@
|
|
|
1
|
-
import { copyFileSync, existsSync,
|
|
1
|
+
import fs, { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { IDE_ENTRY_POINTS } from "./ide-map.js";
|
|
4
|
+
const UTF8_ENCODING = "utf8";
|
|
5
|
+
const AGENTS_FILENAME = "AGENTS.md";
|
|
6
|
+
const DEFAULT_RELATIVE_PREFIX = "./";
|
|
7
|
+
const PARENT_DIR_PREFIX = "../";
|
|
8
|
+
const AGENT_SKILLS_DIR = "AgentSkills/";
|
|
9
|
+
const ANTIGRAVITY_TARGET = ".agents/rules/GEMINI.md";
|
|
10
|
+
const CURSOR_TARGET = ".cursor/rules/instructions.md";
|
|
11
|
+
const ANTIGRAVITY_FRONTMATTER = `---
|
|
12
|
+
trigger: always_on
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
name: core-entry-point
|
|
18
|
+
description: >
|
|
19
|
+
Load on every task. Universal guidelines, standards, and verification rules.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
`;
|
|
24
|
+
const CURSOR_FRONTMATTER = `---
|
|
25
|
+
description: Universal agent instructions and standards
|
|
26
|
+
globs: *
|
|
27
|
+
alwaysApply: true
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
`;
|
|
4
31
|
function relativePath(targetDir, filePath) {
|
|
5
32
|
return path.relative(targetDir, filePath).replaceAll("\\", "/");
|
|
6
33
|
}
|
|
@@ -33,7 +60,7 @@ function copyFile(source, destination, force, existingBeforeInstall) {
|
|
|
33
60
|
copyFileSync(source, destination);
|
|
34
61
|
return true;
|
|
35
62
|
}
|
|
36
|
-
function mergeDirectory(sourceDir, targetDir,
|
|
63
|
+
function mergeDirectory(sourceDir, targetDir, context) {
|
|
37
64
|
if (!existsSync(sourceDir))
|
|
38
65
|
return;
|
|
39
66
|
mkdirSync(targetDir, { recursive: true });
|
|
@@ -41,72 +68,126 @@ function mergeDirectory(sourceDir, targetDir, projectDir, force, existingBeforeI
|
|
|
41
68
|
const source = path.join(sourceDir, entry.name);
|
|
42
69
|
const target = path.join(targetDir, entry.name);
|
|
43
70
|
if (entry.isDirectory()) {
|
|
44
|
-
mergeDirectory(source, target,
|
|
71
|
+
mergeDirectory(source, target, context);
|
|
72
|
+
continue;
|
|
45
73
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
if (!result.skipped.includes(rel)) {
|
|
55
|
-
result.skipped.push(rel);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
74
|
+
const rel = relativePath(context.projectDir, target);
|
|
75
|
+
const copied = copyFile(source, target, context.force, context.existingBeforeInstall);
|
|
76
|
+
const list = copied ? context.result.written : context.result.skipped;
|
|
77
|
+
if (!list.includes(rel)) {
|
|
78
|
+
list.push(rel);
|
|
58
79
|
}
|
|
59
80
|
}
|
|
60
81
|
}
|
|
61
82
|
function selectedEntryPoints(agent) {
|
|
62
|
-
|
|
83
|
+
if (agent)
|
|
84
|
+
return [IDE_ENTRY_POINTS[agent]];
|
|
85
|
+
const all = Array.from(new Set(Object.values(IDE_ENTRY_POINTS)));
|
|
86
|
+
return all.sort((a, b) => (a === AGENTS_FILENAME ? -1 : b === AGENTS_FILENAME ? 1 : a.localeCompare(b)));
|
|
87
|
+
}
|
|
88
|
+
function getRelativePrefix(destination) {
|
|
89
|
+
const dir = path.dirname(destination).replaceAll("\\", "/");
|
|
90
|
+
if (dir === "." || dir === "")
|
|
91
|
+
return DEFAULT_RELATIVE_PREFIX;
|
|
92
|
+
const depth = dir.split("/").filter(Boolean).length;
|
|
93
|
+
return PARENT_DIR_PREFIX.repeat(depth);
|
|
94
|
+
}
|
|
95
|
+
function addAgentsLinkNote(content, prefix) {
|
|
96
|
+
if (content.includes(AGENTS_FILENAME))
|
|
97
|
+
return content;
|
|
98
|
+
const agentsLink = prefix === DEFAULT_RELATIVE_PREFIX ? `./${AGENTS_FILENAME}` : `${prefix}${AGENTS_FILENAME}`;
|
|
99
|
+
const note = `\n> Follow universal guidelines and standards in [${AGENTS_FILENAME}](${agentsLink}).\n`;
|
|
100
|
+
const headerMatch = content.match(/^# [^\n]+/m);
|
|
101
|
+
if (!headerMatch || headerMatch.index === undefined) {
|
|
102
|
+
return `${note}\n${content}`;
|
|
103
|
+
}
|
|
104
|
+
const insertPos = headerMatch.index + headerMatch[0].length;
|
|
105
|
+
return content.slice(0, insertPos) + note + content.slice(insertPos);
|
|
106
|
+
}
|
|
107
|
+
function formatEntryPoint(destination, content, hasAgentsMd) {
|
|
108
|
+
const prefix = getRelativePrefix(destination);
|
|
109
|
+
let adjusted = content;
|
|
110
|
+
if (prefix !== DEFAULT_RELATIVE_PREFIX) {
|
|
111
|
+
adjusted = adjusted.replaceAll(AGENT_SKILLS_DIR, `${prefix}${AGENT_SKILLS_DIR}`);
|
|
112
|
+
}
|
|
113
|
+
if (prefix !== DEFAULT_RELATIVE_PREFIX && hasAgentsMd) {
|
|
114
|
+
adjusted = addAgentsLinkNote(adjusted, prefix);
|
|
115
|
+
}
|
|
116
|
+
if (destination === ANTIGRAVITY_TARGET) {
|
|
117
|
+
adjusted = `${ANTIGRAVITY_FRONTMATTER}${adjusted}`;
|
|
118
|
+
}
|
|
119
|
+
else if (destination === CURSOR_TARGET) {
|
|
120
|
+
adjusted = `${CURSOR_FRONTMATTER}${adjusted}`;
|
|
121
|
+
}
|
|
122
|
+
return adjusted;
|
|
123
|
+
}
|
|
124
|
+
function tryHardlink(primaryPath, target) {
|
|
125
|
+
try {
|
|
126
|
+
fs.linkSync(primaryPath, target);
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
63
132
|
}
|
|
64
|
-
function
|
|
65
|
-
if (existingBeforeInstall.has(target) && !
|
|
133
|
+
function writeOrLinkEntryPoint(target, content, primaryPath, context) {
|
|
134
|
+
if (context.existingBeforeInstall.has(target) && !context.force) {
|
|
66
135
|
return false;
|
|
67
136
|
}
|
|
68
137
|
if (existsSync(target)) {
|
|
69
138
|
rmSync(target, { force: true, recursive: true });
|
|
70
139
|
}
|
|
71
140
|
mkdirSync(path.dirname(target), { recursive: true });
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
// Non-hardlink-compatible filesystems use copy fallback
|
|
79
|
-
}
|
|
141
|
+
const linked = context.hardlink && primaryPath && tryHardlink(primaryPath, target);
|
|
142
|
+
if (!linked) {
|
|
143
|
+
writeFileSync(target, content, UTF8_ENCODING);
|
|
80
144
|
}
|
|
81
|
-
copyFileSync(source, target);
|
|
82
145
|
return true;
|
|
83
146
|
}
|
|
84
147
|
function installEntryPoints(source, options, existingBeforeInstall, result) {
|
|
85
|
-
|
|
86
|
-
|
|
148
|
+
const baseContent = readFileSync(source, UTF8_ENCODING);
|
|
149
|
+
const destinations = selectedEntryPoints(options.agent);
|
|
150
|
+
const agentsPath = path.join(options.targetDir, AGENTS_FILENAME);
|
|
151
|
+
const willHaveAgentsMd = destinations.includes(AGENTS_FILENAME) ||
|
|
152
|
+
existingBeforeInstall.has(agentsPath) ||
|
|
153
|
+
existsSync(agentsPath);
|
|
154
|
+
const writeContext = {
|
|
155
|
+
existingBeforeInstall,
|
|
156
|
+
force: options.force,
|
|
157
|
+
hardlink: options.hardlink ?? true,
|
|
158
|
+
};
|
|
159
|
+
const contentToPrimaryPath = new Map();
|
|
160
|
+
for (const destination of destinations) {
|
|
87
161
|
const target = path.join(options.targetDir, destination);
|
|
88
162
|
const rel = relativePath(options.targetDir, target);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
163
|
+
const content = formatEntryPoint(destination, baseContent, willHaveAgentsMd);
|
|
164
|
+
const primaryPath = contentToPrimaryPath.get(content);
|
|
165
|
+
const written = writeOrLinkEntryPoint(target, content, primaryPath, writeContext);
|
|
166
|
+
const list = written ? result.written : result.skipped;
|
|
167
|
+
if (!list.includes(rel)) {
|
|
168
|
+
list.push(rel);
|
|
94
169
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
result.skipped.push(rel);
|
|
98
|
-
}
|
|
170
|
+
if (written && !contentToPrimaryPath.has(content)) {
|
|
171
|
+
contentToPrimaryPath.set(content, target);
|
|
99
172
|
}
|
|
100
173
|
}
|
|
101
174
|
}
|
|
102
175
|
export function installTemplate(options) {
|
|
103
176
|
const result = { written: [], skipped: [] };
|
|
104
177
|
const existing = collectExistingFiles(options.targetDir);
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
178
|
+
const mergeCtx = {
|
|
179
|
+
existingBeforeInstall: existing,
|
|
180
|
+
force: options.force,
|
|
181
|
+
projectDir: options.targetDir,
|
|
182
|
+
result,
|
|
183
|
+
};
|
|
184
|
+
const sharedSkills = path.join(options.sharedDir, AGENT_SKILLS_DIR);
|
|
185
|
+
const templateSkills = path.join(options.templateDir, AGENT_SKILLS_DIR);
|
|
186
|
+
const targetSkills = path.join(options.targetDir, AGENT_SKILLS_DIR);
|
|
187
|
+
mergeDirectory(sharedSkills, targetSkills, mergeCtx);
|
|
188
|
+
if (path.resolve(templateSkills) !== path.resolve(sharedSkills)) {
|
|
189
|
+
mergeDirectory(templateSkills, targetSkills, mergeCtx);
|
|
190
|
+
}
|
|
110
191
|
installEntryPoints(path.join(options.sharedDir, "entry-points", "instructions.md"), options, existing, result);
|
|
111
192
|
return result;
|
|
112
193
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-template.js","sourceRoot":"","sources":["../../src/core/install-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"install-template.js","sourceRoot":"","sources":["../../src/core/install-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC/G,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AA2ChD,MAAM,aAAa,GAAG,MAAe,CAAC;AACtC,MAAM,eAAe,GAAG,WAAoB,CAAC;AAC7C,MAAM,uBAAuB,GAAG,IAAa,CAAC;AAC9C,MAAM,iBAAiB,GAAG,KAAc,CAAC;AACzC,MAAM,gBAAgB,GAAG,cAAuB,CAAC;AACjD,MAAM,kBAAkB,GAAG,yBAAkC,CAAC;AAC9D,MAAM,aAAa,GAAG,+BAAwC,CAAC;AAE/D,MAAM,uBAAuB,GAAG;;;;;;;;;;;;CAY/B,CAAC;AAEF,MAAM,kBAAkB,GAAG;;;;;;CAM1B,CAAC;AAEF,SAAS,YAAY,CAAC,SAAiB,EAAE,QAAgB;IACvD,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAClE,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AY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IACpE,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IACxE,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAEpE,cAAc,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IACrD,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QAChE,cAAc,CAAC,cAAc,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;IACD,kBAAkB,CAChB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,iBAAiB,CAAC,EAC/D,OAAO,EACP,QAAQ,EACR,MAAM,CACP,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,SAAiB,EACjB,OAA8B;IAE9B,MAAM,MAAM,GAAkB,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC3D,MAAM,QAAQ,GAAG,oBAAoB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzD,kBAAkB,CAChB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,EACvC,OAAO,EACP,QAAQ,EACR,MAAM,CACP,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-template.d.ts","sourceRoot":"","sources":["../../src/core/resolve-template.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"resolve-template.d.ts","sourceRoot":"","sources":["../../src/core/resolve-template.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,UAA2C,CAAC;AAMvE,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWpD"}
|
|
@@ -2,7 +2,7 @@ import { existsSync } from "fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
|
-
export const TEMPLATE_NAMES = ["default", "dotnet", "react"];
|
|
5
|
+
export const TEMPLATE_NAMES = ["default", "dotnet", "react", "shared"];
|
|
6
6
|
function templatesRoot() {
|
|
7
7
|
return path.resolve(__dirname, "..", "..", "templates");
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-template.js","sourceRoot":"","sources":["../../src/core/resolve-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve-template.js","sourceRoot":"","sources":["../../src/core/resolve-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAEvE,SAAS,aAAa;IACpB,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,cAAc,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvF,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,CAAC;IACrD,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,qCAAqC,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pratikpsl/agent-skills",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"description": "CLI to scaffold and manage AI agent skills across projects — like shadcn/ui, but for Cursor, Claude, Codex, Copilot, Antigravity, and more",
|
|
6
6
|
"bin": {
|
|
7
7
|
"agent-skills": "dist/bin/agent-skills.js"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"build": "tsc",
|
|
48
48
|
"test": "vitest run",
|
|
49
49
|
"test:watch": "vitest",
|
|
50
|
-
"dry-run": "
|
|
50
|
+
"dry-run": "bun run build && bun pm pack --dry-run"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"commander": "^15.0.0"
|
|
@@ -26,6 +26,11 @@ minimizing the diff, following the project's own architecture and conventions.
|
|
|
26
26
|
- Use idiomatic non-blocking `async`/`await`; ensure code is free of race conditions and deadlocks.
|
|
27
27
|
- Avoid deprecated APIs and patterns; introduce new dependencies only when strictly necessary (permissive license, actively maintained).
|
|
28
28
|
|
|
29
|
+
### Review & Verification
|
|
30
|
+
- Review code against five core dimensions: correctness (boundaries, errors, race conditions), readability (depth <= 2, functions <= 50 lines), architecture (SOLID, KISS), security, and performance.
|
|
31
|
+
- Review tests first; address root causes over symptoms (fix shared logic once).
|
|
32
|
+
- Categorize findings clearly (Critical, Important, Suggestion) and provide concrete, actionable fixes.
|
|
33
|
+
|
|
29
34
|
## Definition of Done
|
|
30
35
|
- Builds cleanly and all tests pass without errors or warnings.
|
|
31
36
|
- No debug code, dead code, unused imports, or temporary files left behind.
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Workflow
|
|
4
4
|
1. **Memory & Context**: Read `AgentSkills/memory/index.md` (create if missing); load only relevant domain lessons to avoid repeating past mistakes.
|
|
5
|
-
2. **Role & Skill Discovery**: Load relevant role guidance from `AgentSkills/agents/` and skills from `AgentSkills/skills
|
|
5
|
+
2. **Role & Skill Discovery**: Load relevant role guidance from `AgentSkills/agents/` (`architect.md`, `reviewer.md`, `developer.md`) and skills from `AgentSkills/skills/` (including `AgentSkills/skills/review/SKILL.md`).
|
|
6
6
|
3. **Pre-flight Inspection**: Inspect current codebase patterns, dependencies, and baseline build/test state.
|
|
7
7
|
4. **Surgical Implementation**: Apply the minimal change required; adhere strictly to DRY, KISS, and YAGNI.
|
|
8
|
-
5. **Verification**: Run the project's build and test commands (e.g. `npm test`, `dotnet test`, or project test suite) to verify happy paths and edge cases.
|
|
8
|
+
5. **Verification**: Run the project's build and test commands (e.g. `npm test`, `dotnet test`, or project test suite) to verify happy paths and edge cases per `AgentSkills/skills/review/SKILL.md`.
|
|
9
9
|
6. **Learning Loop**: If a mistake was made and corrected or a durable rule discovered, record a concise lesson in `AgentSkills/memory/lessons/<domain>.md` and update `index.md`.
|
|
10
10
|
|
|
11
11
|
## Completion Checklist
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reviewer
|
|
3
|
+
description: Code review, correctness, security, and standards verification.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Reviewer Guidance
|
|
7
|
+
|
|
8
|
+
Universal review guidance for AI agents and human reviewers across all stacks. Security, standards, and core principles remain invariant across frameworks.
|
|
9
|
+
|
|
10
|
+
## Core References
|
|
11
|
+
- **Principles**: Adhere strictly to `AgentSkills/skills/principles/SKILL.md`.
|
|
12
|
+
- **Standards**: Adhere strictly to `AgentSkills/skills/standards/SKILL.md`.
|
|
13
|
+
- **Security**: Adhere strictly to `AgentSkills/skills/security/SKILL.md`.
|
|
14
|
+
- **Review**: Adhere strictly to `AgentSkills/skills/review/SKILL.md`.
|
|
15
|
+
|
|
16
|
+
## Verification & Automated Checks
|
|
17
|
+
- [ ] **Clean Build**
|
|
18
|
+
- [ ] **Zero Lint Errors**
|
|
19
|
+
- [ ] **Tests Pass**
|
|
20
|
+
- [ ] **Test Robustness**
|
|
21
|
+
|
|
22
|
+
## Standards & Skill Compliance
|
|
23
|
+
- [ ] **Principles**: `AgentSkills/skills/principles/SKILL.md`
|
|
24
|
+
- [ ] **Standards**: `AgentSkills/skills/standards/SKILL.md`
|
|
25
|
+
- [ ] **Security**: `AgentSkills/skills/security/SKILL.md`
|
|
26
|
+
- [ ] **Review**: `AgentSkills/skills/review/SKILL.md`
|
|
27
|
+
|
|
28
|
+
## Memory & Learning Loop
|
|
29
|
+
- [ ] **Agent Memory**: `AgentSkills/memory/index.md`
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principles
|
|
3
|
+
description: Core software engineering principles, simplicity ladder, surgical changes, and standards.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Core Principles
|
|
7
|
+
|
|
8
|
+
Foundational software engineering principles and decision rules for AI agents and human contributors.
|
|
9
|
+
|
|
10
|
+
## The Simplicity Ladder
|
|
11
|
+
Before writing any code, stop at the first rung that holds:
|
|
12
|
+
|
|
13
|
+
1. **Does this need to be built at all?** (YAGNI)
|
|
14
|
+
2. **Does it already exist in this codebase?** Reuse the helper, util, or pattern that is already here; do not rewrite it.
|
|
15
|
+
3. **Does the standard library already do this?** Use it.
|
|
16
|
+
4. **Does a native platform feature cover it?** Use it.
|
|
17
|
+
5. **Does an already-installed dependency solve it?** Use it.
|
|
18
|
+
6. **Can this be one line and simple?** Make it one.
|
|
19
|
+
7. **Only then:** write the minimum code that works.
|
|
20
|
+
|
|
21
|
+
The ladder runs after you understand the problem, not instead of it: read the task and the code it touches, trace the real flow end-to-end, then climb.
|
|
22
|
+
|
|
23
|
+
## Root Cause Over Symptom
|
|
24
|
+
Bug fix = root cause, not symptom. A bug report names a symptom. Grep every caller of the function you touch and fix the shared function once — one guard there is a smaller diff than one per caller, and patching only the path the ticket names leaves sibling callers still broken.
|
|
25
|
+
|
|
26
|
+
## Foundational Principles
|
|
27
|
+
- **Think Before Coding**: Thoroughly understand requirements. If ambiguous, ask before guessing.
|
|
28
|
+
- **Surgical Changes**: Make the smallest change that satisfies the request; touch only what is explicitly required.
|
|
29
|
+
- **Simplicity First (KISS / YAGNI)**: Favor simple, clear, maintainable solutions over clever abstractions. Do not add unrequested features.
|
|
30
|
+
- **Zero-Error Builds**: Every change must compile cleanly and pass existing and newly added tests.
|
|
31
|
+
- **Standards, Security & Review**: Adhere strictly to `AgentSkills/skills/standards/SKILL.md`, `AgentSkills/skills/security/SKILL.md`, and `AgentSkills/skills/review/SKILL.md`.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review
|
|
3
|
+
description: Code review framework, verification criteria, correctness, and review output standards.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review Guidelines
|
|
7
|
+
|
|
8
|
+
Universal review framework and verification standards for AI agents and human reviewers across all stacks.
|
|
9
|
+
|
|
10
|
+
## Five Review Dimensions
|
|
11
|
+
1. **Correctness**: Verify behavior matches specifications, handle boundary/edge cases (null, empty, limits, errors), and ensure changes are free of race conditions.
|
|
12
|
+
2. **Readability**: Ensure naming is domain-meaningful, control flow is simple (depth <= 2), and functions do not exceed 50 lines.
|
|
13
|
+
3. **Architecture**: Adhere to SOLID, DRY, and KISS; keep clean module boundaries; avoid circular dependencies and speculative abstractions (YAGNI).
|
|
14
|
+
4. **Security**: Validate untrusted inputs, use parameterized queries, never commit or log credentials/PII, and check for safe error handling.
|
|
15
|
+
5. **Performance**: Avoid N+1 queries, unbounded loops, blocking operations in async flows, and redundant re-computations.
|
|
16
|
+
|
|
17
|
+
## Verification & Automated Checks
|
|
18
|
+
- [ ] **Clean Build**: Project builds cleanly with zero errors or warnings.
|
|
19
|
+
- [ ] **Zero Lint Errors**: Code adheres to project formatting and static analysis rules.
|
|
20
|
+
- [ ] **Tests Pass**: Run test suite; all existing and newly added tests must pass.
|
|
21
|
+
- [ ] **Test Robustness**: Tests must cover failure paths, edge cases, and boundary conditions, not just happy paths.
|
|
22
|
+
|
|
23
|
+
## Review Output Format
|
|
24
|
+
Categorize every review finding clearly:
|
|
25
|
+
- **Critical**: Must fix before merge (security flaw, data corruption, broken functionality).
|
|
26
|
+
- **Important**: Should fix before merge (missing test coverage, poor error recovery, rule violation).
|
|
27
|
+
- **Suggestion**: Optional improvements (naming, non-critical refactoring).
|
|
28
|
+
|
|
29
|
+
## Review Rules
|
|
30
|
+
- Review tests first to understand intent and coverage.
|
|
31
|
+
- Address root causes over symptoms; fix shared logic once rather than patching callers.
|
|
32
|
+
- Never weaken, skip, or delete existing tests to force a pass.
|
|
33
|
+
- Provide concrete, actionable fixes for every Critical and Important finding.
|
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
# Agent Instructions
|
|
1
|
+
# Agent & Developer Instructions
|
|
2
|
+
|
|
3
|
+
> Operating instructions and engineering guidelines for AI agents and human contributors.
|
|
2
4
|
|
|
3
5
|
## Operating Contract
|
|
4
|
-
Always follow `AgentSkills/OPERATING.md` before making changes.
|
|
6
|
+
Always follow `AgentSkills/OPERATING.md` before making changes. Review relevant agent personas in `AgentSkills/agents/` (`architect.md`, `reviewer.md`, `developer.md`) and skills in `AgentSkills/skills/` (including `AgentSkills/skills/review/SKILL.md`).
|
|
5
7
|
|
|
6
8
|
## Goal
|
|
7
|
-
Implement
|
|
8
|
-
minimizing the diff, following the project's own architecture and conventions.
|
|
9
|
+
Implement requested changes with production-quality code, preserving existing behavior and
|
|
10
|
+
minimizing the diff, following the project's own architecture, standards, and conventions.
|
|
9
11
|
|
|
10
12
|
## Core Principles
|
|
13
|
+
- **Principles**: Adhere strictly to `AgentSkills/skills/principles/SKILL.md`.
|
|
14
|
+
- **Standards**: Adhere strictly to `AgentSkills/skills/standards/SKILL.md`.
|
|
15
|
+
- **Security**: Adhere strictly to `AgentSkills/skills/security/SKILL.md`.
|
|
16
|
+
- **Review**: Adhere strictly to `AgentSkills/skills/review/SKILL.md`.
|
|
11
17
|
- **Think Before Coding**: Thoroughly understand requirements. If ambiguous, ask before guessing.
|
|
12
18
|
- **Surgical Changes**: Make the smallest change that satisfies the request; touch only what is explicitly required.
|
|
13
19
|
- **Simplicity First (KISS / YAGNI)**: Favor simple, clear, maintainable solutions over clever abstractions. Do not add unrequested features.
|
|
14
20
|
- **Zero-Error Builds**: Every change must compile cleanly and pass existing and newly added tests.
|
|
15
|
-
- **Standards & Security**: Adhere strictly to `AgentSkills/skills/standards/SKILL.md` and `AgentSkills/skills/security/SKILL.md`.
|
|
16
21
|
|
|
17
22
|
## Definition of Done
|
|
18
23
|
- Builds cleanly and all tests pass without errors or warnings.
|
|
19
24
|
- No debug code, dead code, unused imports, or temporary files left behind.
|
|
20
25
|
- Changes are minimal, focused, covered by tests, and easy to review.
|
|
21
26
|
|
|
22
|
-
## Agent Memory
|
|
27
|
+
## Agent & Contributor Memory
|
|
23
28
|
- Read `AgentSkills/memory/index.md` at the start of every task (create if missing); load only relevant domain lessons.
|
|
24
|
-
- When a mistake is corrected or a durable rule discovered, record an actionable lesson in `AgentSkills/memory/lessons/<domain>.md` (create if missing) and update `index.md`.
|
|
29
|
+
- When a mistake is corrected or a durable rule discovered, record an actionable lesson in `AgentSkills/memory/lessons/<domain>.md` (create if missing) and update `index.md`.
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: reviewer
|
|
3
|
-
description: Code review, correctness, security, and standards verification.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Code Reviewer Guidance
|
|
7
|
-
|
|
8
|
-
## Review Checklist
|
|
9
|
-
|
|
10
|
-
### Scope & Minimality
|
|
11
|
-
- [ ] Minimal diff that directly satisfies the request without unrelated edits or speculative additions (YAGNI).
|
|
12
|
-
- [ ] No dead code, debug logging, commented-out code, or unused imports/variables left behind.
|
|
13
|
-
|
|
14
|
-
### Quality & Standards
|
|
15
|
-
- [ ] Functions stay within 50 lines, nesting depth at most 2 levels, and clean signatures ($\le 4$ params).
|
|
16
|
-
- [ ] Follows established codebase naming conventions, architectural boundaries, and error patterns.
|
|
17
|
-
- [ ] No magic numbers or strings (constants/enums used appropriately).
|
|
18
|
-
|
|
19
|
-
### Security & Reliability
|
|
20
|
-
- [ ] No hardcoded credentials, tokens, passwords, or exposed sensitive user PII.
|
|
21
|
-
- [ ] Input validation applied at boundaries; queries parameterized against injection.
|
|
22
|
-
- [ ] Concurrency and async flows are free of race conditions and deadlocks.
|
|
23
|
-
|
|
24
|
-
### Verification & Tests
|
|
25
|
-
- [ ] Clean build with zero errors and warnings.
|
|
26
|
-
- [ ] Tests pass and verify both success scenarios and failure/edge-case paths.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|