saas-seeder/SKILL.md
Bootstrap a new SaaS from the SaaS Seeder Template: setup database, configure environment, create super admin user, and verify three-tier panel structure. Use when initializing a new multi-tenant SaaS project from this template.
npx skillsauth add peterbamuhigire/skills-web-dev saas-seederInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
saas-seeder or would be better handled by a more specific companion skill.references only as needed.SKILL.md first, then load only the referenced deep-dive files that are necessary for the task.references/ directory for deep detail after reading the core workflow below.Bootstrap a new multi-tenant SaaS project using the SaaS Seeder Template with proper three-tier panel architecture, Argon2ID authentication, and franchise isolation.
Always load and apply the Vibe Security Skill for any seeder work that touches web pages, APIs, authentication, data access, or file handling. Treat its checklist as mandatory.
All database schema setup, seeding, and migrations MUST follow mysql-best-practices skill patterns including character sets, indexing, foreign keys, and stored procedures.
All SaaS projects deploy across three environments:
| Environment | OS | Database | Web Root |
|---|---|---|---|
| Development | Windows 11 (WAMP) | MySQL 8.x | C:\wamp64\www\{project}\ |
| Staging | Ubuntu VPS | MySQL 8.x | /var/www/html/{project}/ |
| Production | Debian VPS | MySQL 8.x | /var/www/html/{project}/ |
Cross-platform rules: Use utf8mb4_unicode_ci collation. Match file/directory case exactly (Linux is case-sensitive). Use forward slashes in PHP paths. Production migrations go in database/migrations-production/ (non-destructive, idempotent).
Use when the user says:
BEFORE bootstrapping, developers MUST provide:
Place in docs/project-requirements/:
docs/project-requirements/
├── requirements.md # Detailed feature requirements
├── business-rules.md # Business logic and validation rules
├── user-types.md # User types and their permissions
├── workflows.md # Key user workflows and processes
└── ui-mockups/ # UI mockups or wireframes (optional)
Use the project-requirements skill to create these files with AI assistance.
/manuals/ and a public entry point (e.g., /public/user-manuals.php)Place in database/schema/:
database/schema/
├── core-schema.sql # Main database schema
├── seed-data.sql # Sample/seed data (optional)
└── schema-diagram.png # Database diagram (optional)
Schema Requirements:
franchise_id columnutf8mb4_unicode_ci collationWhen starting a new project:
Read Project Requirements
docs/project-requirements/Review Database Schema
database/schema/Update Project Documentation
docs/plans/INDEX.md exists as the master plan status index and is maintained as plans are created or updatedCustomize Template
Validate Completeness
See references/architecture.md for complete details.
/public/ (root) - Franchise Admin Panel (THE MAIN WORKSPACE)
owner, staffdashboard.php, skeleton.php/public/adminpanel/ - Super Admin Panel
super_admin/public/memberpanel/ - End User Portal
member, student, customer, patientKey Principle: /public/ root is NOT a redirect router - it's the franchise admin workspace!
All session variables use a prefix:
define('SESSION_PREFIX', 'saas_app_'); // Change per SaaS
// ALWAYS use helpers
setSession('user_id', 123); // Sets $_SESSION['saas_app_user_id']
$userId = getSession('user_id'); // Gets $_SESSION['saas_app_user_id']
hasSession('user_id'); // Checks if exists
Customize per SaaS: school_, restaurant_, clinic_, etc.
Uses Argon2ID (NOT bcrypt):
Algorithm: Argon2ID + salt(32 chars) + pepper(64+ chars)
Hash: salt + Argon2ID(HMAC-SHA256(password, pepper) + salt)
CRITICAL: Use super-user-dev.php to create admin users, NOT migration defaults!
docs/seeder-template/migration.sql - Core auth/RBAC schemadocs/seeder-template/fix-collation-and-create-franchises.sql - Collation fixes + franchises tabledocs/project-requirements/ - Project requirements (developer provides)database/schema/ - Project database schemas (developer provides)public/super-user-dev.php - Super admin creator (DEV ONLY)public/dashboard.php - Franchise admin dashboardpublic/skeleton.php - Page template.env - Environment configurationSee references/workflow.md for complete step-by-step guide.
Environment Setup
.env fileInstall Dependencies
composer install
Install PHP Development Tools
See references/php-tooling.md for complete setup guide.
Quick install:
# Check existing tools
composer show | grep -E "(phpstan|phpunit|pest|php-cs-fixer)"
# Install essential tools
composer require --dev phpstan/phpstan
composer require --dev friendsofphp/php-cs-fixer
composer require --dev pestphp/pest --with-all-dependencies
Create configs and add composer scripts (see references/php-tooling.md for details).
Database Setup
.\setup-database.ps1 # Windows PowerShell
Fix Collations
.\fix-database.ps1 # Creates franchises table
Create Super Admin
http://localhost:8000/super-user-dev.phpVerify Setup
http://localhost:8000/sign-in.phpProject Customization
src/config/session.phpsuper_admin - Platform operators (franchise_id CAN be NULL)owner - Franchise owners (franchise_id REQUIRED)staff - Franchise staff with permissions (franchise_id REQUIRED)ALWAYS filter by franchise_id:
// CORRECT
$stmt = $db->prepare("SELECT * FROM students WHERE franchise_id = ?");
$stmt->execute([getSession('franchise_id')]);
// WRONG - data leakage!
$stmt = $db->prepare("SELECT * FROM students");
RESOURCE_ACTIONINVOICE_CREATE, STUDENT_DELETE, REPORT_VIEWSee references/troubleshooting.md for complete guide.
Session Not Persisting
Password Mismatch
super-user-dev.php, NOT manual password_hash()Collation Errors
.\fix-database.ps1Missing Franchises Table
.\fix-database.ps1Report to user:
✅ [Project Name] Initialized!
Requirements Loaded:
- ✅ Read from docs/project-requirements/
- ✅ Database schema reviewed from database/schema/
- ✅ User types customized: [list custom types]
- ✅ Session prefix set to: [prefix]_
Database Setup:
- ✅ Core schema applied
- ✅ Seed data loaded (if provided)
- ✅ Multi-tenant validation passed
PHP Development Tools Installed:
- ✅ PHPStan (level 8) - Static analysis
- ✅ PHP CS Fixer - PSR-12 formatting
- ✅ PHPUnit/Pest - Testing framework
- ✅ Configuration files created
- ✅ Composer scripts configured
Project Documentation:
- ✅ README.md updated for [Project Name]
- ✅ CLAUDE.md created with project-specific guidance
- ✅ Template docs archived/removed
Branding:
- ✅ Updated throughout application
- ✅ Landing page customized
- ✅ Login page branded
Next Steps:
1. Review updated CLAUDE.md for project-specific guidance
2. Create super admin at http://localhost:8000/super-user-dev.php
3. Login and verify three-tier panel structure
4. Run quality checks: composer quality
5. Begin implementing features from docs/project-requirements/
Development Commands:
- composer test # Run tests
- composer stan # Static analysis
- composer cs-fix # Format code (PSR-12)
- composer quality # Run all checks
References:
- Requirements: docs/project-requirements/
- Schema: database/schema/
- Development Guide: CLAUDE.md
saas-seeder/
├── public/ # Web root
│ ├── index.php # Landing page with nav buttons
│ ├── sign-in.php # Login
│ ├── super-user-dev.php # Super admin creator
│ ├── dashboard.php # Franchise admin dashboard
│ ├── skeleton.php # Page template
│ ├── adminpanel/ # Super admin panel
│ ├── memberpanel/ # End user portal
│ └── assets/ # Shared CSS/JS
├── src/
│ ├── config/
│ │ ├── auth.php # Auth functions + access control
│ │ ├── session.php # Session prefix helpers
│ │ └── database.php # Database connection
│ └── Auth/ # Auth services, helpers, DTOs
├── docs/
│ ├── seeder-template/ # Template schemas
│ ├── PANEL-STRUCTURE.md # Architecture guide
│ └── project-requirements/ # ⭐ PUT PROJECT REQUIREMENTS HERE
│ ├── requirements.md
│ ├── business-rules.md
│ ├── user-types.md
│ └── workflows.md
├── database/
│ └── schema/ # ⭐ PUT DATABASE SCHEMAS HERE
│ ├── core-schema.sql
│ └── seed-data.sql
├── .env # Environment config
├── composer.json # Dependencies
├── setup-database.ps1 # Setup script
├── fix-database.ps1 # Fix script
└── CLAUDE.md # Development guide
Complete documentation in subdirectories:
references/architecture.md - Complete architectural standardsreferences/workflow.md - Detailed step-by-step workflowreferences/troubleshooting.md - Common issues and solutionsreferences/php-tooling.md - PHP development tools setup and usage guideExternal references:
../../docs/PANEL-STRUCTURE.md - Three-tier architecture guide../../CLAUDE.md - Development guidelines../project-requirements/ - Skill for creating requirements docsSee references/php-tooling.md for complete guide.
composer cs-fix # Format code (PSR-12)
composer stan # Static analysis
composer test # Run tests
composer quality # All checks
composer quality && git commit -m "feat: description"
✅ Authentication, franchise isolation, permissions, password hashing, session management, input validation
See references/php-tooling.md for testing examples, CI/CD setup, and IDE integration.
super-user-dev.php or restrict accessSESSION_PREFIX from saas_app_PASSWORD_PEPPER (64+ chars)COOKIE_ENCRYPTION_KEY (32+ chars)APP_ENV=production.env (600)data-ai
Use when adding AI-powered analytics to a SaaS platform — semantic search over business data, natural language queries, trend detection, anomaly alerts, and AI-generated insights for dashboards. Covers embeddings, NL2SQL, and per-tenant analytics...
data-ai
Design AI-powered analytics dashboards — what metrics to show, how to display AI predictions and confidence, drill-down patterns, KPI cards, trend visualisation, AI Insights panels, export design, and role-based dashboard variants. Invoke when...
development
Use when designing, building, reviewing, or upgrading production software systems that must be secure, performant, maintainable, scalable, and user-centered. Apply before writing specs, code, architecture, APIs, databases, mobile apps, SaaS platforms, or ERP systems.
development
Professional web app UI using commercial templates (Tabler/Bootstrap 5) with strong frontend design direction when needed. Use for CRUD interfaces, dashboards, admin panels with SweetAlert2, DataTables, Flatpickr. Clone seeder-page.php, use...