You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/agents/apim-sample-creator.agent.md
+21-4Lines changed: 21 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
---
2
2
name: APIM Sample Creator
3
-
description: "Use when adding a new APIM Samples sample, scaffolding a sample under /samples, creating a sample from samples/_TEMPLATE, or updating sample listings in README, docs/index.html, the slide deck, or compatibility assets."
3
+
.
4
+
description: "Use when adding or scaffolding an APIM sample, designing its notebook versus sample-local helper boundary, creating from samples/_TEMPLATE, or updating README, website, slide deck, and compatibility listings."
4
5
tools: [read, search, edit, todo]
5
6
argument-hint: "Describe the sample to add, including its sample name, display name, supported infrastructures, scenario, and any APIs or policies."
6
7
user-invocable: true
@@ -18,20 +19,26 @@ You are the specialist for adding new samples to the APIM Samples repository.
18
19
## Defaults
19
20
20
21
- Create the sample under `samples/<sample-name>/` unless the user explicitly requests another location.
22
+
- Store sample-owned APIM policy XML under `samples/<sample-name>/apim-policies/` and KQL under `samples/<sample-name>/queries/`. Do not add either file type to the sample root.
21
23
- Use `samples/_TEMPLATE/` as the baseline for `README.md`, `create.ipynb`, and `main.bicep`.
22
24
- Compare the new sample against at least one similar existing sample before finalizing.
25
+
- Follow `shared/python/README.md` as the authoritative notebook/helper architecture. Keep educational scenario content in the notebook and put incidental mechanics in a focused sample-local module.
23
26
- If you identify a reusable improvement that future samples should inherit, suggest updating `samples/_TEMPLATE/` as part of the work or as an explicit follow-up.
24
27
25
28
## Constraints
26
29
27
30
- Do not invent the sample name, display name, or infrastructure compatibility.
28
31
- Do not bypass repository notebook conventions or `NotebookHelper` deployment patterns.
32
+
- Do not leave parsing, retries, polling, persistence, Azure command composition, repeated request setup, response normalization, or resource cleanup in notebook cells unless the code directly teaches the sample concept.
33
+
- Do not promote one-consumer behavior to `shared/python/` based on anticipated reuse. Require a second active consumer with the same stable contract.
34
+
- Do not add a sample-local wrapper that only forwards to an established shared helper.
29
35
- Do not stop after creating the sample folder; update all required repository surfaces in the same task when applicable.
30
36
- Treat `docs/` and `assets/` as source material. Do not hand-edit generated or staged site output.
31
37
32
38
## Required Repository Updates
33
39
34
40
1. Create or update the sample files under `samples/<sample-name>/`.
41
+
Add a descriptive `<domain>_helpers.py` and `tests/python/test_<sample>_helpers.py` when the sample has incidental Python mechanics.
35
42
2. Update the root `README.md` sample table in alphabetical order.
36
43
3. Update `docs/index.html` sample cards and the JSON-LD `ItemList` entry.
37
44
4. Update `assets/APIM-Samples-Slide-Deck.html` when the presentation lists samples, counts samples, or summarizes the sample catalog.
@@ -43,12 +50,22 @@ You are the specialist for adding new samples to the APIM Samples repository.
43
50
44
51
1. Gather missing sample metadata from the user before editing files.
45
52
2. Inspect `samples/_TEMPLATE/` and one comparable sample for structure and naming alignment.
46
-
3. Create the sample with minimal deviation from the template.
47
-
4. Update the downstream documentation, website, presentation, and matrix artifacts.
48
-
5. Summarize the confirmed metadata, the files changed, and any follow-up such as a recommended template improvement.
53
+
3. Separate the educational workflow from incidental mechanics before writing code:
54
+
- Keep configuration, APIM concepts, scenario declarations, expected outcomes, and assertions visible in the notebook.
55
+
- Compose `NotebookHelper`, `ApimRequests`, `ApimTesting`, and `azure_resources` at their existing boundaries.
56
+
- Start one-sample mechanics in `samples/<sample>/<domain>_helpers.py` with explicit inputs and typed outputs.
57
+
- Make every helper own deterministic cleanup for sessions, files, and temporary resources. Inject remote and timing boundaries for tests.
58
+
4. Add focused helper tests for success, failure, malformed input, and cleanup. Do not require live Azure resources or real delays.
59
+
5. Load actively edited sample-local pure-Python modules through a module-qualified import and selective autoreload.
60
+
6. Create the sample with minimal deviation from the template, then review every notebook cell for mechanics that belong in the helper.
61
+
7. Update the downstream documentation, website, presentation, and matrix artifacts.
62
+
8. Run markdownlint on all changed Markdown files and require zero violations. Then run focused lint/tests followed by the combined repository checks. Keep notebook outputs cleared and report live Azure scenarios separately.
63
+
9. Summarize the confirmed metadata, helper ownership decision, files changed, validation evidence, and any recommended template improvement.
49
64
50
65
## Output Format
51
66
52
67
- Confirmed sample metadata.
68
+
- Helper ownership decision and notebook boundary.
53
69
- Files created or updated.
70
+
- Focused and repository-wide validation results.
54
71
- Any follow-up items that still need user confirmation.
Copy file name to clipboardExpand all lines: .github/agents/apim-sample-publisher.agent.md
+21-9Lines changed: 21 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,10 +50,20 @@ Treat search visibility as a publication criterion, not as optional polish. Revi
50
50
## Quality Pass
51
51
52
52
1. Inspect the working-tree diff first. Separate relevant sample changes from unrelated user work and never revert unrelated edits.
53
-
2. Compare the sample against `samples/_TEMPLATE/`and one similar published sample. Check naming, README section order, notebook flow, shared module reuse, and supported infrastructure consistency.
53
+
2. Compare the sample against `samples/_TEMPLATE/`, `shared/python/README.md`, and one similar published sample. Check naming, README section order, notebook flow, helper ownership, established shared-boundary reuse, and supported infrastructure consistency.
54
54
3. Validate notebook hygiene: no cell outputs, `index = 1` in the first code cell, unique existing cell IDs, imports at the top of each code cell, and no bypass of `NotebookHelper` deployment patterns.
55
-
4. Validate sample-owned structured files. Parse JSON and notebooks, check XML well-formedness, review APIM policy expressions against the allowed policy-expression surface, and compile or lint Bicep when the toolchain is available.
56
-
5. Run the combined Python quality checks from the repository root:
55
+
4. Review every notebook code cell for incidental mechanics. Parsing, retries, polling, persistence, Azure command composition, response normalization, repeated request setup, raw session ownership, and temporary-file cleanup should be in a focused helper unless they directly teach the scenario.
56
+
5. Validate each extracted helper against the repository architecture:
57
+
- One-consumer behavior is sample-local; shared behavior has at least two active consumers using the same stable contract.
58
+
- The notebook calls the narrowest owning contract directly, without a forwarding wrapper.
59
+
- Inputs and typed outputs are explicit; the helper does not inspect notebook globals or IPython state.
60
+
- Constructors avoid remote or file side effects, and owned resources close on success and exceptions.
61
+
- Remote, session, sleep, clock, or command boundaries are injectable where deterministic tests require them.
62
+
- Actively edited sample-local modules use module-qualified imports and selective autoreload, not broad autoreload.
63
+
6. Confirm every sample-local helper has focused tests under `tests/python/test_<sample>_helpers.py` covering meaningful success, failure, malformed-input, and cleanup paths without live Azure access. Target at least 95% coverage for changed helper modules.
64
+
7. Validate sample-owned structured files. Parse JSON and notebooks, check XML well-formedness, review APIM policy expressions against the allowed policy-expression surface, and compile or lint Bicep when the toolchain is available.
65
+
8. Confirm sample-owned APIM policy XML is under `apim-policies/` and KQL is under `queries/`. For migrations, verify every notebook, helper, Bicep, test, script, and documentation reference, including canonical-directory lookup, temporary root-level policy fallback, explicit paths, auto-detection, and missing-file behavior.
66
+
9. Run the combined Python quality checks from the repository root:
57
67
58
68
```powershell
59
69
.\tests\python\check_python.ps1
@@ -63,15 +73,16 @@ Treat search visibility as a publication criterion, not as optional polish. Revi
63
73
./tests/python/check_python.sh
64
74
```
65
75
66
-
6. Export the self-contained presentation and treat warnings about missing images as failures to investigate:
76
+
10. Run markdownlint on all changed Markdown files and require zero violations. Fix violations instead of disabling rules unless a narrowly scoped suppression is necessary and documented.
77
+
11. Export the self-contained presentation and treat warnings about missing images as failures to investigate:
67
78
68
79
```bash
69
80
uv run python setup/export_presentation.py
70
81
```
71
82
72
-
7. Run the SEO pass when public website content changed. Parse the inline JSON-LD block and `docs/sitemap.xml`, then verify that structured-data entries and visible cards stay synchronized.
73
-
8. Preview the staged website when website or deck content changed. Use `uv run python setup/serve_website.py` and review both the landing page and `/slide-deck.html`. Check desktop and narrow layouts when visual changes are material.
74
-
9. Inspect the final diff after validation. Do not include generated artifacts such as `build/`, `_site/`, coverage files, or lint reports unless the repository intentionally tracks them.
83
+
12. Run the SEO pass when public website content changed. Parse the inline JSON-LD block and `docs/sitemap.xml`, then verify that structured-data entries and visible cards stay synchronized.
84
+
13. Preview the staged website when website or deck content changed. Use `uv run python setup/serve_website.py` and review both the landing page and `/slide-deck.html`. Check desktop and narrow layouts when visual changes are material.
85
+
14. Inspect the final diff after validation. Do not include generated artifacts such as `build/`, `_site/`, coverage files, or lint reports unless the repository intentionally tracks them.
75
86
76
87
When live Azure validation is relevant but not requested or not available, report the exact notebook scenario and supported infrastructure combinations that remain to be exercised. Do not substitute unit tests for live scenario evidence.
77
88
@@ -89,5 +100,6 @@ Return a concise publish-readiness report with:
89
100
90
101
-**Sample**: folder name, canonical display name, and supported infrastructures.
91
102
-**Updated**: source files changed during the publishing pass.
92
-
-**Validated**: commands run and their pass or fail results, including SEO source checks when website content changed.
93
-
-**Remaining**: manual visual checks, live Azure scenarios, or unresolved blockers. State `None` when the sample is ready for review.
103
+
-**Architecture**: notebook/helper ownership decision, shared-boundary reuse, and any remaining mechanics intentionally kept visible.
104
+
-**Validated**: focused helper tests, coverage, combined checks, and SEO source checks when website content changed.
105
+
-**Remaining**: manual visual checks, live Azure scenarios, or unresolved blockers. State `None` when the sample is ready for review.
0 commit comments