responsible-ai-prototyping
Build, audit, and harden web apps generated by AI builders (Lovable, v0, Bolt) using data minimization, security-first prompts, bipartite auth/authz testing, and dependency pruning. Do not use for generic prose or ungrounded prompts.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- responsible-ai-prototyping
- description
- Build, audit, and harden web apps generated by AI builders (Lovable, v0, Bolt) using data minimization, security-first prompts, bipartite auth/authz testing, and dependency pruning. Do not use for generic prose or ungrounded prompts.
02 资源文件 2
- 参考文档CARD.md5.2 KB
- 参考文档config.default.yaml370 B
03 SKILL.md 正文
Responsible AI Prototyping: Secure AI Web App Engineering
responsible-ai-prototyping operationalizes the engineering heuristics and governance framework from Eva J Patel's methodology ("How to Use Lovable Responsibly", freeCodeCamp, 2026). It bridges the velocity of prompt-driven AI application generators (Lovable, v0, Bolt, Cursor, Replit Agent, Windsurf) with foundational software engineering standards: security, data minimization, authorization isolation, accessibility, and operational honesty.
Speed in prototyping must not replace critical thinking. While AI builders can generate a complete full-stack web application in seconds, unconstrained generation frequently produces client-side security illusions, bloated dependency trees, unvalidated inputs, data leaks, and deceptive dark patterns.
This skill enforces a 5-stage development and auditing lifecycle:
[1. Intent & Data Minimization] → [2. Security-First Prompting] → [3. Auth/Authz Verification] → [4. Hardening Audit] → [5. Stage-Gate Readiness]
See CARD.md for the companion summary card, 5-stage reference matrix, and diagnostic scorecards. Consult crafting-skills for skill authoring standards and pre-commit-security-guard for pre-commit vulnerability scanning.
1. Intent & Data Minimization Framing
Establish rigid problem boundaries and enforce data minimization before writing generation prompts:
- Define Core Intent & User Personas:
- Articulate the specific problem being solved in plain, unambiguous terms.
- Specify target personas (e.g. anonymous visitor, authenticated customer, tenant administrator).
- Execute Data Minimization Audit:
- For every intended database table or form field, apply the two-question test:
- "Why does the application need this specific piece of information?"
- "What is the blast radius if this database table or endpoint is compromised or leaked?"
- Strip all non-essential fields (e.g. phone numbers, physical addresses, unnecessary profile metadata) before schema generation.
- For every intended database table or form field, apply the two-question test:
- Isolate Environment Secrets:
- Define all third-party integrations (Supabase, Stripe, OpenAI, Resend) strictly through environment variables (
.env). - Never supply live API tokens, database connection strings, or service keys into prompt windows.
- Define all third-party integrations (Supabase, Stripe, OpenAI, Resend) strictly through environment variables (
Completion criterion: Core problem defined, data fields minimized to business necessity, and secrets isolated into environment variables.
2. Security-First Prompt Construction
Synthesize prompts using structured constraints rather than casual conversational requests:
- Deploy the Responsible Prompt Template:
Build [feature] for [type of user]. The goal is to [explain problem being solved]. Users should be able to: - [action 1] - [action 2] The application MUST: - Validate all user input on both client and server. - Enforce server-side authorization on all private routes and mutations. - Isolate secrets strictly to environment variables; no hardcoded keys. - Provide clear loading states and actionable error messages. - Support full keyboard navigation and meet WCAG AA contrast. - Work reliably on mobile and desktop viewports. Do NOT: - Collect unnecessary personal data. - Expose private records or internal IDs. - Add unrelated features or unrequested packages. - Alter existing authentication behavior without explicit explanation. After building, explain: - Which files were created or modified. - What data schemas are stored. - Which external APIs or packages were added. - What residual security risks remain. - Step-by-step instructions for testing the feature. - Constrain Generation Scope:
- Request incremental, testable vertical slices (e.g. one form, one API endpoint) rather than monolithic full-stack applications in a single prompt.
Completion criterion: Feature prompt constructed using the Responsible Prompt Template with explicit negative constraints and acceptance criteria.
3. Bipartite Auth & Authorization Verification
Enforce strict conceptual and test separation between Authentication ("Who are you?") and Authorization ("What are you allowed to do?"):
- Assert the Anti-Client-Side-Security Invariant:
- Hiding navigation buttons or links in the UI is NOT a security mechanism.
- Every backend route, serverless function, and database query must verify caller identity and caller permissions independently of client-side state.
- Execute the 5 Negative Security Tests:
- Test 1 (Unauthenticated Route Access): As a logged-out visitor, open protected routes (
/admin,/dashboard). The application must redirect to login or return HTTP 401. - Test 2 (Role Escalation): As a standard authenticated user, navigate directly to administrative URLs or trigger admin actions. The server must deny access with HTTP 403.
- Test 3 (Horizontal IDOR Parameter Tampering): As User A, tamper with record identifiers in URLs or JSON payloads (
/api/items/101$\rightarrow$/api/items/102). The server must reject cross-tenant data access. - Test 4 (Missing Session Token): Dispatch API requests with authorization headers stripped. The server must reject the mutation.
- Test 5 (Post-Logout Cache Traversal): Log out of the application and press the browser's back button. Private session data must not be viewable or operational.
- Test 1 (Unauthenticated Route Access): As a logged-out visitor, open protected routes (
Completion criterion: All 5 negative auth/authz tests executed and verified with server-side enforcement.
4. Code, Dependency & Accessibility Hardening
Audit and harden the generated codebase across dependencies, error handling, accessibility, and data integrity:
- Audit & Prune Generated Dependencies:
- Interrogate the AI: "List all packages in package.json and explain why each is needed."
- Identify and purge "digital souvenir" dependencies; substitute bloated libraries with native web standards.
- Harden Input Validation & Error Guidance:
- Assert validation on both client (UX feedback) and server (security boundary).
- Replace generic "Something went wrong" prompts with actionable instructions ("Could not save task due to network interruption. Check connection and retry").
- Sanitize error handling: never leak stack traces, database schema details, or tokens into console logs or browser network responses.
- Audit Accessibility & Eliminate Dark Patterns:
- Verify semantic HTML (
<button>,<nav>,<main>), visible focus indicators, and WCAG AA color contrast. - Eliminate deceptive UX: remove pre-checked marketing consent, hidden cancellation buttons, and confusing double negatives. Require explicit, clear confirmation modals for destructive operations (
Delete Account).
- Verify semantic HTML (
- Scrub Synthetic Test Data:
- Populate and test applications using fictional data (e.g.
example.testemail domains, dummy names). - Never use real customer records or production credentials during prototyping.
- Populate and test applications using fictional data (e.g.
Completion criterion: Dependencies pruned to essentials, inputs validated, error logging sanitized, WCAG accessibility verified, and fake test data isolated.
5. Stage-Gate Readiness & Honest Classification
Subject the application to recursive self-review and determine honest launch readiness:
- Deploy Recursive AI Self-Review Prompts:
- Prompt the AI to audit its own code:
- "Review this project for authentication and authorization flaws. Identify any route or query that may expose data to the wrong user."
- "Review all forms for missing validation, error handling, and accessibility defects."
- "Review the codebase for hardcoded secrets, unsafe console logging, and client-side PII exposure."
- Cross-examine AI review output against hands-on negative testing; never accept AI assertions without manual verification.
- Prompt the AI to audit its own code:
- Apply The Golden Rule Review:
- "If this application affects another person, review it as if you will be the person affected."
- Would you feel comfortable storing your own data here? Can users easily export or delete their data?
- Enforce Honest Stage Labeling:
- Classify the deliverable:
- Prototype / Demo: Clearly labeled as experimental; no real user PII permitted; intended strictly for concept validation.
- Production Candidate: Full server-side security, rate limiting, audit logging, professional code review, and privacy compliance verified.
- Classify the deliverable:
Completion criterion: Recursive self-review completed, Golden Rule empathy audit passed, and application accurately labeled.
The Visual Brief
When planning or conducting a comprehensive responsible prototyping review of an AI-generated codebase, synthesize the diagnostic audit into an interactive HTML visual brief:
- Target Location: Write to
%TEMP%\book-to-skill-forge-<timestamp>.html(Windows) or/tmp/book-to-skill-forge-<timestamp>.html(Unix). - Styling & Components:
- Dark theme (
#0d1117) loading Tailwind CSS and Mermaid.js via CDN. - Include the Operational Flowchart DAG illustrating the 5-stage progression and decision branches.
- Include the Diagnostic Evaluation Scorecard Table with pass/fail criteria across all 6 gates.
- Include the Anti-Pattern Defense Matrix.
- Dark theme (
- Delivery: Present the clickable local HTML link to the user.
Mandatory Checkpoint
Before generating large multi-file prototypes or deploying AI-generated apps to public environments:
- Present an
implementation_plan.mdartifact detailing:- Target feature scope, user personas, and data fields collected.
- Responsible Prompt Template draft with embedded negative constraints.
- Proposed 5 negative auth/authz test cases.
- Dependency inventory and planned accessibility safeguards.
- Set
RequestFeedback: truein artifact metadata. - STOP and wait for explicit stakeholder confirmation before execution.
Anti-Patterns
- Client-Side Security Illusion — Relying on hidden buttons or UI route guards while leaving backend APIs unprotected against direct requests.
- Digital Souvenir Hoarding — Accumulating heavy, unvetted npm packages for trivial UI components instead of using native primitives.
- Optimism-Driven Data Collection — Requesting sensitive personal information without a clear operational need or threat model.
- Production Pretending — Labeling a rapid prototype as production-ready because of polished styling while ignoring missing security controls.
- Silent Secret Ingestion — Pasting live API tokens or credentials into prompt context or embedding them in client-side bundles.
- Unverified AI Self-Review — Blindly accepting an AI model's assertion that its code is secure without empirical negative testing.
- Dark Pattern Manipulation — Employing pre-checked consent, confusing double negatives, or obfuscated account cancellation workflows.
- Vague Error Obfuscation — Showing generic "Something went wrong" messages to users while dumping full database schemas or stack traces into client console logs.
04 同仓库更多 Skills
ui-behavior-primitive-architect
Architect, audit, and verify zero-dependency headless UI behavior primitives, WebMCP agent bridges, WAI-ARIA/SSR/RTL tri-modal checks, and framework expert routing. Do not use for static CSS theme styling or backend database migrations.
trustgraph-ontology-governor
Govern knowledge graphs, SHACL-AF triple policies, OntologyRAG subclass validation, PROV-O dual named graphs, and Laya entropy decision scoring. Do not use for relational SQL queries or generic web scraping.
shim-harness-governor
Govern universal CLI agent loops, 4-tier tool permissions, ancestor-symlink workspace sandboxes, deterministic-first command routing, collision-safe MCP namespacing, and layered skill loading. Do not use for static UI styling or external SQL analytics.
graphiti-zep-memory-governor
Govern bi-temporal knowledge graphs with Graphiti future-edge clamping, MinHash/LSH entity dedup, RRF/MMR reranking, and Zep typed ontologies. Do not use for static SQL joins or generic web crawling.
agora-mcp-workbench-architect
Architect, audit, and orchestrate Agora Workbench MCP servers, loopback sidecars, unified state graphs, gateway/dispatcher connectors, and policy-enforced data lakes. Do not use for static frontend CSS styling or non-MCP desktop GUI automation.
skill-eval-assurance-runner
Evaluate and assure agent skills using small-N Wilson confidence intervals, unbiased pass^k reliability, deterministic trajectory graders, preflight boundary honesty, and sealed digest verification. Do not use for subjective prose review or unconstrained production deployment.