swallowkit 1.0.0-beta.57 → 1.0.0-beta.58

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.
@@ -0,0 +1,167 @@
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ import { BackendLanguage } from "../../types";
4
+ import { PackageManager } from "../../utils/package-manager";
5
+
6
+ export interface AgentInstructionContext {
7
+ projectName: string;
8
+ backendLanguage: BackendLanguage;
9
+ packageManager: PackageManager;
10
+ }
11
+
12
+ export interface AgentInstructionDocuments {
13
+ agentsMd: string;
14
+ claudeMd: string;
15
+ copilotInstructions: string;
16
+ pathSpecificInstructions: Record<string, string>;
17
+ }
18
+
19
+ export const AGENT_TEMPLATE_FILES = {
20
+ agentsMd: "AGENTS.md",
21
+ claudeMd: "CLAUDE.md",
22
+ copilotInstructions: "copilot-instructions.md",
23
+ sharedModelsInstructions: "shared-models.instructions.md",
24
+ bffRoutesInstructions: "bff-routes.instructions.md",
25
+ azureFunctionsInstructions: "azure-functions.instructions.md",
26
+ } as const;
27
+
28
+ const BACKEND_LANGUAGE_LABELS: Record<BackendLanguage, string> = {
29
+ typescript: "TypeScript",
30
+ csharp: "C#",
31
+ python: "Python",
32
+ };
33
+
34
+ function getTemplatePath(fileName: string): string {
35
+ const candidates = [
36
+ path.join(__dirname, "agent-templates", fileName),
37
+ path.join(__dirname, "../../../src/core/project/agent-templates", fileName),
38
+ ];
39
+ const templatePath = candidates.find((candidate) => fs.existsSync(candidate));
40
+ if (!templatePath) {
41
+ throw new Error(`Agent instruction template not found: ${fileName}`);
42
+ }
43
+ return templatePath;
44
+ }
45
+
46
+ export function readAgentInstructionTemplate(fileName: string): string {
47
+ return fs.readFileSync(getTemplatePath(fileName), "utf-8").replace(/\r\n/g, "\n");
48
+ }
49
+
50
+ function getFunctionsStructureLine(backendLanguage: BackendLanguage): string {
51
+ if (backendLanguage === "typescript") {
52
+ return "│ └── src/ # HTTP trigger handlers with Cosmos DB bindings";
53
+ }
54
+ if (backendLanguage === "csharp") {
55
+ return "│ ├── Crud/ # C# HTTP trigger handlers\n│ └── generated/ # Native-generated C# schema assets";
56
+ }
57
+ return "│ ├── blueprints/ # Python HTTP trigger handlers\n│ └── generated/ # Native-generated Python schema assets";
58
+ }
59
+
60
+ function getBackendRules(backendLanguage: BackendLanguage): string {
61
+ if (backendLanguage === "typescript") {
62
+ return [
63
+ "- All backend business logic and data access live in `functions/src/`.",
64
+ "- Prefer Azure Functions Cosmos DB input/output bindings for reads and writes.",
65
+ "- Use the Cosmos DB SDK directly only where bindings do not support the operation, such as deletes.",
66
+ "- Validate data against the shared Zod schemas before persistence.",
67
+ ].join("\n");
68
+ }
69
+ return [
70
+ "- All backend business logic and data access live in `functions/`.",
71
+ `- SwallowKit derives OpenAPI and native ${BACKEND_LANGUAGE_LABELS[backendLanguage]} schema assets from the Zod source of truth.`,
72
+ "- Keep custom business logic in ai-authored locations identified by the current boundary contract.",
73
+ ].join("\n");
74
+ }
75
+
76
+ function interpolateTemplate(template: string, context: AgentInstructionContext): string {
77
+ const runCmd = context.packageManager === "pnpm" ? "pnpm" : "npx";
78
+ const replacements: Record<string, string> = {
79
+ projectName: context.projectName,
80
+ backendLanguageLabel: BACKEND_LANGUAGE_LABELS[context.backendLanguage],
81
+ functionsStructureLine: getFunctionsStructureLine(context.backendLanguage),
82
+ backendRules: getBackendRules(context.backendLanguage),
83
+ pm: context.packageManager,
84
+ runCmd,
85
+ };
86
+
87
+ const result = template.replace(/\{\{([A-Za-z]+)\}\}/g, (placeholder, key: string) => {
88
+ const replacement = replacements[key];
89
+ if (replacement === undefined) {
90
+ throw new Error(`Unknown Agent instruction placeholder: ${placeholder}`);
91
+ }
92
+ return replacement;
93
+ });
94
+
95
+ if (/\{\{[^}]+\}\}/.test(result)) {
96
+ throw new Error("Unresolved Agent instruction template placeholder");
97
+ }
98
+ return result;
99
+ }
100
+
101
+ function buildTemplate(fileName: string, context: AgentInstructionContext): string {
102
+ return interpolateTemplate(readAgentInstructionTemplate(fileName), context);
103
+ }
104
+
105
+ export function buildAgentsMd(context: AgentInstructionContext): string {
106
+ return buildTemplate(AGENT_TEMPLATE_FILES.agentsMd, context);
107
+ }
108
+
109
+ export function buildClaudeMd(context: AgentInstructionContext): string {
110
+ return buildTemplate(AGENT_TEMPLATE_FILES.claudeMd, context);
111
+ }
112
+
113
+ export function buildCopilotInstructions(context: AgentInstructionContext): string {
114
+ return buildTemplate(AGENT_TEMPLATE_FILES.copilotInstructions, context);
115
+ }
116
+
117
+ export function buildPathSpecificInstructions(
118
+ context: AgentInstructionContext
119
+ ): Record<string, string> {
120
+ return {
121
+ [AGENT_TEMPLATE_FILES.sharedModelsInstructions]: buildTemplate(
122
+ AGENT_TEMPLATE_FILES.sharedModelsInstructions,
123
+ context
124
+ ),
125
+ [AGENT_TEMPLATE_FILES.bffRoutesInstructions]: buildTemplate(
126
+ AGENT_TEMPLATE_FILES.bffRoutesInstructions,
127
+ context
128
+ ),
129
+ [AGENT_TEMPLATE_FILES.azureFunctionsInstructions]: buildTemplate(
130
+ AGENT_TEMPLATE_FILES.azureFunctionsInstructions,
131
+ context
132
+ ),
133
+ };
134
+ }
135
+
136
+ export function buildAgentInstructionDocuments(
137
+ context: AgentInstructionContext
138
+ ): AgentInstructionDocuments {
139
+ return {
140
+ agentsMd: buildAgentsMd(context),
141
+ claudeMd: buildClaudeMd(context),
142
+ copilotInstructions: buildCopilotInstructions(context),
143
+ pathSpecificInstructions: buildPathSpecificInstructions(context),
144
+ };
145
+ }
146
+
147
+ export function writeAgentInstructionFiles(
148
+ projectDir: string,
149
+ context: AgentInstructionContext
150
+ ): AgentInstructionDocuments {
151
+ const documents = buildAgentInstructionDocuments(context);
152
+ fs.writeFileSync(path.join(projectDir, "AGENTS.md"), documents.agentsMd, "utf-8");
153
+ fs.writeFileSync(path.join(projectDir, "CLAUDE.md"), documents.claudeMd, "utf-8");
154
+
155
+ const githubDir = path.join(projectDir, ".github");
156
+ const instructionsDir = path.join(githubDir, "instructions");
157
+ fs.mkdirSync(instructionsDir, { recursive: true });
158
+ fs.writeFileSync(
159
+ path.join(githubDir, "copilot-instructions.md"),
160
+ documents.copilotInstructions,
161
+ "utf-8"
162
+ );
163
+ for (const [fileName, content] of Object.entries(documents.pathSpecificInstructions)) {
164
+ fs.writeFileSync(path.join(instructionsDir, fileName), content, "utf-8");
165
+ }
166
+ return documents;
167
+ }
@@ -0,0 +1,442 @@
1
+ # AGENTS.md
2
+
3
+ This project was generated by **SwallowKit**.
4
+
5
+ SwallowKit is part of this project's architecture and development workflow.
6
+ Treat it as a standing constraint during discovery, requirements clarification,
7
+ specification, planning, ticket decomposition, implementation, verification,
8
+ and review — not only during code generation.
9
+
10
+ ## How SwallowKit Fits Into the Development Process
11
+
12
+ SwallowKit does **not** own the overall software development process.
13
+
14
+ If the user or another Agent Skill or framework defines a process for
15
+ requirements discovery, specification, planning, ticketing, TDD,
16
+ implementation, or review, continue to follow that process.
17
+
18
+ Use SwallowKit as the authoritative project-specific layer for:
19
+
20
+ - inspecting the current project
21
+ - understanding entities, routes, infrastructure, and responsibility boundaries
22
+ - determining which artifacts may be edited directly
23
+ - performing deterministic generation through plan/apply
24
+ - detecting drift
25
+ - verifying the resulting project
26
+ - enforcing human approval gates for sensitive operations
27
+
28
+ External development-process skills and SwallowKit are intended to compose.
29
+
30
+ A process skill decides **how to proceed**.
31
+ SwallowKit determines **how this SwallowKit project can be changed safely and reproducibly**.
32
+
33
+ ## Do Not Assume SwallowKit Capabilities From Memory
34
+
35
+ SwallowKit evolves over time.
36
+
37
+ Do not rely on model knowledge or assumptions about what SwallowKit can or
38
+ cannot generate.
39
+
40
+ When a SwallowKit capability, project structure, or ownership boundary affects
41
+ a design decision, inspect the current project and the currently available
42
+ SwallowKit interfaces before deciding.
43
+
44
+ Prefer the `swallowkit_*` MCP tools when available.
45
+
46
+ If MCP is unavailable, use the machine interface:
47
+
48
+ ```bash
49
+ {{runCmd}} swallowkit machine ...
50
+ ```
51
+
52
+ The machine interface is the fallback Agent-facing interface and returns
53
+ structured `status` / `nextActions` suitable for autonomous workflows.
54
+
55
+ ## Inspect Before Asking or Designing
56
+
57
+ When a task may affect SwallowKit-managed application structure, inspect the
58
+ project before asking the human questions or committing to an implementation
59
+ design.
60
+
61
+ Use only the inspections relevant to the task. Typical inspections include:
62
+
63
+ ```bash
64
+ {{runCmd}} swallowkit machine inspect project
65
+ {{runCmd}} swallowkit machine inspect entities
66
+ {{runCmd}} swallowkit machine inspect routes
67
+ {{runCmd}} swallowkit machine inspect boundaries
68
+ {{runCmd}} swallowkit machine inspect drift
69
+ {{runCmd}} swallowkit machine inspect infra
70
+ ```
71
+
72
+ Use the equivalent `swallowkit_*` MCP tools when available.
73
+
74
+ Questions that can be answered from the repository or SwallowKit inspection
75
+ should be answered by the agent instead of being delegated to the human.
76
+
77
+ Examples:
78
+
79
+ - Do not ask how generated CRUD layers should be wired if SwallowKit already
80
+ defines and generates them.
81
+ - Do not propose editing a generated file until responsibility boundaries have
82
+ been checked.
83
+ - Do not assume an infrastructure capability is unavailable before inspecting
84
+ the current SwallowKit project and available operations.
85
+
86
+ ## Specification and Planning Guidance
87
+
88
+ When producing or refining a specification:
89
+
90
+ - describe user-visible behavior and domain intent
91
+ - define acceptance criteria and important test seams
92
+ - treat SwallowKit's architecture and responsibility boundaries as
93
+ implementation constraints
94
+ - avoid prematurely describing generated artifacts as manually implemented
95
+ components
96
+ - do not duplicate work that SwallowKit can deterministically derive from its
97
+ source of truth
98
+
99
+ For example, if adding a model field causes SwallowKit to regenerate backend,
100
+ BFF, UI, and infrastructure artifacts, the specification should primarily
101
+ describe the desired end-to-end behavior and the SwallowKit constraint.
102
+
103
+ It should not imply that every generated layer is an independent manual
104
+ implementation decision.
105
+
106
+ If whether SwallowKit supports the desired behavior affects the specification,
107
+ inspect the current capabilities before finalizing the spec.
108
+
109
+ ## Ticket Decomposition Guidance
110
+
111
+ Prefer independently verifiable **vertical slices** of user or system behavior.
112
+
113
+ Do not split work into horizontal tickets such as:
114
+
115
+ - schema ticket
116
+ - backend ticket
117
+ - BFF ticket
118
+ - UI ticket
119
+ - infrastructure ticket
120
+
121
+ merely because those artifacts exist in separate layers.
122
+
123
+ When SwallowKit deterministically produces those layers, keep them inside the
124
+ same vertical slice whenever they represent one end-to-end behavior.
125
+
126
+ Example:
127
+
128
+ ```text
129
+ Add priority support to Todo
130
+ ├─ update the source-of-truth model
131
+ ├─ use SwallowKit plan/apply to realign managed artifacts
132
+ ├─ add any required ai-authored business logic
133
+ ├─ add/update tests
134
+ └─ verify the project
135
+ ```
136
+
137
+ Ticket boundaries should reflect independently valuable and verifiable
138
+ behavior, not SwallowKit's generated file structure.
139
+
140
+ ## Responsibility Boundary
141
+
142
+ Before making file-level implementation decisions, inspect the current
143
+ machine-readable boundary contract:
144
+
145
+ ```bash
146
+ {{runCmd}} swallowkit machine inspect boundaries
147
+ ```
148
+
149
+ Treat its current result as authoritative.
150
+
151
+ The general ownership model is:
152
+
153
+ ### ai-authored
154
+
155
+ The agent may edit these directly.
156
+
157
+ Typical examples include:
158
+
159
+ - source-of-truth models
160
+ - custom business logic
161
+ - custom pages/components
162
+ - tests
163
+
164
+ ### deterministic
165
+
166
+ Do not hand-edit these artifacts.
167
+
168
+ They are generated and owned by SwallowKit. Change the appropriate source of
169
+ truth or configuration, then use SwallowKit plan/apply to regenerate them.
170
+
171
+ Managed artifacts are tracked by SwallowKit metadata such as
172
+ `.swallowkit/artifacts.json`.
173
+
174
+ ### shared
175
+
176
+ Edit only outside SwallowKit-managed markers.
177
+
178
+ Always inspect the current boundary contract instead of relying solely on the
179
+ examples in this document.
180
+
181
+ ## Deterministic Changes: Plan → Apply → Verify
182
+
183
+ For autonomous or agent-driven generation, prefer the SwallowKit two-phase
184
+ workflow.
185
+
186
+ ```text
187
+ inspect
188
+ ↓
189
+ plan
190
+ ↓
191
+ evaluate conflicts / approval requirements
192
+ ↓
193
+ apply
194
+ ↓
195
+ verify
196
+ ```
197
+
198
+ Example:
199
+
200
+ ```bash
201
+ {{runCmd}} swallowkit machine plan scaffold <model>
202
+ {{runCmd}} swallowkit machine apply scaffold --plan <planId>
203
+ {{runCmd}} swallowkit machine verify project
204
+ ```
205
+
206
+ Do not bypass plan/apply by manually editing deterministic artifacts.
207
+
208
+ If a plan reports conflicts, determine whether existing hand-written behavior
209
+ must be moved to an ai-authored location or whether overwrite approval is
210
+ required.
211
+
212
+ Never invent or implicitly grant human approval.
213
+
214
+ ## Model Changes
215
+
216
+ For an existing model change, the normal pattern is:
217
+
218
+ ```text
219
+ edit source-of-truth model
220
+ ↓
221
+ inspect drift
222
+ ↓
223
+ plan scaffold
224
+ ↓
225
+ resolve conflicts / approvals if any
226
+ ↓
227
+ apply
228
+ ↓
229
+ verify
230
+ ```
231
+
232
+ Use the `swallowkit-modify-model` Agent Skill when available.
233
+
234
+ Otherwise read and follow the equivalent runbook under
235
+ `.swallowkit/workflows/`.
236
+
237
+ Never repair schema drift by directly patching SwallowKit-managed artifacts.
238
+
239
+ ## New Models / CRUD Features
240
+
241
+ Use the `swallowkit-add-model` Agent Skill when available.
242
+
243
+ Otherwise follow the equivalent runbook under `.swallowkit/workflows/`.
244
+
245
+ The agent may author domain-specific schema fields and custom behavior, but
246
+ SwallowKit should generate framework-owned CRUD artifacts.
247
+
248
+ Do not manually recreate boilerplate that SwallowKit owns.
249
+
250
+ ## Verification Is a Completion Gate
251
+
252
+ Before treating an agent-driven implementation as complete, run SwallowKit
253
+ verification:
254
+
255
+ ```bash
256
+ {{runCmd}} swallowkit machine verify project
257
+ ```
258
+
259
+ or the equivalent MCP operation.
260
+
261
+ Verification covers SwallowKit structural correctness, drift, type correctness,
262
+ and configured project checks.
263
+
264
+ When verification fails, use the structured failure explanation:
265
+
266
+ ```bash
267
+ {{runCmd}} swallowkit machine explain failure
268
+ ```
269
+
270
+ or its MCP equivalent, then repair the appropriate source and verify again.
271
+
272
+ Use the `swallowkit-verify-repair` Agent Skill or runbook when applicable.
273
+
274
+ SwallowKit verification answers:
275
+
276
+ > Is the SwallowKit project mechanically and structurally valid?
277
+
278
+ A semantic code review answers different questions:
279
+
280
+ > Is this implementation well designed?
281
+ > Does it satisfy the specification and user intent?
282
+
283
+ Therefore, perform SwallowKit verification before treating semantic code review
284
+ as the final quality gate.
285
+
286
+ ## Human Approval Gates
287
+
288
+ A machine operation may return terminal states such as:
289
+
290
+ - `complete`
291
+ - `in-progress`
292
+ - `blocked`
293
+ - `requires-human`
294
+ - `failed`
295
+
296
+ Follow `nextActions`.
297
+
298
+ When the status is `requires-human`, stop and request the required human
299
+ decision.
300
+
301
+ Do not reinterpret `requires-human` as an error to work around.
302
+
303
+ Azure provisioning is a human-approved operation.
304
+
305
+ Use the `swallowkit-provision` Agent Skill or runbook and never bypass its
306
+ approval gate. A broad request to deploy does not itself grant the explicit
307
+ approval required by that workflow.
308
+
309
+ ## SwallowKit Agent Skills and Runbooks
310
+
311
+ SwallowKit installs task-specific Agent Skills under:
312
+
313
+ ```text
314
+ .github/skills/
315
+ ```
316
+
317
+ Current workflows include:
318
+
319
+ - `swallowkit-add-model`
320
+ - `swallowkit-modify-model`
321
+ - `swallowkit-verify-repair`
322
+ - `swallowkit-provision`
323
+
324
+ Equivalent agent-agnostic runbooks are available under:
325
+
326
+ ```text
327
+ .swallowkit/workflows/
328
+ ```
329
+
330
+ If the runtime supports Agent Skills, use the relevant Skill when the task
331
+ matches. If it does not, read the corresponding runbook.
332
+
333
+ These task-specific instructions supplement this `AGENTS.md`; they do not
334
+ replace the always-on project contract.
335
+
336
+ ## Architecture
337
+
338
+ This is a full-stack application deployed on Azure with a TypeScript
339
+ frontend/BFF and an Azure Functions backend in {{backendLanguageLabel}}.
340
+
341
+ ```text
342
+ Frontend (React / Next.js App Router)
343
+ ↓
344
+ BFF (Next.js API Routes)
345
+ ↓
346
+ Azure Functions
347
+ ↓
348
+ Azure Cosmos DB
349
+ ```
350
+
351
+ ### Core architecture rules
352
+
353
+ 1. Next.js API routes are a BFF/proxy layer. Do not place application business
354
+ logic or direct database access there.
355
+ 2. Zod schemas under `shared/models/` are the application model source of truth.
356
+ 3. Do not duplicate model definitions across layers.
357
+ 4. Azure Functions own backend business logic and data access.
358
+ 5. SwallowKit-generated artifacts must be changed through their source of truth
359
+ and deterministic generation workflow, not by hand.
360
+ 6. Infrastructure is managed as code with Bicep. Respect SwallowKit ownership
361
+ markers and boundaries.
362
+ 7. Production access to Azure resources must follow the generated security
363
+ architecture; do not introduce hard-coded credentials or connection strings.
364
+
365
+ ### Backend-specific rules
366
+
367
+ {{backendRules}}
368
+
369
+ The backend owns `id`, `createdAt`, and `updatedAt`; never trust client-sent
370
+ values for these fields.
371
+
372
+ ## Project Structure
373
+
374
+ ```text
375
+ {{projectName}}/
376
+ ├── app/ # Next.js App Router
377
+ │ ├── api/ # BFF routes
378
+ │ └── {model}/ # generated/custom UI
379
+ ├── functions/ # Azure Functions backend
380
+ {{functionsStructureLine}}
381
+ ├── shared/
382
+ │ ├── models/ # Zod source-of-truth models
383
+ │ └── index.ts
384
+ ├── lib/
385
+ │ └── api/
386
+ ├── components/
387
+ ├── infra/ # Bicep infrastructure
388
+ ├── .swallowkit/ # SwallowKit project metadata and runbooks
389
+ ├── .github/skills/ # SwallowKit Agent Skills
390
+ ├── .mcp.json # project-scoped SwallowKit MCP bootstrap
391
+ └── AGENTS.md
392
+ ```
393
+
394
+ Inspect the current project rather than assuming every project has exactly the
395
+ same generated structure.
396
+
397
+ ## Naming and Model Conventions
398
+
399
+ - Model schema files use `shared/models/{kebab-case}.ts`.
400
+ - The Zod schema constant and inferred TypeScript type use the same PascalCase
401
+ name: `export const Todo = z.object(...); export type Todo = z.infer<typeof Todo>`.
402
+ - Re-export models from `shared/index.ts`.
403
+ - Mark backend-managed fields as optional in source-of-truth schemas.
404
+ - Cosmos DB containers use PascalCase plural names and default to `/id` as the
405
+ partition key unless the model declares another key.
406
+
407
+ ## Everyday Commands
408
+
409
+ ```bash
410
+ {{pm}} install
411
+ {{runCmd}} swallowkit dev
412
+ {{pm}} run build
413
+ {{pm}} run lint
414
+ {{runCmd}} swallowkit machine verify project
415
+ ```
416
+
417
+ Always invoke SwallowKit using the package-runner convention generated for this
418
+ project. Do not arbitrarily mix package-manager invocation styles.
419
+
420
+ ## Final Rules
421
+
422
+ Do not:
423
+
424
+ - rely on remembered SwallowKit capabilities when current inspection can answer
425
+ the question
426
+ - hand-edit deterministic SwallowKit-managed artifacts
427
+ - bypass plan/apply safety checks
428
+ - bypass human approval gates
429
+ - duplicate model definitions across generated layers
430
+ - move backend business logic into the BFF
431
+ - decompose one end-to-end SwallowKit-generated feature into artificial
432
+ horizontal tickets solely because multiple generated layers exist
433
+ - consider an implementation complete before SwallowKit verification succeeds
434
+
435
+ Do:
436
+
437
+ - inspect before making SwallowKit-dependent design assumptions
438
+ - preserve external development-process workflows
439
+ - use SwallowKit as the deterministic execution and verification layer
440
+ - keep specifications focused on intent and observable behavior
441
+ - prefer vertical, independently verifiable slices
442
+ - verify before final semantic review
@@ -0,0 +1,28 @@
1
+ # CLAUDE.md
2
+
3
+ This is a **SwallowKit** project.
4
+
5
+ Before discovery, requirements clarification, specification, planning, ticket
6
+ decomposition, implementation, verification, or review, read and follow the
7
+ root `AGENTS.md`.
8
+
9
+ SwallowKit must be considered before implementation, not only when generating
10
+ code.
11
+
12
+ Always-on rules:
13
+
14
+ - Inspect the current project and SwallowKit capabilities before making
15
+ SwallowKit-dependent assumptions or asking questions the repository can answer.
16
+ - Prefer `swallowkit_*` MCP tools.
17
+ - Fall back to `{{runCmd}} swallowkit machine ...` when MCP is unavailable.
18
+ - Inspect responsibility boundaries before editing framework-related files.
19
+ - Never hand-edit deterministic SwallowKit-managed artifacts.
20
+ - Use plan/apply for deterministic generation.
21
+ - Respect all `requires-human` states and provisioning approval gates.
22
+ - Run SwallowKit verification before considering implementation complete.
23
+
24
+ Task-specific SwallowKit Agent Skills are available under `.github/skills/`.
25
+ Equivalent agent-agnostic runbooks are available under
26
+ `.swallowkit/workflows/`.
27
+
28
+ The root `AGENTS.md` is the canonical project contract.
@@ -0,0 +1,22 @@
1
+ ---
2
+ applyTo: "functions/**"
3
+ ---
4
+
5
+ # Azure Functions — Backend Rules
6
+
7
+ The root `AGENTS.md` is the canonical contract. Azure Functions own application
8
+ business logic and data access, but generated handlers and contracts may be
9
+ deterministic. Inspect boundaries before choosing an edit location.
10
+
11
+ - Put custom behavior only in an ai-authored location reported by the current
12
+ boundary contract.
13
+ - Never directly edit deterministic handlers or generated schema assets.
14
+ - Keep backend contracts aligned with `shared/models/` through MCP-first
15
+ plan/apply, using the machine interface as fallback.
16
+ - Auto-generate `id`, `createdAt`, and `updatedAt` on the backend. Never trust
17
+ client-sent values for these fields.
18
+ - Container names use PascalCase plural form and default to `/id` as the
19
+ partition key unless the source-of-truth model says otherwise.
20
+ - Respect `requires-human` and run SwallowKit verification after changes.
21
+
22
+ Backend language: {{backendLanguageLabel}}.
@@ -0,0 +1,18 @@
1
+ ---
2
+ applyTo: "app/api/**"
3
+ ---
4
+
5
+ # BFF API Routes — Rules
6
+
7
+ The root `AGENTS.md` is the canonical contract. Inspect the current
8
+ responsibility boundary before editing files in this layer.
9
+
10
+ - `app/api/` is a BFF/proxy layer. Never place business logic, database access,
11
+ or direct Cosmos DB calls here.
12
+ - Use `callFunction()` from `@/lib/api/call-function` to forward requests to
13
+ Azure Functions.
14
+ - Input/output validation may use schemas imported from `@{{projectName}}/shared`.
15
+ - Never directly edit a route reported as deterministic. Change its source of
16
+ truth and use MCP-first plan/apply, with the machine interface as fallback.
17
+ - Edit shared artifacts only outside managed markers.
18
+ - Respect `requires-human` and run SwallowKit verification after changes.
@@ -0,0 +1,24 @@
1
+ # Copilot Instructions
2
+
3
+ This is a **SwallowKit** project.
4
+
5
+ Read and follow the root `AGENTS.md` as the canonical project contract.
6
+
7
+ SwallowKit applies during discovery, requirements clarification, specification,
8
+ planning, ticket decomposition, implementation, verification, and review — not
9
+ only during code generation.
10
+
11
+ Key rules:
12
+
13
+ - Inspect current SwallowKit capabilities instead of assuming them.
14
+ - Answer repository- and SwallowKit-inspectable questions before asking the human.
15
+ - Prefer `swallowkit_*` MCP tools when available.
16
+ - Otherwise use `{{runCmd}} swallowkit machine ...`.
17
+ - Inspect responsibility boundaries before editing framework-related files.
18
+ - Never hand-edit deterministic SwallowKit-managed artifacts.
19
+ - Use plan/apply for deterministic generation.
20
+ - Respect `requires-human` states and other human approval gates.
21
+ - Run SwallowKit verification before completion.
22
+
23
+ Task-specific SwallowKit Agent Skills live under `.github/skills/`.
24
+ Agent-agnostic equivalents live under `.swallowkit/workflows/`.