# Bansat – Make your AI agent write the blueprint before the code

> Source: <https://github.com/bewithkhan/bansat>
> Published: 2026-11-05 01:32:26+00:00

A blueprint-first framework and [Agent Skill](https://agentskills.io) for Claude. Before any production code, your AI agent writes the plan a senior team would: product, architecture, security, privacy law, accessibility and every UI state. Then it stops and waits for your approval.

[**Install**](#install-in-60-seconds) ·
  [**See it work**](#see-it-work) ·
  [**17 launch traps**](#the-17-launch-traps) ·
  [**What's inside**](#whats-in-the-blueprint) ·
  **Cite**

They're decisions nobody made. The demo works and the tests pass. Then:

- **Row Level Security is off** , so anyone with your app's public key can read or change your tables.
- **Your fonts load from Google** , handing every visitor's IP address to a third party before consent. A Munich court awarded damages for exactly this in 2022.
- **Hotjar or Clarity start recording** before anyone has said yes.
- **The "we launched!" email** goes to your waitlist with no unsubscribe link, no sender identity and no address.
- **The sign-up form never asks for age** , so you may be holding children's data without parental consent. Under Nigeria's NDPA, a child is anyone under 18.
- **The privacy policy was written by an AI** and describes an app that doesn't exist.

Bansat makes every one of those decisions explicit before the first commit, and checks them again before launch.

*Bansat* (بنسټ) is Pashto for "foundation": the part you lay before you build.

```
flowchart TB
    subgraph NEW ["Plan"]
        direction LR
        A["Your idea"] --> B["Intake<br/>20-question screen"] --> C["Risk tier<br/>Low · Medium · High"] --> D["docs/BLUEPRINT.md"] --> G1{"G1<br/>You approve"}
    end
    subgraph SHIP ["Build and ship"]
        direction LR
        P["9 build phases"] --> G2{"G2<br/>Data-ready"} --> G3{"G3<br/>Launch gate"} --> L["Launch"] --> G4{"G4<br/>30-day review"}
    end
    NEW --> SHIP
```

The gates are the point:

- **G1:** no production code until you approve the blueprint.
- **G2:** no real personal data, not even a waitlist email, until the privacy basics are live: the notice, processing records, consent capture, processor contracts, RLS tests and the ICO fee.
- **G3:** no launch while any of the 17 blocking checks is red.

**Already built something?** The retrofit track triages the live risks within 48 hours, reverse-engineers the blueprint from your code, and turns every gap into a fix with a deadline:

``` php
flowchart LR
    E["Existing or live app"] --> T["Day-0 triage<br/>11 checks in 48 h"] --> R["As-is blueprint<br/>from the code"] --> GR["Gap register<br/>with deadlines"] --> S["Fix sprints<br/>R1 → R4"]
```

**Claude Code** (terminal or VS Code). Install it once and use it in every project:

```
# macOS / Linux
git clone https://github.com/bewithkhan/bansat ~/.claude/skills/bansat
# Windows (PowerShell)
git clone https://github.com/bewithkhan/bansat "$HOME\.claude\skills\bansat"
```

Start a new Claude Code session and type `/bansat`. To update, run `git pull` in that folder. To share it with your team, copy the folder into your repo at `.claude/skills/bansat/` and commit it.

**Claude apps** (web and desktop): add it as a skill in your Claude settings. See [Use skills in Claude](https://support.claude.com/en/articles/12512180-use-skills-in-claude).

**Any other agent:** `SKILL.md` follows the open [Agent Skills](https://agentskills.io) format, so skills-compatible agents can load it as it is. For Cursor, Copilot, Lovable, Bolt or anything else that reads a rules file, give the agent `reference/bansat-framework.md` and paste its [Part 12.1 agent rules](https://github.com/bewithkhan/bansat/blob/main/reference/bansat-framework.md#p12) into `AGENTS.md`, `.cursor/rules` or your project knowledge.

In Claude Code, in an empty folder:

```
/bansat I want to build a revision app with an AI tutor for students in the UK and Nigeria
```

Bansat restates the idea and asks at most five questions, only where a wrong guess would be costly. It then writes `docs/BLUEPRINT.md` and a summary like this one (abridged):

```
Risk tier       HIGH: under-18s are a likely audience, plus AI features
DPIA            Required before any real data
Stack profile   D2 Progressive web app
Modules         Part 8 AI · 9.11 Marketing · 9.12 Children

Top 5 risks
 1  Children's data. The UK Children's Code is likely to apply, and Nigeria's
    NDPA treats anyone under 18 as a child: parental consent if you rely on
    consent, plus an age check.
 2  Student work sent to an LLM. Needs a DPA, no training on your data,
    redaction and a clear notice.
 3  The waitlist launch email. Needs consent evidence, one-click unsubscribe
    and sender details.
 4  Nigerian users. Past 200 in any six months you're a data controller of
    major importance and must register with the NDPC.
 5  AI cost abuse. Per-user quotas, a spend cap and a rate-limit screen (S13).

Assumptions     Web first · a waitlist before launch · no payments in the MVP
                13+ with a parental-consent flow                    (all flagged)
Open question   Will schools sign pupils up? Then you're their processor.
Missing for G1  Legal entity · ICO fee tier · AI provider

No production code until you approve this blueprint (G1).
```

Auditing an existing app works the same way: run `/bansat audit this repo`. The Day-0 triage comes first, marking each check pass, fail or unknown with its evidence: exposed secrets, missing RLS, public buckets, tracking before consent, unsafe marketing email, children's data, and whether anything was actually exposed.

These are the failures that get vibe-coded apps fined, breached or rejected by the app stores. Bansat checks every one before you collect real data (G2), and again before launch (G3). The full table, with fixes and tests, is in [§9.26 of the framework](https://github.com/bewithkhan/bansat/blob/main/reference/bansat-framework.md#926-launch-trap-audit-the-vibe-coding-failures-that-get-apps-fined).

| # | Trap | Why it bites | 
|---|---|---|
| 1 | The sign-up form never asks for age | Children's data without parental consent or safeguards. Under Nigeria's NDPA, a child is anyone under 18. | 
| 2 | Fonts from `fonts.googleapis.com` or any CDN | Visitor IP addresses go to a third party with no lawful basis. German courts have awarded damages. | 
| 3 | Session replay or heatmaps load before consent | A consent breach, and recordings can capture personal data | 
| 4 | A "we launched" email with no unsubscribe, sender identity or address | Breaches UK PECR, US CAN-SPAM and the NDPA, and fails Gmail and Yahoo sender rules | 
| 5 | RLS off, or the secret key in the client | Anyone can read or write your database: a breach, with 72-hour deadlines | 
| 6 | A template or AI-written privacy policy | It doesn't match what the app does, so it breaches transparency rules | 
| 7 | Ad or analytics pixels in the root layout | Data shared with ad platforms before consent | 
| 8 | User data sent to an LLM with no disclosure or DPA | Transparency, transfer and contract breaches, and possible training on your data | 
| 9 | No way to delete an account or export data | A rights breach, and an App Store rejection | 
| 10 | Personal data in logs or error trackers | Breaches minimisation and widens any breach | 
| 11 | Pre-ticked boxes, or "by using this site you agree" | Invalid consent | 
| 12 | A cookie banner with no "Reject all" | Invalid consent, and a top enforcement theme for regulators | 
| 13 | Real customer data in preview or staging | A security and purpose-limitation breach | 
| 14 | A public storage bucket for user uploads | Data exposure | 
| 15 | ICO fee unpaid; NDPC status unchecked | ICO penalties of up to £4,350; missed duties for Nigeria's major-importance controllers | 
| 16 | No breach plan | Missed 72-hour clocks | 
| 17 | Dates of birth or ID scans kept "just in case" | A minimisation breach, and a honeypot for attackers | 

If you read one thing in this repo, read this table. Then check your own app against it.

Viral compliance threads get some of this wrong. Bansat sticks to what the law actually says:

| The claim | What's actually true | 
|---|---|
| "Your app can be fined ₦10m before its first sale." | ₦10m or 2% of annual gross revenue, whichever is greater, is the most the NDPC *may* impose on a major-importance controller after an investigation. It isn't automatic. The risk is still real: targeting people in Nigeria counts as operating there, and the major-importance threshold is just 200 people in six months. | 
| "Hotjar and Clarity record every keystroke, including passwords." | Not by default. The real failures are missing consent, relaxed masking and unmasked custom inputs. | 
| "Anyone under 18 needs parental consent." | Under Nigeria's NDPA, yes, when you rely on consent. In the UK and EU, the age for consenting to online services is between 13 and 16. Build to your markets, or make the service 18+. | 

One Markdown file: 15 parts and 4 appendices, about 2,800 lines. Claude reads only the parts each project needs.

| Part | What it nails down | 
|---|---|
| **0** Intake & risk | 20 screening questions, a risk tier, and which modules switch on | 
| **1** Product (PRD) | Problem, metrics, personas, MoSCoW features with IDs, Gherkin acceptance criteria | 
| **2** Non-functional | Targets with numbers: Core Web Vitals, uptime, recovery, security baseline, accessibility, cost | 
| **3** Architecture (TRD) | Pinned stack, environments, a context diagram, data flows, a processor register, secrets | 
| **4** Decisions (ADRs) | Baseline architecture decisions, accepted unless you override them | 
| **5** Data | Classification, a data dictionary, a Prisma 7 schema, RLS policies with isolation tests, retention | 
| **6** API | An endpoint inventory, RFC 9457 errors mapped to UI states, validation, webhooks, rate limits | 
| **7** Security | Auth, an RBAC matrix, 12 pre-filled STRIDE threats, headers and CSP, logging rules | 
| **8** AI features | A feature register with pinned models, data minimisation, evals, prompt-injection defences, EU AI Act labelling, spend caps | 
| **9** Privacy & compliance | 27 sections, from lawful bases, consent and cookies to children, marketing, rights, breaches and DPIAs | 
| **10** Experience | Journeys, WCAG 2.2 AA, contrast-checked design tokens, and 17 mandatory UI states for every screen | 
| **11** Delivery | 9 phases with exit criteria, a Definition of Done, RLS, privacy and E2E tests, CI/CD, incidents | 
| **12** Agent manual | Rules for `CLAUDE.md` or`AGENTS.md` , a feature protocol and an 8-step debugging protocol | 
| **13** Launch gate | 37 go/no-go checks; any one of the 17 blocking checks stops the launch | 
| **14** Retrofit | Day-0 triage, reverse-engineering, a gap register, a review cadence and a portfolio register | 
| **A–D** Appendices | Templates (DPIA, LIA, breach log and more), references, a glossary and 9 stack profiles | 

|  | PRD template | Asking the AI | **Bansat** | 
|---|---|---|---|
| Product, architecture, security, privacy and UX in one plan | Product only | Patchy | ✅ | 
| Gates that block code, data and launch until you approve | ❌ | ❌ | ✅ G0–G4 | 
| Laws cited to the section, and checked on a stated date | ❌ | Unverified | ✅ 4 Nov 2026 | 
| Code samples tested before release | ❌ | Untested | ✅ | 
| A track for apps that are already live | ❌ | ❌ | ✅ Day-0 triage | 
| Every UI state designed and tested on every screen | ❌ | Happy path only | ✅ 17 states | 
| The same standard on every project, team and tool | Copy and paste | Per chat | ✅ One skill, one file | 

The code in the framework was run before release:

- The **Prisma 7 schema** validates, with the connection in`prisma.config.ts` as Prisma 7 requires.
- The **Supabase RLS policies** pass 14 tenant-isolation tests on a real Postgres database, and an audit query finds any table left without RLS.
- The **TypeScript UI-state pattern** compiles in strict mode, and the build fails if a screen forgets a state.
- The **Playwright privacy test** passes on a clean page and fails as soon as a page contacts a third party before consent.

## **Laws and standards covered** (checked 4 November 2026)

- UK GDPR and the Data Protection Act 2018, as amended by the Data (Use and Access) Act 2025
- PECR (cookies and electronic marketing), with fines now at UK GDPR levels
- The UK Children's Code (Age Appropriate Design Code)
- EU GDPR and the ePrivacy rules, including the EU representative check
- Nigeria Data Protection Act 2023 and the GAID 2025 directive
- EU AI Act: transparency duties (Art. 50), AI literacy and the high-risk check
- UK Online Safety Act 2023, for apps with user-to-user content
- UK PSTI product security rules for connectable devices, and the European Accessibility Act
- US: COPPA, CAN-SPAM, TCPA and state privacy laws
- Pointers for India, South Africa, Kenya and Pakistan
- Standards: WCAG 2.2 AA · OWASP ASVS · OWASP Top 10 for LLM Applications · STRIDE · RFC 9457 · RFC 9116 · RFC 2119

Laws change. Re-check anything you rely on before launch; see the [disclaimer](#disclaimer).

## **Works for any kind of project** (9 stack profiles)

| Profile | What it adds | 
|---|---|
| D1 Web app (Next.js + Supabase) | The reference stack the examples use | 
| D2 Progressive web app | Cache rules, offline and sync states, web push limits, and no background location on the web | 
| D3 Mobile (Flutter, React Native, native) | No secrets in the binary, secure storage, store privacy labels, and Firebase rules as your RLS | 
| D4 Wearables, BLE and connected devices | Device states, vendor clouds and transfers, consent from the people being monitored, PSTI | 
| D5 Admin panels and CRMs | You're usually the client's processor, even when the client is abroad; exports are the biggest leak | 
| D6 Research prototypes | Ethics approval, a data management plan, pseudonymisation at collection | 
| D7 Websites and waitlists | A waitlist is already personal data, so the privacy basics come first | 
| D8 AI agents and clinical prototypes | Synthetic data until reviewed, a medical-device check, a human in the loop | 
| D9 Hardware with no personal data | Which parts apply, and when a sensor switches privacy on | 

## **Is this legal advice?**

No. It summarises the law and regulator guidance as of 4 November 2026, cites the sections, and says when to get a qualified review: health, children, biometrics, worker monitoring or large-scale tracking.

## **Won't a blueprint slow me down?**

It scales with risk. A low-risk project fills in only the essentials: intake, the core product spec, the stack, cookies and third-party requests, the launch traps, UI states and the launch gate. High-risk projects get everything, because that's where mistakes cost the most.

## **Do I need Claude?**

No. The framework is one Markdown file you can fill in by hand or with any AI agent. Claude Code just does the most for you: it screens your idea, writes the blueprint and holds the gates.

## **My country isn't covered.**

The engineering half applies everywhere, and the laws table has pointers for other markets. Open an issue with your country's law and a link to an official source.

## **Can I use it commercially?**

Yes. The text and templates are CC BY 4.0, so you can use and adapt them commercially as long as you keep the credit line. The code samples are MIT.

## **How do I keep a project's blueprint current?**

It lives in your repo as `docs/BLUEPRINT.md` and changes in the same pull request as the code. Live projects get a monthly review and a quarterly launch-trap audit.

Use GitHub's **Cite this repository** button, or:

Khan, M. T. (2026). *Bansat (بنسټ): A blueprint-first framework for building software* (Version 2.0) [Computer software]. GitHub. [https://github.com/bewithkhan/bansat](https://github.com/bewithkhan/bansat)

```
@misc{khan2026bansat,
  author       = {Khan, Muhammad Tufail},
  title        = {Bansat: A blueprint-first framework for building software},
  year         = {2026},
  note         = {Version 2.0},
  howpublished = {\url{https://github.com/bewithkhan/bansat}}
}
```

Bansat gets better with every project it meets. Contributions are welcome:

- **A law changed?** Open an issue with a link to the official source.
- **A stack that isn't covered?** Propose a profile for Appendix D.
- **A launch trap that bit you?** Describe what happened and how you fixed it.

Keep the credit line in anything you copy or adapt (CC BY 4.0).

**Muhammad Tufail Khan**: PhD researcher in AI and IoT for healthcare at the University of the West of Scotland, based in Glasgow.

- **Text and templates:**[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) , full text in`LICENSE` . You can use, adapt and share them, including commercially, if you keep this credit:*"Bansat (بنسټ) by Muhammad Tufail Khan, [https://github.com/bewithkhan/bansat](https://github.com/bewithkhan/bansat), CC BY 4.0"* .
- **Code samples:** MIT (see`LICENSE-CODE` ).
- `NOTICE` sets out which licence covers what, with the credit line.

Bansat summarises laws and regulator guidance as of 4 November 2026. It is not legal advice. Check the current rules before you launch, and get a qualified review for high-risk processing.

  If Bansat saves you from one bad launch, **star the repo** so the next builder finds it before theirs.

  Built by Muhammad Tufail Khan · [LinkedIn](https://www.linkedin.com/in/bewithkhan/) · [GitHub](https://github.com/bewithkhan)
