Skip to content
prod 352bb92
Browse

5 · Rules & skills

Objective — seed .claude/rules/ with the universal behavioral + reference rule set, install the stack skills and deploy orchestrator into .claude/skills/, then restart so the new context loads. This is the accumulated-knowledge layer — hard-won lessons from past CodeCanyon deployments that arm every future session.

Steps at a glance:

  1. Seed .claude/rules/ — The kit ships the full universal rule set plus a seed-project-rules.sh that copies them into .claude/rules/, backs up any existing versions, and writes a human-readable index.
  2. Install skills into .claude/skills/ — The zaj-laravel-codecanyon orchestrator should already be in the project from C2 (machine setup §5).
  3. Commit rules + skills (C5) — commit the rule and skill layers, so the repo carries the stack-specific operating system future sessions need.
  4. Restart all layers.claude/rules/ and .claude/skills/ load once at session start and are not re-scanned mid-session.

Rules and skills are the accumulated knowledge layer — hard-won lessons from past CodeCanyon deployments that arm every future session (and every teammate who pulls the repo) so you don’t re-hit known bugs from scratch.

LayerLocationWhat it isLoaded
Rules.claude/rules/*.mdBehavioral (feedback_*) + reference (reference_*) + project (project_*) knowledgeIn full, at session start
Skills.claude/skills/Reusable procedures the agent invokes on demand (e.g. the deploy orchestrator)On invocation

Both are committed at C5 (orchestrator already at C2) so they travel with the repo — see git policy.

flowchart TD
Boot[Agent session start] --> Rules[".claude/rules/<br/>loaded in full"]
Boot --> Skills[".claude/skills/<br/>invoked on demand"]
Rules --> Guard[Behavior + reference + project context]
Skills --> Proc[Procedures e.g. deploy orchestrator]

The kit ships the full universal rule set plus a seed-project-rules.sh that copies them into .claude/rules/, backs up any existing versions, and writes a human-readable index. It’s safe to re-run anytime the rule set is updated; it never touches your project_*.md files.

  1. Choose Path A or Path B, then seed rules.

    PathWhenCommand
    A — kit installFresh AI-System kit / seed.sh already ranbash .claude/rules/seed-project-rules.sh
    B — hand-builtConstitution/settings written manually firstCopy rules from kit temp dir only (see below)

    Path A — from the project root:

    Terminal window
    bash .claude/rules/seed-project-rules.sh # idempotent — only adds/updates by mtime
    # Expected: rules copied/updated; existing project_*.md files left untouched

    Path B — fetch kit, copy only .claude/rules/:

    Terminal window
    KIT_DIR="Admin-Local/0-Setup/codecanyon-ai-system-kit"
    mkdir -p .claude/rules Admin-Local/1-Project
    cp -R "$KIT_DIR/dot-claude/rules/." .claude/rules/
    touch Zaj-PROJECT.md \
    .tool-versions \
    Zaj-CUSTOMIZATIONS.md \
    Zaj-PROGRESS.md \
    Zaj-BACKLOG.md \
    Zaj-CHANGELOG.md \
    Admin-Local/1-Project/playbook-feedback.md
    # Expected: rules + tracking files exist; AGENTS.md/CLAUDE.md/settings untouched
    • .claude/rules/ fills with the feedback_* + reference_* set (Path A or B).
  2. Add a project-specific context file. The universal rules are universal; add one file for this project’s current state. Save it as .claude/rules/project_context.md — this file is yours, and seed re-runs never overwrite project_* files.

    ---
    name: Project context — <AppName>
    description: High-level context every session should load. Update as the project progresses.
    ---
    ## <AppName>
    - Type: <SaaS / marketplace / directory>
    - Vendor family: <Froiden / LiquidThemes / WorkDo / InfyOm / IqonicDesign / other>
    - Tech stack: Laravel <version>, <notes>
    - Environments: see `Zaj-PROJECT.md` environment matrix (`staging-primary`, `qa`, `uat`, `production`, etc.)
    - Current phase: AI dev environment setup (complete — update as you go)
    ## Known vendor gotchas (fill in after the local dev source scan)
    - APP_ENV hardcoding: <not yet scanned>
    • .claude/rules/project_context.md exists with this project’s type, vendor family, stack, and environments.

What gets seeded (grouped for discoverability)

Section titled “What gets seeded (grouped for discoverability)”

Meta — how to work with the system itself

  • feedback_rule_persistence.md — when to write a rule directly vs propose-first; keep rules small, grouped, cross-referenced
  • feedback_guide_updates_proactive.md — apply guide edits directly when root cause is clear
  • feedback_playbook_feedback_logging.md — log guide gaps / vendor quirks to project playbook feedback instead of silent inline fixes
  • feedback_devlog_convention.md — use Admin-Local/1-Project/90-DevLog/ as the build journal and hot-file coordination surface
  • feedback_commit_split_strategy.md — the rules→deviations→content→docs commit pattern
  • feedback_idempotent_replay_scripts.md · feedback_replay_script_persistence.md — recoverable, persisted bulk-write scripts

CodeCanyon vendor handling

  • feedback_product_naming.md — use your project names, never vendor script names
  • feedback_vendor_assumptions_verify.md — installed ≠ canonically used; grep source first
  • feedback_vendor_ui_first.md · feedback_vendor_ui_warnings.md — prefer vendor UI/code paths; treat UI warnings as hypotheses
  • feedback_observer_reseed_trap.md — vendor observers silently re-materialize defaults; check app/Observers/ first
  • feedback_demo_content_replacement.md — replace vendor demo content (fake testimonials are a legal landmine)
  • feedback_tier_gating_model.md — discover the vendor’s gating model before designing tiers
  • reference_codecanyon_vendor_families.md — known gotchas by vendor family
  • reference_vendor_deviation_pattern.md — the safe 3-file deviation pattern with comment markers

Customization-ownership system

  • feedback_zaj_code_markers.md — wrap edits in ZAJ:BEGIN/END; net-new files get ZAJ:FILE
  • feedback_zaj_table_naming.md — table/migration naming conventions
  • reference_zaj_customization_strategy.md — the vendor-customization vs new-module vs table-extension decision tree

Laravel / PHP

  • feedback_blade_short_php_form.md · feedback_env_hardcoding_scan.md · feedback_php_alt_binary_artisan.md · feedback_toolchain_version_parity.md
  • reference_laravel_execution_patterns.md — when to use tinker vs script vs artisan vs seeder vs migration

Deploy / infra

  • feedback_shared_files_add_not_set.md · feedback_cron_every_minute_gotcha.md · feedback_staging_vs_production_execution.md

Security / secrets

  • feedback_secret_handling.md · feedback_server_side_secret_execution.md · feedback_op_signin_interactive.md · feedback_stripe_agent_safety.md
  • reference_stripe_restricted_key_scopes.md

i18n / content

  • feedback_free_translate_polysemy.md — spot-check machine translations for polysemy before shipping

The zaj-laravel-codecanyon orchestrator should already be in the project from C2 (machine setup §5). This step adds stack skills (Stripe, etc.) — skip re-downloading the orchestrator unless C2 was skipped.

  1. Confirm the orchestrator from C2 (or download if missing).

    Terminal window
    test -d .claude/skills/zaj-laravel-codecanyon/handbook \
    && echo "orchestrator present (C2)" \
    || { mkdir -p .claude/skills/zaj-laravel-codecanyon
    curl -fsSL https://library.zajapps.com/skills/zaj-laravel-codecanyon.tgz \
    | tar -xz -C .claude/skills/zaj-laravel-codecanyon; }
    # Expected: handbook/ + SKILL.md present
    • .claude/skills/zaj-laravel-codecanyon/handbook/ exists or you deliberately use a global ~/.claude/skills/zaj-laravel-codecanyon copy only.
  2. Add stack skills (Stripe example — install only if this project uses Stripe).

    Terminal window
    npx skills add stripe # example — installs the Stripe skill into .claude/skills/
    ls .claude/skills/
    # Expected: orchestrator + any stack skills you chose
    • ls .claude/skills/ lists the orchestrator (downloaded into the project) and any stack/Stripe skills.
  3. If you built by hand, copy only the rules bundle.

    If you already wrote AGENTS.md, .claude/settings.json, and project mirrors by hand, do not run the kit’s full seed.sh here. Use the kit as a source tree and copy the rule files deliberately so you do not overwrite hand-built project policy.

    Terminal window
    KIT_DIR="Admin-Local/0-Setup/codecanyon-ai-system-kit"
    mkdir -p .claude/rules
    cp -R "$KIT_DIR/dot-claude/rules/." .claude/rules/
    # Expected: only .claude/rules/ is copied from the kit in this hand-built path
    • ✅ Hand-built constitution/settings files remain untouched; .claude/rules/ carries the CodeCanyon feedback rules.
  4. Verify on disk — commit at C5 (§3 below).

    Terminal window
    git add -n .claude/rules/ .claude/skills/ .claude/agents/
    # Expected: paths listed (dry-run) — commit in §3 below
    • .claude/rules/ + stack skills are in place. .claude/agents/ is present only if you created real reviewer files, not just placeholders.

Decide whether to create review subagents (.claude/agents/)

Section titled “Decide whether to create review subagents (.claude/agents/)”

Skills are procedures the agent runs; subagents are specialist reviewers you dispatch for a focused second opinion. The kit ships three CodeCanyon-specific ones into .claude/agents/ — they travel with the repo after C5:

  • vendor-update-reviewer — checks a change for CodeCanyon vendor-upgrade safety (the _zaj suffix, ZAJ:BEGIN/END markers, no edits to vendor migrations). Run it before any commit that touches vendor territory.
  • security-reviewer — security review tuned for a multi-tenant Workdo/Dash Laravel SaaS (tenant isolation, mass-assignment, auth/permission gaps). Run it in Phase 7 and before production.
  • flow-auditor — audits one user flow end-to-end for production-readiness (full-stack, not just the happy path). Run it in Phase 10.

If the kit you downloaded contains only .claude/agents/README.md placeholders, treat these reviewers as conditional/create-as-needed, not as files that already exist. Either create real agent files from your team’s current agent template before C5, or leave .claude/agents/README.md as a placeholder and record the evidence-backed decision in Zaj-PROGRESS.md: N/A — reviewers dispatch from the global agent pool until a real project agent is written.

They commit alongside .claude/skills/ (stack skills) and .claude/rules/ at C5 only when real files exist, so they load for every teammate on clone.

The project orchestrator (zaj-laravel-codecanyon) lives in .claude/skills/ (or globally at ~/.claude/skills/). Companion skills are optional globals you invoke for focused review — no per-project install required when they ship in your IDE plugin pool or ~/.claude/skills/.

Phase / momentGlobal skill (on demand)Not a skill — tool/prereq
Pre-deploy / Phase 7security-review, code-review
Verify gates (this phase, Phase 10)verification-loop
Hotfix / bug loopsystematic-debugging
UI / landing workfrontend-design
Atomic commitsgit-commit
Deeper audit (optional)supply-chain / semgrep reviewers
Machine setupHerd, gh, op, Composer, Node

Tools are not skills. Herd, GitHub CLI, 1Password CLI, and Composer are prerequisites you run in the terminal — they do not need a “skill” entry. The orchestrator skill references this playbook; companion skills add second-opinion review when you dispatch them.

  1. Stage and commit C5 from the project root.

    Terminal window
    git branch --show-current # must be develop
    git add .claude/rules .claude/skills .claude/agents
    git commit -m "feat(ai): seed rules + install stack skills"
    git log --oneline -5 # C5 atop C4…C1
    # Expected: C5 on develop; zaj-laravel-codecanyon unchanged from C2 unless you added stack skills beside it
    • git log shows C5; .claude/rules/ and stack skills are tracked. Review subagents are tracked only if you created real reviewer files; placeholders alone are not a done signal.

.claude/rules/ and .claude/skills/ load once at session start and are not re-scanned mid-session. If you seed without restarting, the current session keeps running with the old/empty context and the new rules have zero effect.

Why it matters: if you run a Stripe-key step in a session that never loaded feedback_stripe_agent_safety.md, the agent may accept an unrestricted key or skip the human-gate.

  1. Save work — or /compact to preserve context, but note a reload still needs a new session.

    • ✅ Pending work is saved (or context compacted) before exiting.
  2. End the session and start fresh.

    1. Save work (or /compact to preserve context — but reload still needs a NEW session)
    2. End the session (/exit or Ctrl+D)
    3. Start fresh: claude
    4. Verify: ask "What rules do you have loaded in .claude/rules/?"
    • ✅ A fresh claude session is running.
  3. Verify the rules loaded. Ask the new session what rules it has.

    Ask: "What rules do you have loaded in .claude/rules/?"
    # Expected: it lists the feedback_* + reference_* set plus project_context.md
    • ✅ The session lists the feedback_* + reference_* set plus project_context.md.

Do not mark this step done until every box below is checked.

  • 🤖 Rules seededbash .claude/rules/seed-project-rules.sh ran; .claude/rules/ holds the feedback_* + reference_* set.
  • 🤖 Project context added.claude/rules/project_context.md exists with this project’s type, vendor family, stack, and environments.
  • 🤖 Skills installed.claude/skills/zaj-laravel-codecanyon/handbook/ (per-project download) or global ~/.claude/skills/zaj-laravel-codecanyon/handbook/; plus any stack/Stripe skills.
  • 🤖 Review subagent plan recorded — either .claude/agents/ holds real vendor-update / security / flow-auditor reviewer files, or the placeholders explicitly say the project will dispatch global reviewers as needed.
  • 🤖 Tracking files seeded — root Zaj-PROJECT.md, .tool-versions, Zaj-CUSTOMIZATIONS.md, Zaj-PROGRESS.md, Zaj-BACKLOG.md, and Zaj-CHANGELOG.md exist; Admin-Local/1-Project/playbook-feedback.md exists (later phases write to them).
  • 🤖 C5 committed on develop.claude/rules/, stack skills, and .claude/agents/ tracked (git log shows C5); orchestrator already from C2.
  • 👤 Session restarted — a fresh session was started after seeding.
  • 🔀 Rules confirmed loaded — the fresh session lists the feedback_* + reference_* set plus project_context.md.