- Foreword
-
Preface
- Why this guide
- Who it's for
- What you'll find
- What you won't find
- How to read it
- How this guide was written
- Feedback and errata
-
1. What is Claude Code
- 1.1 A brief history
- 1.2 Claude Code compared to Lovable, Replit and other AI environments
- 1.3 When it's worth using
- 1.4 The learning curve
-
2. Installation and setup
- 2.1 Compatible plans
- 2.2 System requirements
- 2.3 Installation on macOS and Linux
- 2.4 Installation on Windows
- 2.5 Installation via WSL2 (recommended for Windows)
- 2.6 Alternative installation via npm (deprecated but supported)
- 2.7 Verifying the installation
- 2.8 Authentication
-
3. The first end-to-end project
- 3.1 Step 1: Position yourself in the project directory
- 3.2 Step 2: Initialize the project
- 3.3 Step 3: Review and customize CLAUDE.md
- 3.4 Step 4: First request
- 3.5 Step 5: Exit the session
- 3.6 Step 6: Resume where you left off
-
4. Essential commands and shortcuts
- 4.1 The command-driven syntax: why it works this way
- 4.2 Essential CLI flags
- 4.3 Advanced CLI flags
- 4.4 Slash commands: the heart of the interactive session
- 4.5 Essential slash commands
- 4.6 Slash commands for specific workflows
- 4.7 Keyboard shortcuts
- 4.8 The @, !, / syntax — the three prefixes that change everything
-
5. Plan Mode: think before you write
- 5.1 Why it matters
- 5.2 How to activate it
- 5.3 Tools available in Plan Mode
- 5.4 Example workflow with Plan Mode
- 5.5 opusplan: the right model for the right job
-
6. Prompt engineering: writing effective prompts
- 6.1 What prompt engineering is and why it matters in CLI
- 6.2 Anatomy of a well-made prompt
- 6.3 From roles to structural constraints (the 2026 revolution)
- 6.4 The fundamental techniques
- 6.5 Claude Code specifics compared to chat
- 6.6 Before/after examples
- 6.7 Common anti-patterns
- 6.8 Promoting a prompt: when it goes in CLAUDE.md or in a custom command
- 6.9 Prompt library: archiving and versioning
-
7. Persistent memory: CLAUDE.md and Auto Memory
- 7.1 Generating CLAUDE.md with /init
- 7.2 What to put in CLAUDE.md
- 7.3 Example 1: WordPress plugin
- 7.4 Example 2: generic Node/TypeScript project
- 7.5 Hierarchical CLAUDE.md
- 7.6 Auto Memory: what it is and what changes
- 7.7 Requirements and enabling
- 7.8 Where memories live
- 7.9 Anatomy of the memory folder
- 7.10 Auto Memory and subagents
- 7.11 When to disable it
- 7.12 CLAUDE.md vs Auto Memory: when to use what
-
8. Context management
- 8.1 What context is and why it matters
- 8.2 What weighs in the context
- 8.3 Signals of a saturated context
- 8.4 The /context command: reading and acting
- 8.5 Compression: /compact and /clear
- 8.6 Subagents: the structural strategy
- 8.7 Models with 1M token window: when to switch
- 8.8 Practical rule and mindset
- 8.9 Choosing the right architecture: decision table
- 8.10 Prompt cache and consumption observability
-
9. Security, permissions, and guardrails
- 9.1 Claude Code guardrails: defense in depth
- 9.2 The permissions system
- 9.3 Configuring permissions in settings.json
- 9.4 Protecting secrets
- 9.5 Dangerous modes
- 9.6 Prompt injection
- 9.7 Tests as correctness guardrails
-
10. Skills: the extension mechanism
- 10.1 How a Skill works
- 10.2 Bundled native skills — deep dive
- 10.3 Community skills: a curated selection
- 10.4 Installing and managing skills
- 10.5 Creating a custom Skill
- 10.6 Security of third-party skills
-
11. MCP: integrating external services
- 11.1 What MCP is and why it exists
- 11.2 Protocol architecture
- 11.3 Configuring an existing MCP server
- 11.4 Useful MCP servers: a curated selection
- 11.5 Creating an MCP server from scratch: publishing to WordPress
- 11.6 Security and operational considerations
- 11.7 Managing the cost of MCP servers on context
-
12. Subagents: orchestrating specialized work
- 12.1 What they are and why you need them
- 12.2 Subagent vs main agent: the concrete difference
- 12.3 Built-in subagents
- 12.4 Creating a custom subagent
- 12.5 Precedence hierarchy
- 12.6 Automatic vs explicit invocation
- 12.7 Parallelism: multi-delegation patterns
- 12.8 Cost optimization via model routing
- 12.9 When NOT to use them
- 12.10 Subagents, Skills and Hooks compared
-
13. Hooks: automating Claude Code's lifecycle
- 13.1 What they are and what they're for
- 13.2 Anatomy of a hook
- 13.3 Lifecycle events
- 13.4 Matchers and inspection (/hooks)
- 13.5 Input and output
- 13.6 Practical examples
- 13.7 Security
- 13.8 Gotchas and when NOT to use them
-
14. Plugins: distributable packages
- 14.1 Claude Code's extension mechanisms: a map
- 14.2 What a plugin is and why it exists
- 14.3 Anatomy of a plugin
- 14.4 Plugin marketplace
- 14.5 Creating a custom plugin
- 14.6 Distributing a plugin
- 14.7 Security and operational considerations
-
15. Advanced workflows and tips
- 15.1 Onboarding to an existing repository
- 15.2 Bug hunting with TDD
- 15.3 Safe refactoring
- 15.4 Performance audit
- 15.5 Vim mode
- 15.6 Custom slash commands
- 15.7 Headless mode for CI/CD
- 15.8 Session recap
- 15.9 Strategic Git checkpoints
- 15.10 Conversation forks
-
16. Conclusions: why CLI and not just chat
- 16.1 Persistent context: stop introducing yourself every time
- 16.2 Agentic autonomy: it executes, not just suggests
- 16.3 Integration into the real workflow
- 16.4 When chat remains the right choice
- 16.5 In summary
- Appendix A — Glossary
- Appendix B — Sources
- Note on the Author
Claude Code
A practical guide for those who want to start using Claude Code professionally
The book is free — pay-what-you-want with a $0 minimum. If you find it useful and want to contribute, you decide how much. If you can't or don't want to, just download and read without worry: the Creative Commons BY-SA 4.0 license even allows you to redistribute and modify it, as long as you credit the source and maintain the same license.
Minimum price
Free!
$6.00
You pay
Author earns
About
About the Book
Claude Code is Anthropic's agentic CLI that lives in the developer's terminal: it
reads the code, executes commands, respects the project conventions.
This practical guide — for those who want to start using it professionally —
covers installation and setup, daily commands, Plan Mode, prompt engineering,
context and permission management, hooks, MCP servers, subagents, and
custom Skills.
All content is verified against the official Anthropic documentation. Concrete
examples on PHP, JavaScript, and WordPress. No hype: every chapter states
where the tool is really worth using and where it isn't.
Aimed at web developers familiar with terminal and Git, professionals who want
to integrate AI into their workflow consciously, and technical teams evaluating
the adoption of agentic AI tools in development processes.
Feedback
Author
About the Author
Mi chiamo **Maurizio Pelizzone**, sono Senior Software Architect, Co-titolare di **Mavida snc** (Torino) dal 2001 e formatore tecnico specializzato nell'ecosistema WordPress. In oltre vent'anni ho progettato e portato in produzione più di 200 progetti web per clienti nazionali, specializzandomi in architetture WordPress enterprise, sviluppo plugin e temi custom, migrazioni di piattaforme legacy e ottimizzazione performance/security. Dal 2010 sono **Speaker ricorrente ai WordCamp italiani** (Milano, Bologna, Torino, WordCamp Italia), con talk su Custom Post Types, Hardening & Security, Solutions Architecture e Full Site Editing. **Dal 2023 ho aggiunto un "superpotere" al mio workflow: l'Intelligenza Artificiale**, usandola come leva strategica per scrivere codice più pulito, scalabile e intelligente. Non come sostituto del mestiere, ma come amplificatore: vent'anni di PHP, WordPress e architetture software mi permettono di distinguere un suggerimento brillante da una scorciatoia rischiosa, e di dirigere l'AI verso soluzioni che reggono il peso della produzione. Oggi affianco alla consulenza tecnica per PMI e aziende nazionali un'attività di **formazione su AI tools, prompt engineering, vibe coding e automazione con N8N**, convinto che la combinazione tra esperienza artigianale del codice e utilizzo consapevole dell'AI sia la direzione in cui il nostro mestiere sta evolvendo. Questa guida nasce da quella convinzione: uno strumento come Claude Code non sostituisce lo sviluppatore, ma cambia il modo in cui lavora. Per usarlo bene servono le stesse virtù di sempre — rigore, curiosità, capacità di verificare — più un po' di disciplina nuova.
Translations
Translations
Languages
Contents
Table of Contents
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.