Using Claude Code

Tutorial:

Using Claude Code at Hybrowlabs — A Step-by-Step Playbook

Goal: Ship ERPNext/Frappe features quickly and safely by splitting work into clear docs and specialized agents (PRD → LLD → Implementation), with Claude handling the heavy lifting and you focusing on review and direction.


0) Quick Start (TL;DR)

  1. Create context at repo root: run /init (aka Claude MD init) to generate CLAUDE.md summarizing the codebase.
  2. Create agents with /agent:
    • PRD Agent → writes Product Requirements.
    • LLD Agent → writes Low-Level Design from a PRD.
    • Frappe Agent → implements the LLD (Doctypes, scripts, hooks, migrations, etc.).
  3. Run the workflow:
    • Prompt PRD Agent → outputs docs/prd/<feature>.md.
    • Feed PRD path to LLD Agent → outputs app/<module>/documentation/lld/<feature>.md.
    • Feed LLD path to Frappe Agent → commits code; run bench migrate, test, review, iterate.
  4. (Optional) Enable auto-execution mode for long tasks. Use sparingly; always review diffs and logs.

1) Prerequisites

  • Access: Anthropic Claude (desktop or web) with tool/agent support; repository access (Git); terminal on your dev machine.
  • Project env: Frappe/ERPNext dev setup (bench, site, app modules), Python & Node as required by your stack.
  • Recommended MCP tools (if available in your setup): Filesystem, Git, Shell, and any custom Hybrowlabs MCPs.

Naming convention: Keep everything under the project repo (bench level). We keep one top-level CLAUDE.md, plus nested Claude MDs inside specific apps/modules when needed.


2) Initialize Project Context — Claude MD

Why: Gives Claude a compact, always-fresh summary of your repo so it can reason faster and make safer changes.

Steps 1. Open the project root (bench) in Claude. 2. Run /init (or the Claude MD init command your setup provides). 3. Commit the generated CLAUDE.md to the repo. 4. (Optional) In large benches, also run /init within individual apps to create nested MDs (e.g., apps/hylabs_customization/CLAUDE.md).

Tips - Re-run after big refactors. - Keep MDs short and specific; deletions are fine—Claude will re-summarize.


3) Create Core Agents

Use /agent to create project-wide agents. Keep prompts crisp and outcome-driven. Below are Hybrowlabs-ready templates.

3.1 PRD Agent (Product Requirements)

You are a PRD Agent for ERPNext/Frappe projects.
- Ask me: (1) app/module, (2) feature name, (3) stakeholders, (4) constraints.
- Create (if missing) docs/prd/ and write docs/prd/<feature>.md with:
  - Problem & success metrics
  - In/out of scope
  - User stories & acceptance criteria
  - Security/compliance notes
  - Dependencies & risks
- Output the saved PRD path.

3.2 LLD Agent (Low-Level Design)

You are an LLD Agent for Frappe/ERPNext.
- Input: path to a PRD .md file.
- Output: app/<module>/documentation/lld/<feature>.md describing:
  - Doctypes (fields, fieldtypes, links, indices)
  - Permissions/roles & visibility rules
  - Client/server scripts, controllers, validations
  - Reports, pages, workspaces, shortcuts
  - Hooks (events, scheduled jobs), patches/migrations
  - API routes & request/response schemas (if any)
- Write in Frappe-native terminology with CLI steps.
- Always include a migration/bench run plan and test checklist.
- Output the saved LLD path.

3.3 Frappe Agent (Implementation)

You are a Frappe Implementation Agent.
- Input: path to the LLD .md file.
- Implement exactly as designed:
  - Create/modify Doctypes and modules in the app repo
  - Add JS/PY customizations, controllers, REST endpoints
  - Update hooks.py (events, cron)
  - Generate and apply patches/migrations; run bench migrate
  - Add reports/pages/workspaces per LLD
  - Write unit/integration tests where specified
- Produce a concise CHANGELOG and a commit message.
- Stop on schema-destructive steps and ask before proceeding.

4) Run the Standard Workflow

  1. PRD Agent → Draft requirements in docs/prd/.
  2. LLD Agent → Generate schema + technical doc in documentation/lld/.
  3. Frappe Agent → Implement exactly as per LLD.
  4. Frontend Agent (optional) → Build Jinja/HTML client pages.
  5. QA & Ship → Validate acceptance criteria, update CHANGELOG, merge.

5) Auto-Execution (YOLO/Dangerous Mode)

  • Only enable after PRD/LLD is solid.
  • Stop on destructive schema steps.
  • Keep logs visible; interrupt if divergence occurs.

6) Suggested Folder Structure

repo/
├─ CLAUDE.md
├─ docs/
│  └─ prd/
│     └─ project_document_request.md
├─ apps/
│  └─ hylabs_customization/
│     ├─ documentation/
│     │  └─ lld/
│     │     └─ project_document_request.md
│     ├─ hylabs_customization/
│     │  ├─ doctype/
│     │  ├─ public/
│     │  ├─ templates/
│     │  ├─ hooks.py
│     │  └─ ...
└─ CHANGELOG.md

7) Working Style (Hybrowlabs)

  • Drive 2–4 parallel tasks; let agents run while you review.
  • Keep prompts short; point to files/paths, not long prose.
  • Commit early, PRs per feature.
  • Prefer agents per app for context clarity.

8) Example: Project Document Request

  • PRD highlights: secure link per project/contact, predefined templates, sample attachments, dashboards.
  • LLD highlights: Doctypes + child tables, token model, upload API, email/SMS templates, reminders, reports.
  • Implementation: Doctypes, controllers, hooks, client page, tests, migrations.
Discard
Save
This page has been updated since your last edit. Your draft may contain outdated content. Load Latest Version

On this page

Review Changes ← Back to Content
Message Status Space Raised By Last update on