vinta-ai-workflows 0.1.7
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/CHANGELOG.md +830 -0
- package/LICENSE +21 -0
- package/README.md +547 -0
- package/package.json +27 -0
- package/schemas/README.md +84 -0
- package/schemas/mcp-preflight-cache.v1.schema.json +50 -0
- package/schemas/prs-context-comments.v1.schema.json +51 -0
- package/schemas/prs-context-frontmatter.v1.schema.json +77 -0
- package/schemas/sub-agent.v1.schema.json +105 -0
- package/schemas/vinta-ai-workflows-config.v1.schema.json +283 -0
- package/skills/vinta-analyze-codebase/SKILL.md +325 -0
- package/skills/vinta-bootstrap-ai-tools/SKILL.md +375 -0
- package/skills/vinta-bootstrap-ai-tools/resources/stacks/README.md +50 -0
- package/skills/vinta-bootstrap-ai-tools/resources/stacks/django/notes.md +52 -0
- package/skills/vinta-bootstrap-ai-tools/resources/stacks/medplum/notes.md +45 -0
- package/skills/vinta-bootstrap-ai-tools/resources/stacks/nextjs-app-router/notes.md +35 -0
- package/skills/vinta-bootstrap-ai-tools/resources/stacks/python-package/notes.md +31 -0
- package/skills/vinta-bootstrap-ai-tools/resources/stacks/typescript-monorepo/notes.md +32 -0
- package/skills/vinta-derive-skills/SKILL.md +200 -0
- package/skills/vinta-derive-skills/resources/amend-plan-template.md +355 -0
- package/skills/vinta-derive-skills/resources/foundation-skills/add-one-off-script/SKILL.md +292 -0
- package/skills/vinta-derive-skills/resources/foundation-skills/add-one-off-script/resources/one_off_script_base.py +602 -0
- package/skills/vinta-derive-skills/resources/foundation-skills/add-one-off-script/resources/one_off_script_base.ts +624 -0
- package/skills/vinta-derive-skills/resources/foundation-skills/create-qa-use-cases/SKILL.md +232 -0
- package/skills/vinta-derive-skills/resources/foundation-skills/create-spec/SKILL.md +235 -0
- package/skills/vinta-derive-skills/resources/foundation-skills/open-pr-from-context/SKILL.md +78 -0
- package/skills/vinta-derive-skills/resources/foundation-skills/open-pr-from-context/scripts/open-pr.sh +357 -0
- package/skills/vinta-derive-skills/resources/foundation-skills/plan-feature/SKILL.md +418 -0
- package/skills/vinta-derive-skills/resources/implement-plan-template.md +375 -0
- package/skills/vinta-derive-skills/resources/prs-context-template.md +91 -0
- package/skills/vinta-derive-skills/resources/systematic-debugging-mcp-tools.md +125 -0
- package/skills/vinta-derive-skills/resources/systematic-debugging-template.md +167 -0
- package/skills/vinta-derive-subagents/SKILL.md +192 -0
- package/skills/vinta-install-ai-tools-setup/SKILL.md +138 -0
- package/skills/vinta-install-ai-tools-setup/resources/setup-ai-tools.mjs +392 -0
- package/skills/vinta-migrate-plans-specs/SKILL.md +229 -0
- package/skills/vinta-sync-ai-tools/SKILL.md +184 -0
- package/skills/vinta-update-project-skills/SKILL.md +178 -0
- package/skills/vinta-write-agents-md/SKILL.md +192 -0
- package/vinta-ai-workflows.mjs +316 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vinta-sync-ai-tools
|
|
3
|
+
description: Bring a project up to date with the latest `vinta-ai-workflows` package version. Reads the project's `.vinta-ai-workflows.yaml` (the single source of truth for which surface area is enabled), reads the cloned package's `CHANGELOG.md` to enumerate releases since the project's recorded version, classifies each change against the project's opt-in surface (affects-project / opt-in-offer / config-schema-change / not-applicable), shows per-change diffs, asks the user one `AskUserQuestion` per change (`Apply` / `Skip` / `Show diff`), applies approved changes (re-render templates, add new foundation skills, patch setup script, migrate config schema), and bumps `vinta_ai_workflows_version` + `last_synced_at` at the end. Layers on top of [vinta-update-project-skills](../vinta-update-project-skills/SKILL.md), which it invokes for foundation-skill body diffs. Use after `npm update vinta-ai-workflows` or pulling a newer git+ssh ref.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# vinta-sync-ai-tools
|
|
7
|
+
|
|
8
|
+
The version-upgrade path. Companion to the rest of the builder skills:
|
|
9
|
+
|
|
10
|
+
- [vinta-bootstrap-ai-tools](../vinta-bootstrap-ai-tools/SKILL.md) — writes the project for the first time.
|
|
11
|
+
- **vinta-sync-ai-tools** — this skill. Updates the project against a newer package version.
|
|
12
|
+
- [vinta-update-project-skills](../vinta-update-project-skills/SKILL.md) — narrow tool for refreshing only the foundation-skill bodies. This skill calls it as a sub-step.
|
|
13
|
+
|
|
14
|
+
## Source of truth
|
|
15
|
+
|
|
16
|
+
`.vinta-ai-workflows.yaml` at the repo root. Defined by [`schemas/vinta-ai-workflows-config.v1.schema.json`](../../schemas/vinta-ai-workflows-config.v1.schema.json). Every consumer (this skill, every other builder skill, every template render) reads from this file. Modifying values there is the only supported way to change project-wide settings — never hand-edit values inlined into rendered SKILL.md bodies, those will be overwritten on the next sync.
|
|
17
|
+
|
|
18
|
+
If `.vinta-ai-workflows.yaml` is missing (older bootstrap or hand-built project), the sync skill's first step builds one by reverse-extracting state from the project's existing artifacts and interview-filling gaps. See "Bootstrapping the config file" below.
|
|
19
|
+
|
|
20
|
+
## Inputs
|
|
21
|
+
|
|
22
|
+
1. The project root (default: cwd).
|
|
23
|
+
2. The cloned `vinta-ai-workflows` source. Auto-detected via the same paths as [vinta-update-project-skills](../vinta-update-project-skills/SKILL.md) — symlink realpath, copy-mode marker, or asked.
|
|
24
|
+
3. The project's `.vinta-ai-workflows.yaml` (read; rewritten at the end).
|
|
25
|
+
|
|
26
|
+
## Steps
|
|
27
|
+
|
|
28
|
+
### 1. Locate + load the config
|
|
29
|
+
|
|
30
|
+
`<project>/.vinta-ai-workflows.yaml` is required. If absent, run "Bootstrapping the config file" below to seed it before continuing.
|
|
31
|
+
|
|
32
|
+
Validate the config against the schema matching its `schema_version`. Any validation error → stop, surface the error path. Don't proceed against a malformed config.
|
|
33
|
+
|
|
34
|
+
Read:
|
|
35
|
+
|
|
36
|
+
- `vinta_ai_workflows_version` (call it `OLD_VERSION`).
|
|
37
|
+
- The current `version` field of the cloned package's `package.json` (call it `NEW_VERSION`).
|
|
38
|
+
- `foundation_skills`, `foundation_agents`, `vendors`, `stacks`, `policies` — used to decide what's `affects-project` vs `not-applicable` per change.
|
|
39
|
+
|
|
40
|
+
`OLD_VERSION === NEW_VERSION` → nothing to sync. Print "already up to date" and exit.
|
|
41
|
+
|
|
42
|
+
### 2. Enumerate releases
|
|
43
|
+
|
|
44
|
+
Read the cloned package's `CHANGELOG.md`. Parse each `## [X.Y.Z]` heading. Build the ordered list of releases between `OLD_VERSION` (exclusive) and `NEW_VERSION` (inclusive).
|
|
45
|
+
|
|
46
|
+
For each release, parse the `### Added`, `### Changed`, `### Removed`, `### Deprecated`, `### Notes` sub-sections into a list of change records: `{ release, kind, summary, body }`.
|
|
47
|
+
|
|
48
|
+
If the changelog is missing entries that file diffs reveal exist (orphan diffs), surface them at the end as "undocumented changes — please cross-check with maintainers". Don't try to apply orphans automatically.
|
|
49
|
+
|
|
50
|
+
### 3. Classify each change
|
|
51
|
+
|
|
52
|
+
For each change record, decide its bucket:
|
|
53
|
+
|
|
54
|
+
| Bucket | Trigger |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `affects-project` | Touches surface area enabled in the config. Examples: foundation-skill body changed and the skill is `enabled`; template gained a section and the project has the rendered skill. |
|
|
57
|
+
| `opt-in-offer` | New optional surface area. Project doesn't have it enabled. Show the description; offer to enable. |
|
|
58
|
+
| `config-schema-change` | Adds a field to the config schema or bumps its major. Migrate the config; ask user to fill new required fields. |
|
|
59
|
+
| `not-applicable` | Project opted out (`disabled` in config) or never applicable (e.g. stack-specific change for a stack the project doesn't use). |
|
|
60
|
+
| `tooling` | Setup-script / gitignore / packaging changes that propagate transparently — no per-change question; apply if approved as a batch. |
|
|
61
|
+
|
|
62
|
+
Cross-check via file diff: every `affects-project` change should correspond to a real file delta between `OLD_VERSION`'s source (reachable via git tag in the clone) and `NEW_VERSION`'s source. Diffs without changelog entries → flag as orphan (see step 2).
|
|
63
|
+
|
|
64
|
+
### 4. Build the proposal
|
|
65
|
+
|
|
66
|
+
Group by bucket. Print as a structured report. Example:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
vinta-ai-workflows sync: 0.1.0 → 0.1.2 (2 releases)
|
|
70
|
+
====================================================
|
|
71
|
+
|
|
72
|
+
AFFECTS PROJECT — your enabled surface gained changes
|
|
73
|
+
[0.1.1] implement-plan template: "Open PR via context file" PR-context flow added
|
|
74
|
+
file: ai-tools/skills/implement-plan/SKILL.md (will re-render)
|
|
75
|
+
diff: +88 lines, -6 lines
|
|
76
|
+
|
|
77
|
+
[0.1.2] amend-plan template: blast-radius gate added
|
|
78
|
+
file: ai-tools/skills/amend-plan/SKILL.md (will re-render)
|
|
79
|
+
diff: +52 lines, -0 lines
|
|
80
|
+
|
|
81
|
+
OPT-IN OFFER — new optional surface area
|
|
82
|
+
[0.1.2] foundation skill: open-pr-from-context
|
|
83
|
+
your config has: foundation_skills.open-pr-from-context: <missing>
|
|
84
|
+
enabling will: copy SKILL.md + scripts/open-pr.sh into ai-tools/skills/
|
|
85
|
+
|
|
86
|
+
CONFIG SCHEMA CHANGE
|
|
87
|
+
[0.1.2] new field: run_options.amend-plan.blast_radius_signal_threshold (int, default 2)
|
|
88
|
+
|
|
89
|
+
TOOLING (batch-apply if approved)
|
|
90
|
+
[0.1.2] setup-ai-tools.mjs: appends `.vinta-ai-workflows/prs-context/` to .gitignore on first run
|
|
91
|
+
|
|
92
|
+
NOT APPLICABLE (skipped — opted out / unused stack)
|
|
93
|
+
[0.1.1] add-env-var optional skill update — your config has add-env-var: disabled
|
|
94
|
+
[0.1.1] medplum stack notes update — project doesn't use medplum stack
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
For each `affects-project` and `opt-in-offer` entry, expand a unified diff inline on user request.
|
|
98
|
+
|
|
99
|
+
### 5. Per-change confirmation
|
|
100
|
+
|
|
101
|
+
**Critical: never apply silently.**
|
|
102
|
+
|
|
103
|
+
For each `affects-project` and `opt-in-offer` and `config-schema-change` entry, ask the user via `AskUserQuestion`:
|
|
104
|
+
|
|
105
|
+
- `Apply`
|
|
106
|
+
- `Skip` (records as opted-out for this version; next sync won't re-propose; user can later flip the foundation skill back to `enabled` to re-offer)
|
|
107
|
+
- `Show diff` (re-displays in full, then re-asks)
|
|
108
|
+
|
|
109
|
+
`tooling` changes batch under one prompt: `Apply all tooling changes?` — they're typically idempotent and small.
|
|
110
|
+
|
|
111
|
+
`opt-in-offer` `Skip` writes the corresponding entry to `foundation_skills` (or wherever it lives) as `disabled` so the next sync respects the choice.
|
|
112
|
+
|
|
113
|
+
Don't batch `affects-project` decisions. Each is a separate decision so the user can keep their hand-tuned wording for one skill while accepting another.
|
|
114
|
+
|
|
115
|
+
### 6. Apply approved changes
|
|
116
|
+
|
|
117
|
+
In order:
|
|
118
|
+
|
|
119
|
+
1. **`config-schema-change`** first. Migrate `.vinta-ai-workflows.yaml`:
|
|
120
|
+
- Add new optional fields with defaults from the schema.
|
|
121
|
+
- For new required fields: prompt the user for a value with `AskUserQuestion`.
|
|
122
|
+
- On schema major bump: apply the documented migration from the bumped schema's release notes.
|
|
123
|
+
- Bump `schema_version` if the major changed.
|
|
124
|
+
|
|
125
|
+
2. **`opt-in-offer` accepts** — flip the corresponding entry to `enabled` in the config; copy / render the artifact (foundation skill, agent, etc.).
|
|
126
|
+
|
|
127
|
+
3. **`affects-project` accepts** — re-render the relevant template (for `implement-plan` / `amend-plan`) or re-copy the foundation skill body (for verbatim ones — delegated to [vinta-update-project-skills](../vinta-update-project-skills/SKILL.md)). Use the values in `.vinta-ai-workflows.yaml` as the substitution source. Validate every `{{PLACEHOLDER}}` is resolved.
|
|
128
|
+
|
|
129
|
+
4. **`tooling` accepts** — run setup-ai-tools.mjs from the new package version in idempotent mode. The script handles gitignore append, vendor symlinks, vendor agent file regeneration.
|
|
130
|
+
|
|
131
|
+
5. Re-validate every YAML file under the project against its schema (`.vinta-ai-workflows.yaml`, `ai-tools/agents/*.yaml`, any `.vinta-ai-workflows/prs-context/**/*.md` frontmatter blocks). Surface validation failures; don't silently proceed.
|
|
132
|
+
|
|
133
|
+
### 7. Bump version + final report
|
|
134
|
+
|
|
135
|
+
After all approved changes apply:
|
|
136
|
+
|
|
137
|
+
1. Update `.vinta-ai-workflows.yaml`:
|
|
138
|
+
- `vinta_ai_workflows_version: <NEW_VERSION>`.
|
|
139
|
+
- `last_synced_at: <ISO timestamp>`.
|
|
140
|
+
2. Print the final summary:
|
|
141
|
+
- Applied (per-change list).
|
|
142
|
+
- Skipped — and where the user can re-evaluate later (config file path).
|
|
143
|
+
- New `foundation_skills` / `foundation_agents` entries set to `disabled`.
|
|
144
|
+
- Orphan diffs (undocumented changes from step 2) for the user's review.
|
|
145
|
+
- If the package version was a major bump (e.g. `0.x.y` → `1.0.0`): warn the user to read the full changelog, especially the `### Removed` / `### Deprecated` sections.
|
|
146
|
+
|
|
147
|
+
## Bootstrapping the config file
|
|
148
|
+
|
|
149
|
+
Run on first sync against a project without `.vinta-ai-workflows.yaml`:
|
|
150
|
+
|
|
151
|
+
1. Detect the installed package version: read `node_modules/vinta-ai-workflows/package.json` (or the clone's). Use as `vinta_ai_workflows_version`.
|
|
152
|
+
2. Detect project facts:
|
|
153
|
+
- `project.name` → `package.json#name` or `Cargo.toml#package.name` or repo dir name; confirm.
|
|
154
|
+
- `project.default_branch` → `git remote show origin | grep 'HEAD branch'` or `git rev-parse --abbrev-ref origin/HEAD`.
|
|
155
|
+
- `project.code_host` → parse `git remote get-url origin`.
|
|
156
|
+
- `project.stack_summary` → run [vinta-analyze-codebase](../vinta-analyze-codebase/SKILL.md) inventory, take the one-liner.
|
|
157
|
+
- `project.ai_plans_dir` → look for `ai-plans/`, `apps/<service>/ai-plans/`, etc.
|
|
158
|
+
3. Detect commands by scanning `package.json#scripts`, `Makefile`, etc. Confirm each via `AskUserQuestion`.
|
|
159
|
+
4. Detect policies by reading the existing `ai-tools/skills/implement-plan/SKILL.md` (if present) — reverse-extract `pr_creation`, `ai_coauthor`, `commit_style` from the rendered body. Interview-fill gaps.
|
|
160
|
+
5. Detect vendor coverage from existing vendor symlinks/dirs (`.claude/`, `.cursor/`, `.codex/`, `.github/agents/`).
|
|
161
|
+
6. Detect foundation-skill opt-ins by scanning `ai-tools/skills/`.
|
|
162
|
+
7. Detect stacks via `vinta-analyze-codebase` matched-stacks list.
|
|
163
|
+
8. Write `.vinta-ai-workflows.yaml` with the inferred state. Add the schema-language-server directive at the top.
|
|
164
|
+
9. Print the final config to the user; ask `AskUserQuestion`: `Looks right — proceed with sync` / `Edit values first` / `Stop`.
|
|
165
|
+
|
|
166
|
+
Then re-enter step 1 of the main flow.
|
|
167
|
+
|
|
168
|
+
## Pitfalls
|
|
169
|
+
|
|
170
|
+
- **Hand-edited rendered skill bodies.** `vinta-sync-ai-tools` re-renders templates from the config — any inline edits the user made to the rendered `ai-tools/skills/<name>/SKILL.md` will be overwritten on `Apply`. Surface a warning when re-rendering would clobber a body the user touched (heuristic: file modified after the bootstrap commit). Default action: ask before overwriting.
|
|
171
|
+
- **`OLD_VERSION` lower than the oldest changelog entry.** Some projects predate the changelog. Treat anything before the earliest documented version as "best-effort sync" and rely on file diff entirely.
|
|
172
|
+
- **Multiple package versions in the clone.** If the user has both `node_modules/vinta-ai-workflows/` and a separate `git clone`, they may diverge. Pick one source and pin to it for the run; surface the choice up front.
|
|
173
|
+
- **Orphan diffs.** Surfaced, never auto-applied. Ask the maintainer to add a changelog entry; don't try to interpret an undocumented change.
|
|
174
|
+
- **Breaking schema bump (`schema_version: N → N+1`).** Migration code must come from the package's release notes. If migration data is missing, stop — don't guess.
|
|
175
|
+
- **Sticky opt-outs.** A user who accepted `add-env-var: disabled` once stays disabled across sync runs. To re-offer, manually flip to `enabled` in `.vinta-ai-workflows.yaml` and re-run sync.
|
|
176
|
+
|
|
177
|
+
## Verification
|
|
178
|
+
|
|
179
|
+
1. **Up-to-date project**: `OLD_VERSION === NEW_VERSION` → "already up to date", no changes.
|
|
180
|
+
2. **Single template change accepted**: re-renders one skill body, all `{{PLACEHOLDER}}` resolved, `vinta_ai_workflows_version` bumped, no other files touched.
|
|
181
|
+
3. **Opt-in declined**: `foundation_skills.<name>: disabled` written to config; nothing else added.
|
|
182
|
+
4. **Schema bump**: new field added with default; `schema_version` bumped if major changed; payload still validates.
|
|
183
|
+
5. **Bootstrap from missing config**: `.vinta-ai-workflows.yaml` written with reverse-extracted values; user confirms before main flow runs.
|
|
184
|
+
6. **Orphan diff**: changelog has no entry for a real file change; sync surfaces it at the end without applying.
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vinta-update-project-skills
|
|
3
|
+
description: Refresh the user's project skills under `ai-tools/skills/` against the latest versions in this `vinta-ai-workflows` repo. Detects which project skills came from the bundled foundation set or stack templates, computes a per-file diff against the current source, presents the proposed changes, and only applies them after the user explicitly accepts each one. Skills the user authored themselves (no matching upstream source) are detected and left alone. Use after pulling a new version of `vinta-ai-workflows` to bring an existing project up to date without re-running the full bootstrap. Read-only by default — every write is gated on explicit user approval.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Update project skills
|
|
7
|
+
|
|
8
|
+
[vinta-bootstrap-ai-tools](../vinta-bootstrap-ai-tools/SKILL.md) (specifically [vinta-derive-skills](../vinta-derive-skills/SKILL.md)) seeds a project's `ai-tools/skills/` directory from sources that live in this repo:
|
|
9
|
+
|
|
10
|
+
- **Verbatim foundation skills** — copied as-is from `vinta-derive-skills/resources/foundation-skills/<name>/SKILL.md`.
|
|
11
|
+
- **Templated skills** — `implement-plan/SKILL.md` is rendered from `vinta-derive-skills/resources/implement-plan-template.md` with project-specific values interpolated.
|
|
12
|
+
- **Stack-derived skills** — drafted from prompts under `vinta-bootstrap-ai-tools/resources/stacks/<stack>/notes.md`.
|
|
13
|
+
- **User-authored skills** — anything else the team added later. **Never overwritten.**
|
|
14
|
+
|
|
15
|
+
When this repo gains an updated foundation skill (new section, fixed wording, bumped checklist), existing projects sit on the old copy until someone refreshes them. This skill is the safe path to that refresh.
|
|
16
|
+
|
|
17
|
+
## Inputs
|
|
18
|
+
|
|
19
|
+
- Path to the project being updated (default: cwd).
|
|
20
|
+
- Path to the `vinta-ai-workflows` clone (auto-detected from this skill's installed location — see "Locating the source").
|
|
21
|
+
- The project's `ai-tools/skills/` directory.
|
|
22
|
+
|
|
23
|
+
## Output
|
|
24
|
+
|
|
25
|
+
- A diff report listing each project skill with status: `up-to-date`, `outdated`, `templated (regenerate)`, or `user-authored (skip)`.
|
|
26
|
+
- For each `outdated` skill the user accepts: the project file is overwritten with the source content. Nothing else changes.
|
|
27
|
+
- A summary of what was updated, what was left alone, and any follow-ups (e.g. "re-run [vinta-derive-skills](../vinta-derive-skills/SKILL.md) to refresh `implement-plan`").
|
|
28
|
+
|
|
29
|
+
## Locating the source
|
|
30
|
+
|
|
31
|
+
The skill must know where this `vinta-ai-workflows` repo lives. Resolution order:
|
|
32
|
+
|
|
33
|
+
1. **Symlink installs** (default): the project's installed copy of this skill is a symlink. Use `realpath` of `<project>/.claude/skills/vinta-update-project-skills/SKILL.md` (or whichever vendor path) to walk back to `<clone>/ai-tools-builder/skills/vinta-update-project-skills/SKILL.md`. From there, `<clone>` is three directories up.
|
|
34
|
+
2. **Copy installs**: the installed copy contains `.installed-by-vinta-ai-workflows` whose body records the original `source:` path. Read that path and walk up.
|
|
35
|
+
3. **Both fail** (e.g. the clone moved): ask the user for the path with `AskUserQuestion`. Don't proceed without it.
|
|
36
|
+
|
|
37
|
+
Once located:
|
|
38
|
+
|
|
39
|
+
- Foundation source root: `<clone>/ai-tools-builder/skills/vinta-derive-skills/resources/foundation-skills/`.
|
|
40
|
+
- Template source root: `<clone>/ai-tools-builder/skills/vinta-derive-skills/resources/`.
|
|
41
|
+
- Stack source root: `<clone>/ai-tools-builder/skills/vinta-bootstrap-ai-tools/resources/stacks/`.
|
|
42
|
+
|
|
43
|
+
## Steps
|
|
44
|
+
|
|
45
|
+
### 1. Prerequisite check
|
|
46
|
+
|
|
47
|
+
`<project>/ai-tools/skills/` exists and is non-empty. If not → stop and tell the user to run [vinta-bootstrap-ai-tools](../vinta-bootstrap-ai-tools/SKILL.md) first.
|
|
48
|
+
|
|
49
|
+
The clone is locatable (per "Locating the source"). If not → ask, then continue.
|
|
50
|
+
|
|
51
|
+
### 2. Inventory the project skills
|
|
52
|
+
|
|
53
|
+
For each subdirectory under `<project>/ai-tools/skills/`, record:
|
|
54
|
+
|
|
55
|
+
- Skill name (= directory name).
|
|
56
|
+
- The file paths inside (`SKILL.md` always; sometimes `resources/`, `scripts/`, etc.).
|
|
57
|
+
- The current contents of `SKILL.md`.
|
|
58
|
+
|
|
59
|
+
### 3. Classify each skill
|
|
60
|
+
|
|
61
|
+
For each project skill, decide its bucket:
|
|
62
|
+
|
|
63
|
+
| Bucket | Detection | Action |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| `verbatim` | The skill name matches a directory under `vinta-derive-skills/resources/foundation-skills/` (e.g. `plan-feature`, `create-spec`, `create-qa-use-cases`). | Diff against source. |
|
|
66
|
+
| `templated` | The skill name is `implement-plan` (or any other future templated skill listed under `vinta-derive-skills/resources/*-template.md`). | **Don't diff.** Surface as "regenerate via [vinta-derive-skills](../vinta-derive-skills/SKILL.md)". |
|
|
67
|
+
| `stack-derived` | The skill maps to a stack-template prompt under `vinta-bootstrap-ai-tools/resources/stacks/<stack>/notes.md`. | Same as `templated` — surface, don't diff. |
|
|
68
|
+
| `user-authored` | None of the above. | Skip silently. |
|
|
69
|
+
|
|
70
|
+
For `templated` and `stack-derived`, in-place diffing is misleading because the project version contains interpolated values (commands, branch names, etc.) that won't appear in the template. The right refresh path for those is to re-run [vinta-derive-skills](../vinta-derive-skills/SKILL.md) so the user can re-supply the inputs.
|
|
71
|
+
|
|
72
|
+
### 4. Diff verbatim skills
|
|
73
|
+
|
|
74
|
+
For each `verbatim` skill:
|
|
75
|
+
|
|
76
|
+
- Read the source `SKILL.md` from the clone.
|
|
77
|
+
- Read the project's `SKILL.md`.
|
|
78
|
+
- If byte-identical → mark `up-to-date`.
|
|
79
|
+
- Else → mark `outdated`, compute a unified diff (use `git diff --no-index` if available, otherwise produce a text diff yourself).
|
|
80
|
+
|
|
81
|
+
Also compare the rest of the directory tree (`resources/`, `scripts/`, etc.). Any source files not present in the project version → mark as "new files to add". Any project files not present in source → leave alone (could be local additions).
|
|
82
|
+
|
|
83
|
+
### 5. Build the proposal
|
|
84
|
+
|
|
85
|
+
Produce a human-readable report grouped by status. Example:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Project skills under ai-tools/skills/ — refresh proposal
|
|
89
|
+
========================================================
|
|
90
|
+
|
|
91
|
+
UP-TO-DATE (no action needed)
|
|
92
|
+
- plan-feature
|
|
93
|
+
|
|
94
|
+
OUTDATED (proposed: overwrite SKILL.md from source)
|
|
95
|
+
- create-spec (12 lines added, 3 removed)
|
|
96
|
+
- create-qa-use-cases (2 lines changed)
|
|
97
|
+
|
|
98
|
+
REGENERATE NEEDED (proposed: re-run vinta-derive-skills)
|
|
99
|
+
- implement-plan (templated — values would be lost on overwrite)
|
|
100
|
+
|
|
101
|
+
USER-AUTHORED (no action — left alone)
|
|
102
|
+
- my-team-thing
|
|
103
|
+
- update-tenant-fields
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
For each `outdated` entry, include the diff inline (collapsed if long). Don't truncate — the user needs to see what's changing.
|
|
107
|
+
|
|
108
|
+
### 6. Per-skill confirmation
|
|
109
|
+
|
|
110
|
+
**Critical: never apply changes silently.**
|
|
111
|
+
|
|
112
|
+
For each `outdated` skill, ask the user explicitly. Use `AskUserQuestion` (or the equivalent for the vendor) with options:
|
|
113
|
+
|
|
114
|
+
- `Apply` — overwrite the project file with source.
|
|
115
|
+
- `Skip` — leave the project version alone for now.
|
|
116
|
+
- `Diff again` — re-display the diff in full.
|
|
117
|
+
|
|
118
|
+
Do NOT batch these under a single "apply all?" prompt. Each skill is a separate decision so the user can keep their hand-tuned wording where it matters.
|
|
119
|
+
|
|
120
|
+
For `templated` / `stack-derived` skills, the question is different — they can't be applied directly:
|
|
121
|
+
|
|
122
|
+
- `Re-run vinta-derive-skills now` (orchestrator decides if that's in-scope for this session) — exits this skill, hands off.
|
|
123
|
+
- `Skip` — leave alone, surface as a TODO at the end.
|
|
124
|
+
|
|
125
|
+
### 7. Apply approved changes
|
|
126
|
+
|
|
127
|
+
For each `outdated` skill where the user said `Apply`:
|
|
128
|
+
|
|
129
|
+
- Overwrite `<project>/ai-tools/skills/<name>/SKILL.md` with source content.
|
|
130
|
+
- For any "new files to add" inside that skill's source tree, copy them into the project (preserving subdir structure).
|
|
131
|
+
- Do not touch project-only files inside that skill's directory.
|
|
132
|
+
|
|
133
|
+
After each write, log: `[updated] ai-tools/skills/<name>/SKILL.md`.
|
|
134
|
+
|
|
135
|
+
### 8. Re-run the per-vendor setup script
|
|
136
|
+
|
|
137
|
+
The project's `ai-tools/scripts/setup-ai-tools.mjs` (installed by [vinta-install-ai-tools-setup](../vinta-install-ai-tools-setup/SKILL.md)) materializes vendor-specific copies. After updating canonical skills, run it so each vendor's `<vendor>/skills/` symlink/copy resolves to the new content:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pnpm setup:ai-tools
|
|
141
|
+
# or: node ai-tools/scripts/setup-ai-tools.mjs
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
If the project's setup script is symlinked-style, this is a no-op; for copy-style it refreshes the per-vendor copies.
|
|
145
|
+
|
|
146
|
+
### 9. Final report
|
|
147
|
+
|
|
148
|
+
Echo back, in this order:
|
|
149
|
+
|
|
150
|
+
1. **Updated** — skills that got overwritten (with file paths).
|
|
151
|
+
2. **Skipped by user** — skills the user kept their version of (with reason if given).
|
|
152
|
+
3. **Needs regeneration** — `templated` / `stack-derived` skills the user should refresh by re-running [vinta-derive-skills](../vinta-derive-skills/SKILL.md).
|
|
153
|
+
4. **User-authored (untouched)** — for transparency.
|
|
154
|
+
|
|
155
|
+
If anything was updated, suggest the next steps the user should take: review the changes (`git diff ai-tools/`), commit, optionally re-run vendor setup.
|
|
156
|
+
|
|
157
|
+
## Read-only mode
|
|
158
|
+
|
|
159
|
+
If the user asks for a "preview" / "what would change" / "dry-run" — perform steps 1–5 only. Stop before step 6. Print the proposal and exit. The user can re-invoke without `--dry-run` semantics when ready.
|
|
160
|
+
|
|
161
|
+
When invoked without an explicit dry-run intent, still default to **showing all diffs first, then asking**. Never start with destructive actions.
|
|
162
|
+
|
|
163
|
+
## Pitfalls
|
|
164
|
+
|
|
165
|
+
- **Overwriting hand-edited foundation skills.** Some teams tweak the foundation `SKILL.md` after bootstrap (project-specific examples). The byte-diff will flag those as `outdated` even though the upstream hasn't moved. The per-skill confirmation gate is what protects them — but make sure the diff is *visible* before asking, so the user notices their edit is about to be lost.
|
|
166
|
+
- **Skipping the explicit confirmation.** Bulk "apply all" prompts feel efficient but defeat the safety property. One question per outdated skill.
|
|
167
|
+
- **Trying to diff templated skills.** `implement-plan` and stack-derived skills contain interpolated values. A byte-diff vs the template will be huge and useless. Classify them first; never diff.
|
|
168
|
+
- **Forgetting the per-vendor refresh.** The user runs this skill, sees "updated 3 files", opens Cursor, and Cursor still shows the old content because its `.cursor/skills/` is a copy that wasn't refreshed. Step 8 fixes this — don't skip it.
|
|
169
|
+
- **Hard-coded clone path.** Don't assume `~/code/vinta-ai-workflows`. Resolve the clone via the symlink / marker / explicit ask path described in "Locating the source".
|
|
170
|
+
- **Touching skills not under `ai-tools/skills/`.** This skill operates only on the canonical skill source directory. The vendor-specific copies under `.claude/skills/`, `.cursor/skills/`, etc. are derived — they get refreshed by step 8, not by direct writes here.
|
|
171
|
+
|
|
172
|
+
## Verification
|
|
173
|
+
|
|
174
|
+
1. **Up-to-date project**: run the skill; expected outcome — every project skill in `up-to-date` bucket, no questions asked, exit cleanly.
|
|
175
|
+
2. **Drift case**: edit one foundation skill in this repo, run the skill on a project that has the old version; expected — that skill flagged `outdated`, diff displayed, user prompted, accept → file updated, decline → file unchanged.
|
|
176
|
+
3. **User-authored skill present**: project has `ai-tools/skills/my-thing/SKILL.md` with no upstream source; expected — bucket = `user-authored`, no prompt, no write.
|
|
177
|
+
4. **Templated skill drift**: `implement-plan` differs from template; expected — bucket = `templated`, prompt offers re-run hand-off, never auto-overwrites.
|
|
178
|
+
5. **No `ai-tools/skills/`**: expected — stop early, route to [vinta-bootstrap-ai-tools](../vinta-bootstrap-ai-tools/SKILL.md).
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vinta-write-agents-md
|
|
3
|
+
description: Synthesize `ai-tools/AGENTS.md` from the inventory produced by [vinta-analyze-codebase](../vinta-analyze-codebase/SKILL.md) plus a focused interview for what the analysis can't see. Used by [vinta-bootstrap-ai-tools](../vinta-bootstrap-ai-tools/SKILL.md) as step 2; also runnable standalone to refresh AGENTS.md after a major refactor. Project-agnostic — sections are the same shape across stacks, content adapts. Symlinked into root `AGENTS.md` so Claude Code, Cursor, Codex, VS Code Copilot all read it natively.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Write AGENTS.md
|
|
7
|
+
|
|
8
|
+
The canonical project-conventions document. Read by every AI tool. Single source of truth — every other agent / skill defers to it for "how this project does X".
|
|
9
|
+
|
|
10
|
+
## Output
|
|
11
|
+
|
|
12
|
+
`ai-tools/AGENTS.md`. The setup script symlinks `AGENTS.md` at root and `.github/copilot-instructions.md` to it.
|
|
13
|
+
|
|
14
|
+
## Inputs
|
|
15
|
+
|
|
16
|
+
1. The structured inventory from [vinta-analyze-codebase](../vinta-analyze-codebase/SKILL.md). Pay attention to `existing_ai_artifacts.instructions` — every found instruction doc must be folded in, replaced, or referenced per the [Existing AI artifacts (per-artifact disposition)](../vinta-bootstrap-ai-tools/SKILL.md#e-existing-ai-artifacts-per-artifact-disposition) decision captured in the bootstrap interview.
|
|
17
|
+
2. Any existing `AGENTS.md` / `CLAUDE.md` / `CONTRIBUTING.md` / `README.md` / `.cursorrules` / `.github/copilot-instructions.md` content — read in full. Behavior depends on the user's disposition:
|
|
18
|
+
- **Merge into new AGENTS.md** — extract every still-accurate fact (commands, paths, naming rules, multi-tenancy notes, env vars, deploy steps) and weave into the canonical sections below. Don't lose content silently — if a paragraph doesn't fit any section, surface it for the user to place or drop.
|
|
19
|
+
- **Keep as-is, link from AGENTS.md** — leave the file untouched; add a `## See also` reference to it from the new AGENTS.md and copy only the high-level pointer (one sentence + link).
|
|
20
|
+
- **Replace from scratch** — discard the old content; draft fresh from inventory + interview. Note the discarded files in the run summary so the user can verify nothing important was lost.
|
|
21
|
+
3. Interview answers (Step 0 below).
|
|
22
|
+
|
|
23
|
+
## Step 0 — Interview before drafting
|
|
24
|
+
|
|
25
|
+
The analysis tells you the *shape* of the repo. The interview tells you *intent* — conventions humans hold but don't surface in code. Use `AskUserQuestion` for finite-choice; iterate plain prose for narrative.
|
|
26
|
+
|
|
27
|
+
### A. Project framing
|
|
28
|
+
|
|
29
|
+
1. **What does this project do?** One paragraph. Inferred from README is OK; confirm with user.
|
|
30
|
+
2. **Primary user(s)?** Internal team, external customers, both, integration partners.
|
|
31
|
+
3. **Maturity stage?** Greenfield, MVP, post-launch, mature.
|
|
32
|
+
|
|
33
|
+
### B. Conventions the analysis can't see
|
|
34
|
+
|
|
35
|
+
1. **Code-style nuances Biome / ruff / etc don't enforce** — naming, file layout, import order conventions. Free-form list.
|
|
36
|
+
2. **"Always do X" / "never do Y" rules** the team holds. e.g. "always inject deps with defaults", "never use `let` unless reassignment", "all FHIR resources stamp `meta.account`".
|
|
37
|
+
3. **Architecture patterns** — separation of concerns, where business logic lives, error-handling style.
|
|
38
|
+
4. **Testing philosophy** — unit vs integration ratio, mock vs real backends, test data conventions.
|
|
39
|
+
5. **Multi-tenancy details** if applicable — how is tenant scope enforced at every layer (DB / API / UI / background jobs).
|
|
40
|
+
|
|
41
|
+
### C. Deploy + env model
|
|
42
|
+
|
|
43
|
+
1. **Environments named.** `staging`, `production`, `preview-*`, `dev-<handle>`, etc. Confirm what `vinta-analyze-codebase` extracted.
|
|
44
|
+
2. **Deploy gates** — manual approval, soak window, automated promotion?
|
|
45
|
+
3. **Manual deploy steps** that aren't in CI — `npx medplum post`, `pnpm bots:deploy`, `kubectl apply`, etc.
|
|
46
|
+
4. **Per-env value mechanism** — `.env` files, secret managers, deploy-time injection, project-wide secrets vs per-env.
|
|
47
|
+
|
|
48
|
+
### D. PR + commit conventions
|
|
49
|
+
|
|
50
|
+
1. **Branch naming** — `feature/*`, `feat/*`, `<ticket>-<slug>`, free-form.
|
|
51
|
+
2. **PR who-creates-it** — agents create PRs, or only branches and humans open PRs?
|
|
52
|
+
3. **Commit message style** — Conventional Commits, short imperative, free-form.
|
|
53
|
+
4. **AI co-author trailers in commits** — allowed, forbidden, undefined. Most repos: forbidden.
|
|
54
|
+
|
|
55
|
+
### E. Out of scope (non-goals)
|
|
56
|
+
|
|
57
|
+
1. **Things AGENTS.md should explicitly NOT cover** — internal API tokens, customer data, security secrets that don't belong in a public-ish doc.
|
|
58
|
+
2. **Topics handled elsewhere** — if there's a `docs/ARCHITECTURE.md` or `docs/RBAC.md` already, reference it instead of duplicating.
|
|
59
|
+
|
|
60
|
+
After interview: read back load-bearing decisions in one paragraph; final `AskUserQuestion` `Looks good` / `Some corrections` / `More to clarify` / `Stop, rethink`. Loop until `Looks good`.
|
|
61
|
+
|
|
62
|
+
## Structure
|
|
63
|
+
|
|
64
|
+
The skeleton is fixed. Sections that don't apply: skip with a one-line "n/a — single-tenant" note rather than omitting silently.
|
|
65
|
+
|
|
66
|
+
```markdown
|
|
67
|
+
# {Project Name}
|
|
68
|
+
|
|
69
|
+
{One-paragraph what + why, from the **Project framing** interview group.}
|
|
70
|
+
|
|
71
|
+
## Project Overview
|
|
72
|
+
|
|
73
|
+
{Apps, libs, services list — one bullet per. Pulled from analyze-codebase monorepo.apps + .packages.}
|
|
74
|
+
|
|
75
|
+
{Key data backend / framework callout — e.g. "All data is stored as FHIR resources in Medplum — there is no traditional database." Or "Postgres 17 with psqlextra LIST partitioning by tenant_id". Or "stateless API; no persistent storage."}
|
|
76
|
+
|
|
77
|
+
## Tech Stack
|
|
78
|
+
|
|
79
|
+
- **{Framework}** {version} — {one-line role}
|
|
80
|
+
- **{Build tool}** ({purpose}), **{Test runner}** ({purpose}), **{Package manager}** ({version})
|
|
81
|
+
- **{Lint+format}** — {note any deviation from defaults}
|
|
82
|
+
- **{Deploy target}** — {note manual steps}
|
|
83
|
+
- ... etc
|
|
84
|
+
|
|
85
|
+
## Common Commands
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
{install}
|
|
89
|
+
{dev}
|
|
90
|
+
{build}
|
|
91
|
+
{test_unit}
|
|
92
|
+
{test_e2e} # if applicable
|
|
93
|
+
{lint}
|
|
94
|
+
{format}
|
|
95
|
+
{typecheck} # if separate from build
|
|
96
|
+
{deploy_*} # if commands surface in package.json / Makefile
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Code Style
|
|
100
|
+
|
|
101
|
+
{Pulled from analysis + the **Conventions the analysis can't see** interview group. Bullet list of enforced + cultural rules.}
|
|
102
|
+
|
|
103
|
+
## Architecture
|
|
104
|
+
|
|
105
|
+
### {Subsystem 1, e.g. "FHIR Workflow Engine" / "Data Pipeline" / "Auth"}
|
|
106
|
+
{Describe at the level a new contributor needs. Reference files / dirs.}
|
|
107
|
+
|
|
108
|
+
### {Subsystem 2, e.g. "Access Control" / "Multi-tenancy"}
|
|
109
|
+
{...}
|
|
110
|
+
|
|
111
|
+
### Routing / Page structure / Service shape (whichever applies)
|
|
112
|
+
{...}
|
|
113
|
+
|
|
114
|
+
### Testing
|
|
115
|
+
{What runner, where tests live, mocking conventions, fixture patterns.}
|
|
116
|
+
|
|
117
|
+
## {Multi-tenancy / Tenant Model — only if applicable}
|
|
118
|
+
|
|
119
|
+
{How tenants are scoped at every layer. Pull from the **Conventions the analysis can't see → Multi-tenancy details** interview answer + analyze-codebase env_model.multi_tenancy.}
|
|
120
|
+
|
|
121
|
+
## Environment Variables
|
|
122
|
+
|
|
123
|
+
{Per-app or per-service code fence with var names — no values. Pull from analyze-codebase env_model.example_files.}
|
|
124
|
+
|
|
125
|
+
**{App 1}** (`.env`):
|
|
126
|
+
```
|
|
127
|
+
VAR_ONE
|
|
128
|
+
VAR_TWO
|
|
129
|
+
...
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**{App 2}** (`.env`):
|
|
133
|
+
```
|
|
134
|
+
...
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Error / Exception Tracking
|
|
138
|
+
|
|
139
|
+
{If Sentry / Bugsnag / Datadog detected: one section with init pattern + tracing examples. Else: omit.}
|
|
140
|
+
|
|
141
|
+
## Deployment
|
|
142
|
+
|
|
143
|
+
| Environment | URL / target | Trigger |
|
|
144
|
+
|---|---|---|
|
|
145
|
+
| Staging | ... | ... |
|
|
146
|
+
| Production | ... | ... |
|
|
147
|
+
|
|
148
|
+
{Manual deploy steps if any: bullet list.}
|
|
149
|
+
|
|
150
|
+
## Key Documentation
|
|
151
|
+
|
|
152
|
+
{Bullets pointing at docs/<file>.md for deep dives the AGENTS.md doesn't replicate.}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Rules
|
|
156
|
+
|
|
157
|
+
- **Don't replicate doc content already in `docs/`.** Reference it. AGENTS.md is the orientation map, not the encyclopedia.
|
|
158
|
+
- **Be specific.** "Use bulk_create" not "use efficient ORM patterns". "Stamp meta.account on every FHIR resource" not "respect tenancy".
|
|
159
|
+
- **Cite paths.** Every "X lives in Y" claim names the file or dir. Future readers grep for the filename.
|
|
160
|
+
- **Plain English.** Read by humans + agents + new hires. Acronyms expanded on first use.
|
|
161
|
+
- **No code beyond what's necessary.** If a 5-line snippet captures the convention, use it. Don't paste 50 lines of context.
|
|
162
|
+
- **No marketing language.** "Robust", "seamless", "delightful" — strike. State what it does.
|
|
163
|
+
- **No `§N` shorthand for cross-references.** When AGENTS.md points at other docs, name the section (`See the **Multi-tenancy** section in docs/ARCHITECTURE.md`). `§4.2` is unreadable for humans and breaks when section numbering shifts.
|
|
164
|
+
|
|
165
|
+
## What NOT to put in AGENTS.md
|
|
166
|
+
|
|
167
|
+
- Customer-specific business rules ("this clinic gets X discount") — too volatile.
|
|
168
|
+
- Secrets, tokens, real env values.
|
|
169
|
+
- Detailed RBAC matrices — link to `docs/RBAC.md` if it exists; if not, derive-skills creates `manage-access-policy/SKILL.md` to handle it.
|
|
170
|
+
- Architecture deep-dives — those live in `docs/ARCHITECTURE.md` or per-subsystem docs.
|
|
171
|
+
- Incident postmortems / change history — git log + a CHANGELOG handle that.
|
|
172
|
+
|
|
173
|
+
## Examples to study before writing
|
|
174
|
+
|
|
175
|
+
If the source repo (the one defining `vinta-bootstrap-ai-tools`) has a real `AGENTS.md`, read it first as a worked example. Vinta's lives at `ai-tools/AGENTS.md` in the bootstrap-defining repo. Note its sectioning + density before writing the target's.
|
|
176
|
+
|
|
177
|
+
## Verification
|
|
178
|
+
|
|
179
|
+
After writing:
|
|
180
|
+
|
|
181
|
+
1. Re-read the document end-to-end — does it answer "what is this codebase, how do I work in it, what conventions matter"?
|
|
182
|
+
2. Every claim cites a file or convention source.
|
|
183
|
+
3. Section headings match the skeleton above (or skipped sections are explicit).
|
|
184
|
+
4. Length: 200–400 lines for a typical project. Shorter = probably under-specified. Longer = probably duplicating docs/ content.
|
|
185
|
+
5. `pnpm setup:ai-tools` (or whichever vendors selected) re-runs cleanly after the file is in place — confirms the symlinks point at it.
|
|
186
|
+
|
|
187
|
+
## Pitfalls
|
|
188
|
+
|
|
189
|
+
- **Letting analyze-codebase output dictate the prose.** The inventory is structured data; AGENTS.md is human-readable narrative. Translate, don't paste.
|
|
190
|
+
- **Writing the convention "Use X library" when the project actually uses Y.** Re-read direct deps in `package.json` / `pyproject.toml` before each section.
|
|
191
|
+
- **Forgetting commit / PR conventions.** The **PR + commit conventions** interview group is short and easy to skip; don't. The implement-plan / fixer agents need this.
|
|
192
|
+
- **Assuming multi-tenant when single-tenant.** Re-read evidence from the **Conventions the analysis can't see → Multi-tenancy details** answer + analyze-codebase env_model.multi_tenancy. If absent, mark the section "n/a — single-tenant".
|