agent-security-hardening
AFaffaan-m/ECC315k4,381 new stars in the last 7 days
Designs a production-ready Microsoft Dataverse data model from a business process described in plain language. Use when the user asks to design Dataverse tables, columns, choices, relationships, alternate keys, security roles or a solution structure, to model a process for Power Apps or Copilot Studio, or says "diseña el modelo de datos en Dataverse". Outputs a design doc, Mermaid ER diagram, column dictionary and security matrix.
Turns a business process described in natural language into a complete, reviewable Microsoft Dataverse data model: tables, columns, choices, relationships with cascade behavior, alternate keys, security roles, column security, auditing and solution packaging — following Microsoft naming and ALM best practices.
The goal is a design a senior Power Platform architect would sign off on before anyone opens the maker portal, so the model does not have to be rebuilt after the first sprint.
Critical: Always ask the user for the following information before proceeding. If the user doesn't provide all details upfront, ask for the missing ones before proceeding (in a single message, not one question at a time).
cnt). Defaults to new only as a placeholder, and you must warn that new must not be used in productionIf a detail is still missing after asking once, proceed and list the assumption explicitly in the Assumptions section.
Produce a single Markdown design document with these sections, in this order:
Summary — 3–5 lines: the process, number of tables, key design decisions
Assumptions & Open Questions — numbered; each assumption tagged [ASSUMED], each open question tagged [DECIDE]
Entity-Relationship Diagram — a Mermaid erDiagram block with every custom table, the main standard tables used (account, contact, systemuser, team, businessunit) and all relationships with cardinality
Table Catalog — one table per row:
| Display name | Schema name | Type | Ownership | Primary name column | Purpose | Est. volume | Audit |
|---|
Column Dictionary — one sub-section per table:
| Display name | Schema name | Data type / format | Required | Default | Searchable | Notes (choice values, formula, behavior) |
|---|
Choices — global choices with label → value (value prefix from the publisher, e.g. 100000000), and which columns use them
Relationships — schema name, type (1:N / N:1 / N:N), parent → child, relationship behavior (Parental / Referential / Referential, Restrict Delete / Custom) and cascade settings when Custom
Alternate Keys — for every table that is integrated or imported
Security Model — security roles × tables matrix with privilege depth (None, User, BU, Parent:Child BU, Org) for Create, Read, Write, Delete, Append, Append To, Assign, Share; plus column security profiles and team/business unit strategy
Solution & ALM — solution name, publisher, components list in build order, environment variables, connection references, managed vs unmanaged guidance
Build Checklist — ordered checklist the maker follows to create the model in the maker portal or with pac CLI
Risks & Anti-patterns Avoided — what the design deliberately does not do and why
systemuser / team / contact (external people) / account (external organizations) before creating custom tables for people or companiesaccount, contact, task, email, note/annotation). Never create cnt_customer if account fitsFor each table decide and justify:
INS-{SEQNUM:6}) and say so<prefix>_<PascalCaseSingularNoun> (e.g. cnt_Inspection); logical name is the lowercase form (cnt_inspection). Singular, English, no accents, no spaces, no abbreviations that only one team understandsChoose the most specific data type. Apply these rules:
| Need | Use | Avoid |
|---|---|---|
| Fixed list maintained by IT | Choice (global if reused in 2+ tables) | Text column with "allowed values" |
| List maintained by business users or with extra attributes | Lookup to a catalog table (org-owned) | Choice that changes every month |
| Multiple selections for filtering only | Choices (multi-select) | Multi-select when you need reporting per value — use an N:N or child table instead |
| Money | Currency (note that it adds base-currency columns and requires transactioncurrency) | Decimal for money |
| Dates without time (birth date, due date) | Date only, behavior Date Only | Date and Time with User Local (causes off-by-one-day across time zones) |
| Timestamps of events | Date and Time, behavior User Local | Text |
| Derived values | Formula column (Power Fx). In DateDiff, never mix User Local with Time-Zone Independent / Date Only columns: pair User Local columns with Now(), TZI or Date Only columns with UTCNow() / UTCToday(). Formulas using UTCNow() can't feed rollups | Legacy Calculated columns for new designs |
| Aggregates from children | Rollup column (state refresh is asynchronous) or Power BI | Plugins only for counts |
| Sequential human IDs | Autonumber | Flows that compute "max + 1" |
| Documents | File column (set max size) | URLs to random SharePoint folders |
| Yes/No | Yes/No with explicit default | Choice with two values |
statecode) and Status Reason (statuscode) values that map to the process lifecycle — design them; do not leave the defaults Active/Inactive when the process has more states🔒 PII and route them to a column security profile in Step 6<prefix>_<Parent>_<Child> or by the lookup column (cnt_InspectionId)cnt_ErpCode). Creating the key starts a background index job; the key can't be used until its status is Active (Pending → In Progress → Active / Failed), so include that check in the Build ChecklistUser (own records), BU (my unit), Parent:Child BU (my unit and below), Org (everyone)— None, U User, B BU, P Parent:Child BU, O Orgpac solution export / pac solution unpack (or Git integration in Power Platform) when the user mentions DevOps or GitHubpac CLI / Web API payloads[ASSUMED]new_ or cr123_ default prefixes in a production design; flag them if the user provides themInput (user):
Our safety team inspects each plant monthly. An inspector fills a checklist, records findings with photos and a risk level (low, medium, high, critical). Each finding can have one or more corrective actions assigned to a person with a due date. Plant managers only see their plants; the safety director sees everything. We already have plants in our ERP with a code. Prefix:
cnt.
Output (excerpt):
Summary — 4 custom tables (cnt_Site, cnt_Inspection, cnt_Finding, cnt_CorrectiveAction), 1 global choice (cnt_risklevel), segregation by business unit per plant, alternate key on the ERP plant code.
erDiagram
businessunit ||--o{ cnt_Site : "owns"
cnt_Site ||--o{ cnt_Inspection : "Restrict Delete"
systemuser ||--o{ cnt_Inspection : "inspector"
cnt_Inspection ||--o{ cnt_Finding : "Parental"
cnt_Finding ||--o{ cnt_CorrectiveAction : "Parental"
systemuser ||--o{ cnt_CorrectiveAction : "responsible"
Table Catalog
| Display name | Schema name | Type | Ownership | Primary name column | Purpose | Est. volume | Audit |
|---|---|---|---|---|---|---|---|
| Site | cnt_Site | Standard | User/Team (owned by plant BU team) | cnt_Name | Plant master data synced from ERP | < 100 | Yes |
| Inspection | cnt_Inspection | Standard | User/Team | cnt_Code Autonumber INS-{SEQNUM:6} | Monthly inspection header | ~1,200/yr | Yes |
| Finding | cnt_Finding | Standard | User/Team | cnt_Title | Each non-conformity found | ~6,000/yr | Yes |
| Corrective Action | cnt_CorrectiveAction | Standard | User/Team | cnt_Title | Action to close a finding | ~8,000/yr | Yes |
Column Dictionary — Finding (excerpt)
| Display name | Schema name | Data type / format | Required | Default | Searchable | Notes |
|---|---|---|---|---|---|---|
| Inspection | cnt_InspectionId | Lookup → cnt_Inspection | Yes | — | Yes | Parental |
| Risk level | cnt_RiskLevel | Choice (global cnt_risklevel) | Yes | — | Yes | Low 100000000, Medium 100000001, High 100000002, Critical 100000003 |
| Evidence photo | cnt_EvidencePhoto | Image | No | — | No | Full-size image enabled |
| Days open | cnt_DaysOpen | Formula (Whole number) | — | — | No | DateDiff(createdon, If(IsBlank('Closed on'), Now(), 'Closed on'), TimeUnit.Days) — createdon and cnt_ClosedOn are User Local, so it uses Now() (User Local), not UTCNow() (Time-Zone Independent) |
Security Model (excerpt)
| Role \ Table | Site | Inspection | Finding | Corrective Action |
|---|---|---|---|---|
| Safety Inspector | R:B | C:U R:B W:U A:B AT:B | C:U R:B W:U A:B AT:B | C:U R:B W:U A:B |
| Plant Manager | R:B | R:B | R:B | C:B R:B W:B Assign:B |
| Safety Director | R:O W:O | R:O | R:O | R:O W:O Assign:O |
Alternate Keys — cnt_Site.cnt_ErpCode (upsert from ERP nightly).
Risks & Anti-patterns Avoided — risk level is a global choice, not free text; no custom "Users" table; findings are not a multi-line text field inside the inspection (would make reporting impossible); Days open is a Formula column instead of a nightly flow.
Before presenting the design, verify:
[ASSUMED]Now(); Time-Zone Independent / Date Only with UTCNow())erDiagram syntax) and matches the Relationships sectionAFaffaan-m/ECC315k4,381 new stars in the last 7 days
Audit the whole repo: find bugs, security holes and performance bottlenecks. Get a ranked report in plain English.
DIDietrichGebert/ponytail203k4,904 new stars in the last 7 days
GAgarrytan/gstack143k598 new stars in the last 7 days
Harden code against the OWASP Top 10: input handling, authentication, sessions and dependencies.
ADaddyosmani/agent-skills122k1,667 new stars in the last 7 days
ADaddyosmani/agent-skills122k1,667 new stars in the last 7 days
RUruvnet/RuView106k596 new stars in the last 7 days