@yarkingulacti/agentic-scaffold 0.6.0 → 0.7.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 +12 -3
- package/bin/index.js +8 -5
- package/package.json +7 -2
- package/src/prompts.js +2 -2
- package/src/scaffold.js +10 -1
- package/templates/docs/agents/session-close.md.hbs +5 -0
- package/templates/hooks/post-bugfix.md.hbs +17 -0
- package/templates/hooks/post-feature.md.hbs +18 -0
- package/templates/hooks/post-session.md.hbs +34 -0
- package/templates/hooks/pre-feature.md.hbs +17 -0
- package/templates/hooks/scripts/post-bugfix.sh.hbs +15 -0
- package/templates/hooks/scripts/post-feature.sh.hbs +15 -0
- package/templates/hooks/scripts/post-session.sh.hbs +15 -0
- package/templates/hooks/scripts/pre-feature.sh.hbs +15 -0
- package/templates/root/AGENTS.md.hbs +12 -0
- package/templates/root/CLAUDE.md.hbs +12 -0
- package/templates/skills/bugfix/SKILL.md +2 -1
- package/templates/skills/create-hook/SKILL.md +91 -0
- package/templates/skills/implement/SKILL.md +7 -5
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ npx @yarkingulacti/agentic-scaffold --interactive
|
|
|
60
60
|
npx @yarkingulacti/agentic-scaffold --target ../my-project
|
|
61
61
|
|
|
62
62
|
# Skip specific groups
|
|
63
|
-
npx @yarkingulacti/agentic-scaffold --skip-skills --skip-scripts
|
|
63
|
+
npx @yarkingulacti/agentic-scaffold --skip-skills --skip-scripts --skip-hooks
|
|
64
64
|
|
|
65
65
|
# Pre-configure values
|
|
66
66
|
npx @yarkingulacti/agentic-scaffold --project-name "my-app" --issue-tracker github
|
|
@@ -87,7 +87,8 @@ project/
|
|
|
87
87
|
│ │ └── glossary.md # Ubiquitous language glossary
|
|
88
88
|
│ ├── engineering/README.md
|
|
89
89
|
│ └── product/README.md
|
|
90
|
-
├── .agents/skills/ # Agent skill definitions (
|
|
90
|
+
├── .agents/skills/ # Agent skill definitions (21 skills)
|
|
91
|
+
├── .agents/hooks/ # Pre/post lifecycle hooks for agent workflows
|
|
91
92
|
├── scripts/ # Markdown memory indexing pipeline
|
|
92
93
|
├── .scratchpad/ # Local detailed planning
|
|
93
94
|
└── .history/ # Shipped work summaries
|
|
@@ -115,7 +116,15 @@ CLI flags.
|
|
|
115
116
|
|-------|-------------|------|
|
|
116
117
|
| `docs` | Documentation framework (CODING_PRINCIPLES, ADR, agents, context) | `--skip-docs` |
|
|
117
118
|
| `scripts` | Python memory indexing pipeline (sqlite-vec based RAG) | `--skip-scripts` |
|
|
118
|
-
| `skills` |
|
|
119
|
+
| `skills` | 21 agent skills (implement, bugfix, create-hook, diagnose, tdd, fill-docs, etc.) | `--skip-skills` |
|
|
120
|
+
| `hooks` | Pre/post lifecycle hooks for agent workflows (pre-feature, post-feature, post-bugfix, post-session) with executable scripts | `--skip-hooks` |
|
|
121
|
+
|
|
122
|
+
## New in v0.7
|
|
123
|
+
|
|
124
|
+
- **Agent lifecycle hooks** — new `.agents/hooks/` component group with 4 hooks (pre-feature, post-feature, post-bugfix, post-session) and executable shell scripts. Skills reference hooks conditionally with graceful fallback.
|
|
125
|
+
- **`create-hook` skill** — new agent skill that guides you through adding custom hooks for any lifecycle point.
|
|
126
|
+
- **`--skip-hooks` flag** — skip the hooks component group.
|
|
127
|
+
- **98 tests** — detection, scaffolding, CLI, and hooks tested end-to-end.
|
|
119
128
|
|
|
120
129
|
## New in v0.5
|
|
121
130
|
|
package/bin/index.js
CHANGED
|
@@ -35,11 +35,14 @@ const argv = yargs(hideBin(process.argv))
|
|
|
35
35
|
description: "Comma-separated component groups to include: docs,scripts,skills,all",
|
|
36
36
|
default: "all",
|
|
37
37
|
})
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
.option("skip-skills", {
|
|
39
|
+
type: "boolean",
|
|
40
|
+
description: "Skip agent skill definitions",
|
|
41
|
+
})
|
|
42
|
+
.option("skip-hooks", {
|
|
43
|
+
type: "boolean",
|
|
44
|
+
description: "Skip agent lifecycle hook templates",
|
|
45
|
+
})
|
|
43
46
|
.option("skip-scripts", {
|
|
44
47
|
type: "boolean",
|
|
45
48
|
description: "Skip memory scripts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yarkingulacti/agentic-scaffold",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Scaffold agentic development documentation & configuration into any project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
17
|
"test": "node --test tests/*.test.js",
|
|
18
|
-
"prepublishOnly": "npm test"
|
|
18
|
+
"prepublishOnly": "npm test",
|
|
19
|
+
"release": "commit-and-tag-version",
|
|
20
|
+
"release:dry": "commit-and-tag-version --dry-run"
|
|
19
21
|
},
|
|
20
22
|
"dependencies": {
|
|
21
23
|
"handlebars": "^4.7.8",
|
|
@@ -29,5 +31,8 @@
|
|
|
29
31
|
"repository": {
|
|
30
32
|
"type": "git",
|
|
31
33
|
"url": "git+https://github.com/yarkingulacti/agentic-scaffold.git"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"commit-and-tag-version": "^12.7.3"
|
|
32
37
|
}
|
|
33
38
|
}
|
package/src/prompts.js
CHANGED
|
@@ -36,10 +36,10 @@ export async function askOverwrite(filePath) {
|
|
|
36
36
|
export async function askComponents() {
|
|
37
37
|
const r = rl();
|
|
38
38
|
console.log("\nComponent groups to include (comma-separated):");
|
|
39
|
-
console.log(" docs, scripts, skills");
|
|
39
|
+
console.log(" docs, scripts, skills, hooks");
|
|
40
40
|
const answer = await r.question("All [default]: ");
|
|
41
41
|
r.close();
|
|
42
42
|
const trimmed = answer.trim().toLowerCase();
|
|
43
|
-
if (!trimmed) return ["docs", "scripts", "skills"];
|
|
43
|
+
if (!trimmed) return ["docs", "scripts", "skills", "hooks"];
|
|
44
44
|
return trimmed.split(",").map((s) => s.trim()).filter(Boolean);
|
|
45
45
|
}
|
package/src/scaffold.js
CHANGED
|
@@ -43,10 +43,11 @@ function resolveIncludes(argv) {
|
|
|
43
43
|
if (argv.only && argv.only !== "all") {
|
|
44
44
|
return new Set(argv.only.split(",").map((s) => s.trim()));
|
|
45
45
|
}
|
|
46
|
-
const set = new Set(["docs", "scripts", "skills"]);
|
|
46
|
+
const set = new Set(["docs", "scripts", "skills", "hooks"]);
|
|
47
47
|
if (argv.skipDocs) set.delete("docs");
|
|
48
48
|
if (argv.skipScripts) set.delete("scripts");
|
|
49
49
|
if (argv.skipSkills) set.delete("skills");
|
|
50
|
+
if (argv.skipHooks) set.delete("hooks");
|
|
50
51
|
return set;
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -239,6 +240,12 @@ async function scaffoldSkills(config, extraOpts = {}) {
|
|
|
239
240
|
return copyStaticDir(skillsSrc, skillsDest, { force: config.force, interactive: config.interactive, ...extraOpts });
|
|
240
241
|
}
|
|
241
242
|
|
|
243
|
+
async function scaffoldHooks(config, hbData, extraOpts = {}) {
|
|
244
|
+
const hooksSrc = join(TEMPLATES_DIR, "hooks");
|
|
245
|
+
const hooksDest = join(config.target, ".agents", "hooks");
|
|
246
|
+
return renderDir(hooksSrc, hooksDest, hbData, { force: config.force, interactive: config.interactive, ...extraOpts });
|
|
247
|
+
}
|
|
248
|
+
|
|
242
249
|
async function scaffoldScratchpad(config, extraOpts = {}) {
|
|
243
250
|
const src = join(TEMPLATES_DIR, "scratchpad");
|
|
244
251
|
const dest = join(config.target, ".scratchpad");
|
|
@@ -257,6 +264,7 @@ function countTemplateFiles(config) {
|
|
|
257
264
|
...(config.include.has("docs") ? [join(TEMPLATES_DIR, "docs")] : []),
|
|
258
265
|
...(config.include.has("scripts") ? [join(TEMPLATES_DIR, "scripts")] : []),
|
|
259
266
|
...(config.include.has("skills") ? [join(TEMPLATES_DIR, "skills")] : []),
|
|
267
|
+
...(config.include.has("hooks") ? [join(TEMPLATES_DIR, "hooks")] : []),
|
|
260
268
|
join(TEMPLATES_DIR, "scratchpad"),
|
|
261
269
|
join(TEMPLATES_DIR, "history"),
|
|
262
270
|
];
|
|
@@ -311,6 +319,7 @@ export async function scaffold(argv) {
|
|
|
311
319
|
if (config.include.has("docs")) results.push(...(await scaffoldDocs(config, hbData, tickOpts)));
|
|
312
320
|
if (config.include.has("scripts")) results.push(...(await scaffoldScripts(config, hbData, tickOpts)));
|
|
313
321
|
if (config.include.has("skills")) results.push(...(await scaffoldSkills(config, tickOpts)));
|
|
322
|
+
if (config.include.has("hooks")) results.push(...(await scaffoldHooks(config, hbData, tickOpts)));
|
|
314
323
|
|
|
315
324
|
results.push(...(await scaffoldScratchpad(config, tickOpts)));
|
|
316
325
|
results.push(...(await scaffoldHistory(config, tickOpts)));
|
|
@@ -5,6 +5,11 @@ handing off.
|
|
|
5
5
|
|
|
6
6
|
## Required Steps
|
|
7
7
|
|
|
8
|
+
If `.agents/hooks/post-session.md` exists, read and follow it instead of this
|
|
9
|
+
file — it contains the canonical post-session workflow.
|
|
10
|
+
|
|
11
|
+
Otherwise, follow the steps below:
|
|
12
|
+
|
|
8
13
|
1. Run the relevant tests.
|
|
9
14
|
2. Build every touched project when a build command exists.
|
|
10
15
|
3. Create or update `.history/DD.MM.YYYY/README.md` with the master work title,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Post-Bugfix Hook
|
|
2
|
+
|
|
3
|
+
Fires after a bugfix is delivered.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. Run the project's test suite to confirm the fix does not regress:
|
|
8
|
+
{{#if packageManager}} `{{packageManager}} test`{{else}} `npm test`{{/if}}
|
|
9
|
+
2. Run `.agents/hooks/scripts/post-bugfix.sh` if it exists.
|
|
10
|
+
3. Update `.history/DD.MM.YYYY/README.md` with a summary of the fix.
|
|
11
|
+
4. Update the related `.scratchpad/` status to mark completion.
|
|
12
|
+
5. Create a Conventional Commit under the master work title.
|
|
13
|
+
|
|
14
|
+
## When to skip
|
|
15
|
+
|
|
16
|
+
If the project has no tests or no history directory, skip the unavailable
|
|
17
|
+
steps silently. Do not pretend they succeeded.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Post-Feature Hook
|
|
2
|
+
|
|
3
|
+
Fires after a feature is delivered by any implementation skill.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. Run the project's test suite:
|
|
8
|
+
{{#if packageManager}} `{{packageManager}} test`{{else}} `npm test`{{/if}}
|
|
9
|
+
2. Run `.agents/hooks/scripts/post-feature.sh` if it exists.
|
|
10
|
+
3. Update `.history/DD.MM.YYYY/README.md` with a summary of shipped work.
|
|
11
|
+
4. Run `scripts/memory_index.py` to keep the vector index current.
|
|
12
|
+
5. Update the related `.scratchpad/` status to mark completion.
|
|
13
|
+
6. Create a Conventional Commit under the master work title.
|
|
14
|
+
|
|
15
|
+
## When to skip
|
|
16
|
+
|
|
17
|
+
If the project has no tests, no history directory, or no memory pipeline,
|
|
18
|
+
skip the unavailable steps silently. Do not pretend they succeeded.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Post-Session Hook
|
|
2
|
+
|
|
3
|
+
Fires after every successful coding session, regardless of the skill used.
|
|
4
|
+
Replaces the legacy session-close workflow.
|
|
5
|
+
|
|
6
|
+
## Steps
|
|
7
|
+
|
|
8
|
+
1. Run `.agents/hooks/scripts/post-session.sh` if it exists.
|
|
9
|
+
2. Run all applicable post-* hooks that match the work done:
|
|
10
|
+
- After feature work: `.agents/hooks/post-feature.md`
|
|
11
|
+
- After bugfix work: `.agents/hooks/post-bugfix.md`
|
|
12
|
+
3. Build every touched project when a build command exists.
|
|
13
|
+
4. Run `scripts/memory_index.py` so `.history/` is in the vector database.
|
|
14
|
+
5. Update all affected `.scratchpad/` status lines.
|
|
15
|
+
6. Push the feature/bugfix branch to the remote.
|
|
16
|
+
7. Create a PR, review it, merge it, then delete the PR branch.
|
|
17
|
+
|
|
18
|
+
## Commit Message Format
|
|
19
|
+
|
|
20
|
+
Use the master work title as the first line, then the Conventional Commit:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
<Master work title>
|
|
24
|
+
|
|
25
|
+
<type>(<scope>): <short imperative summary>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Allowed types: `feat`, `fix`, `docs`, `refactor`, `test`, `build`, `ci`, `chore`.
|
|
29
|
+
|
|
30
|
+
## Blockers
|
|
31
|
+
|
|
32
|
+
If a step cannot run because the repo has no command, no remote, invalid
|
|
33
|
+
auth, or missing external service, record that in `.history/` and the final
|
|
34
|
+
response. Do not pretend the step succeeded.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Pre-Feature Hook
|
|
2
|
+
|
|
3
|
+
Fires before a feature implementation begins, regardless of which skill
|
|
4
|
+
initiates the work.
|
|
5
|
+
|
|
6
|
+
## Steps
|
|
7
|
+
|
|
8
|
+
1. Read `BUSINESS_LOGIC.md` and any relevant ADR.
|
|
9
|
+
2. Read the issue ticket and matching `.scratchpad/` detail file.
|
|
10
|
+
3. If no scratchpad detail exists and the task is complex, create one.
|
|
11
|
+
4. Read `docs/CODING_PRINCIPLES.md` to confirm approach.
|
|
12
|
+
5. Run `.agents/hooks/scripts/pre-feature.sh` if it exists.
|
|
13
|
+
|
|
14
|
+
## When to skip
|
|
15
|
+
|
|
16
|
+
If any referenced file does not exist, proceed silently — do not flag the
|
|
17
|
+
absence unless the task specifically requires it.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Post-bugfix hook — runs after a bugfix is delivered.
|
|
3
|
+
# Customize this file with project-specific post-fix tasks.
|
|
4
|
+
#
|
|
5
|
+
# Available context variables:
|
|
6
|
+
# projectName = "{{projectName}}"
|
|
7
|
+
# packageManager = "{{packageManager}}"
|
|
8
|
+
# scriptLanguage = "{{scriptLanguage}}"
|
|
9
|
+
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
echo "Running post-bugfix checks for {{projectName}}..."
|
|
13
|
+
{{#if packageManager}}
|
|
14
|
+
{{packageManager}} run lint 2>/dev/null || true
|
|
15
|
+
{{/if}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Post-feature hook — runs after a feature is delivered.
|
|
3
|
+
# Customize this file with project-specific post-delivery tasks.
|
|
4
|
+
#
|
|
5
|
+
# Available context variables:
|
|
6
|
+
# projectName = "{{projectName}}"
|
|
7
|
+
# packageManager = "{{packageManager}}"
|
|
8
|
+
# scriptLanguage = "{{scriptLanguage}}"
|
|
9
|
+
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
echo "Running post-feature tasks for {{projectName}}..."
|
|
13
|
+
{{#if packageManager}}
|
|
14
|
+
{{packageManager}} run lint 2>/dev/null || true
|
|
15
|
+
{{/if}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Post-session hook — runs after every successful coding session.
|
|
3
|
+
# Customize this file with project-specific session-close tasks.
|
|
4
|
+
#
|
|
5
|
+
# Available context variables:
|
|
6
|
+
# projectName = "{{projectName}}"
|
|
7
|
+
# packageManager = "{{packageManager}}"
|
|
8
|
+
# scriptLanguage = "{{scriptLanguage}}"
|
|
9
|
+
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
echo "Running post-session tasks for {{projectName}}..."
|
|
13
|
+
{{#if packageManager}}
|
|
14
|
+
{{packageManager}} run build 2>/dev/null || true
|
|
15
|
+
{{/if}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Pre-feature hook — runs before feature implementation begins.
|
|
3
|
+
# Customize this file with project-specific pre-flight checks.
|
|
4
|
+
#
|
|
5
|
+
# Available context variables:
|
|
6
|
+
# projectName = "{{projectName}}"
|
|
7
|
+
# packageManager = "{{packageManager}}"
|
|
8
|
+
# scriptLanguage = "{{scriptLanguage}}"
|
|
9
|
+
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
echo "Running pre-feature checks for {{projectName}}..."
|
|
13
|
+
{{#if packageManager}}
|
|
14
|
+
echo " Package manager: {{packageManager}}"
|
|
15
|
+
{{/if}}
|
|
@@ -22,6 +22,18 @@ Shipped work is summarized in `.history/DD.MM.YYYY/README.md`. Use separated
|
|
|
22
22
|
dated worklog files only; do not use issue comments as the project memory.
|
|
23
23
|
After every successful coding session, follow `docs/agents/session-close.md`.
|
|
24
24
|
|
|
25
|
+
### Agent lifecycle hooks
|
|
26
|
+
|
|
27
|
+
Pre/post lifecycle hooks live in `.agents/hooks/`. Implementation skills
|
|
28
|
+
reference them automatically. Available hooks:
|
|
29
|
+
|
|
30
|
+
- `.agents/hooks/pre-feature.md` — before implementing a feature
|
|
31
|
+
- `.agents/hooks/post-feature.md` — after implementing a feature
|
|
32
|
+
- `.agents/hooks/post-bugfix.md` — after fixing a bug
|
|
33
|
+
- `.agents/hooks/post-session.md` — after a coding session (canonical
|
|
34
|
+
post-session workflow, replaces `docs/agents/session-close.md`)
|
|
35
|
+
- `.agents/hooks/scripts/` — executable helpers for the hooks above
|
|
36
|
+
|
|
25
37
|
### Domain docs
|
|
26
38
|
|
|
27
39
|
Use `BUSINESS_LOGIC.md`, `docs/`, and `docs/adr/` as tracked source material.
|
|
@@ -22,6 +22,18 @@ Shipped work is summarized in `.history/DD.MM.YYYY/README.md`. Use separated
|
|
|
22
22
|
dated worklog files only; do not use issue comments as the project memory.
|
|
23
23
|
After every successful coding session, follow `docs/agents/session-close.md`.
|
|
24
24
|
|
|
25
|
+
### Agent lifecycle hooks
|
|
26
|
+
|
|
27
|
+
Pre/post lifecycle hooks live in `.agents/hooks/`. Implementation skills
|
|
28
|
+
reference them automatically. Available hooks:
|
|
29
|
+
|
|
30
|
+
- `.agents/hooks/pre-feature.md` — before implementing a feature
|
|
31
|
+
- `.agents/hooks/post-feature.md` — after implementing a feature
|
|
32
|
+
- `.agents/hooks/post-bugfix.md` — after fixing a bug
|
|
33
|
+
- `.agents/hooks/post-session.md` — after a coding session (canonical
|
|
34
|
+
post-session workflow, replaces `docs/agents/session-close.md`)
|
|
35
|
+
- `.agents/hooks/scripts/` — executable helpers for the hooks above
|
|
36
|
+
|
|
25
37
|
### Domain docs
|
|
26
38
|
|
|
27
39
|
Use `BUSINESS_LOGIC.md`, `docs/`, and `docs/adr/` as tracked source material.
|
|
@@ -9,4 +9,5 @@ Diagnose and fix a described bug.
|
|
|
9
9
|
3. Identify the smallest root-cause fix.
|
|
10
10
|
4. Add or update a regression test when practical.
|
|
11
11
|
5. Run focused verification.
|
|
12
|
-
6.
|
|
12
|
+
6. If `.agents/hooks/post-bugfix.md` exists, read and follow it.
|
|
13
|
+
Otherwise record shipped work in `.history/DD.MM.YYYY/README.md`.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-hook
|
|
3
|
+
description: >
|
|
4
|
+
Interview the user to identify a new lifecycle hook point, then create the
|
|
5
|
+
hook markdown file, optional executable script, and wire it into the
|
|
6
|
+
relevant skills.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Create Hook
|
|
10
|
+
|
|
11
|
+
Add a new agent lifecycle hook to `.agents/hooks/`. Hooks are markdown files
|
|
12
|
+
that describe what an AI agent should do at a specific point in the workflow
|
|
13
|
+
(pre-feature, post-bugfix, etc.).
|
|
14
|
+
|
|
15
|
+
## Steps
|
|
16
|
+
|
|
17
|
+
### 1. Determine the hook point
|
|
18
|
+
|
|
19
|
+
Ask the user what event should trigger the hook. Common patterns:
|
|
20
|
+
|
|
21
|
+
| Prefix | Meaning | Example |
|
|
22
|
+
|--------|---------|---------|
|
|
23
|
+
| `pre-` | Before an event | `pre-deploy`, `pre-commit`, `pre-test` |
|
|
24
|
+
| `post-` | After an event | `post-deploy`, `post-migration`, `post-docs-change` |
|
|
25
|
+
|
|
26
|
+
If the user is unsure, suggest hooking into `post-session.md` instead — it
|
|
27
|
+
already chains to `post-feature.md` and `post-bugfix.md`.
|
|
28
|
+
|
|
29
|
+
### 2. Name and create the hook file
|
|
30
|
+
|
|
31
|
+
Name the file `<prefix>-<name>.md` and create it at `.agents/hooks/`. Use
|
|
32
|
+
this anatomy:
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
# <Name> Hook
|
|
36
|
+
|
|
37
|
+
Fires <when this hook runs, e.g. "after every database migration">.
|
|
38
|
+
|
|
39
|
+
## Steps
|
|
40
|
+
|
|
41
|
+
1. First step the agent should take.
|
|
42
|
+
2. Second step.
|
|
43
|
+
3. Run `.agents/hooks/scripts/<name>.sh` if it exists.
|
|
44
|
+
|
|
45
|
+
## When to skip
|
|
46
|
+
|
|
47
|
+
Conditions under which the agent should silently skip this hook.
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 3. Create the optional executable script
|
|
51
|
+
|
|
52
|
+
If the hook needs automation, create `.agents/hooks/scripts/<name>.sh`:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
#!/usr/bin/env bash
|
|
56
|
+
# <Name> hook — runs <when>.
|
|
57
|
+
set -euo pipefail
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Follow the project's script language convention. Make the script
|
|
61
|
+
idempotent where possible.
|
|
62
|
+
|
|
63
|
+
### 4. Wire into skills
|
|
64
|
+
|
|
65
|
+
Add a conditional reference in every skill where the hook should fire.
|
|
66
|
+
Use the existing pattern:
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
4. If `.agents/hooks/<hook-name>.md` exists, read and follow it.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Skills commonly wired to hooks:
|
|
73
|
+
|
|
74
|
+
| Skill | Hook point | File |
|
|
75
|
+
|-------|-----------|------|
|
|
76
|
+
| `implement` | pre + post | `.agents/skills/implement/SKILL.md` |
|
|
77
|
+
| `bugfix` | post | `.agents/skills/bugfix/SKILL.md` |
|
|
78
|
+
| `tdd` | pre + post | `.agents/skills/tdd/SKILL.md` |
|
|
79
|
+
|
|
80
|
+
### 5. Wire into the session close chain
|
|
81
|
+
|
|
82
|
+
If the hook should fire at the end of every session, add it to the
|
|
83
|
+
`post-session.md` chaining step — for example, after the existing
|
|
84
|
+
sub-hook references.
|
|
85
|
+
|
|
86
|
+
### 6. Confirm with the user
|
|
87
|
+
|
|
88
|
+
Show the user:
|
|
89
|
+
- The new hook file path
|
|
90
|
+
- The script file path (if created)
|
|
91
|
+
- Which skills reference it
|
|
@@ -6,10 +6,12 @@ when not in Plan Mode.
|
|
|
6
6
|
## Steps
|
|
7
7
|
|
|
8
8
|
1. Read `BUSINESS_LOGIC.md` and relevant ADRs.
|
|
9
|
-
2.
|
|
10
|
-
3.
|
|
11
|
-
4.
|
|
12
|
-
5.
|
|
13
|
-
6.
|
|
9
|
+
2. If `.agents/hooks/pre-feature.md` exists, read and follow it.
|
|
10
|
+
3. Read the Linear issue and matching `.scratchpad/` detail file.
|
|
11
|
+
4. If no scratchpad detail exists, create one before coding.
|
|
12
|
+
5. Implement the smallest complete slice that satisfies the plan.
|
|
13
|
+
6. Run focused verification.
|
|
14
|
+
7. If `.agents/hooks/post-feature.md` exists, read and follow it.
|
|
15
|
+
Otherwise record shipped work in `.history/DD.MM.YYYY/README.md`.
|
|
14
16
|
|
|
15
17
|
Keep Linear descriptions short. Keep detailed reasoning in `.scratchpad/`.
|