thomas-agentkit 0.7.0 → 0.9.0-alpha.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 +96 -3
- package/dist/cli.js +124 -21
- package/dist/skill-install.js +125 -0
- package/package.json +3 -1
- package/templates/.cursor/rules/agentkit.md +11 -10
- package/templates/.github/copilot-instructions.md +1 -9
- package/templates/AGENTS.md +67 -32
- package/templates/CHANGE-EXPLANATION.md +20 -4
- package/templates/CLAUDE.md +2 -12
- package/templates/CODE-QUALITY.md +5 -15
- package/templates/IMPLEMENTATION-BRIEF-TEMPLATE.md +2 -0
- package/templates/PRD-TEMPLATE.md +2 -0
- package/templates/SECURITY-CHECKLIST.md +2 -2
- package/templates/TESTING.md +1 -1
- package/templates/WORKFLOWS.md +13 -86
- package/templates/skills/agentkit/SKILL.md +94 -0
- package/templates/skills/agentkit/agents/openai.yaml +4 -0
- package/templates/skills/agentkit/references/doctor.md +133 -0
- package/templates/skills/agentkit/references/file-contract.md +163 -0
- package/templates/skills/agentkit/references/init.md +212 -0
- package/templates/skills/agentkit/references/learn.md +149 -0
- package/templates/skills/agentkit/references/repair.md +119 -0
- package/templates/skills/agentkit/references/update.md +201 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# AgentKit File Contract
|
|
2
|
+
|
|
3
|
+
Read this before creating, updating, auditing, or repairing any AgentKit-managed guidance file.
|
|
4
|
+
|
|
5
|
+
This contract is the shared rulebook for AgentKit guidance-edit workflows. Route files define procedure; this file defines the invariants every route must preserve.
|
|
6
|
+
|
|
7
|
+
## Config
|
|
8
|
+
|
|
9
|
+
Read `agentkit.config.json` from the repository root when present:
|
|
10
|
+
|
|
11
|
+
| Field | Use |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| `installMode` | `"skill"` confirms a skill-path project; missing values are treated as template-path unless the user explicitly invokes the skill workflow |
|
|
14
|
+
| `agentkitVersion` | Package version at skill install; informational |
|
|
15
|
+
| `templateSet` | `minimal`, `standard`, or `full`; determines configured guidance inventory |
|
|
16
|
+
| `preset` | Stack preset (`next`, `sveltekit`, `express`, `convex`, `fullstack`) used for `STACK.md` |
|
|
17
|
+
| `aiTools` | Which thin adapter files to create (`codex`, `cursor`, `claude`, `copilot`) |
|
|
18
|
+
| `designSystem` | `linear` or `apple`; style lens for `DESIGN-SYSTEM.md` |
|
|
19
|
+
| `personalization` | Fallback defaults for project name, commands, and paths; repo facts win when available |
|
|
20
|
+
|
|
21
|
+
Prefer repository facts over config personalization. Use config values as defaults, not as a reason to ignore visible codebase reality.
|
|
22
|
+
|
|
23
|
+
## Route Behavior
|
|
24
|
+
|
|
25
|
+
- `agentkit init`: create missing configured guidance files from repo context; skip existing files by default.
|
|
26
|
+
- `agentkit update`: refresh valid AgentKit managed blocks and create missing configured files; skip unmanaged files by default.
|
|
27
|
+
- `agentkit doctor`: audit guidance quality and report findings; do not edit by default.
|
|
28
|
+
- `agentkit learn`: teach recent codebase changes; do not edit or create files by default.
|
|
29
|
+
- Refresh, conversion, repair, or wholesale regeneration requires an explicit user request.
|
|
30
|
+
|
|
31
|
+
## File Inventory
|
|
32
|
+
|
|
33
|
+
### Template sets
|
|
34
|
+
|
|
35
|
+
`minimal`:
|
|
36
|
+
|
|
37
|
+
- `AGENTS.md`
|
|
38
|
+
|
|
39
|
+
`standard`:
|
|
40
|
+
|
|
41
|
+
- `AGENTS.md`
|
|
42
|
+
- `CHANGE-EXPLANATION.md`
|
|
43
|
+
- `CODE-QUALITY.md`
|
|
44
|
+
- `DESIGN-SYSTEM.md`
|
|
45
|
+
- `.github/pull_request_template.md`
|
|
46
|
+
|
|
47
|
+
`full`:
|
|
48
|
+
|
|
49
|
+
- Everything in `standard`
|
|
50
|
+
- `TESTING.md`
|
|
51
|
+
- `SECURITY-CHECKLIST.md`
|
|
52
|
+
- `WORKFLOWS.md`
|
|
53
|
+
- `PRD-TEMPLATE.md`
|
|
54
|
+
- `IMPLEMENTATION-BRIEF-TEMPLATE.md`
|
|
55
|
+
|
|
56
|
+
### AI tool adapters
|
|
57
|
+
|
|
58
|
+
Adapters are additive and controlled by `aiTools` or explicit user request. Do not create adapters for unselected tools just because `templateSet` is `full`.
|
|
59
|
+
|
|
60
|
+
| Tool | File |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| `codex` | Uses `AGENTS.md` directly; no adapter file |
|
|
63
|
+
| `cursor` | `.cursor/rules/agentkit.md` |
|
|
64
|
+
| `claude` | `CLAUDE.md` |
|
|
65
|
+
| `copilot` | `.github/copilot-instructions.md` |
|
|
66
|
+
|
|
67
|
+
Adapters are thin pointers to `AGENTS.md`. Do not duplicate operating rules.
|
|
68
|
+
|
|
69
|
+
### Stack guidance
|
|
70
|
+
|
|
71
|
+
Create or update `STACK.md` when:
|
|
72
|
+
|
|
73
|
+
- `preset` is set in config
|
|
74
|
+
- the user explicitly asks for stack guidance
|
|
75
|
+
- stack signals are strong enough to infer a preset confidently
|
|
76
|
+
|
|
77
|
+
When `STACK.md` exists or will be created, `AGENTS.md` should tell agents to read `STACK.md` before stack-specific changes.
|
|
78
|
+
|
|
79
|
+
## File Roles
|
|
80
|
+
|
|
81
|
+
- `AGENTS.md`: source-of-truth router; project purpose, project map, real commands, workflow expectations, companion-doc routing, safety rules, and before-finishing checklist.
|
|
82
|
+
- `STACK.md`: stack-specific guidance based on repo facts and configured or inferred preset.
|
|
83
|
+
- `CHANGE-EXPLANATION.md`: handoff, summary, and change-explanation expectations.
|
|
84
|
+
- `CODE-QUALITY.md`: review, refactor, and maintainability guidance; reference commands from `AGENTS.md`.
|
|
85
|
+
- `DESIGN-SYSTEM.md`: UI/design guidance for detected or configured UI surfaces.
|
|
86
|
+
- `.github/pull_request_template.md`: concise PR checklist; do not over-personalize per-work-item templates.
|
|
87
|
+
- `TESTING.md`: detected test tools, test locations, and real test commands.
|
|
88
|
+
- `SECURITY-CHECKLIST.md`: project-relevant security boundaries such as auth, secrets, API inputs, and data access.
|
|
89
|
+
- `WORKFLOWS.md`: repo-specific planning, review, release, and development workflows.
|
|
90
|
+
- `PRD-TEMPLATE.md`: reusable product requirements template; do not fill with current work.
|
|
91
|
+
- `IMPLEMENTATION-BRIEF-TEMPLATE.md`: reusable implementation planning template; do not fill with current work.
|
|
92
|
+
- AI adapters: thin pointers to `AGENTS.md`.
|
|
93
|
+
|
|
94
|
+
## Managed Blocks
|
|
95
|
+
|
|
96
|
+
AgentKit-owned content must be wrapped in paired markers:
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<!-- agentkit:start <id> -->
|
|
100
|
+
Generated content
|
|
101
|
+
<!-- agentkit:end <id> -->
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Rules:
|
|
105
|
+
|
|
106
|
+
- Use stable ids, such as `agents`, `stack`, `design-system`, `testing`, or `security-checklist`.
|
|
107
|
+
- For new files, usually wrap the full AgentKit-generated body in one top-level managed block.
|
|
108
|
+
- Adapters can be fully managed because they should only point to `AGENTS.md`.
|
|
109
|
+
- Preserve all user edits before and after managed blocks.
|
|
110
|
+
- Replace only valid managed block content during update or refresh.
|
|
111
|
+
- Skip unmanaged existing files unless the user explicitly asks to convert them.
|
|
112
|
+
- Malformed managed block markers block edits to that file; defer and recommend repair.
|
|
113
|
+
|
|
114
|
+
## Repository Inspection
|
|
115
|
+
|
|
116
|
+
Inspect before writing or auditing:
|
|
117
|
+
|
|
118
|
+
1. `package.json` for name, description, and scripts
|
|
119
|
+
2. Lockfiles for package manager
|
|
120
|
+
3. Framework signals, such as `next.config.*`, `svelte.config.*`, `convex/`, `vite.config.*`, `app/`, or `pages/`
|
|
121
|
+
4. Source layout, such as `src/`, `test/`, `tests/`, `docs/`, `.github/`
|
|
122
|
+
5. Test runner and tooling config, such as Vitest, Jest, Playwright, ESLint, TypeScript, or build config
|
|
123
|
+
6. UI/design signals, such as Tailwind config, CSS files, component folders, or design docs
|
|
124
|
+
7. Backend/data/auth signals, such as API routes, schema files, auth packages, or server modules
|
|
125
|
+
8. Existing guidance files and managed block markers
|
|
126
|
+
|
|
127
|
+
Prefer repo facts over config personalization when they conflict.
|
|
128
|
+
|
|
129
|
+
## Placeholder And Command Rules
|
|
130
|
+
|
|
131
|
+
Replace bracket placeholders with real values from the repo or omit the placeholder-dependent section:
|
|
132
|
+
|
|
133
|
+
| Placeholder | Source |
|
|
134
|
+
| --- | --- |
|
|
135
|
+
| `[Project Name]` | `package.json` name or directory name |
|
|
136
|
+
| `[short project description]` | `package.json` description or README first paragraph |
|
|
137
|
+
| `[issue tracker, e.g. Linear or GitHub Issues]` | `personalization.issueTracker` or infer from `.github/` |
|
|
138
|
+
| `[design system path, e.g. docs/design-system.md]` | `personalization.designSystemPath`, existing design docs, or `DESIGN-SYSTEM.md` |
|
|
139
|
+
| `[briefs path, e.g. docs/briefs]` | `personalization.briefsPath`, existing docs path, or omit |
|
|
140
|
+
| Project commands | Real scripts from `package.json` or explicit user/config personalization |
|
|
141
|
+
|
|
142
|
+
Never invent scripts. If a command is not present and not explicitly provided, omit it or describe that it is not configured.
|
|
143
|
+
|
|
144
|
+
## Healthy Guidance Criteria
|
|
145
|
+
|
|
146
|
+
AgentKit guidance is healthy when:
|
|
147
|
+
|
|
148
|
+
- Required files for the configured inventory exist or are intentionally deferred.
|
|
149
|
+
- `AGENTS.md` is present and acts as the router/source of truth.
|
|
150
|
+
- Managed block markers are paired and stable.
|
|
151
|
+
- Commands match `package.json` scripts or explicit user/config personalization.
|
|
152
|
+
- No `[Project Name]`-style placeholders remain in AgentKit-managed content.
|
|
153
|
+
- `AGENTS.md` references only companion files that exist or are being created.
|
|
154
|
+
- `STACK.md` exists when configured or confidently inferred, and `AGENTS.md` references it.
|
|
155
|
+
- AI adapters point to `AGENTS.md` and do not duplicate full operating rules.
|
|
156
|
+
- Generated guidance reflects visible repo facts instead of generic filler.
|
|
157
|
+
|
|
158
|
+
## Edit Boundaries
|
|
159
|
+
|
|
160
|
+
- Do not modify application source code, lockfiles, package manifests, or CI config during AgentKit workflows.
|
|
161
|
+
- Do not delete user-written content outside managed blocks.
|
|
162
|
+
- Do not run `git commit`, `git push`, or destructive shell commands.
|
|
163
|
+
- Docs-only and learn workflows do not require running project test/build commands.
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# agentkit init (skill workflow)
|
|
2
|
+
|
|
3
|
+
Create AgentKit guidance files from the current repository context. This workflow runs **inside the agent** after `agentkit skill install`; it is not the CLI `agentkit init` template installer.
|
|
4
|
+
|
|
5
|
+
The skill path is context-aware. Do not copy generic templates when repository facts are available. Use AgentKit's file contract as structure, then author guidance from the codebase in front of you.
|
|
6
|
+
|
|
7
|
+
## Preconditions
|
|
8
|
+
|
|
9
|
+
- Read `references/file-contract.md` before editing any AgentKit-managed file.
|
|
10
|
+
- Prefer `agentkit.config.json` when present.
|
|
11
|
+
- If config is missing but the user explicitly requested `/agentkit init`, continue with safe defaults:
|
|
12
|
+
- `templateSet: standard`
|
|
13
|
+
- `aiTools: ["codex"]`
|
|
14
|
+
- infer `preset` from repository signals when obvious
|
|
15
|
+
- infer `designSystem` only when UI/design signals exist
|
|
16
|
+
|
|
17
|
+
## Non-negotiables
|
|
18
|
+
|
|
19
|
+
- Create missing guidance files only by default.
|
|
20
|
+
- Skip existing files unless the user explicitly asks to refresh or regenerate them.
|
|
21
|
+
- Preserve user content outside AgentKit managed blocks.
|
|
22
|
+
- Never invent commands. Commands must come from `package.json` scripts or explicit user/config personalization.
|
|
23
|
+
- Replace all bracket placeholders with real values or omit the placeholder-dependent section.
|
|
24
|
+
- Do not modify application source files, lockfiles, or CI config during init.
|
|
25
|
+
- Keep `AGENTS.md` as the source-of-truth router; adapters stay thin pointers.
|
|
26
|
+
|
|
27
|
+
## Procedure
|
|
28
|
+
|
|
29
|
+
### 1. Build Repo Profile
|
|
30
|
+
|
|
31
|
+
Inspect the repository before choosing file content.
|
|
32
|
+
|
|
33
|
+
Collect:
|
|
34
|
+
|
|
35
|
+
- Project name and description from `package.json`, README, or directory name
|
|
36
|
+
- Package manager from lockfiles
|
|
37
|
+
- Scripts from `package.json`
|
|
38
|
+
- Framework/runtime signals, such as Next.js, SvelteKit, Express, Convex, Vite, React, Node, TypeScript
|
|
39
|
+
- Source layout, such as `src/`, `app/`, `pages/`, `convex/`, `test/`, `docs/`
|
|
40
|
+
- Test, lint, build, typecheck, and dev tooling
|
|
41
|
+
- UI/design system signals, such as Tailwind, CSS files, component folders, design docs
|
|
42
|
+
- Backend/data/auth signals, such as API routes, database/schema files, auth packages
|
|
43
|
+
- Existing docs, briefs, PR templates, workflow docs, or agent guidance files
|
|
44
|
+
- Issue tracker/workflow hints from `.github/`, Linear docs, or config personalization
|
|
45
|
+
|
|
46
|
+
Prefer repository facts over config personalization. Use config personalization only as fallback.
|
|
47
|
+
|
|
48
|
+
### 2. Resolve AgentKit Config
|
|
49
|
+
|
|
50
|
+
Read `agentkit.config.json` when present.
|
|
51
|
+
|
|
52
|
+
Use:
|
|
53
|
+
|
|
54
|
+
- `installMode`
|
|
55
|
+
- `agentkitVersion`
|
|
56
|
+
- `templateSet`
|
|
57
|
+
- `preset`
|
|
58
|
+
- `aiTools`
|
|
59
|
+
- `designSystem`
|
|
60
|
+
- `personalization`
|
|
61
|
+
|
|
62
|
+
If values are missing:
|
|
63
|
+
|
|
64
|
+
- Default `templateSet` to `standard`
|
|
65
|
+
- Default `aiTools` to `["codex"]`
|
|
66
|
+
- Infer `preset` only when repo signals are strong
|
|
67
|
+
- Use `designSystem` only for standard/full installs or when UI guidance is clearly useful
|
|
68
|
+
|
|
69
|
+
Configs without `installMode` are treated as template-path installs, but if the user explicitly invoked this skill workflow, continue carefully and report the assumption.
|
|
70
|
+
|
|
71
|
+
### 3. Decide File Inventory
|
|
72
|
+
|
|
73
|
+
Use `references/file-contract.md` as the source of truth.
|
|
74
|
+
|
|
75
|
+
Inventory rules:
|
|
76
|
+
|
|
77
|
+
- `minimal`
|
|
78
|
+
- `AGENTS.md`
|
|
79
|
+
|
|
80
|
+
- `standard`
|
|
81
|
+
- `AGENTS.md`
|
|
82
|
+
- `CHANGE-EXPLANATION.md`
|
|
83
|
+
- `CODE-QUALITY.md`
|
|
84
|
+
- `DESIGN-SYSTEM.md`
|
|
85
|
+
- `.github/pull_request_template.md`
|
|
86
|
+
|
|
87
|
+
- `full`
|
|
88
|
+
- everything in `standard`
|
|
89
|
+
- `TESTING.md`
|
|
90
|
+
- `SECURITY-CHECKLIST.md`
|
|
91
|
+
- `WORKFLOWS.md`
|
|
92
|
+
- `PRD-TEMPLATE.md`
|
|
93
|
+
- `IMPLEMENTATION-BRIEF-TEMPLATE.md`
|
|
94
|
+
- selected AI tool adapters
|
|
95
|
+
|
|
96
|
+
- `preset` set or confidently inferred
|
|
97
|
+
- add `STACK.md`
|
|
98
|
+
|
|
99
|
+
- `aiTools`
|
|
100
|
+
- `codex`: no adapter; uses `AGENTS.md`
|
|
101
|
+
- `cursor`: `.cursor/rules/agentkit.md`
|
|
102
|
+
- `claude`: `CLAUDE.md`
|
|
103
|
+
- `copilot`: `.github/copilot-instructions.md`
|
|
104
|
+
|
|
105
|
+
Before writing, briefly tell the user which missing files will be created and which existing files will be skipped.
|
|
106
|
+
|
|
107
|
+
### 4. Author Missing Files
|
|
108
|
+
|
|
109
|
+
Create only files that do not already exist.
|
|
110
|
+
|
|
111
|
+
For each created file:
|
|
112
|
+
|
|
113
|
+
- Create parent directories if needed.
|
|
114
|
+
- Wrap AgentKit-owned content in managed block markers from `references/file-contract.md`.
|
|
115
|
+
- Use project-specific facts from the repo profile.
|
|
116
|
+
- Avoid generic filler.
|
|
117
|
+
- Keep guidance concise and operational.
|
|
118
|
+
|
|
119
|
+
File roles:
|
|
120
|
+
|
|
121
|
+
- `AGENTS.md`
|
|
122
|
+
- Primary router and source of truth
|
|
123
|
+
- Include project purpose, project map, real commands, workflow expectations, companion-doc routing, safety rules, and before-finishing checklist
|
|
124
|
+
- Reference `STACK.md` when created
|
|
125
|
+
- Reference companion files only when they exist or are part of this init
|
|
126
|
+
|
|
127
|
+
- `STACK.md`
|
|
128
|
+
- Stack-specific guidance based on repo facts and configured/inferred preset
|
|
129
|
+
- Include framework boundaries, source layout, validation points, and relevant checks
|
|
130
|
+
- Do not include generic framework advice that does not apply to the repo
|
|
131
|
+
|
|
132
|
+
- `CHANGE-EXPLANATION.md`
|
|
133
|
+
- Handoff and change-summary expectations
|
|
134
|
+
- Keep tied to this project's likely workflows and changed-file surfaces
|
|
135
|
+
|
|
136
|
+
- `CODE-QUALITY.md`
|
|
137
|
+
- Review, refactor, and maintainability guidance
|
|
138
|
+
- Reference real project commands from `AGENTS.md`
|
|
139
|
+
- Avoid duplicating large command tables
|
|
140
|
+
|
|
141
|
+
- `DESIGN-SYSTEM.md`
|
|
142
|
+
- Only include design guidance appropriate to the detected UI surface
|
|
143
|
+
- Use configured `designSystem` as a style lens
|
|
144
|
+
- Mention real component/style paths when visible
|
|
145
|
+
|
|
146
|
+
- `.github/pull_request_template.md`
|
|
147
|
+
- Keep concise and generally useful
|
|
148
|
+
- Do not over-personalize per-work-item templates
|
|
149
|
+
|
|
150
|
+
- `TESTING.md`
|
|
151
|
+
- Include detected test tools and where tests live
|
|
152
|
+
- Include real test commands only
|
|
153
|
+
|
|
154
|
+
- `SECURITY-CHECKLIST.md`
|
|
155
|
+
- Include project-relevant security boundaries such as auth, secrets, API inputs, and data access
|
|
156
|
+
- Avoid irrelevant compliance boilerplate
|
|
157
|
+
|
|
158
|
+
- `WORKFLOWS.md`
|
|
159
|
+
- Capture repo-specific development workflows, planning docs, release steps, or review flow when visible
|
|
160
|
+
|
|
161
|
+
- `PRD-TEMPLATE.md` and `IMPLEMENTATION-BRIEF-TEMPLATE.md`
|
|
162
|
+
- Keep as reusable work-item templates
|
|
163
|
+
- Do not fill them with current project facts beyond light path references
|
|
164
|
+
|
|
165
|
+
- AI adapters
|
|
166
|
+
- Keep thin
|
|
167
|
+
- Point to `AGENTS.md`
|
|
168
|
+
- Do not duplicate operating rules
|
|
169
|
+
|
|
170
|
+
### 5. Existing Files And Refresh Requests
|
|
171
|
+
|
|
172
|
+
Default behavior:
|
|
173
|
+
|
|
174
|
+
- Skip existing guidance files.
|
|
175
|
+
- Report them as skipped.
|
|
176
|
+
- Do not edit managed blocks during normal init.
|
|
177
|
+
|
|
178
|
+
If the user explicitly asks to refresh or regenerate existing files:
|
|
179
|
+
|
|
180
|
+
- Preserve all content outside managed blocks.
|
|
181
|
+
- Replace only AgentKit managed blocks.
|
|
182
|
+
- Stop and recommend `agentkit doctor` or `agentkit repair` if managed block markers are malformed.
|
|
183
|
+
- Never overwrite unmanaged user-written files wholesale unless the user explicitly confirms the exact file.
|
|
184
|
+
|
|
185
|
+
### 6. Verify
|
|
186
|
+
|
|
187
|
+
Before finishing, check:
|
|
188
|
+
|
|
189
|
+
- Every planned missing file was created or explicitly deferred with a reason.
|
|
190
|
+
- Existing files were not overwritten by default.
|
|
191
|
+
- Managed block markers are paired and use stable ids.
|
|
192
|
+
- No `[Project Name]`-style placeholders remain.
|
|
193
|
+
- Commands in guidance match `package.json` scripts or explicit config/user personalization.
|
|
194
|
+
- `AGENTS.md` references `STACK.md` only when `STACK.md` exists.
|
|
195
|
+
- AI adapters point to `AGENTS.md` and do not duplicate full guidance.
|
|
196
|
+
- No application source files, lockfiles, or CI files were modified.
|
|
197
|
+
|
|
198
|
+
Docs-only init does not require running the project's test/build commands.
|
|
199
|
+
|
|
200
|
+
### 7. Report
|
|
201
|
+
|
|
202
|
+
Tell the user:
|
|
203
|
+
|
|
204
|
+
- Files created
|
|
205
|
+
- Files skipped because they already existed
|
|
206
|
+
- Stack and package manager inferred
|
|
207
|
+
- Commands inferred
|
|
208
|
+
- Config values used
|
|
209
|
+
- Assumptions made
|
|
210
|
+
- Any deferred files and why
|
|
211
|
+
|
|
212
|
+
Keep the report concise.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# agentkit learn (skill workflow)
|
|
2
|
+
|
|
3
|
+
Teach the user what changed in the codebase and help them build durable understanding after an implementation, bug fix, refactor, or agent session.
|
|
4
|
+
|
|
5
|
+
This workflow is read-only by default. Do not create Markdown notes, edit guidance files, or modify repo state unless the user explicitly asks.
|
|
6
|
+
|
|
7
|
+
## Preconditions
|
|
8
|
+
|
|
9
|
+
- Inspect the change context before explaining.
|
|
10
|
+
- Prefer current repo facts, diffs, changed files, and test output over memory of the session.
|
|
11
|
+
- If there are no visible changes, ask which change, branch, commit, or files the user wants to learn.
|
|
12
|
+
- Do not run mutating commands, formatters, code generators, or file writes during learn.
|
|
13
|
+
|
|
14
|
+
## Non-negotiables
|
|
15
|
+
|
|
16
|
+
- Teach incrementally; do not dump the whole explanation at once.
|
|
17
|
+
- Start by asking the user to restate their current understanding.
|
|
18
|
+
- Explain the problem before the solution.
|
|
19
|
+
- Cover why, what, and how: motivation, root cause, design choices, business logic, edge cases, validation, and impact.
|
|
20
|
+
- Use real code references and short snippets when useful.
|
|
21
|
+
- Keep the running learning checklist in the conversation, not in a file, unless the user explicitly asks for notes.
|
|
22
|
+
- Check understanding before moving to the next stage, but let the user skip ahead if they ask.
|
|
23
|
+
|
|
24
|
+
## Procedure
|
|
25
|
+
|
|
26
|
+
### 1. Build Change Context
|
|
27
|
+
|
|
28
|
+
Inspect the repository enough to teach accurately.
|
|
29
|
+
|
|
30
|
+
Use available context such as:
|
|
31
|
+
|
|
32
|
+
- `git status --short`
|
|
33
|
+
- `git diff --stat`
|
|
34
|
+
- `git diff`
|
|
35
|
+
- changed files relevant to the user's question
|
|
36
|
+
- recent commits only when the user asks about committed work or no working-tree diff exists
|
|
37
|
+
- test, build, or check output when relevant
|
|
38
|
+
|
|
39
|
+
Identify:
|
|
40
|
+
|
|
41
|
+
- What changed
|
|
42
|
+
- What problem the change addressed
|
|
43
|
+
- Why the problem existed
|
|
44
|
+
- What branches, cases, or constraints mattered
|
|
45
|
+
- What solution was chosen
|
|
46
|
+
- What tradeoffs were accepted
|
|
47
|
+
- What edge cases or risks remain
|
|
48
|
+
- What tests or checks validate the change
|
|
49
|
+
- What broader behavior, workflow, or maintenance impact exists
|
|
50
|
+
|
|
51
|
+
### 2. Start With The User's Current Understanding
|
|
52
|
+
|
|
53
|
+
Before teaching, ask a short calibration question:
|
|
54
|
+
|
|
55
|
+
```md
|
|
56
|
+
Before I explain, tell me your current read: what problem do you think we solved, and what changed?
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Use the answer to fill gaps instead of repeating what the user already understands.
|
|
60
|
+
|
|
61
|
+
If the user asks for a specific level, adapt to it:
|
|
62
|
+
|
|
63
|
+
- `ELI5`: plain language and analogies, minimal code
|
|
64
|
+
- `ELI14`: plain language plus simple technical terms
|
|
65
|
+
- `intern`: practical engineering detail, with code walkthroughs
|
|
66
|
+
- `engineer`: concise, precise, tradeoff-aware
|
|
67
|
+
- `expert`: focus on invariants, edge cases, and design alternatives
|
|
68
|
+
|
|
69
|
+
### 3. Teach In Stages
|
|
70
|
+
|
|
71
|
+
Use this order:
|
|
72
|
+
|
|
73
|
+
1. Problem
|
|
74
|
+
- What was wrong or missing
|
|
75
|
+
- Why it mattered
|
|
76
|
+
- Why it existed
|
|
77
|
+
- What branches or cases were involved
|
|
78
|
+
|
|
79
|
+
2. Solution
|
|
80
|
+
- What changed
|
|
81
|
+
- Why this approach was chosen
|
|
82
|
+
- What alternatives were avoided
|
|
83
|
+
- What behavior is now explicit
|
|
84
|
+
|
|
85
|
+
3. Code walkthrough
|
|
86
|
+
- Important files and functions
|
|
87
|
+
- How data or control flows through the changed code
|
|
88
|
+
- Business logic and edge cases
|
|
89
|
+
- Short snippets or file references where helpful
|
|
90
|
+
|
|
91
|
+
4. Validation and impact
|
|
92
|
+
- Tests or checks that support the change
|
|
93
|
+
- What users or developers will notice
|
|
94
|
+
- What remains unchanged
|
|
95
|
+
- What follow-up work or risks remain
|
|
96
|
+
|
|
97
|
+
After each stage, ask the user to restate the key idea or answer a small check question before continuing.
|
|
98
|
+
|
|
99
|
+
### 4. Maintain A Conversation Checklist
|
|
100
|
+
|
|
101
|
+
Keep a visible checklist in the conversation:
|
|
102
|
+
|
|
103
|
+
```md
|
|
104
|
+
Learning checklist
|
|
105
|
+
|
|
106
|
+
- [ ] The original problem and why it existed
|
|
107
|
+
- [ ] The main solution and why this design was chosen
|
|
108
|
+
- [ ] The changed files and how code flows through them
|
|
109
|
+
- [ ] The business logic and edge cases
|
|
110
|
+
- [ ] The tests or checks that validate the behavior
|
|
111
|
+
- [ ] The broader impact and maintenance implications
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Mark items as understood only after the user demonstrates understanding or asks to move on.
|
|
115
|
+
|
|
116
|
+
### 5. Use Code Well
|
|
117
|
+
|
|
118
|
+
When discussing code:
|
|
119
|
+
|
|
120
|
+
- Cite real files and line numbers when possible.
|
|
121
|
+
- Prefer short snippets over large pasted sections.
|
|
122
|
+
- Show before/after comparisons when they clarify the change.
|
|
123
|
+
- Trace one important value, branch, or request through the code when useful.
|
|
124
|
+
- Avoid overwhelming the user with every changed line.
|
|
125
|
+
|
|
126
|
+
### 6. Mastery Checks
|
|
127
|
+
|
|
128
|
+
Use lightweight checks such as:
|
|
129
|
+
|
|
130
|
+
- "Can you explain why this bug happened in your own words?"
|
|
131
|
+
- "What would break if we removed this branch?"
|
|
132
|
+
- "Which file would you inspect first if this regressed?"
|
|
133
|
+
- "What edge case is this guard protecting?"
|
|
134
|
+
- "Why did this solution fit better than the simpler alternative?"
|
|
135
|
+
|
|
136
|
+
If the user struggles, explain again at a simpler level and ask a narrower question.
|
|
137
|
+
|
|
138
|
+
### 7. Final Recap
|
|
139
|
+
|
|
140
|
+
End with a concise recap:
|
|
141
|
+
|
|
142
|
+
- What changed
|
|
143
|
+
- Why it changed
|
|
144
|
+
- How it works
|
|
145
|
+
- What validates it
|
|
146
|
+
- What to watch for
|
|
147
|
+
- What the user now understands
|
|
148
|
+
|
|
149
|
+
Do not create files unless explicitly requested.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# agentkit repair (skill workflow)
|
|
2
|
+
|
|
3
|
+
Repair AgentKit guidance structure after an explicit user request. This workflow fixes guidance-file safety problems that block `agentkit update`, especially malformed managed blocks, unmanaged-file conversion, broken adapters, stale companion references, and missing managed wrappers.
|
|
4
|
+
|
|
5
|
+
Repair is not a general rewrite workflow. Use `agentkit update` for stale content and `agentkit doctor` for read-only audits.
|
|
6
|
+
|
|
7
|
+
## Preconditions
|
|
8
|
+
|
|
9
|
+
- Read `references/file-contract.md` before repairing any file.
|
|
10
|
+
- Read `agentkit.config.json` when present.
|
|
11
|
+
- Inspect the affected guidance files before proposing repairs.
|
|
12
|
+
- Briefly tell the user which files need repair and what will change before editing.
|
|
13
|
+
|
|
14
|
+
## Non-negotiables
|
|
15
|
+
|
|
16
|
+
- Preserve user-written content.
|
|
17
|
+
- Modify only AgentKit guidance files and AI tool adapters.
|
|
18
|
+
- Do not modify application source files, lockfiles, package manifests, or CI config.
|
|
19
|
+
- Do not guess ownership when managed block markers are ambiguous.
|
|
20
|
+
- Do not regenerate whole files unless the user explicitly asks for that exact file.
|
|
21
|
+
- Keep `AGENTS.md` as the source of truth; adapters stay thin pointers.
|
|
22
|
+
|
|
23
|
+
## Procedure
|
|
24
|
+
|
|
25
|
+
### 1. Identify Repair Targets
|
|
26
|
+
|
|
27
|
+
Inspect:
|
|
28
|
+
|
|
29
|
+
- `AGENTS.md`
|
|
30
|
+
- `STACK.md`
|
|
31
|
+
- companion guidance files
|
|
32
|
+
- AI tool adapters
|
|
33
|
+
- managed block markers
|
|
34
|
+
- companion references in `AGENTS.md`
|
|
35
|
+
|
|
36
|
+
Classify each target:
|
|
37
|
+
|
|
38
|
+
- Malformed managed block markers
|
|
39
|
+
- Missing managed wrapper around AgentKit-owned content
|
|
40
|
+
- Unmanaged guidance file the user wants converted
|
|
41
|
+
- AI adapter that duplicates full guidance or points to the wrong source
|
|
42
|
+
- `AGENTS.md` references to missing companion files
|
|
43
|
+
- Configured guidance file missing a safe managed block
|
|
44
|
+
|
|
45
|
+
### 2. Plan The Repair
|
|
46
|
+
|
|
47
|
+
Before editing, report:
|
|
48
|
+
|
|
49
|
+
- Files to repair
|
|
50
|
+
- Repair type for each file
|
|
51
|
+
- Files deferred because ownership is ambiguous
|
|
52
|
+
- Any user confirmation needed
|
|
53
|
+
|
|
54
|
+
If ownership is ambiguous, defer the file and ask the user whether to convert, preserve, or leave it unmanaged.
|
|
55
|
+
|
|
56
|
+
### 3. Repair Managed Blocks
|
|
57
|
+
|
|
58
|
+
For malformed markers:
|
|
59
|
+
|
|
60
|
+
- Repair obvious one-start/one-end pairing issues only when the intended block boundaries are clear.
|
|
61
|
+
- Preserve all text outside the repaired block.
|
|
62
|
+
- Keep the same stable block id when clear.
|
|
63
|
+
- If there are multiple starts, multiple ends, overlapping blocks, or unclear ownership, defer instead of guessing.
|
|
64
|
+
|
|
65
|
+
For missing wrappers:
|
|
66
|
+
|
|
67
|
+
- Add one top-level AgentKit managed block around clearly AgentKit-owned generated content.
|
|
68
|
+
- Preserve pre-existing user notes outside the managed block when possible.
|
|
69
|
+
- Do not wrap unrelated project documentation.
|
|
70
|
+
|
|
71
|
+
### 4. Convert Unmanaged Files
|
|
72
|
+
|
|
73
|
+
Only convert an unmanaged file when the user explicitly asks.
|
|
74
|
+
|
|
75
|
+
When converting:
|
|
76
|
+
|
|
77
|
+
- Preserve existing user-written content outside the new managed block when possible.
|
|
78
|
+
- Add one AgentKit managed block for generated AgentKit guidance.
|
|
79
|
+
- Do not delete custom instructions.
|
|
80
|
+
- Do not convert application docs that are not part of AgentKit guidance.
|
|
81
|
+
|
|
82
|
+
### 5. Repair AI Adapters
|
|
83
|
+
|
|
84
|
+
For `.cursor/rules/agentkit.md`, `CLAUDE.md`, and `.github/copilot-instructions.md`:
|
|
85
|
+
|
|
86
|
+
- Replace thick duplicated guidance with a thin pointer to `AGENTS.md`.
|
|
87
|
+
- Wrap the adapter body in a managed block.
|
|
88
|
+
- Preserve any user-specific adapter notes outside the managed block when present.
|
|
89
|
+
|
|
90
|
+
### 6. Repair Companion References
|
|
91
|
+
|
|
92
|
+
For `AGENTS.md` companion references:
|
|
93
|
+
|
|
94
|
+
- Remove references to companion files that do not exist and are not being created.
|
|
95
|
+
- Add references to existing configured companions when useful.
|
|
96
|
+
- Reference `STACK.md` only when it exists or will be created.
|
|
97
|
+
|
|
98
|
+
### 7. Verify
|
|
99
|
+
|
|
100
|
+
Before finishing, check:
|
|
101
|
+
|
|
102
|
+
- Managed block markers are paired and stable.
|
|
103
|
+
- User-written content outside managed blocks was preserved.
|
|
104
|
+
- AI adapters point to `AGENTS.md` and do not duplicate full guidance.
|
|
105
|
+
- `AGENTS.md` references only companion files that exist.
|
|
106
|
+
- No application source files, lockfiles, package manifests, or CI files were modified.
|
|
107
|
+
|
|
108
|
+
Docs-only repair does not require running the project's test/build commands.
|
|
109
|
+
|
|
110
|
+
### 8. Report
|
|
111
|
+
|
|
112
|
+
Tell the user:
|
|
113
|
+
|
|
114
|
+
- Files repaired
|
|
115
|
+
- Files deferred and why
|
|
116
|
+
- Repairs performed
|
|
117
|
+
- Any follow-up recommendation, such as `/agentkit update` after structural repair
|
|
118
|
+
|
|
119
|
+
Keep the report concise.
|