Tutorial

Getting Started with Claude Code: The AI-Powered Development Tool

Claude Code is changing how developers build software. Anthropic's official CLI tool brings the power of Claude directly to your terminal, enabling you to write code, debug issues, explore codebases, and automate tasks through natural language conversation.

What is Claude Code?

Claude Code is a command-line interface that connects you to Claude, Anthropic's AI assistant. Unlike web-based chat interfaces, Claude Code operates directly in your development environment, with access to:

  • Your file system (read and write files)
  • Terminal commands (execute shell scripts)
  • Web content (fetch documentation and APIs)
  • Your full project context
  • This deep integration means Claude Code can do more than answer questions—it can actively help you build software.

    Installation

    Getting started with Claude Code takes just a few commands:

    # Install via npm
    npm install -g @anthropic-ai/claude-code
    
    # Or via Homebrew on macOS
    brew install claude-code
    
    # Verify installation
    claude --version

    Authentication

    Claude Code uses your Anthropic API key for authentication:

    # Set your API key
    export ANTHROPIC_API_KEY="sk-ant-..."
    
    # Or configure it permanently
    claude config set api_key sk-ant-...

    Your First Session

    Start Claude Code by running claude in your terminal:

    cd my-project
    claude

    You'll enter an interactive session where you can chat with Claude about your project:

    You: What does this project do?
    
    Claude Code: Looking at your project structure...
    
    This is a Next.js web application for LumenQuery, a Stellar
    blockchain API service. Key components include:
    
    - Portal: User dashboard for API key management
    - API Gateway: Proxies requests to Stellar Horizon
    - RPC Gateway: Proxies requests to Soroban RPC
    - Monitoring: Prometheus + Grafana stack
    
    The main technologies are TypeScript, React, Prisma, and Docker.

    Core Capabilities

    1. Reading and Understanding Code

    Ask Claude Code to explain any part of your codebase:

    You: How does the authentication middleware work?
    
    Claude Code: Let me look at the middleware...
    
    The authentication flow works like this:
    
    1. middleware.ts intercepts all /api/* requests
    2. It checks for an X-API-Key header
    3. Keys are validated against the database via Prisma
    4. Valid requests proceed; invalid ones return 401
    
    Here's the key code in lib/auth.ts:
    [Shows relevant code snippet]

    2. Writing Code

    Claude Code can create new files and modify existing ones:

    You: Create a new API endpoint that returns server health
    
    Claude Code: I'll create a health check endpoint for you.
    
    Creating app/api/health/route.ts...
    
    This endpoint returns:
    - Server status
    - Timestamp
    - Service version
    - Database connectivity

    3. Running Commands

    Execute shell commands directly through Claude Code:

    You: Run the tests and tell me if anything fails
    
    Claude Code: Running npm test...
    
    All 47 tests passed:
    - 12 unit tests
    - 23 integration tests
    - 12 e2e tests
    
    Test coverage: 84%

    4. Debugging

    When something breaks, Claude Code helps you fix it:

    You: The API is returning 500 errors. Help me debug.
    
    Claude Code: Let me check the logs and trace the issue...
    
    Found the problem in api-gateway/src/index.ts:142
    
    The Redis connection is timing out because the REDIS_URL
    environment variable isn't set in production.
    
    Fix: Add REDIS_URL to your .env file:
    REDIS_URL=redis://lumenquery-redis:6379
    
    Want me to add this for you?

    5. Git Operations

    Manage version control through natural language:

    You: Commit these changes with a good message
    
    Claude Code: Analyzing your changes...
    
    You've modified 3 files:
    - Added rate limiting to API gateway
    - Updated the dashboard UI
    - Fixed a typo in documentation
    
    Creating commit:
    "Add rate limiting to API gateway and update dashboard UI"

    Practical Examples

    Example 1: Adding a New Feature

    You: Add a dark mode toggle to the dashboard
    
    Claude Code: I'll implement dark mode for you. Here's my plan:
    
    1. Add a ThemeProvider using next-themes
    2. Create a toggle component in the header
    3. Update Tailwind config for dark variants
    4. Apply dark styles to existing components
    
    Starting implementation...
    [Creates/modifies files]
    
    Done! The toggle is in the dashboard header.
    User preferences persist in localStorage.

    Example 2: Exploring an API

    You: Show me how to use the LumenQuery Soroban RPC
    
    Claude Code: Here's how to interact with Soroban RPC:
    
    Endpoint: https://rpc.lumenquery.io
    
    Example - Get latest ledger:
    [Shows curl command and response]
    
    Example - Simulate transaction:
    [Shows curl command and response]
    
    Want me to create a helper library for these calls?

    Example 3: Code Review

    You: Review the changes in my current branch
    
    Claude Code: Reviewing your changes...
    
    Looks good overall! A few suggestions:
    
    1. Line 45 in api/keys/route.ts: Consider adding input
       validation for the key name parameter
    
    2. Line 112 in dashboard/page.tsx: This useEffect has
       a missing dependency - add 'apiKeys' to the array
    
    3. Good job on the error handling in the new endpoint!
    
    Want me to apply these fixes?

    Tips for Effective Use

    Be Specific

    The more context you provide, the better Claude Code can help:

    # Less effective
    You: Fix the bug
    
    # More effective
    You: The signup form isn't validating email addresses.
         Users can submit invalid emails.

    Use Project Context

    Claude Code understands your entire project. Reference files and concepts:

    You: Update the Header component to match the Footer styling

    Iterate Collaboratively

    Claude Code works best as a collaborative partner:

    You: Create a user profile page
    
    Claude Code: [Creates basic page]
    
    You: Add the user's API usage stats
    
    Claude Code: [Adds stats component]
    
    You: Make it match our existing dashboard style
    
    Claude Code: [Updates styling]

    Review Generated Code

    Always review what Claude Code creates:

    You: Show me what you changed before committing

    Keyboard Shortcuts

    ShortcutAction
    Ctrl+CCancel current operation
    Ctrl+DExit Claude Code
    Up/DownNavigate command history
    TabAutocomplete file paths

    Configuration Options

    Customize Claude Code behavior:

    # Set preferred model
    claude config set model claude-sonnet-4
    
    # Set working directory
    claude config set workdir ~/projects
    
    # Enable verbose output
    claude config set verbose true

    Security Best Practices

    Claude Code has powerful capabilities. Use them responsibly:

  • Review before executing: Check commands before running them
  • Use environment variables: Never hardcode secrets
  • Limit scope: Run in project directories, not system-wide
  • Audit changes: Review git diffs before committing
  • Integrating with Your Workflow

    VS Code Extension

    Claude Code integrates with VS Code for a seamless experience:

    # Install the extension
    code --install-extension anthropic.claude-code

    CI/CD Pipelines

    Use Claude Code in automation:

    # GitHub Actions example
    - name: Generate changelog
      run: claude "Generate a changelog from recent commits" > CHANGELOG.md

    Team Collaboration

    Share Claude Code configurations across your team:

    # Export settings
    claude config export > .claude-config.json
    
    # Team members import
    claude config import .claude-config.json

    Conclusion

    Claude Code represents a new paradigm in software development. By bringing AI assistance directly into your terminal, it reduces friction between thinking about code and writing it.

    Whether you're exploring a new codebase, debugging a tricky issue, or building new features, Claude Code accelerates your workflow while keeping you in control.

    The best way to learn Claude Code is to use it. Start with small tasks, build confidence, and gradually tackle more complex challenges. You'll quickly discover how AI assistance can transform your development process.


    *Building on Stellar with Claude Code? Sign up for LumenQuery to get reliable API infrastructure for your blockchain applications.*