agent-context-dotnet — Bootstrap .NET Repository Context
You are generating a context pack: a small, cross-linked set of Markdown docs that makes an
unfamiliar .NET repository legible to an AI coding agent. It has two halves, produced in one run:
- the base pack — , , and (business, architecture, data model,
infrastructure, ADRs);
- the .NET deep-dive — : the solution/project graph, target frameworks,
package management, EF Core data access, the DI composition root, configuration & secrets,
analyzer posture, the UI/API surface, packaging, and CI.
You MUST NOT write application code, install packages, or run destructive commands. Your only
outputs are Markdown files at the repo root and under
.
Philosophy (hold these in mind throughout)
- AGENTS.md is a table of contents, not an encyclopedia. Keep it under ~80 lines.
- The repository is the system of record. Anything not in the repo is invisible to the agent.
- Context is a scarce resource. Every line in every doc must earn its place. A deleted section
beats a section full of TODOs.
- Progressive disclosure. AGENTS.md points to specialized docs; each specialized doc delegates
further.
- TODOs over fabrication. Never invent a framework version, NuGet version, or schema detail.
- No application code. This skill documents; it does not build.
Input: language
- If → output docs in Spanish. Load templates from .
- If or empty → output docs in English (default). Load templates from .
The skill's own instructions (this file) stay in English regardless.
Phase 1 — Discover (silent)
Do this without talking to the user. Use Glob, Grep, and Read.
1a. Confirm this is a .NET repo
Look for
,
,
,
,
,
, or
.
Before concluding "not .NET", also check for
file-based apps (.NET 10+): standalone
files carrying
/
/
/
directives, or a
shebang. These have no project file and a
glob will miss them.
If nothing matches, stop and tell the user this skill only applies to .NET repositories.
Write no files.
1b. Detect prior context → augment mode
If ANY of these exist, switch to augment mode:
- , at repo root
- directory with files
- ,
- , , ,
In augment mode: read what exists, report it to the user in Phase 2, and only create missing
docs. Never overwrite.
A tree is not necessarily yours. Many repos ship their own documentation
(
, design notes, database dumps) that this skill did not create. Those are
not yours to edit — but DO cross-link them from
("Related docs") and from
AGENTS.md, so the generated context points at what already exists instead of ignoring or
duplicating it.
When pre-existing docs are in one language, prefer matching it in Phase 2's language question.
1c. Deep .NET discovery
Run the full checklist in
references/dotnet-inspection.md
. It covers the solution/project graph,
target frameworks, package management (including central package
management), Aspire orchestration, data access, DI, configuration & secrets, build/run/test
including the test-platform split, quality gates, the UI/API surface, deployment & packaging,
cross-cutting concerns, the C# language posture, and hotspots.
The checklist is conditional: inspect only what the repo actually signals, and carry that
conditionality into the doc — delete
sections that don't apply.
Read real files. Where a fact isn't readable, you'll leave a TODO — do not guess.
1d. Adjacent signals
A .NET repo is rarely only .NET. Glob for these, since they feed
and
:
| Signal | Infer |
|---|
| , , | Containerization (but see the checklist — the SDK can build images with no Dockerfile) |
| , , , | Kubernetes / Helm |
| , , , , , | Infrastructure as Code |
| , , , | CI/CD |
| , , , , | API contract style (SOAP, gRPC, REST) |
| , , , | JS/TS frontend alongside the .NET backend |
| , | Quality gates (details in the checklist) |
1e. Read the README
Read
if present. Use it to seed the one-line project summary. Do NOT copy large
chunks — just extract the purpose.
1f. Scan for obvious domain cues
Grep the entity / model /
classes. Note dominant domain nouns (e.g.
,
,
,
). Use them only as prompts for your Phase 2 interview — don't
hallucinate a domain you can't verify.
Phase 2 — Interview
Around ten questions is the norm here, and asking more is fine when the repo genuinely left a
load-bearing gap. What keeps that from being tedious is the skip rule, which is absolute:
never ask what Phase 1 already read. On a well-documented repo you may end up asking three
questions; on a bare legacy solution, twelve. Both are correct.
caps at 4 questions per call and 4 options per question, so the structured set
needs two batched calls. Long-form answers don't fit it at all — ask those in plain chat.
2a. Batch A — scope and disambiguation (one )
- Output language — only if was empty. Options: , .
- Optional docs — "Generate also and/or ?" .
Options: , .
- Augment-mode confirmation — only if Phase 1b found existing docs: "Existing docs detected:
[list]. Only generate missing ones?" Options: , ,
.
- Phase-1 ambiguity — the one thing discovery could not settle. Usually the DB provider
(when the and the package list disagree) or the primary target framework (when
projects differ). Offer the top candidates you actually read, not generic ones.
2b. Batch B — facts that live outside the repo (second )
- Production deployment target — rarely readable from source, and needs
it. Options: ,
Azure Container Apps / AKS
, , .
- Production secrets source — Options: , ,
, .
- Auth / identity model — only if ambiguous from the packages. Options:
Entra ID (Microsoft.Identity.Web)
, , ,
.
- Path to production — how a merge reaches the deployment target:
CI deploys on merge to main
, Tag / release triggers deploy
, , . Feeds ;
the pipeline file often shows the build but not the promotion path.
2c. Free-text answers — ask in plain chat
- Business context — "In one or two sentences: what does this product do, and who pays for
it?"
- Non-obvious rules — "List up to 3 invariants or gotchas an AI coding agent must know that
are NOT enforceable by linters or tests. Examples: ' must not reference
', 'never bypass the tenant query filter', 'always thread ',
'run migrations before starting the API', 'do not touch the legacy project'. If
none come to mind, reply 'skip'."
2d. Conditional extras — ask only when the repo left the gap
- Test expectations — only if Phase 1 found thin or missing test coverage: "What counts as
done for a change here — unit tests only, integration tests required, or end-to-end?"
- Ownership / escalation — only if there is no and no obvious maintainer:
"Who reviews changes to this repo?"
Do not proceed to Phase 3 until the interview is complete.
Phase 3 — Draft
For each doc to generate, read the template at
templates/<lang>/<doc>.md.template
, substitute
the placeholders, and write to the target path. Placeholders use
syntax; each
template declares its own at the top.
Target paths:
- (repo root) — see Phase 4
- (repo root) — see Phase 4
- +
docs/adrs/adr-template.md
+ docs/adrs/adr-0001-<slug>.md
(1–3 seed ADRs)
- (only if opted in)
- (only if opted in)
Rules for filling templates:
- Short sentences. Sacrifice grammar for clarity.
- If you don't have info for a section, leave a marker — don't
hallucinate. If a whole section doesn't apply (no UI, no Aspire, no MAUI), delete it rather
than filling it with TODOs.
- In augment mode, never clobber user content. Fill slots or append a clearly
marked subsection; leave everything else alone. Docs the repo already shipped are read-only —
cross-link them instead.
What each doc must carry from the .NET discovery:
- — the primary output of Phase 1c. Keep the project table and the reference
graph concrete (real project names). Cross-link, don't restate, the other docs.
- — name the framework + EF Core explicitly in the stack summary
(e.g. "ASP.NET Core 10 + SQL Server + EF Core 10"), and add a one-line pointer to
for the project graph and layering.
- — migration tool is EF Core; record the location, the
provider, and the migrations workflow ( vs on startup vs applied in CI).
- — the CI system and its pipeline file, the configuration & secrets
layering, and the deployment/packaging shape (Dockerfile or SDK container publishing, AOT /
trimming / single-file if in play).
ADR seeds — propose 1–3 decisions that were clearly made, each with Status, Context (with
alternatives considered), Decision, and Consequences (easier / harder). Good candidates:
adr-0001-target-framework.md
— the target framework the solution standardizes on.
- Data access — EF Core (and the provider) as the persistence approach.
- Deployment target, if a Dockerfile, IaC, or SDK container properties were detected.
Never fabricate the rationale for an ADR.
Phase 4 — Wire (AGENTS.md + CLAUDE.md)
Generate
strictly as a
table of contents:
- Opening: 2 lines max (project name + one-line purpose).
- "Where to find things": a bulleted list of every doc with a one-line description, including
("deep .NET context: project graph, TFMs, EF Core, DI") and any pre-existing
repo docs found in Phase 1b.
- "Commands": the 3–6 commands a developer actually runs. Take them from the real repo, not
from habit:
- When Aspire is present the entry point is /
dotnet run --project *.AppHost
,
not each service individually. Getting this wrong sends an agent down the wrong path.
- Note the test command the repo's runner actually needs (see the test-platform split in the
checklist), and invocation style (global tool vs ).
- "Non-obvious rules": the user's Phase 2 answers, each as a bullet with a short rationale.
Add the mechanical rules discovery turned up, which agents reliably get wrong:
- central package management — when manages versions, a
in a must not carry ;
- any AOT / trimming constraint (no unbounded reflection, no reflection-based serialization);
- the project-layering rule, if one exists.
- "Testing" and "Code style": one paragraph each, naming the frameworks and analyzers
detected in Phase 1.
- "Security": no secrets committed, / user-secrets not in VCS, don't log PII.
Enforce the ~80-line ceiling. If you exceed it, move detail into
.
is one line:
, with a comment explaining that it delegates.
Phase 5 — Validate claims (Claimify-inspired)
Generated docs hallucinate. Before finishing, surface the load-bearing factual claims you wrote
and confirm the uncertain ones with the user. This step is adapted from Microsoft Research's
Claimify — extract atomic, self-contained, verifiable claims, and
flag ambiguity instead of
guessing. Follow
references/claim-validation.md
in full. In short:
- Select the verifiable, load-bearing claims from the docs you just wrote: target frameworks,
the persistence provider and migration workflow, the deployment
target, the CI system, key entities, the commands, package versions, DI lifetimes, and the
user's non-obvious rules. Skip TODOs, boilerplate, and opinions.
- Atomize + tag provenance. One self-contained statement each, with a source ref
( or ) and a confidence: (read from a file), (one weak
signal), (guessed / unverified).
- Flag ambiguity. Mark any claim with more than one plausible reading or no clear source
(e.g. two projects pinning different target frameworks). Never silently keep a low-confidence
claim.
- Verify with the user. Present a compact ledger; confirm or correct the / /
ambiguous claims (use for the top binary confirmations, plain chat for the
rest). -confidence claims with a concrete source are shown but not blocking.
- Apply. Write corrections into the docs. Downgrade any unconfirmed -confidence claim to
rather than asserting it.
- Persist the ledger to (format in the reference) as an audit trail.
Phase 6 — Verify
- Print a tree of files written (or augmented).
- Check that every link in and resolves to a file that exists
(use Read).
- Remind the user:
- Commit:
git add AGENTS.md CLAUDE.md docs/ && git commit -m "docs: bootstrap .NET context pack for AI coding agents"
- Fill in the markers, review the ADRs, and skim for
anything still unverified.
- If quality gates were absent, consider adopting + analyzers
(,
Microsoft.CodeAnalysis.NetAnalyzers
) and an arch-linting tool
( / ) to enforce the layering the docs describe.
- Re-run
/arkandia:agent-context-dotnet
later; it will augment, not overwrite.
Reference
references/dotnet-inspection.md
— the full .NET discovery checklist (Phase 1c).
references/claim-validation.md
— the Claimify-inspired claim-validation procedure (Phase 5).
- and — the doc skeletons.
Rules
- Do NOT write application code.
- Do NOT overwrite existing docs without explicit user opt-in; enrich by filling TODOs or
appending clearly marked sections.
- Do NOT fabricate framework or package versions, providers, endpoint names, or schema you
haven't read.
- DO leave markers where human input is needed, and delete sections that don't
apply rather than padding them.
- DO keep every doc focused: each has one job, delegated from AGENTS.md.