Home / Part 2 / Coding with Claude

Coding with Claude

Use Claude to scaffold a simple Solana program and iterate fast.

Prompt -> Program -> Test
Clear prompts plus tight feedback loops build reliable code.

Learning Objective

  • Structure prompts for code generation
  • Define accounts and instructions clearly
  • Test, debug, and iterate on generated code

What to Expect

  • Prompt structure: context, goal, constraints
  • "Wall of Wishes" data model outline
  • Interactive prompt flow stepper

Prompt Flow (Interactive)

1. Define Goal

Describe what you want to build.

2. Add Constraints

Accounts, limits, and rules.

3. Generate & Review

Inspect code before running.

4. Test & Iterate

Run tests and refine.

Example Prompt (Wall of Wishes)

Prompt
I'm building a Wall of Wishes Anchor program. Please create the lib.rs file with:
- A WishCounter PDA (seed: "counter") storing total_wishes (u64) + bump (u8)
- A Wish PDA (seeds: ["wish", author pubkey, wish_number]) storing:
  author, text (max 280), author_name (max 50), timestamp, bump
Instructions:
- initialize: create counter PDA
- create_wish: create wish, increment counter
Use Anchor 0.30.x conventions.

Checkpoint Quiz