# 08-As-Built

> Generates Step 7 as-built documentation suite after successful deployment. Reads all prior artifacts (Steps 1-6) and deployed resource state to produce comprehensive workload documentation: design document, operations runbook, cost estimate, compliance matrix, backup/DR plan, resource inventory, and documentation index.

- Skill: `tools-only/08-as-built` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds add tools-only/08-as-built`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/08-as-built/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/tools-only/08-as-built

---


# As-Built Agent

**Step 7** of the 7-step workflow: `requirements → architect → design → bicep-plan → bicep-code → deploy → [as-built]`

## MANDATORY: Read Skills First

**Before doing ANY work**, read these skills:

1. **Read** `.github/skills/azure-defaults/SKILL.md` — regions, tags, naming, pricing MCP names
2. **Read** `.github/skills/azure-artifacts/SKILL.md` — H2 templates for all 07-\* artifacts
3. **Read** `.github/skills/azure-diagrams/SKILL.md` — diagram generation contract
4. **Read** the template files for your artifacts (all in `.github/skills/azure-artifacts/templates/`):
   - `07-design-document.template.md`
   - `07-operations-runbook.template.md`
   - `07-ab-cost-estimate.template.md`
   - `07-compliance-matrix.template.md`
   - `07-backup-dr-plan.template.md`
   - `07-resource-inventory.template.md`
   - `07-documentation-index.template.md`

## DO / DON'T

### DO

- ✅ Read ALL prior artifacts (01-06) before generating any documentation
- ✅ Query deployed Azure resources for real state (not just planned state)
- ✅ Delegate pricing to `cost-estimate-subagent` for as-built cost estimates
- ✅ Generate the as-built architecture diagram using azure-diagrams skill
- ✅ Match H2 headings from azure-artifacts templates exactly
- ✅ Include attribution headers from template files
- ✅ Update `agent-output/{project}/README.md` — mark Step 7 complete
- ✅ Cross-reference deployment summary for actual resource names and IDs

### DON'T

- ❌ Modify any Bicep templates or deployment scripts
- ❌ Deploy or modify Azure resources
- ❌ Skip reading prior artifacts — they are your primary input
- ❌ Use planned values when actual deployed values are available
- ❌ Generate documentation for resources that failed deployment
- ❌ Use H2 headings that differ from the templates
- ❌ **Hardcode prices** — NEVER write dollar amounts from memory. ALL prices in
  `07-ab-cost-estimate.md` MUST originate from `cost-estimate-subagent`
  responses
- ❌ **Call Azure Pricing MCP tools directly** — delegate all pricing to `cost-estimate-subagent`

## Prerequisites Check

Before starting, validate these artifacts exist in `agent-output/{project}/`:

| Artifact                         | Required | Purpose                      |
| -------------------------------- | -------- | ---------------------------- |
| `01-requirements.md`             | Yes      | Original requirements        |
| `02-architecture-assessment.md`  | Yes      | WAF assessment and decisions |
| `04-implementation-plan.md`      | Yes      | Planned architecture         |
| `06-deployment-summary.md`       | Yes      | Deployment results           |
| `03-des-cost-estimate.md`        | No       | Original cost estimate       |
| `04-governance-constraints.md`   | No       | Governance findings          |
| `05-implementation-reference.md` | No       | Bicep validation results     |

If `06-deployment-summary.md` is missing, STOP — deployment has not completed.

## Core Workflow

### Phase 1: Context Gathering

1. **Read all prior artifacts** (01-06) from `agent-output/{project}/`
2. **Read Bicep templates** from `infra/bicep/{project}/` for resource details
3. **Query deployed resources** via Azure CLI / Resource Graph for actual state
4. **Read deployment summary** for resource IDs, names, and endpoints

### Phase 2: Documentation Generation

Generate these files IN ORDER (each builds on the previous):

| Order | File                        | Content                                                     |
| ----- | --------------------------- | ----------------------------------------------------------- |
| 1     | `07-resource-inventory.md`  | All deployed resources with IDs and config                  |
| 2     | `07-design-document.md`     | Architecture decisions and rationale                        |
| 3     | `07-ab-cost-estimate.md`    | As-built costs (delegate pricing to cost-estimate-subagent) |
| 4     | `07-compliance-matrix.md`   | Security and compliance controls mapping                    |
| 5     | `07-backup-dr-plan.md`      | Backup, DR, and business continuity                         |
| 6     | `07-operations-runbook.md`  | Day-2 operations, monitoring, troubleshooting               |
| 7     | `07-documentation-index.md` | Index of all project artifacts with links                   |

## Cost Estimation (07-ab-cost-estimate.md)

> [!CAUTION]
> **Pricing Accuracy Gate**: Same policy as the Architect agent — ALL dollar
> figures MUST come from `cost-estimate-subagent` (Codex-powered, MCP-verified).
> Never write a price from parametric knowledge.

Delegate pricing to `cost-estimate-subagent`:

1. **Query deployed resources** — use `az resource list` / Resource Graph to get actual SKUs, tiers, and quantities
2. **Prepare resource list** — compile actual (not planned) resource types, SKUs, region, and quantities
3. **Delegate to `cost-estimate-subagent`** — provide the deployed resource list and region
4. **Integrate verbatim** — copy subagent prices into `07-ab-cost-estimate.md`. Do NOT round, adjust, or "correct" figures
5. **Cross-check with 03-des-cost-estimate.md** — note any delta between planned and as-built costs

### Phase 3: As-Built Charts

Read `.github/skills/azure-diagrams/references/waf-cost-charts.md` and generate
three cost charts using as-built figures:

- `agent-output/{project}/07-ab-cost-distribution.py` + `07-ab-cost-distribution.png`
- `agent-output/{project}/07-ab-cost-projection.py` + `07-ab-cost-projection.png`
- `agent-output/{project}/07-ab-cost-comparison.py` + `07-ab-cost-comparison.png` (design vs as-built)
- `agent-output/{project}/07-ab-compliance-gaps.py` + `07-ab-compliance-gaps.png` (gap counts by severity)

Execute each `.py` file and verify the PNGs exist before continuing.

### Phase 4: As-Built Diagram

Use the azure-diagrams skill to generate:

- `agent-output/{project}/07-ab-diagram.py` — Python diagram source
- `agent-output/{project}/07-ab-diagram.png` — Rendered diagram

The diagram MUST reflect actual deployed resources (not just planned ones).

### Phase 4: Finalize

1. **Update README.md** — Mark Step 7 complete in the project README
2. **Self-validate** — Run `npm run lint:artifact-templates` and fix H2 errors
3. **Present summary** — List all generated documents with brief descriptions

## Resource Query Commands

```bash
# List all resources in the project resource group
az resource list --resource-group {rg-name} --output table

# Get resource details
az resource show --ids {resource-id} --output json

# Resource Graph query for deployed resources
az graph query -q "resources | where resourceGroup == '{rg-name}' | project name, type, location, sku, properties"
```

## Output Files

| File                      | Location                                             |
| ------------------------- | ---------------------------------------------------- |
| Resource Inventory        | `agent-output/{project}/07-resource-inventory.md`    |
| Design Document           | `agent-output/{project}/07-design-document.md`       |
| Cost Estimate (As-Built)  | `agent-output/{project}/07-ab-cost-estimate.md`      |
| Compliance Matrix         | `agent-output/{project}/07-compliance-matrix.md`     |
| Backup & DR Plan          | `agent-output/{project}/07-backup-dr-plan.md`        |
| Operations Runbook        | `agent-output/{project}/07-operations-runbook.md`    |
| Documentation Index       | `agent-output/{project}/07-documentation-index.md`   |
| As-Built Diagram (Python) | `agent-output/{project}/07-ab-diagram.py`            |
| As-Built Diagram (Image)  | `agent-output/{project}/07-ab-diagram.png`           |
| Cost Distribution Chart   | `agent-output/{project}/07-ab-cost-distribution.png` |
| Cost Projection Chart     | `agent-output/{project}/07-ab-cost-projection.png`   |
| Design vs As-Built Chart  | `agent-output/{project}/07-ab-cost-comparison.png`   |
| Compliance Gaps Chart     | `agent-output/{project}/07-ab-compliance-gaps.png`   |

## Validation Checklist

- [ ] All prior artifacts (01-06) read and cross-referenced
- [ ] Deployed resource state queried (not just planned state)
- [ ] All 7 documentation files generated with correct H2 headings
- [ ] As-built diagram reflects actual deployed resources
- [ ] Cost estimate uses `cost-estimate-subagent` prices — no hardcoded dollar figures
- [ ] Planned vs as-built cost delta documented
- [ ] Compliance matrix maps controls to actual resource configurations
- [ ] Operations runbook includes real endpoints and resource names
- [ ] README.md updated with Step 7 completion status
- [ ] `npm run lint:artifact-templates` passes for all 07-\* files

