SpyBara
Go Premium Account
2026
24 Nov 2025, 21:01
12 May 2026, 14:59 12 May 2026, 01:59 12 May 2026, 00:01 11 May 2026, 23:00 11 May 2026, 21:57 11 May 2026, 20:02 11 May 2026, 18:59 11 May 2026, 18:00 11 May 2026, 15:00 10 May 2026, 23:03 10 May 2026, 17:00 10 May 2026, 04:02 9 May 2026, 04:57 9 May 2026, 04:01 9 May 2026, 03:01 8 May 2026, 22:00 8 May 2026, 19:00 8 May 2026, 18:00 8 May 2026, 16:57 8 May 2026, 07:02 8 May 2026, 06:02 8 May 2026, 03:01 8 May 2026, 02:03 8 May 2026, 01:02 8 May 2026, 00:02 7 May 2026, 22:59 7 May 2026, 21:57 7 May 2026, 17:08 5 May 2026, 23:00 5 May 2026, 21:00 5 May 2026, 17:00 5 May 2026, 15:59 5 May 2026, 14:57 5 May 2026, 00:02 4 May 2026, 22:58 4 May 2026, 22:01 4 May 2026, 18:58 4 May 2026, 15:35 4 May 2026, 06:55 4 May 2026, 04:18 2 May 2026, 18:14 2 May 2026, 04:05 2 May 2026, 00:19 1 May 2026, 18:19 1 May 2026, 04:22 1 May 2026, 00:20 29 Apr 2026, 21:21 29 Apr 2026, 15:36 29 Apr 2026, 09:39 29 Apr 2026, 04:11 29 Apr 2026, 00:20 28 Apr 2026, 21:21 28 Apr 2026, 18:28 28 Apr 2026, 15:45 28 Apr 2026, 06:49 27 Apr 2026, 21:20 27 Apr 2026, 18:23 26 Apr 2026, 04:08 25 Apr 2026, 21:10 24 Apr 2026, 18:11 24 Apr 2026, 06:34 24 Apr 2026, 00:17 23 Apr 2026, 18:19 23 Apr 2026, 04:04 23 Apr 2026, 00:17 22 Apr 2026, 21:15 22 Apr 2026, 04:00 22 Apr 2026, 00:13 21 Apr 2026, 21:14 21 Apr 2026, 09:30 21 Apr 2026, 04:01 20 Apr 2026, 21:14 20 Apr 2026, 18:16 18 Apr 2026, 18:09 18 Apr 2026, 00:13 17 Apr 2026, 21:13 17 Apr 2026, 18:14 17 Apr 2026, 00:15 16 Apr 2026, 21:13 16 Apr 2026, 18:21 16 Apr 2026, 15:30 16 Apr 2026, 04:02 16 Apr 2026, 00:16 15 Apr 2026, 18:20 15 Apr 2026, 15:24 15 Apr 2026, 09:29 15 Apr 2026, 04:00 14 Apr 2026, 21:14 14 Apr 2026, 18:21 14 Apr 2026, 06:32 14 Apr 2026, 04:00 14 Apr 2026, 00:16 13 Apr 2026, 21:14 13 Apr 2026, 18:21 11 Apr 2026, 00:11 10 Apr 2026, 21:09 10 Apr 2026, 18:13 10 Apr 2026, 06:32 10 Apr 2026, 00:12 9 Apr 2026, 21:14 9 Apr 2026, 18:17 9 Apr 2026, 15:29 9 Apr 2026, 03:55 9 Apr 2026, 00:09 8 Apr 2026, 21:13 8 Apr 2026, 18:21 8 Apr 2026, 15:27 8 Apr 2026, 00:12 7 Apr 2026, 21:14 4 Apr 2026, 18:05 4 Apr 2026, 03:46 4 Apr 2026, 00:09 3 Apr 2026, 21:07 3 Apr 2026, 18:08 3 Apr 2026, 03:54 3 Apr 2026, 00:11 2 Apr 2026, 21:08 2 Apr 2026, 18:12 2 Apr 2026, 09:19 2 Apr 2026, 06:21 2 Apr 2026, 03:53 1 Apr 2026, 21:12 1 Apr 2026, 18:13 1 Apr 2026, 04:00 1 Apr 2026, 00:11 31 Mar 2026, 21:09 31 Mar 2026, 06:24 31 Mar 2026, 03:56 31 Mar 2026, 00:11 30 Mar 2026, 21:13 30 Mar 2026, 18:15 28 Mar 2026, 18:04 28 Mar 2026, 15:06 27 Mar 2026, 21:09 27 Mar 2026, 18:14 27 Mar 2026, 15:15 27 Mar 2026, 06:21 27 Mar 2026, 03:56 27 Mar 2026, 00:10 26 Mar 2026, 21:07 26 Mar 2026, 18:16 26 Mar 2026, 15:25 26 Mar 2026, 06:21 26 Mar 2026, 03:55 26 Mar 2026, 00:10 25 Mar 2026, 21:08 25 Mar 2026, 18:15 25 Mar 2026, 06:18 25 Mar 2026, 03:47 25 Mar 2026, 00:08 24 Mar 2026, 18:15 24 Mar 2026, 00:07 23 Mar 2026, 21:08 23 Mar 2026, 18:13 23 Mar 2026, 00:09 22 Mar 2026, 18:04 22 Mar 2026, 00:07 21 Mar 2026, 18:03 21 Mar 2026, 00:07 20 Mar 2026, 21:05 20 Mar 2026, 18:08 20 Mar 2026, 15:13 20 Mar 2026, 03:45 20 Mar 2026, 00:08 19 Mar 2026, 06:17 19 Mar 2026, 00:08 18 Mar 2026, 18:16 18 Mar 2026, 12:11 18 Mar 2026, 09:15 18 Mar 2026, 03:50 18 Mar 2026, 00:09 17 Mar 2026, 21:10 17 Mar 2026, 18:15 17 Mar 2026, 03:46 17 Mar 2026, 00:08 16 Mar 2026, 21:10 16 Mar 2026, 18:15 14 Mar 2026, 03:44 14 Mar 2026, 00:08 13 Mar 2026, 21:07 13 Mar 2026, 18:07 13 Mar 2026, 06:12 12 Mar 2026, 21:07 12 Mar 2026, 18:12 12 Mar 2026, 00:07 11 Mar 2026, 03:43 11 Mar 2026, 00:05 10 Mar 2026, 03:43 10 Mar 2026, 00:05 9 Mar 2026, 21:06 7 Mar 2026, 03:37 7 Mar 2026, 00:07 6 Mar 2026, 06:10 6 Mar 2026, 03:44 6 Mar 2026, 00:12 5 Mar 2026, 06:12 5 Mar 2026, 03:45 5 Mar 2026, 00:07 4 Mar 2026, 21:06 4 Mar 2026, 18:09 4 Mar 2026, 09:09 1 Mar 2026, 06:10 1 Mar 2026, 03:49 28 Feb 2026, 21:01 28 Feb 2026, 00:05 27 Feb 2026, 21:05 27 Feb 2026, 18:07 27 Feb 2026, 09:11 27 Feb 2026, 06:13 27 Feb 2026, 00:08 26 Feb 2026, 21:08 26 Feb 2026, 18:12 26 Feb 2026, 09:14 26 Feb 2026, 06:17 26 Feb 2026, 00:07 25 Feb 2026, 03:47 25 Feb 2026, 00:09 24 Feb 2026, 21:08 24 Feb 2026, 18:15 23 Feb 2026, 21:13 21 Feb 2026, 18:03 21 Feb 2026, 06:08 20 Feb 2026, 21:03 20 Feb 2026, 06:14 20 Feb 2026, 00:07 19 Feb 2026, 21:06 19 Feb 2026, 03:48 19 Feb 2026, 00:08 18 Feb 2026, 03:48 17 Feb 2026, 21:08 17 Feb 2026, 00:08 16 Feb 2026, 21:05 14 Feb 2026, 03:44 13 Feb 2026, 21:09 12 Feb 2026, 00:06 11 Feb 2026, 21:10 11 Feb 2026, 00:11 10 Feb 2026, 21:13 10 Feb 2026, 03:56 10 Feb 2026, 00:11 9 Feb 2026, 15:17 9 Feb 2026, 00:08 7 Feb 2026, 21:05 7 Feb 2026, 18:03 7 Feb 2026, 03:43 6 Feb 2026, 21:06 6 Feb 2026, 00:05 5 Feb 2026, 21:06 5 Feb 2026, 18:13 5 Feb 2026, 03:46 5 Feb 2026, 00:07 4 Feb 2026, 21:07 4 Feb 2026, 18:11 4 Feb 2026, 03:45 4 Feb 2026, 00:06 3 Feb 2026, 21:08 3 Feb 2026, 18:14 3 Feb 2026, 09:10 3 Feb 2026, 03:46 1 Feb 2026, 21:03 1 Feb 2026, 18:02 31 Jan 2026, 03:42 31 Jan 2026, 00:06 30 Jan 2026, 18:07 30 Jan 2026, 00:06 29 Jan 2026, 21:03 28 Jan 2026, 15:06 28 Jan 2026, 03:30 28 Jan 2026, 00:05 27 Jan 2026, 21:01 27 Jan 2026, 18:03 27 Jan 2026, 06:02 26 Jan 2026, 21:03 25 Jan 2026, 03:34 24 Jan 2026, 03:29 23 Jan 2026, 21:01 23 Jan 2026, 18:02 23 Jan 2026, 00:05 22 Jan 2026, 21:03 22 Jan 2026, 15:05 22 Jan 2026, 03:31 22 Jan 2026, 00:05 21 Jan 2026, 21:05 21 Jan 2026, 06:02 21 Jan 2026, 03:30 21 Jan 2026, 00:05 20 Jan 2026, 21:03 20 Jan 2026, 18:03 20 Jan 2026, 15:05 20 Jan 2026, 03:30 19 Jan 2026, 21:01 19 Jan 2026, 00:05 16 Jan 2026, 21:01 16 Jan 2026, 18:02 16 Jan 2026, 15:02 16 Jan 2026, 00:05 14 Jan 2026, 06:02 14 Jan 2026, 00:05 12 Jan 2026, 21:02 12 Jan 2026, 18:02 12 Jan 2026, 00:05 11 Jan 2026, 18:02 11 Jan 2026, 03:31 11 Jan 2026, 00:06 10 Jan 2026, 21:01 10 Jan 2026, 03:29 10 Jan 2026, 00:04 9 Jan 2026, 21:01 9 Jan 2026, 00:04 8 Jan 2026, 21:02 8 Jan 2026, 06:02 8 Jan 2026, 03:29 8 Jan 2026, 00:05 7 Jan 2026, 21:01 7 Jan 2026, 18:02 7 Jan 2026, 09:05 7 Jan 2026, 06:02 7 Jan 2026, 03:30 7 Jan 2026, 00:04 6 Jan 2026, 21:01 6 Jan 2026, 03:29 6 Jan 2026, 00:05 3 Jan 2026, 18:02 27 Dec 2025, 06:02 27 Dec 2025, 03:28 23 Dec 2025, 18:02 20 Dec 2025, 00:04 19 Dec 2025, 21:01 19 Dec 2025, 18:02 19 Dec 2025, 00:05 18 Dec 2025, 21:01 18 Dec 2025, 18:02 18 Dec 2025, 15:02 17 Dec 2025, 15:02 17 Dec 2025, 03:27 16 Dec 2025, 21:01 16 Dec 2025, 18:02 16 Dec 2025, 00:05 15 Dec 2025, 21:01 15 Dec 2025, 18:02 13 Dec 2025, 06:02 12 Dec 2025, 21:01 12 Dec 2025, 00:05 11 Dec 2025, 21:02 11 Dec 2025, 18:01 11 Dec 2025, 06:02 10 Dec 2025, 09:03 9 Dec 2025, 18:01 9 Dec 2025, 06:02 9 Dec 2025, 03:25 8 Dec 2025, 21:01 8 Dec 2025, 06:02 8 Dec 2025, 00:05 6 Dec 2025, 18:02 5 Dec 2025, 00:04 4 Dec 2025, 21:02 4 Dec 2025, 18:02 4 Dec 2025, 06:02 4 Dec 2025, 03:26 3 Dec 2025, 00:04 2 Dec 2025, 21:01 2 Dec 2025, 00:04 1 Dec 2025, 03:31 27 Nov 2025, 06:02 27 Nov 2025, 03:20 26 Nov 2025, 00:04 25 Nov 2025, 03:22 24 Nov 2025, 21:01 21 Nov 2025, 00:04 20 Nov 2025, 18:02 20 Nov 2025, 06:02 20 Nov 2025, 03:20 19 Nov 2025, 03:21 19 Nov 2025, 00:05 18 Nov 2025, 18:02 18 Nov 2025, 09:02 18 Nov 2025, 03:21 17 Nov 2025, 03:24 17 Nov 2025, 00:04 16 Nov 2025, 00:04 14 Nov 2025, 21:26 6 Nov 2025, 18:02 6 Nov 2025, 15:02 6 Nov 2025, 12:02 6 Nov 2025, 06:01 6 Nov 2025, 03:22 4 Nov 2025, 18:02 4 Nov 2025, 03:19 4 Nov 2025, 00:04 3 Nov 2025, 21:01 3 Nov 2025, 12:03 3 Nov 2025, 09:02 3 Nov 2025, 06:02 3 Nov 2025, 03:24 3 Nov 2025, 00:04 2 Nov 2025, 18:01 2 Nov 2025, 12:02 2 Nov 2025, 09:01 1 Nov 2025, 21:01 31 Oct 2025, 00:04 30 Oct 2025, 18:02 29 Oct 2025, 21:02 28 Oct 2025, 18:02 27 Oct 2025, 18:02 24 Oct 2025, 21:01 23 Oct 2025, 21:02 23 Oct 2025, 09:02 23 Oct 2025, 06:02 23 Oct 2025, 00:04 21 Oct 2025, 00:04 20 Oct 2025, 21:02 20 Oct 2025, 15:12 20 Oct 2025, 00:05 17 Oct 2025, 18:01 17 Oct 2025, 12:03 16 Oct 2025, 18:02 16 Oct 2025, 00:05 15 Oct 2025, 18:02 13 Oct 2025, 21:01 12 Oct 2025, 18:01
27 Jan 2026, 06:02
12 May 2026, 14:59 12 May 2026, 01:59 12 May 2026, 00:01 11 May 2026, 23:00 11 May 2026, 21:57 11 May 2026, 20:02 11 May 2026, 18:59 11 May 2026, 18:00 11 May 2026, 15:00 10 May 2026, 23:03 10 May 2026, 17:00 10 May 2026, 04:02 9 May 2026, 04:57 9 May 2026, 04:01 9 May 2026, 03:01 8 May 2026, 22:00 8 May 2026, 19:00 8 May 2026, 18:00 8 May 2026, 16:57 8 May 2026, 07:02 8 May 2026, 06:02 8 May 2026, 03:01 8 May 2026, 02:03 8 May 2026, 01:02 8 May 2026, 00:02 7 May 2026, 22:59 7 May 2026, 21:57 7 May 2026, 17:08 5 May 2026, 23:00 5 May 2026, 21:00 5 May 2026, 17:00 5 May 2026, 15:59 5 May 2026, 14:57 5 May 2026, 00:02 4 May 2026, 22:58 4 May 2026, 22:01 4 May 2026, 18:58 4 May 2026, 15:35 4 May 2026, 06:55 4 May 2026, 04:18 2 May 2026, 18:14 2 May 2026, 04:05 2 May 2026, 00:19 1 May 2026, 18:19 1 May 2026, 04:22 1 May 2026, 00:20 29 Apr 2026, 21:21 29 Apr 2026, 15:36 29 Apr 2026, 09:39 29 Apr 2026, 04:11 29 Apr 2026, 00:20 28 Apr 2026, 21:21 28 Apr 2026, 18:28 28 Apr 2026, 15:45 28 Apr 2026, 06:49 27 Apr 2026, 21:20 27 Apr 2026, 18:23 26 Apr 2026, 04:08 25 Apr 2026, 21:10 24 Apr 2026, 18:11 24 Apr 2026, 06:34 24 Apr 2026, 00:17 23 Apr 2026, 18:19 23 Apr 2026, 04:04 23 Apr 2026, 00:17 22 Apr 2026, 21:15 22 Apr 2026, 04:00 22 Apr 2026, 00:13 21 Apr 2026, 21:14 21 Apr 2026, 09:30 21 Apr 2026, 04:01 20 Apr 2026, 21:14 20 Apr 2026, 18:16 18 Apr 2026, 18:09 18 Apr 2026, 00:13 17 Apr 2026, 21:13 17 Apr 2026, 18:14 17 Apr 2026, 00:15 16 Apr 2026, 21:13 16 Apr 2026, 18:21 16 Apr 2026, 15:30 16 Apr 2026, 04:02 16 Apr 2026, 00:16 15 Apr 2026, 18:20 15 Apr 2026, 15:24 15 Apr 2026, 09:29 15 Apr 2026, 04:00 14 Apr 2026, 21:14 14 Apr 2026, 18:21 14 Apr 2026, 06:32 14 Apr 2026, 04:00 14 Apr 2026, 00:16 13 Apr 2026, 21:14 13 Apr 2026, 18:21 11 Apr 2026, 00:11 10 Apr 2026, 21:09 10 Apr 2026, 18:13 10 Apr 2026, 06:32 10 Apr 2026, 00:12 9 Apr 2026, 21:14 9 Apr 2026, 18:17 9 Apr 2026, 15:29 9 Apr 2026, 03:55 9 Apr 2026, 00:09 8 Apr 2026, 21:13 8 Apr 2026, 18:21 8 Apr 2026, 15:27 8 Apr 2026, 00:12 7 Apr 2026, 21:14 4 Apr 2026, 18:05 4 Apr 2026, 03:46 4 Apr 2026, 00:09 3 Apr 2026, 21:07 3 Apr 2026, 18:08 3 Apr 2026, 03:54 3 Apr 2026, 00:11 2 Apr 2026, 21:08 2 Apr 2026, 18:12 2 Apr 2026, 09:19 2 Apr 2026, 06:21 2 Apr 2026, 03:53 1 Apr 2026, 21:12 1 Apr 2026, 18:13 1 Apr 2026, 04:00 1 Apr 2026, 00:11 31 Mar 2026, 21:09 31 Mar 2026, 06:24 31 Mar 2026, 03:56 31 Mar 2026, 00:11 30 Mar 2026, 21:13 30 Mar 2026, 18:15 28 Mar 2026, 18:04 28 Mar 2026, 15:06 27 Mar 2026, 21:09 27 Mar 2026, 18:14 27 Mar 2026, 15:15 27 Mar 2026, 06:21 27 Mar 2026, 03:56 27 Mar 2026, 00:10 26 Mar 2026, 21:07 26 Mar 2026, 18:16 26 Mar 2026, 15:25 26 Mar 2026, 06:21 26 Mar 2026, 03:55 26 Mar 2026, 00:10 25 Mar 2026, 21:08 25 Mar 2026, 18:15 25 Mar 2026, 06:18 25 Mar 2026, 03:47 25 Mar 2026, 00:08 24 Mar 2026, 18:15 24 Mar 2026, 00:07 23 Mar 2026, 21:08 23 Mar 2026, 18:13 23 Mar 2026, 00:09 22 Mar 2026, 18:04 22 Mar 2026, 00:07 21 Mar 2026, 18:03 21 Mar 2026, 00:07 20 Mar 2026, 21:05 20 Mar 2026, 18:08 20 Mar 2026, 15:13 20 Mar 2026, 03:45 20 Mar 2026, 00:08 19 Mar 2026, 06:17 19 Mar 2026, 00:08 18 Mar 2026, 18:16 18 Mar 2026, 12:11 18 Mar 2026, 09:15 18 Mar 2026, 03:50 18 Mar 2026, 00:09 17 Mar 2026, 21:10 17 Mar 2026, 18:15 17 Mar 2026, 03:46 17 Mar 2026, 00:08 16 Mar 2026, 21:10 16 Mar 2026, 18:15 14 Mar 2026, 03:44 14 Mar 2026, 00:08 13 Mar 2026, 21:07 13 Mar 2026, 18:07 13 Mar 2026, 06:12 12 Mar 2026, 21:07 12 Mar 2026, 18:12 12 Mar 2026, 00:07 11 Mar 2026, 03:43 11 Mar 2026, 00:05 10 Mar 2026, 03:43 10 Mar 2026, 00:05 9 Mar 2026, 21:06 7 Mar 2026, 03:37 7 Mar 2026, 00:07 6 Mar 2026, 06:10 6 Mar 2026, 03:44 6 Mar 2026, 00:12 5 Mar 2026, 06:12 5 Mar 2026, 03:45 5 Mar 2026, 00:07 4 Mar 2026, 21:06 4 Mar 2026, 18:09 4 Mar 2026, 09:09 1 Mar 2026, 06:10 1 Mar 2026, 03:49 28 Feb 2026, 21:01 28 Feb 2026, 00:05 27 Feb 2026, 21:05 27 Feb 2026, 18:07 27 Feb 2026, 09:11 27 Feb 2026, 06:13 27 Feb 2026, 00:08 26 Feb 2026, 21:08 26 Feb 2026, 18:12 26 Feb 2026, 09:14 26 Feb 2026, 06:17 26 Feb 2026, 00:07 25 Feb 2026, 03:47 25 Feb 2026, 00:09 24 Feb 2026, 21:08 24 Feb 2026, 18:15 23 Feb 2026, 21:13 21 Feb 2026, 18:03 21 Feb 2026, 06:08 20 Feb 2026, 21:03 20 Feb 2026, 06:14 20 Feb 2026, 00:07 19 Feb 2026, 21:06 19 Feb 2026, 03:48 19 Feb 2026, 00:08 18 Feb 2026, 03:48 17 Feb 2026, 21:08 17 Feb 2026, 00:08 16 Feb 2026, 21:05 14 Feb 2026, 03:44 13 Feb 2026, 21:09 12 Feb 2026, 00:06 11 Feb 2026, 21:10 11 Feb 2026, 00:11 10 Feb 2026, 21:13 10 Feb 2026, 03:56 10 Feb 2026, 00:11 9 Feb 2026, 15:17 9 Feb 2026, 00:08 7 Feb 2026, 21:05 7 Feb 2026, 18:03 7 Feb 2026, 03:43 6 Feb 2026, 21:06 6 Feb 2026, 00:05 5 Feb 2026, 21:06 5 Feb 2026, 18:13 5 Feb 2026, 03:46 5 Feb 2026, 00:07 4 Feb 2026, 21:07 4 Feb 2026, 18:11 4 Feb 2026, 03:45 4 Feb 2026, 00:06 3 Feb 2026, 21:08 3 Feb 2026, 18:14 3 Feb 2026, 09:10 3 Feb 2026, 03:46 1 Feb 2026, 21:03 1 Feb 2026, 18:02 31 Jan 2026, 03:42 31 Jan 2026, 00:06 30 Jan 2026, 18:07 30 Jan 2026, 00:06 29 Jan 2026, 21:03 28 Jan 2026, 15:06 28 Jan 2026, 03:30 28 Jan 2026, 00:05 27 Jan 2026, 21:01 27 Jan 2026, 18:03 27 Jan 2026, 06:02 26 Jan 2026, 21:03 25 Jan 2026, 03:34 24 Jan 2026, 03:29 23 Jan 2026, 21:01 23 Jan 2026, 18:02 23 Jan 2026, 00:05 22 Jan 2026, 21:03 22 Jan 2026, 15:05 22 Jan 2026, 03:31 22 Jan 2026, 00:05 21 Jan 2026, 21:05 21 Jan 2026, 06:02 21 Jan 2026, 03:30 21 Jan 2026, 00:05 20 Jan 2026, 21:03 20 Jan 2026, 18:03 20 Jan 2026, 15:05 20 Jan 2026, 03:30 19 Jan 2026, 21:01 19 Jan 2026, 00:05 16 Jan 2026, 21:01 16 Jan 2026, 18:02 16 Jan 2026, 15:02 16 Jan 2026, 00:05 14 Jan 2026, 06:02 14 Jan 2026, 00:05 12 Jan 2026, 21:02 12 Jan 2026, 18:02 12 Jan 2026, 00:05 11 Jan 2026, 18:02 11 Jan 2026, 03:31 11 Jan 2026, 00:06 10 Jan 2026, 21:01 10 Jan 2026, 03:29 10 Jan 2026, 00:04 9 Jan 2026, 21:01 9 Jan 2026, 00:04 8 Jan 2026, 21:02 8 Jan 2026, 06:02 8 Jan 2026, 03:29 8 Jan 2026, 00:05 7 Jan 2026, 21:01 7 Jan 2026, 18:02 7 Jan 2026, 09:05 7 Jan 2026, 06:02 7 Jan 2026, 03:30 7 Jan 2026, 00:04 6 Jan 2026, 21:01 6 Jan 2026, 03:29 6 Jan 2026, 00:05 3 Jan 2026, 18:02 27 Dec 2025, 06:02 27 Dec 2025, 03:28 23 Dec 2025, 18:02 20 Dec 2025, 00:04 19 Dec 2025, 21:01 19 Dec 2025, 18:02 19 Dec 2025, 00:05 18 Dec 2025, 21:01 18 Dec 2025, 18:02 18 Dec 2025, 15:02 17 Dec 2025, 15:02 17 Dec 2025, 03:27 16 Dec 2025, 21:01 16 Dec 2025, 18:02 16 Dec 2025, 00:05 15 Dec 2025, 21:01 15 Dec 2025, 18:02 13 Dec 2025, 06:02 12 Dec 2025, 21:01 12 Dec 2025, 00:05 11 Dec 2025, 21:02 11 Dec 2025, 18:01 11 Dec 2025, 06:02 10 Dec 2025, 09:03 9 Dec 2025, 18:01 9 Dec 2025, 06:02 9 Dec 2025, 03:25 8 Dec 2025, 21:01 8 Dec 2025, 06:02 8 Dec 2025, 00:05 6 Dec 2025, 18:02 5 Dec 2025, 00:04 4 Dec 2025, 21:02 4 Dec 2025, 18:02 4 Dec 2025, 06:02 4 Dec 2025, 03:26 3 Dec 2025, 00:04 2 Dec 2025, 21:01 2 Dec 2025, 00:04 1 Dec 2025, 03:31 27 Nov 2025, 06:02 27 Nov 2025, 03:20 26 Nov 2025, 00:04 25 Nov 2025, 03:22 24 Nov 2025, 21:01 21 Nov 2025, 00:04 20 Nov 2025, 18:02 20 Nov 2025, 06:02 20 Nov 2025, 03:20 19 Nov 2025, 03:21 19 Nov 2025, 00:05 18 Nov 2025, 18:02 18 Nov 2025, 09:02 18 Nov 2025, 03:21 17 Nov 2025, 03:24 17 Nov 2025, 00:04 16 Nov 2025, 00:04 14 Nov 2025, 21:26 6 Nov 2025, 18:02 6 Nov 2025, 15:02 6 Nov 2025, 12:02 6 Nov 2025, 06:01 6 Nov 2025, 03:22 4 Nov 2025, 18:02 4 Nov 2025, 03:19 4 Nov 2025, 00:04 3 Nov 2025, 21:01 3 Nov 2025, 12:03 3 Nov 2025, 09:02 3 Nov 2025, 06:02 3 Nov 2025, 03:24 3 Nov 2025, 00:04 2 Nov 2025, 18:01 2 Nov 2025, 12:02 2 Nov 2025, 09:01 1 Nov 2025, 21:01 31 Oct 2025, 00:04 30 Oct 2025, 18:02 29 Oct 2025, 21:02 28 Oct 2025, 18:02 27 Oct 2025, 18:02 24 Oct 2025, 21:01 23 Oct 2025, 21:02 23 Oct 2025, 09:02 23 Oct 2025, 06:02 23 Oct 2025, 00:04 21 Oct 2025, 00:04 20 Oct 2025, 21:02 20 Oct 2025, 15:12 20 Oct 2025, 00:05 17 Oct 2025, 18:01 17 Oct 2025, 12:03 16 Oct 2025, 18:02 16 Oct 2025, 00:05 15 Oct 2025, 18:02 13 Oct 2025, 21:01 12 Oct 2025, 18:01
Sat 3 18:02 Tue 6 00:05 Tue 6 03:29 Tue 6 21:01 Wed 7 00:04 Wed 7 03:30 Wed 7 06:02 Wed 7 09:05 Wed 7 18:02 Wed 7 21:01 Thu 8 00:05 Thu 8 03:29 Thu 8 06:02 Thu 8 21:02 Fri 9 00:04 Fri 9 21:01 Sat 10 00:04 Sat 10 03:29 Sat 10 21:01 Sun 11 00:06 Sun 11 03:31 Sun 11 18:02 Mon 12 00:05 Mon 12 18:02 Mon 12 21:02 Wed 14 00:05 Wed 14 06:02 Fri 16 00:05 Fri 16 15:02 Fri 16 18:02 Fri 16 21:01 Mon 19 00:05 Mon 19 21:01 Tue 20 03:30 Tue 20 15:05 Tue 20 18:03 Tue 20 21:03 Wed 21 00:05 Wed 21 03:30 Wed 21 06:02 Wed 21 21:05 Thu 22 00:05 Thu 22 03:31 Thu 22 15:05 Thu 22 21:03 Fri 23 00:05 Fri 23 18:02 Fri 23 21:01 Sat 24 03:29 Sun 25 03:34 Mon 26 21:03 Tue 27 06:02 Tue 27 18:03 Tue 27 21:01 Wed 28 00:05 Wed 28 03:30 Wed 28 15:06 Thu 29 21:03 Fri 30 00:06 Fri 30 18:07 Sat 31 00:06 Sat 31 03:42

amazon-bedrock.md +34 −12

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Claude Code on Amazon Bedrock5# Claude Code on Amazon Bedrock

2 6 

3> Learn about configuring Claude Code through Amazon Bedrock, including setup, IAM configuration, and troubleshooting.7> Learn about configuring Claude Code through Amazon Bedrock, including setup, IAM configuration, and troubleshooting.


7Before configuring Claude Code with Bedrock, ensure you have:11Before configuring Claude Code with Bedrock, ensure you have:

8 12 

9* An AWS account with Bedrock access enabled13* An AWS account with Bedrock access enabled

10* Access to desired Claude models (e.g., Claude Sonnet 4.5) in Bedrock14* Access to desired Claude models (for example, Claude Sonnet 4.5) in Bedrock

11* AWS CLI installed and configured (optional - only needed if you don't have another mechanism for getting credentials)15* AWS CLI installed and configured (optional - only needed if you don't have another mechanism for getting credentials)

12* Appropriate IAM permissions16* Appropriate IAM permissions

13 17 


48export AWS_PROFILE=your-profile-name52export AWS_PROFILE=your-profile-name

49```53```

50 54 

51**Option D: Bedrock API keys**55**Option D: AWS Management Console credentials**

56 

57```bash theme={null}

58aws login

59```

60 

61[Learn more](https://docs.aws.amazon.com/signin/latest/userguide/command-line-sign-in.html) about `aws login`.

62 

63**Option E: Bedrock API keys**

52 64 

53```bash theme={null}65```bash theme={null}

54export AWS_BEARER_TOKEN_BEDROCK=your-bedrock-api-key66export AWS_BEARER_TOKEN_BEDROCK=your-bedrock-api-key


75 87 

76##### Configuration settings explained88##### Configuration settings explained

77 89 

78**`awsAuthRefresh`**: Use this for commands that modify the `.aws` directory (e.g., updating credentials, SSO cache, or config files). Output is shown to the user (but user input is not supported), making it suitable for browser-based authentication flows where the CLI displays a code to enter in the browser.90**`awsAuthRefresh`**: Use this for commands that modify the `.aws` directory, such as updating credentials, SSO cache, or config files. The command's output is displayed to the user, but interactive input isn't supported. This works well for browser-based SSO flows where the CLI displays a URL or code and you complete authentication in the browser.

79 91 

80**`awsCredentialExport`**: Only use this if you cannot modify `.aws` and must directly return credentials. Output is captured silently (not shown to the user). The command must output JSON in this format:92**`awsCredentialExport`**: Only use this if you can't modify `.aws` and must directly return credentials. Output is captured silently and not shown to the user. The command must output JSON in this format:

81 93 

82```json theme={null}94```json theme={null}

83{95{


102export ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION=us-west-2114export ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION=us-west-2

103```115```

104 116 

105**For VS Code Extension users**: Configure environment variables in the VS Code extension settings instead of exporting them in your shell. See [Using Third-Party Providers in VS Code](/en/vs-code#using-third-party-providers-vertex-and-bedrock) for detailed instructions. All environment variables shown in this guide should work when configured through the VS Code extension settings.

106 

107When enabling Bedrock for Claude Code, keep the following in mind:117When enabling Bedrock for Claude Code, keep the following in mind:

108 118 

109* `AWS_REGION` is a required environment variable. Claude Code does not read from the `.aws` config file for this setting.119* `AWS_REGION` is a required environment variable. Claude Code does not read from the `.aws` config file for this setting.


120| Small/fast model | `us.anthropic.claude-haiku-4-5-20251001-v1:0` |130| Small/fast model | `us.anthropic.claude-haiku-4-5-20251001-v1:0` |

121 131 

122<Note>132<Note>

123 For Bedrock users, Claude Code will not automatically upgrade from Haiku 3.5 to Haiku 4.5. To manually switch to a newer Haiku model, set the `ANTHROPIC_DEFAULT_HAIKU_MODEL` environment variable to the full model name (e.g., `us.anthropic.claude-haiku-4-5-20251001-v1:0`).133 For Bedrock users, Claude Code won't automatically upgrade from Haiku 3.5 to Haiku 4.5. To manually switch to a newer Haiku model, set the `ANTHROPIC_DEFAULT_HAIKU_MODEL` environment variable to the full model name (for example, `us.anthropic.claude-haiku-4-5-20251001-v1:0`).

124</Note>134</Note>

125 135 

126To customize models, use one of these methods:136To customize models, use one of these methods:


137export DISABLE_PROMPT_CACHING=1147export DISABLE_PROMPT_CACHING=1

138```148```

139 149 

140<Note>150<Note>[Prompt caching](https://docs.claude.com/en/docs/build-with-claude/prompt-caching) may not be available in all regions.</Note>

141 [Prompt caching](https://docs.claude.com/en/docs/build-with-claude/prompt-caching) may not be available in all regions

142</Note>

143 151 

144### 5. Output token configuration152### 5. Output token configuration

145 153 

146When using Claude Code with Amazon Bedrock, we recommend the following token settings:154These are the recommended token settings for Claude Code with Amazon Bedrock:

147 155 

148```bash theme={null}156```bash theme={null}

149# Recommended output token settings for Bedrock157# Recommended output token settings for Bedrock


153 161 

154**Why these values:**162**Why these values:**

155 163 

156* **`CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096`**: Bedrock's burndown throttling logic sets a minimum of 4096 tokens as the max\_token penalty. Setting this lower won't reduce costs but may cut off long tool uses, causing the Claude Code agent loop to fail persistently. Claude Code typically uses less than 4096 output tokens without extended thinking, but may need this headroom for tasks involving significant file creation or Write tool usage.164* **`CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096`**: Bedrock's burndown throttling logic sets a minimum of 4096 tokens as the `max_token` penalty. Setting this lower won't reduce costs but may cut off long tool uses, causing the Claude Code agent loop to fail persistently. Claude Code typically uses less than 4096 output tokens without extended thinking, but may need this headroom for tasks involving significant file creation or Write tool usage.

157 165 

158* **`MAX_THINKING_TOKENS=1024`**: This provides space for extended thinking without cutting off tool use responses, while still maintaining focused reasoning chains. This balance helps prevent trajectory changes that aren't always helpful for coding tasks specifically.166* **`MAX_THINKING_TOKENS=1024`**: This provides space for extended thinking without cutting off tool use responses, while still maintaining focused reasoning chains. This balance helps prevent trajectory changes that aren't always helpful for coding tasks specifically.

159 167 


205 We recommend creating a dedicated AWS account for Claude Code to simplify cost tracking and access control.213 We recommend creating a dedicated AWS account for Claude Code to simplify cost tracking and access control.

206</Note>214</Note>

207 215 

216## AWS Guardrails

217 

218[Amazon Bedrock Guardrails](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html) let you implement content filtering for Claude Code. Create a Guardrail in the [Amazon Bedrock console](https://console.aws.amazon.com/bedrock/), publish a version, then add the Guardrail headers to your [settings file](/en/settings). Enable Cross-Region inference on your Guardrail if you're using cross-region inference profiles.

219 

220Example configuration:

221 

222```json theme={null}

223{

224 "env": {

225 "ANTHROPIC_CUSTOM_HEADERS": "X-Amzn-Bedrock-GuardrailIdentifier: your-guardrail-id\nX-Amzn-Bedrock-GuardrailVersion: 1"

226 }

227}

228```

229 

208## Troubleshooting230## Troubleshooting

209 231 

210If you encounter region issues:232If you encounter region issues:

analytics.md +4 −0

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Analytics5# Analytics

2 6 

3> View detailed usage insights and productivity metrics for your organization's Claude Code deployment.7> View detailed usage insights and productivity metrics for your organization's Claude Code deployment.

best-practices.md +597 −0 added

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

5# Best Practices for Claude Code

6 

7> Tips and patterns for getting the most out of Claude Code, from configuring your environment to scaling across parallel sessions.

8 

9Claude Code is an agentic coding environment. Unlike a chatbot that answers questions and waits, Claude Code can read your files, run commands, make changes, and autonomously work through problems while you watch, redirect, or step away entirely.

10 

11This changes how you work. Instead of writing code yourself and asking Claude to review it, you describe what you want and Claude figures out how to build it. Claude explores, plans, and implements.

12 

13But this autonomy still comes with a learning curve. Claude works within certain constraints you need to understand.

14 

15This guide covers patterns that have proven effective across Anthropic's internal teams and for engineers using Claude Code across various codebases, languages, and environments. For how the agentic loop works under the hood, see [How Claude Code works](/en/how-claude-code-works).

16 

17***

18 

19Most best practices are based on one constraint: Claude's context window fills up fast, and performance degrades as it fills.

20 

21Claude's context window holds your entire conversation, including every message, every file Claude reads, and every command output. However, this can fill up fast. A single debugging session or codebase exploration might generate and consume tens of thousands of tokens.

22 

23This matters since LLM performance degrades as context fills. When the context window is getting full, Claude may start "forgetting" earlier instructions or making more mistakes. The context window is the most important resource to manage. For detailed strategies on reducing token usage, see [Reduce token usage](/en/costs#reduce-token-usage).

24 

25***

26 

27## Give Claude a way to verify its work

28 

29<Tip>

30 Include tests, screenshots, or expected outputs so Claude can check itself. This is the single highest-leverage thing you can do.

31</Tip>

32 

33Claude performs dramatically better when it can verify its own work, like run tests, compare screenshots, and validate outputs.

34 

35Without clear success criteria, it might produce something that looks right but actually doesn't work. You become the only feedback loop, and every mistake requires your attention.

36 

37| Strategy | Before | After |

38| ------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

39| **Provide verification criteria** | *"implement a function that validates email addresses"* | *"write a validateEmail function. example test cases: [user@example.com](mailto:user@example.com) is true, invalid is false, [user@.com](mailto:user@.com) is false. run the tests after implementing"* |

40| **Verify UI changes visually** | *"make the dashboard look better"* | *"\[paste screenshot] implement this design. take a screenshot of the result and compare it to the original. list differences and fix them"* |

41| **Address root causes, not symptoms** | *"the build is failing"* | *"the build fails with this error: \[paste error]. fix it and verify the build succeeds. address the root cause, don't suppress the error"* |

42 

43UI changes can be verified using the [Claude in Chrome extension](/en/chrome). It opens a browser, tests the UI, and iterates until the code works.

44 

45Your verification can also be a test suite, a linter, or a Bash command that checks output. Invest in making your verification rock-solid.

46 

47***

48 

49## Explore first, then plan, then code

50 

51<Tip>

52 Separate research and planning from implementation to avoid solving the wrong problem.

53</Tip>

54 

55Letting Claude jump straight to coding can produce code that solves the wrong problem. Use [Plan Mode](/en/common-workflows#use-plan-mode-for-safe-code-analysis) to separate exploration from execution.

56 

57The recommended workflow has four phases:

58 

59<Steps>

60 <Step title="Explore">

61 Enter Plan Mode. Claude reads files and answers questions without making changes.

62 

63 ```txt claude (Plan Mode) theme={null}

64 read /src/auth and understand how we handle sessions and login.

65 also look at how we manage environment variables for secrets.

66 ```

67 </Step>

68 

69 <Step title="Plan">

70 Ask Claude to create a detailed implementation plan.

71 

72 ```txt claude (Plan Mode) theme={null}

73 I want to add Google OAuth. What files need to change?

74 What's the session flow? Create a plan.

75 ```

76 

77 Press `Ctrl+G` to open the plan in your text editor for direct editing before Claude proceeds.

78 </Step>

79 

80 <Step title="Implement">

81 Switch back to Normal Mode and let Claude code, verifying against its plan.

82 

83 ```txt claude (Normal Mode) theme={null}

84 implement the OAuth flow from your plan. write tests for the

85 callback handler, run the test suite and fix any failures.

86 ```

87 </Step>

88 

89 <Step title="Commit">

90 Ask Claude to commit with a descriptive message and create a PR.

91 

92 ```txt claude (Normal Mode) theme={null}

93 commit with a descriptive message and open a PR

94 ```

95 </Step>

96</Steps>

97 

98<Callout>

99 Plan Mode is useful, but also adds overhead.

100 

101 For tasks where the scope is clear and the fix is small (like fixing a typo, adding a log line, or renaming a variable) ask Claude to do it directly.

102 

103 Planning is most useful when you're uncertain about the approach, when the change modifies multiple files, or when you're unfamiliar with the code being modified. If you could describe the diff in one sentence, skip the plan.

104</Callout>

105 

106***

107 

108## Provide specific context in your prompts

109 

110<Tip>

111 The more precise your instructions, the fewer corrections you'll need.

112</Tip>

113 

114Claude can infer intent, but it can't read your mind. Reference specific files, mention constraints, and point to example patterns.

115 

116| Strategy | Before | After |

117| ------------------------------------------------------------------------------------------------ | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

118| **Scope the task.** Specify which file, what scenario, and testing preferences. | *"add tests for foo.py"* | *"write a test for foo.py covering the edge case where the user is logged out. avoid mocks."* |

119| **Point to sources.** Direct Claude to the source that can answer a question. | *"why does ExecutionFactory have such a weird api?"* | *"look through ExecutionFactory's git history and summarize how its api came to be"* |

120| **Reference existing patterns.** Point Claude to patterns in your codebase. | *"add a calendar widget"* | *"look at how existing widgets are implemented on the home page to understand the patterns. HotDogWidget.php is a good example. follow the pattern to implement a new calendar widget that lets the user select a month and paginate forwards/backwards to pick a year. build from scratch without libraries other than the ones already used in the codebase."* |

121| **Describe the symptom.** Provide the symptom, the likely location, and what "fixed" looks like. | *"fix the login bug"* | *"users report that login fails after session timeout. check the auth flow in src/auth/, especially token refresh. write a failing test that reproduces the issue, then fix it"* |

122 

123Vague prompts can be useful when you're exploring and can afford to course-correct. A prompt like `"what would you improve in this file?"` can surface things you wouldn't have thought to ask about.

124 

125### Provide rich content

126 

127<Tip>

128 Use `@` to reference files, paste screenshots/images, or pipe data directly.

129</Tip>

130 

131You can provide rich data to Claude in several ways:

132 

133* **Reference files with `@`** instead of describing where code lives. Claude reads the file before responding.

134* **Paste images directly**. Copy/paste or drag and drop images into the prompt.

135* **Give URLs** for documentation and API references. Use `/permissions` to allowlist frequently-used domains.

136* **Pipe in data** by running `cat error.log | claude` to send file contents directly.

137* **Let Claude fetch what it needs**. Tell Claude to pull context itself using Bash commands, MCP tools, or by reading files.

138 

139***

140 

141## Configure your environment

142 

143A few setup steps make Claude Code significantly more effective across all your sessions. For a full overview of extension features and when to use each one, see [Extend Claude Code](/en/features-overview).

144 

145### Write an effective CLAUDE.md

146 

147<Tip>

148 Run `/init` to generate a starter CLAUDE.md file based on your current project structure, then refine over time.

149</Tip>

150 

151CLAUDE.md is a special file that Claude reads at the start of every conversation. Include Bash commands, code style, and workflow rules. This gives Claude persistent context **it can't infer from code alone**.

152 

153The `/init` command analyzes your codebase to detect build systems, test frameworks, and code patterns, giving you a solid foundation to refine.

154 

155There's no required format for CLAUDE.md files, but keep it short and human-readable. For example:

156 

157```markdown CLAUDE.md theme={null}

158# Code style

159- Use ES modules (import/export) syntax, not CommonJS (require)

160- Destructure imports when possible (eg. import { foo } from 'bar')

161 

162# Workflow

163- Be sure to typecheck when you're done making a series of code changes

164- Prefer running single tests, and not the whole test suite, for performance

165```

166 

167CLAUDE.md is loaded every session, so only include things that apply broadly. For domain knowledge or workflows that are only relevant sometimes, use [skills](/en/skills) instead. Claude loads them on demand without bloating every conversation.

168 

169Keep it concise. For each line, ask: *"Would removing this cause Claude to make mistakes?"* If not, cut it. Bloated CLAUDE.md files cause Claude to ignore your actual instructions!

170 

171| ✅ Include | ❌ Exclude |

172| ---------------------------------------------------- | -------------------------------------------------- |

173| Bash commands Claude can't guess | Anything Claude can figure out by reading code |

174| Code style rules that differ from defaults | Standard language conventions Claude already knows |

175| Testing instructions and preferred test runners | Detailed API documentation (link to docs instead) |

176| Repository etiquette (branch naming, PR conventions) | Information that changes frequently |

177| Architectural decisions specific to your project | Long explanations or tutorials |

178| Developer environment quirks (required env vars) | File-by-file descriptions of the codebase |

179| Common gotchas or non-obvious behaviors | Self-evident practices like "write clean code" |

180 

181If Claude keeps doing something you don't want despite having a rule against it, the file is probably too long and the rule is getting lost. If Claude asks you questions that are answered in CLAUDE.md, the phrasing might be ambiguous. Treat CLAUDE.md like code: review it when things go wrong, prune it regularly, and test changes by observing whether Claude's behavior actually shifts.

182 

183You can tune instructions by adding emphasis (e.g., "IMPORTANT" or "YOU MUST") to improve adherence. Check CLAUDE.md into git so your team can contribute. The file compounds in value over time.

184 

185CLAUDE.md files can import additional files using `@path/to/import` syntax:

186 

187```markdown CLAUDE.md theme={null}

188See @README.md for project overview and @package.json for available npm commands.

189 

190# Additional Instructions

191- Git workflow: @docs/git-instructions.md

192- Personal overrides: @~/.claude/my-project-instructions.md

193```

194 

195You can place CLAUDE.md files in several locations:

196 

197* **Home folder (`~/.claude/CLAUDE.md`)**: Applies to all Claude sessions

198* **Project root (`./CLAUDE.md`)**: Check into git to share with your team, or name it `CLAUDE.local.md` and `.gitignore` it

199* **Parent directories**: Useful for monorepos where both `root/CLAUDE.md` and `root/foo/CLAUDE.md` are pulled in automatically

200* **Child directories**: Claude pulls in child CLAUDE.md files on demand when working with files in those directories

201 

202### Configure permissions

203 

204<Tip>

205 Use `/permissions` to allowlist safe commands or `/sandbox` for OS-level isolation. This reduces interruptions while keeping you in control.

206</Tip>

207 

208By default, Claude Code requests permission for actions that might modify your system: file writes, Bash commands, MCP tools, etc. This is safe but tedious. After the tenth approval you're not really reviewing anymore, you're just clicking through. There are two ways to reduce these interruptions:

209 

210* **Permission allowlists**: Permit specific tools you know are safe (like `npm run lint` or `git commit`)

211* **Sandboxing**: Enable OS-level isolation that restricts filesystem and network access, allowing Claude to work more freely within defined boundaries

212 

213Alternatively, use `--dangerously-skip-permissions` to bypass all permission checks for contained workflows like fixing lint errors or generating boilerplate.

214 

215<Warning>

216 Letting Claude run arbitrary commands can result in data loss, system corruption, or data exfiltration via prompt injection. Only use `--dangerously-skip-permissions` in a sandbox without internet access.

217</Warning>

218 

219Read more about [configuring permissions](/en/settings) and [enabling sandboxing](/en/sandboxing#sandboxing).

220 

221### Use CLI tools

222 

223<Tip>

224 Tell Claude Code to use CLI tools like `gh`, `aws`, `gcloud`, and `sentry-cli` when interacting with external services.

225</Tip>

226 

227CLI tools are the most context-efficient way to interact with external services. If you use GitHub, install the `gh` CLI. Claude knows how to use it for creating issues, opening pull requests, and reading comments. Without `gh`, Claude can still use the GitHub API, but unauthenticated requests often hit rate limits.

228 

229Claude is also effective at learning CLI tools it doesn't already know. Try prompts like `Use 'foo-cli-tool --help' to learn about foo tool, then use it to solve A, B, C.`

230 

231### Connect MCP servers

232 

233<Tip>

234 Run `claude mcp add` to connect external tools like Notion, Figma, or your database.

235</Tip>

236 

237With [MCP servers](/en/mcp), you can ask Claude to implement features from issue trackers, query databases, analyze monitoring data, integrate designs from Figma, and automate workflows.

238 

239### Set up hooks

240 

241<Tip>

242 Use hooks for actions that must happen every time with zero exceptions.

243</Tip>

244 

245[Hooks](/en/hooks-guide) run scripts automatically at specific points in Claude's workflow. Unlike CLAUDE.md instructions which are advisory, hooks are deterministic and guarantee the action happens.

246 

247Claude can write hooks for you. Try prompts like *"Write a hook that runs eslint after every file edit"* or *"Write a hook that blocks writes to the migrations folder."* Run `/hooks` for interactive configuration, or edit `.claude/settings.json` directly.

248 

249### Create skills

250 

251<Tip>

252 Create `SKILL.md` files in `.claude/skills/` to give Claude domain knowledge and reusable workflows.

253</Tip>

254 

255[Skills](/en/skills) extend Claude's knowledge with information specific to your project, team, or domain. Claude applies them automatically when relevant, or you can invoke them directly with `/skill-name`.

256 

257Create a skill by adding a directory with a `SKILL.md` to `.claude/skills/`:

258 

259```markdown .claude/skills/api-conventions/SKILL.md theme={null}

260---

261name: api-conventions

262description: REST API design conventions for our services

263---

264# API Conventions

265- Use kebab-case for URL paths

266- Use camelCase for JSON properties

267- Always include pagination for list endpoints

268- Version APIs in the URL path (/v1/, /v2/)

269```

270 

271Skills can also define repeatable workflows you invoke directly:

272 

273```markdown .claude/skills/fix-issue/SKILL.md theme={null}

274---

275name: fix-issue

276description: Fix a GitHub issue

277disable-model-invocation: true

278---

279Analyze and fix the GitHub issue: $ARGUMENTS.

280 

2811. Use `gh issue view` to get the issue details

2822. Understand the problem described in the issue

2833. Search the codebase for relevant files

2844. Implement the necessary changes to fix the issue

2855. Write and run tests to verify the fix

2866. Ensure code passes linting and type checking

2877. Create a descriptive commit message

2888. Push and create a PR

289```

290 

291Run `/fix-issue 1234` to invoke it. Use `disable-model-invocation: true` for workflows with side effects that you want to trigger manually.

292 

293### Create custom subagents

294 

295<Tip>

296 Define specialized assistants in `.claude/agents/` that Claude can delegate to for isolated tasks.

297</Tip>

298 

299[Subagents](/en/sub-agents) run in their own context with their own set of allowed tools. They're useful for tasks that read many files or need specialized focus without cluttering your main conversation.

300 

301```markdown .claude/agents/security-reviewer.md theme={null}

302---

303name: security-reviewer

304description: Reviews code for security vulnerabilities

305tools: Read, Grep, Glob, Bash

306model: opus

307---

308You are a senior security engineer. Review code for:

309- Injection vulnerabilities (SQL, XSS, command injection)

310- Authentication and authorization flaws

311- Secrets or credentials in code

312- Insecure data handling

313 

314Provide specific line references and suggested fixes.

315```

316 

317Tell Claude to use subagents explicitly: *"Use a subagent to review this code for security issues."*

318 

319### Install plugins

320 

321<Tip>

322 Run `/plugin` to browse the marketplace. Plugins add skills, tools, and integrations without configuration.

323</Tip>

324 

325[Plugins](/en/plugins) bundle skills, hooks, subagents, and MCP servers into a single installable unit from the community and Anthropic. If you work with a typed language, install a [code intelligence plugin](/en/discover-plugins#code-intelligence) to give Claude precise symbol navigation and automatic error detection after edits.

326 

327For guidance on choosing between skills, subagents, hooks, and MCP, see [Extend Claude Code](/en/features-overview#match-features-to-your-goal).

328 

329***

330 

331## Communicate effectively

332 

333The way you communicate with Claude Code significantly impacts the quality of results.

334 

335### Ask codebase questions

336 

337<Tip>

338 Ask Claude questions you'd ask a senior engineer.

339</Tip>

340 

341When onboarding to a new codebase, use Claude Code for learning and exploration. You can ask Claude the same sorts of questions you would ask another engineer:

342 

343* How does logging work?

344* How do I make a new API endpoint?

345* What does `async move { ... }` do on line 134 of `foo.rs`?

346* What edge cases does `CustomerOnboardingFlowImpl` handle?

347* Why does this code call `foo()` instead of `bar()` on line 333?

348 

349Using Claude Code this way is an effective onboarding workflow, improving ramp-up time and reducing load on other engineers. No special prompting required: ask questions directly.

350 

351### Let Claude interview you

352 

353<Tip>

354 For larger features, have Claude interview you first. Start with a minimal prompt and ask Claude to interview you using the `AskUserQuestion` tool.

355</Tip>

356 

357Claude asks about things you might not have considered yet, including technical implementation, UI/UX, edge cases, and tradeoffs.

358 

359```

360I want to build [brief description]. Interview me in detail using the AskUserQuestion tool.

361 

362Ask about technical implementation, UI/UX, edge cases, concerns, and tradeoffs. Don't ask obvious questions, dig into the hard parts I might not have considered.

363 

364Keep interviewing until we've covered everything, then write a complete spec to SPEC.md.

365```

366 

367Once the spec is complete, start a fresh session to execute it. The new session has clean context focused entirely on implementation, and you have a written spec to reference.

368 

369***

370 

371## Manage your session

372 

373Conversations are persistent and reversible. Use this to your advantage!

374 

375### Course-correct early and often

376 

377<Tip>

378 Correct Claude as soon as you notice it going off track.

379</Tip>

380 

381The best results come from tight feedback loops. Though Claude occasionally solves problems perfectly on the first attempt, correcting it quickly generally produces better solutions faster.

382 

383* **`Esc`**: Stop Claude mid-action with the `Esc` key. Context is preserved, so you can redirect.

384* **`Esc + Esc` or `/rewind`**: Press `Esc` twice or run `/rewind` to open the rewind menu and restore previous conversation and code state.

385* **`"Undo that"`**: Have Claude revert its changes.

386* **`/clear`**: Reset context between unrelated tasks. Long sessions with irrelevant context can reduce performance.

387 

388If you've corrected Claude more than twice on the same issue in one session, the context is cluttered with failed approaches. Run `/clear` and start fresh with a more specific prompt that incorporates what you learned. A clean session with a better prompt almost always outperforms a long session with accumulated corrections.

389 

390### Manage context aggressively

391 

392<Tip>

393 Run `/clear` between unrelated tasks to reset context.

394</Tip>

395 

396Claude Code automatically compacts conversation history when you approach context limits, which preserves important code and decisions while freeing space.

397 

398During long sessions, Claude's context window can fill with irrelevant conversation, file contents, and commands. This can reduce performance and sometimes distract Claude.

399 

400* Use `/clear` frequently between tasks to reset the context window entirely

401* When auto compaction triggers, Claude summarizes what matters most, including code patterns, file states, and key decisions

402* For more control, run `/compact <instructions>`, like `/compact Focus on the API changes`

403* Customize compaction behavior in CLAUDE.md with instructions like `"When compacting, always preserve the full list of modified files and any test commands"` to ensure critical context survives summarization

404 

405### Use subagents for investigation

406 

407<Tip>

408 Delegate research with `"use subagents to investigate X"`. They explore in a separate context, keeping your main conversation clean for implementation.

409</Tip>

410 

411Since context is your fundamental constraint, subagents are one of the most powerful tools available. When Claude researches a codebase it reads lots of files, all of which consume your context. Subagents run in separate context windows and report back summaries:

412 

413```

414Use subagents to investigate how our authentication system handles token

415refresh, and whether we have any existing OAuth utilities I should reuse.

416```

417 

418The subagent explores the codebase, reads relevant files, and reports back with findings, all without cluttering your main conversation.

419 

420You can also use subagents for verification after Claude implements something:

421 

422```

423use a subagent to review this code for edge cases

424```

425 

426### Rewind with checkpoints

427 

428<Tip>

429 Every action Claude makes creates a checkpoint. You can restore conversation, code, or both to any previous checkpoint.

430</Tip>

431 

432Claude automatically checkpoints before changes. Double-tap `Escape` or run `/rewind` to open the checkpoint menu. You can restore conversation only (keep code changes), restore code only (keep conversation), or restore both.

433 

434Instead of carefully planning every move, you can tell Claude to try something risky. If it doesn't work, rewind and try a different approach. Checkpoints persist across sessions, so you can close your terminal and still rewind later.

435 

436<Warning>

437 Checkpoints only track changes made *by Claude*, not external processes. This isn't a replacement for git.

438</Warning>

439 

440### Resume conversations

441 

442<Tip>

443 Run `claude --continue` to pick up where you left off, or `--resume` to choose from recent sessions.

444</Tip>

445 

446Claude Code saves conversations locally. When a task spans multiple sessions (you start a feature, get interrupted, come back the next day) you don't have to re-explain the context:

447 

448```bash theme={null}

449claude --continue # Resume the most recent conversation

450claude --resume # Select from recent conversations

451```

452 

453Use `/rename` to give sessions descriptive names (`"oauth-migration"`, `"debugging-memory-leak"`) so you can find them later. Treat sessions like branches. Different workstreams can have separate, persistent contexts.

454 

455***

456 

457## Automate and scale

458 

459Once you're effective with one Claude, multiply your output with parallel sessions, headless mode, and fan-out patterns.

460 

461Everything so far assumes one human, one Claude, and one conversation. But Claude Code scales horizontally. The techniques in this section show how you can get more done.

462 

463### Run headless mode

464 

465<Tip>

466 Use `claude -p "prompt"` in CI, pre-commit hooks, or scripts. Add `--output-format stream-json` for streaming JSON output.

467</Tip>

468 

469With `claude -p "your prompt"`, you can run Claude headlessly, without an interactive session. Headless mode is how you integrate Claude into CI pipelines, pre-commit hooks, or any automated workflow. The output formats (plain text, JSON, streaming JSON) let you parse results programmatically.

470 

471```bash theme={null}

472# One-off queries

473claude -p "Explain what this project does"

474 

475# Structured output for scripts

476claude -p "List all API endpoints" --output-format json

477 

478# Streaming for real-time processing

479claude -p "Analyze this log file" --output-format stream-json

480```

481 

482### Run multiple Claude sessions

483 

484<Tip>

485 Run multiple Claude sessions in parallel to speed up development, run isolated experiments, or start complex workflows.

486</Tip>

487 

488There are two main ways to run parallel sessions:

489 

490* [Claude Desktop](/en/desktop): Manage multiple local sessions visually. Each session gets its own isolated worktree.

491* [Claude Code on the web](/en/claude-code-on-the-web): Run on Anthropic's secure cloud infrastructure in isolated VMs.

492 

493Beyond parallelizing work, multiple sessions enable quality-focused workflows. A fresh context improves code review since Claude won't be biased toward code it just wrote.

494 

495For example, use a Writer/Reviewer pattern:

496 

497| Session A (Writer) | Session B (Reviewer) |

498| ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

499| `Implement a rate limiter for our API endpoints` | |

500| | `Review the rate limiter implementation in @src/middleware/rateLimiter.ts. Look for edge cases, race conditions, and consistency with our existing middleware patterns.` |

501| `Here's the review feedback: [Session B output]. Address these issues.` | |

502 

503You can do something similar with tests: have one Claude write tests, then another write code to pass them.

504 

505### Fan out across files

506 

507<Tip>

508 Loop through tasks calling `claude -p` for each. Use `--allowedTools` to scope permissions for batch operations.

509</Tip>

510 

511For large migrations or analyses, you can distribute work across many parallel Claude invocations:

512 

513<Steps>

514 <Step title="Generate a task list">

515 Have Claude list all files that need migrating (e.g., `list all 2,000 Python files that need migrating`)

516 </Step>

517 

518 <Step title="Write a script to loop through the list">

519 ```bash theme={null}

520 for file in $(cat files.txt); do

521 claude -p "Migrate $file from React to Vue. Return OK or FAIL." \

522 --allowedTools "Edit,Bash(git commit:*)"

523 done

524 ```

525 </Step>

526 

527 <Step title="Test on a few files, then run at scale">

528 Refine your prompt based on what goes wrong with the first 2-3 files, then run on the full set. The `--allowedTools` flag restricts what Claude can do, which matters when you're running unattended.

529 </Step>

530</Steps>

531 

532You can also integrate Claude into existing data/processing pipelines:

533 

534```bash theme={null}

535claude -p "<your prompt>" --output-format json | your_command

536```

537 

538Use `--verbose` for debugging during development, and turn it off in production.

539 

540### Safe Autonomous Mode

541 

542Use `claude --dangerously-skip-permissions` to bypass all permission checks and let Claude work uninterrupted. This works well for workflows like fixing lint errors or generating boilerplate code.

543 

544<Warning>

545 Letting Claude run arbitrary commands is risky and can result in data loss, system corruption, or data exfiltration (e.g., via prompt injection attacks). To minimize these risks, use `--dangerously-skip-permissions` in a container without internet access.

546 

547 With sandboxing enabled (`/sandbox`), you get similar autonomy with better security. Sandbox defines upfront boundaries rather than bypassing all checks.

548</Warning>

549 

550***

551 

552## Avoid common failure patterns

553 

554These are common mistakes. Recognizing them early saves time:

555 

556* **The kitchen sink session.** You start with one task, then ask Claude something unrelated, then go back to the first task. Context is full of irrelevant information.

557 > **Fix**: `/clear` between unrelated tasks.

558* **Correcting over and over.** Claude does something wrong, you correct it, it's still wrong, you correct again. Context is polluted with failed approaches.

559 > **Fix**: After two failed corrections, `/clear` and write a better initial prompt incorporating what you learned.

560* **The over-specified CLAUDE.md.** If your CLAUDE.md is too long, Claude ignores half of it because important rules get lost in the noise.

561 > **Fix**: Ruthlessly prune. If Claude already does something correctly without the instruction, delete it or convert it to a hook.

562* **The trust-then-verify gap.** Claude produces a plausible-looking implementation that doesn't handle edge cases.

563 > **Fix**: Always provide verification (tests, scripts, screenshots). If you can't verify it, don't ship it.

564* **The infinite exploration.** You ask Claude to "investigate" something without scoping it. Claude reads hundreds of files, filling the context.

565 > **Fix**: Scope investigations narrowly or use subagents so the exploration doesn't consume your main context.

566 

567***

568 

569## Develop your intuition

570 

571The patterns in this guide aren't set in stone. They're starting points that work well in general, but might not be optimal for every situation.

572 

573Sometimes you *should* let context accumulate because you're deep in one complex problem and the history is valuable. Sometimes you should skip planning and let Claude figure it out because the task is exploratory. Sometimes a vague prompt is exactly right because you want to see how Claude interprets the problem before constraining it.

574 

575Pay attention to what works. When Claude produces great output, notice what you did: the prompt structure, the context you provided, the mode you were in. When Claude struggles, ask why. Was the context too noisy? The prompt too vague? The task too big for one pass?

576 

577Over time, you'll develop intuition that no guide can capture. You'll know when to be specific and when to be open-ended, when to plan and when to explore, when to clear context and when to let it accumulate.

578 

579## Related resources

580 

581<CardGroup cols={2}>

582 <Card title="How Claude Code works" icon="gear" href="/en/how-claude-code-works">

583 Understand the agentic loop, tools, and context management

584 </Card>

585 

586 <Card title="Extend Claude Code" icon="puzzle-piece" href="/en/features-overview">

587 Choose between skills, hooks, MCP, subagents, and plugins

588 </Card>

589 

590 <Card title="Common workflows" icon="list-check" href="/en/common-workflows">

591 Step-by-step recipes for debugging, testing, PRs, and more

592 </Card>

593 

594 <Card title="CLAUDE.md" icon="file-lines" href="/en/memory">

595 Store project conventions and persistent context

596 </Card>

597</CardGroup>

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Checkpointing5# Checkpointing

2 6 

3> Automatically track and rewind Claude's edits to quickly recover from unwanted changes.7> Automatically track and rewind Claude's edits to quickly recover from unwanted changes.


61## See also65## See also

62 66 

63* [Interactive mode](/en/interactive-mode) - Keyboard shortcuts and session controls67* [Interactive mode](/en/interactive-mode) - Keyboard shortcuts and session controls

64* [Slash commands](/en/slash-commands) - Accessing checkpoints using `/rewind`68* [Built-in commands](/en/interactive-mode#built-in-commands) - Accessing checkpoints using `/rewind`

65* [CLI reference](/en/cli-reference) - Command-line options69* [CLI reference](/en/cli-reference) - Command-line options

chrome.md +219 −0 added

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

5# Use Claude Code with Chrome (beta)

6 

7> Connect Claude Code to your browser to test web apps, debug with console logs, and automate browser tasks.

8 

9<Note>

10 Chrome integration is in beta and currently works with Google Chrome only. It is not yet supported on Brave, Arc, or other Chromium-based browsers. WSL (Windows Subsystem for Linux) is also not supported.

11</Note>

12 

13Claude Code integrates with the Claude in Chrome browser extension to give you browser automation capabilities directly from your terminal. Build in your terminal, then test and debug in your browser without switching contexts.

14 

15## What the integration enables

16 

17With Chrome connected, you can chain browser actions with terminal commands in a single workflow. For example: scrape documentation from a website, analyze it, generate code based on what you learned, and commit the result.

18 

19Key capabilities include:

20 

21* **Live debugging**: Claude reads console errors and DOM state directly, then fixes the code that caused them

22* **Design verification**: Build a UI from a Figma mock, then have Claude open it in the browser and verify it matches

23* **Web app testing**: Test form validation, check for visual regressions, or verify user flows work correctly

24* **Authenticated web apps**: Interact with Google Docs, Gmail, Notion, or any app you're logged into without needing API connectors

25* **Data extraction**: Pull structured information from web pages and save it locally

26* **Task automation**: Automate repetitive browser tasks like data entry, form filling, or multi-site workflows

27* **Session recording**: Record browser interactions as GIFs to document or share what happened

28 

29## Prerequisites

30 

31Before using Claude Code with Chrome, you need:

32 

33* [Google Chrome](https://www.google.com/chrome/) browser

34* [Claude in Chrome extension](https://chromewebstore.google.com/detail/claude/fcoeoabgfenejglbffodgkkbkcdhcgfn) version 1.0.36 or higher

35* [Claude Code CLI](/en/quickstart#step-1-install-claude-code) version 2.0.73 or higher

36* A paid Claude plan (Pro, Team, or Enterprise)

37 

38## How the integration works

39 

40Claude Code communicates with Chrome through the Claude in Chrome browser extension. The extension uses Chrome's [Native Messaging API](https://developer.chrome.com/docs/extensions/develop/concepts/native-messaging) to receive commands from Claude Code and execute them in your browser. This architecture lets Claude Code control browser tabs, read page content, and perform actions while you continue working in your terminal.

41 

42When Claude encounters a login page, CAPTCHA, or other blocker, it pauses and asks you to handle it. You can provide credentials for Claude to enter, or log in manually in the browser. Once you're past the blocker, tell Claude to continue and it picks up where it left off.

43 

44Claude opens new tabs for browser tasks rather than taking over existing ones. However, it shares your browser's login state, so if you're already signed into a site in Chrome, Claude can access it without re-authenticating.

45 

46<Note>

47 The Chrome integration requires a visible browser window. When Claude performs browser actions, you'll see Chrome open and navigate in real time. There's no headless mode since the integration relies on your actual browser session with its login state.

48</Note>

49 

50## Set up the integration

51 

52<Steps>

53 <Step title="Update Claude Code">

54 Chrome integration requires a recent version of Claude Code. If you installed using the [native installer](/en/quickstart#step-1-install-claude-code), updates happen automatically. Otherwise, run:

55 

56 ```bash theme={null}

57 claude update

58 ```

59 </Step>

60 

61 <Step title="Start Claude Code with Chrome enabled">

62 Launch Claude Code with the `--chrome` flag:

63 

64 ```bash theme={null}

65 claude --chrome

66 ```

67 </Step>

68 

69 <Step title="Verify the connection">

70 Run `/chrome` to check the connection status and manage settings. If the extension isn't detected, you'll see a warning with a link to install it.

71 </Step>

72</Steps>

73 

74You can also enable Chrome integration from within an existing session using the `/chrome` command.

75 

76## Try it out

77 

78Once connected, type this into Claude to see the integration in action:

79 

80```

81Go to code.claude.com/docs, click on the search box,

82type "hooks", and tell me what results appear

83```

84 

85Claude opens the page, clicks into the search field, types the query, and reports the autocomplete results. This shows navigation, clicking, and typing in a single workflow.

86 

87## Example workflows

88 

89Claude can navigate pages, click and type, fill forms, scroll, read console logs and network requests, manage tabs, resize windows, and record GIFs. Run `/mcp` and click into `claude-in-chrome` to see the full list of available tools.

90 

91The following examples show common patterns for browser automation.

92 

93### Test a local web application

94 

95When developing a web app, ask Claude to verify your changes work correctly:

96 

97```

98I just updated the login form validation. Can you open localhost:3000,

99try submitting the form with invalid data, and check if the error

100messages appear correctly?

101```

102 

103Claude navigates to your local server, interacts with the form, and reports what it observes.

104 

105### Debug with console logs

106 

107If your app has issues, Claude can read console output to help diagnose problems:

108 

109```

110Open the dashboard page and check the console for any errors when

111the page loads.

112```

113 

114Claude reads the console messages and can filter for specific patterns or error types.

115 

116### Automate form filling

117 

118Speed up repetitive data entry tasks:

119 

120```

121I have a spreadsheet of customer contacts in contacts.csv. For each row,

122go to our CRM at crm.example.com, click "Add Contact", and fill in the

123name, email, and phone fields.

124```

125 

126Claude reads your local file, navigates the web interface, and enters the data for each record.

127 

128### Draft content in Google Docs

129 

130Use Claude to write directly in your documents without API setup:

131 

132```

133Draft a project update based on our recent commits and add it to my

134Google Doc at docs.google.com/document/d/abc123

135```

136 

137Claude opens the document, clicks into the editor, and types the content. This works with any web app you're logged into: Gmail, Notion, Sheets, and more.

138 

139### Extract data from web pages

140 

141Pull structured information from websites:

142 

143```

144Go to the product listings page and extract the name, price, and

145availability for each item. Save the results as a CSV file.

146```

147 

148Claude navigates to the page, reads the content, and compiles the data into a structured format.

149 

150### Run multi-site workflows

151 

152Coordinate tasks across multiple websites:

153 

154```

155Check my calendar for meetings tomorrow, then for each meeting with

156an external attendee, look up their company on LinkedIn and add a

157note about what they do.

158```

159 

160Claude works across tabs to gather information and complete the workflow.

161 

162### Record a demo GIF

163 

164Create shareable recordings of browser interactions:

165 

166```

167Record a GIF showing how to complete the checkout flow, from adding

168an item to the cart through to the confirmation page.

169```

170 

171Claude records the interaction sequence and saves it as a GIF file.

172 

173## Best practices

174 

175When using browser automation, keep these guidelines in mind:

176 

177* **Modal dialogs can interrupt the flow**: JavaScript alerts, confirms, and prompts block browser events and prevent Claude from receiving commands. If a dialog appears, dismiss it manually and tell Claude to continue.

178* **Use fresh tabs**: Claude creates new tabs for each session. If a tab becomes unresponsive, ask Claude to create a new one.

179* **Filter console output**: Console logs can be verbose. When debugging, tell Claude what patterns to look for rather than asking for all console output.

180 

181## Troubleshooting

182 

183### Extension not detected

184 

185If Claude Code shows "Chrome extension not detected":

186 

1871. Verify the Chrome extension (version 1.0.36 or higher) is installed

1882. Verify Claude Code is version 2.0.73 or higher by running `claude --version`

1893. Check that Chrome is running

1904. Run `/chrome` and select "Reconnect extension" to re-establish the connection

1915. If the issue persists, restart both Claude Code and Chrome

192 

193### Browser not responding

194 

195If Claude's browser commands stop working:

196 

1971. Check if a modal dialog (alert, confirm, prompt) is blocking the page

1982. Ask Claude to create a new tab and try again

1993. Restart the Chrome extension by disabling and re-enabling it

200 

201### First-time setup

202 

203The first time you use the integration, Claude Code installs a native messaging host that allows communication between the CLI and Chrome. If you encounter permission errors, you may need to restart Chrome for the installation to take effect.

204 

205## Enable by default

206 

207Chrome integration requires the `--chrome` flag each time you start Claude Code. To enable it by default, run `/chrome` and select "Enabled by default".

208 

209<Note>

210 Enabling Chrome by default increases context usage since browser tools are always loaded. If you notice increased context consumption, disable this setting and use `--chrome` only when needed.

211</Note>

212 

213Site-level permissions are inherited from the Chrome extension. Manage permissions in the Chrome extension settings to control which sites Claude can browse, click, and type on. Run `/chrome` to see current permission settings.

214 

215## See also

216 

217* [CLI reference](/en/cli-reference) - Command-line flags including `--chrome`

218* [Common workflows](/en/common-workflows) - More ways to use Claude Code

219* [Getting started with Claude for Chrome](https://support.anthropic.com/en/articles/12012173-getting-started-with-claude-for-chrome) - Full documentation for the Chrome extension, including shortcuts, scheduling, and permissions

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Claude Code on the web5# Claude Code on the web

2 6 

3> Run Claude Code tasks asynchronously on secure cloud infrastructure7> Run Claude Code tasks asynchronously on secure cloud infrastructure


11Claude Code on the web lets developers kick off Claude Code from the Claude app. This is perfect for:15Claude Code on the web lets developers kick off Claude Code from the Claude app. This is perfect for:

12 16 

13* **Answering questions**: Ask about code architecture and how features are implemented17* **Answering questions**: Ask about code architecture and how features are implemented

14* **Bugfixes and routine tasks**: Well-defined tasks that don't require frequent steering18* **Bug fixes and routine tasks**: Well-defined tasks that don't require frequent steering

15* **Parallel work**: Tackle multiple bug fixes in parallel19* **Parallel work**: Tackle multiple bug fixes in parallel

16* **Repositories not on your local machine**: Work on code you don't have checked out locally20* **Repositories not on your local machine**: Work on code you don't have checked out locally

17* **Backend changes**: Where Claude Code can write tests and then write code to pass those tests21* **Backend changes**: Where Claude Code can write tests and then write code to pass those tests

18 22 

19Claude Code is also available on the Claude iOS app. This is perfect for:23Claude Code is also available on the Claude iOS app for kicking off tasks on the go and monitoring work in progress.

20 

21* **On the go**: Kick off tasks while commuting or away from laptop

22* **Monitoring**: Watch the trajectory and steer the agent's work

23 24 

24Developers can also move Claude Code sessions from the Claude app to their terminal to continue tasks locally.25You can move between local and remote development: [send tasks from your terminal to run on the web](#from-terminal-to-web) with the `&` prefix, or [teleport web sessions back to your terminal](#from-web-to-terminal) to continue locally.

25 26 

26## Who can use Claude Code on the web?27## Who can use Claude Code on the web?

27 28 


393. Install the Claude GitHub app in your repositories403. Install the Claude GitHub app in your repositories

404. Select your default environment414. Select your default environment

415. Submit your coding task425. Submit your coding task

426. Review changes and create a pull request in GitHub436. Review changes in diff view, iterate with comments, then create a pull request

43 44 

44## How it works45## How it works

45 46 


525. **Completion**: You're notified when finished and can create a PR with the changes535. **Completion**: You're notified when finished and can create a PR with the changes

536. **Results**: Changes are pushed to a branch, ready for pull request creation546. **Results**: Changes are pushed to a branch, ready for pull request creation

54 55 

56## Review changes with diff view

57 

58Diff view lets you see exactly what Claude changed before creating a pull request. Instead of clicking "Create PR" to review changes in GitHub, view the diff directly in the app and iterate with Claude until the changes are ready.

59 

60When Claude makes changes to files, a diff stats indicator appears showing the number of lines added and removed (for example, `+12 -1`). Select this indicator to open the diff viewer, which displays a file list on the left and the changes for each file on the right.

61 

62From the diff view, you can:

63 

64* Review changes file by file

65* Comment on specific changes to request modifications

66* Continue iterating with Claude based on what you see

67 

68This lets you refine changes through multiple rounds of feedback without creating draft PRs or switching to GitHub.

69 

55## Moving tasks between web and terminal70## Moving tasks between web and terminal

56 71 

72You can start tasks on the web and continue them in your terminal, or send tasks from your terminal to run on the web. Web sessions persist even if you close your laptop, and you can monitor them from anywhere including the Claude iOS app.

73 

74<Note>

75 Session handoff is one-way: you can pull web sessions into your terminal, but you can't push an existing terminal session to the web. The [`&` prefix](#from-terminal-to-web) creates a *new* web session with your current conversation context.

76</Note>

77 

78### From terminal to web

79 

80Start a message with `&` inside Claude Code to send a task to run on the web:

81 

82```

83& Fix the authentication bug in src/auth/login.ts

84```

85 

86This creates a new web session on claude.ai with your current conversation context. The task runs in the cloud while you continue working locally. Use `/tasks` to check progress, or open the session on claude.ai or the Claude iOS app to interact directly. From there you can steer Claude, provide feedback, or answer questions just like any other conversation.

87 

88You can also start a web session directly from the command line:

89 

90```bash theme={null}

91claude --remote "Fix the authentication bug in src/auth/login.ts"

92```

93 

94#### Tips for background tasks

95 

96**Plan locally, execute remotely**: For complex tasks, start Claude in plan mode to collaborate on the approach before sending work to the web:

97 

98```bash theme={null}

99claude --permission-mode plan

100```

101 

102In plan mode, Claude can only read files and explore the codebase. Once you're satisfied with the plan, send it to the web for autonomous execution:

103 

104```

105& Execute the migration plan we discussed

106```

107 

108This pattern gives you control over the strategy while letting Claude execute autonomously in the cloud.

109 

110**Run tasks in parallel**: Each `&` command creates its own web session that runs independently. You can kick off multiple tasks and they'll all run simultaneously in separate sessions:

111 

112```

113& Fix the flaky test in auth.spec.ts

114& Update the API documentation

115& Refactor the logger to use structured output

116```

117 

118Monitor all sessions with `/tasks`. When a session completes, you can create a PR from the web interface or [teleport](#from-web-to-terminal) the session to your terminal to continue working.

119 

57### From web to terminal120### From web to terminal

58 121 

59After starting a task on the web:122There are several ways to pull a web session into your terminal:

123 

124* **Using `/teleport`**: From within Claude Code, run `/teleport` (or `/tp`) to see an interactive picker of your web sessions. If you have uncommitted changes, you'll be prompted to stash them first.

125* **Using `--teleport`**: From the command line, run `claude --teleport` for an interactive session picker, or `claude --teleport <session-id>` to resume a specific session directly.

126* **From `/tasks`**: Run `/tasks` to see your background sessions, then press `t` to teleport into one

127* **From the web interface**: Click "Open in CLI" to copy a command you can paste into your terminal

128 

129When you teleport a session, Claude verifies you're in the correct repository, fetches and checks out the branch from the remote session, and loads the full conversation history into your terminal.

60 130 

611. Click the "Open in CLI" button131#### Requirements for teleporting

622. Paste and run the command in your terminal in a checkout of the repo132 

633. Any existing local changes will be stashed, and the remote session will be loaded133Teleport checks these requirements before resuming a session. If any requirement isn't met, you'll see an error or be prompted to resolve the issue.

644. Continue working locally134 

135| Requirement | Details |

136| ------------------ | ---------------------------------------------------------------------------------------------------------------------- |

137| Clean git state | Your working directory must have no uncommitted changes. Teleport prompts you to stash changes if needed. |

138| Correct repository | You must run `--teleport` from a checkout of the same repository, not a fork. |

139| Branch available | The branch from the web session must have been pushed to the remote. Teleport automatically fetches and checks it out. |

140| Same account | You must be authenticated to the same Claude.ai account used in the web session. |

65 141 

66## Cloud environment142## Cloud environment

67 143 


127 203 

128**To update an existing environment:** Select the current environment, to the right of the environment name, and select the settings button. This will open a dialog where you can update the environment name, network access, and environment variables.204**To update an existing environment:** Select the current environment, to the right of the environment name, and select the settings button. This will open a dialog where you can update the environment name, network access, and environment variables.

129 205 

206**To select your default environment from the terminal:** If you have multiple environments configured, run `/remote-env` to choose which one to use when starting web sessions from your terminal with `&` or `--remote`. With a single environment, this command shows your current configuration.

207 

130<Note>208<Note>

131 Environment variables must be specified as key-value pairs, in [`.env` format](https://www.dotenv.org/). For example:209 Environment variables must be specified as key-value pairs, in [`.env` format](https://www.dotenv.org/). For example:

132 210 


223 301 

224* api.anthropic.com302* api.anthropic.com

225* statsig.anthropic.com303* statsig.anthropic.com

304* docs.claude.com

305* code.claude.com

226* claude.ai306* claude.ai

227 307 

228#### Version Control308#### Version Control


230* github.com310* github.com

231* [www.github.com](http://www.github.com)311* [www.github.com](http://www.github.com)

232* api.github.com312* api.github.com

313* npm.pkg.github.com

233* raw\.githubusercontent.com314* raw\.githubusercontent.com

315* pkg-npm.githubusercontent.com

234* objects.githubusercontent.com316* objects.githubusercontent.com

235* codeload.github.com317* codeload.github.com

236* avatars.githubusercontent.com318* avatars.githubusercontent.com


252* [www.docker.com](http://www.docker.com)334* [www.docker.com](http://www.docker.com)

253* production.cloudflare.docker.com335* production.cloudflare.docker.com

254* download.docker.com336* download.docker.com

337* gcr.io

255* \*.gcr.io338* \*.gcr.io

256* ghcr.io339* ghcr.io

257* mcr.microsoft.com340* mcr.microsoft.com

258* \*.data.mcr.microsoft.com341* \*.data.mcr.microsoft.com

342* public.ecr.aws

259 343 

260#### Cloud Platforms344#### Cloud Platforms

261 345 


276* dot.net360* dot.net

277* visualstudio.com361* visualstudio.com

278* dev.azure.com362* dev.azure.com

363* \*.amazonaws.com

364* \*.api.aws

279* oracle.com365* oracle.com

280* [www.oracle.com](http://www.oracle.com)366* [www.oracle.com](http://www.oracle.com)

281* java.com367* java.com


325 411 

326* crates.io412* crates.io

327* [www.crates.io](http://www.crates.io)413* [www.crates.io](http://www.crates.io)

414* index.crates.io

328* static.crates.io415* static.crates.io

329* rustup.rs416* rustup.rs

330* static.rust-lang.org417* static.rust-lang.org


423* statsig.com510* statsig.com

424* [www.statsig.com](http://www.statsig.com)511* [www.statsig.com](http://www.statsig.com)

425* api.statsig.com512* api.statsig.com

513* sentry.io

426* \*.sentry.io514* \*.sentry.io

515* http-intake.logs.datadoghq.com

516* \*.datadoghq.com

517* \*.datadoghq.eu

427 518 

428#### Content Delivery & Mirrors519#### Content Delivery & Mirrors

429 520 

521* sourceforge.net

430* \*.sourceforge.net522* \*.sourceforge.net

431* packagecloud.io523* packagecloud.io

432* \*.packagecloud.io524* \*.packagecloud.io


438* json.schemastore.org530* json.schemastore.org

439* [www.schemastore.org](http://www.schemastore.org)531* [www.schemastore.org](http://www.schemastore.org)

440 532 

533#### Model Context Protocol

534 

535* \*.modelcontextprotocol.io

536 

441<Note>537<Note>

442 Domains marked with `*` indicate wildcard subdomain matching. For example, `*.gcr.io` allows access to any subdomain of `gcr.io`.538 Domains marked with `*` indicate wildcard subdomain matching. For example, `*.gcr.io` allows access to any subdomain of `gcr.io`.

443</Note>539</Note>


473 569 

474## Best practices570## Best practices

475 571 

4761. **Use Claude Code hooks**: Configure [sessionStart hooks](/en/hooks#sessionstart) to automate environment setup and dependency installation.5721. **Use Claude Code hooks**: Configure [SessionStart hooks](/en/hooks#sessionstart) to automate environment setup and dependency installation.

4772. **Document requirements**: Clearly specify dependencies and commands in your `CLAUDE.md` file. If you have an `AGENTS.md` file, you can source it in your `CLAUDE.md` using `@AGENTS.md` to maintain a single source of truth.5732. **Document requirements**: Clearly specify dependencies and commands in your `CLAUDE.md` file. If you have an `AGENTS.md` file, you can source it in your `CLAUDE.md` using `@AGENTS.md` to maintain a single source of truth.

478 574 

479## Related resources575## Related resources

cli-reference.md +60 −32

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# CLI reference5# CLI reference

2 6 

3> Complete reference for Claude Code command-line interface, including commands and flags.7> Complete reference for Claude Code command-line interface, including commands and flags.


5## CLI commands9## CLI commands

6 10 

7| Command | Description | Example |11| Command | Description | Example |

8| :--------------------------------- | :--------------------------------------------- | :------------------------------------------------ |12| :------------------------------ | :----------------------------------------------------- | :------------------------------------------------ |

9| `claude` | Start interactive REPL | `claude` |13| `claude` | Start interactive REPL | `claude` |

10| `claude "query"` | Start REPL with initial prompt | `claude "explain this project"` |14| `claude "query"` | Start REPL with initial prompt | `claude "explain this project"` |

11| `claude -p "query"` | Query via SDK, then exit | `claude -p "explain this function"` |15| `claude -p "query"` | Query via SDK, then exit | `claude -p "explain this function"` |

12| `cat file \| claude -p "query"` | Process piped content | `cat logs.txt \| claude -p "explain"` |16| `cat file \| claude -p "query"` | Process piped content | `cat logs.txt \| claude -p "explain"` |

13| `claude -c` | Continue most recent conversation | `claude -c` |17| `claude -c` | Continue most recent conversation in current directory | `claude -c` |

14| `claude -c -p "query"` | Continue via SDK | `claude -c -p "Check for type errors"` |18| `claude -c -p "query"` | Continue via SDK | `claude -c -p "Check for type errors"` |

15| `claude -r "<session-id>" "query"` | Resume session by ID | `claude -r "abc123" "Finish this PR"` |19| `claude -r "<session>" "query"` | Resume session by ID or name | `claude -r "auth-refactor" "Finish this PR"` |

16| `claude update` | Update to latest version | `claude update` |20| `claude update` | Update to latest version | `claude update` |

17| `claude mcp` | Configure Model Context Protocol (MCP) servers | See the [Claude Code MCP documentation](/en/mcp). |21| `claude mcp` | Configure Model Context Protocol (MCP) servers | See the [Claude Code MCP documentation](/en/mcp). |

18 22 


21Customize Claude Code's behavior with these command-line flags:25Customize Claude Code's behavior with these command-line flags:

22 26 

23| Flag | Description | Example |27| Flag | Description | Example |

24| :------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------- |28| :------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------- |

25| `--add-dir` | Add additional working directories for Claude to access (validates each path exists as a directory) | `claude --add-dir ../apps ../lib` |29| `--add-dir` | Add additional working directories for Claude to access (validates each path exists as a directory) | `claude --add-dir ../apps ../lib` |

30| `--agent` | Specify an agent for the current session (overrides the `agent` setting) | `claude --agent my-custom-agent` |

26| `--agents` | Define custom [subagents](/en/sub-agents) dynamically via JSON (see below for format) | `claude --agents '{"reviewer":{"description":"Reviews code","prompt":"You are a code reviewer"}}'` |31| `--agents` | Define custom [subagents](/en/sub-agents) dynamically via JSON (see below for format) | `claude --agents '{"reviewer":{"description":"Reviews code","prompt":"You are a code reviewer"}}'` |

27| `--allowedTools` | A list of tools that should be allowed without prompting the user for permission, in addition to [settings.json files](/en/settings) | `"Bash(git log:*)" "Bash(git diff:*)" "Read"` |32| `--allow-dangerously-skip-permissions` | Enable permission bypassing as an option without immediately activating it. Allows composing with `--permission-mode` (use with caution) | `claude --permission-mode plan --allow-dangerously-skip-permissions` |

28| `--disallowedTools` | A list of tools that should be disallowed without prompting the user for permission, in addition to [settings.json files](/en/settings) | `"Bash(git log:*)" "Bash(git diff:*)" "Edit"` |33| `--allowedTools` | Tools that execute without prompting for permission. See [permission rule syntax](/en/settings#permission-rule-syntax) for pattern matching. To restrict which tools are available, use `--tools` instead | `"Bash(git log:*)" "Bash(git diff:*)" "Read"` |

29| `--print`, `-p` | Print response without interactive mode (see [SDK documentation](https://docs.claude.com/en/docs/agent-sdk) for programmatic usage details) | `claude -p "query"` |34| `--append-system-prompt` | Append custom text to the end of the default system prompt (works in both interactive and print modes) | `claude --append-system-prompt "Always use TypeScript"` |

30| `--system-prompt` | Replace the entire system prompt with custom text (works in both interactive and print modes; added in v2.0.14) | `claude --system-prompt "You are a Python expert"` |35| `--append-system-prompt-file` | Load additional system prompt text from a file and append to the default prompt (print mode only) | `claude -p --append-system-prompt-file ./extra-rules.txt "query"` |

31| `--system-prompt-file` | Load system prompt from a file, replacing the default prompt (print mode only; added in v1.0.54) | `claude -p --system-prompt-file ./custom-prompt.txt "query"` |36| `--betas` | Beta headers to include in API requests (API key users only) | `claude --betas interleaved-thinking` |

32| `--append-system-prompt` | Append custom text to the end of the default system prompt (works in both interactive and print modes; added in v1.0.55) | `claude --append-system-prompt "Always use TypeScript"` |37| `--chrome` | Enable [Chrome browser integration](/en/chrome) for web automation and testing | `claude --chrome` |

33| `--output-format` | Specify output format for print mode (options: `text`, `json`, `stream-json`) | `claude -p "query" --output-format json` |38| `--continue`, `-c` | Load the most recent conversation in the current directory | `claude --continue` |

39| `--dangerously-skip-permissions` | Skip all permission prompts (use with caution) | `claude --dangerously-skip-permissions` |

40| `--debug` | Enable debug mode with optional category filtering (for example, `"api,hooks"` or `"!statsig,!file"`) | `claude --debug "api,mcp"` |

41| `--disable-slash-commands` | Disable all skills and slash commands for this session | `claude --disable-slash-commands` |

42| `--disallowedTools` | Tools that are removed from the model's context and cannot be used | `"Bash(git log:*)" "Bash(git diff:*)" "Edit"` |

43| `--fallback-model` | Enable automatic fallback to specified model when default model is overloaded (print mode only) | `claude -p --fallback-model sonnet "query"` |

44| `--fork-session` | When resuming, create a new session ID instead of reusing the original (use with `--resume` or `--continue`) | `claude --resume abc123 --fork-session` |

45| `--ide` | Automatically connect to IDE on startup if exactly one valid IDE is available | `claude --ide` |

46| `--init` | Run [Setup hooks](/en/hooks#setup) and start interactive mode | `claude --init` |

47| `--init-only` | Run [Setup hooks](/en/hooks#setup) and exit (no interactive session) | `claude --init-only` |

48| `--include-partial-messages` | Include partial streaming events in output (requires `--print` and `--output-format=stream-json`) | `claude -p --output-format stream-json --include-partial-messages "query"` |

34| `--input-format` | Specify input format for print mode (options: `text`, `stream-json`) | `claude -p --output-format json --input-format stream-json` |49| `--input-format` | Specify input format for print mode (options: `text`, `stream-json`) | `claude -p --output-format json --input-format stream-json` |

35| `--json-schema` | Get validated JSON output matching a JSON Schema after agent completes its workflow (print mode only, see [Agent SDK Structured Outputs](https://docs.claude.com/en/docs/agent-sdk/structured-outputs)) | `claude -p --json-schema '{"type":"object","properties":{...}}' "query"` |50| `--json-schema` | Get validated JSON output matching a JSON Schema after agent completes its workflow (print mode only, see [Agent SDK Structured Outputs](https://docs.claude.com/en/docs/agent-sdk/structured-outputs)) | `claude -p --json-schema '{"type":"object","properties":{...}}' "query"` |

36| `--include-partial-messages` | Include partial streaming events in output (requires `--print` and `--output-format=stream-json`) | `claude -p --output-format stream-json --include-partial-messages "query"` |51| `--maintenance` | Run [Setup hooks](/en/hooks#setup) with maintenance trigger and exit | `claude --maintenance` |

37| `--verbose` | Enable verbose logging, shows full turn-by-turn output (helpful for debugging in both print and interactive modes) | `claude --verbose` |52| `--max-budget-usd` | Maximum dollar amount to spend on API calls before stopping (print mode only) | `claude -p --max-budget-usd 5.00 "query"` |

38| `--max-turns` | Limit the number of agentic turns in non-interactive mode | `claude -p --max-turns 3 "query"` |53| `--max-turns` | Limit the number of agentic turns (print mode only). Exits with an error when the limit is reached. No limit by default | `claude -p --max-turns 3 "query"` |

54| `--mcp-config` | Load MCP servers from JSON files or strings (space-separated) | `claude --mcp-config ./mcp.json` |

39| `--model` | Sets the model for the current session with an alias for the latest model (`sonnet` or `opus`) or a model's full name | `claude --model claude-sonnet-4-5-20250929` |55| `--model` | Sets the model for the current session with an alias for the latest model (`sonnet` or `opus`) or a model's full name | `claude --model claude-sonnet-4-5-20250929` |

56| `--no-chrome` | Disable [Chrome browser integration](/en/chrome) for this session | `claude --no-chrome` |

57| `--no-session-persistence` | Disable session persistence so sessions are not saved to disk and cannot be resumed (print mode only) | `claude -p --no-session-persistence "query"` |

58| `--output-format` | Specify output format for print mode (options: `text`, `json`, `stream-json`) | `claude -p "query" --output-format json` |

40| `--permission-mode` | Begin in a specified [permission mode](/en/iam#permission-modes) | `claude --permission-mode plan` |59| `--permission-mode` | Begin in a specified [permission mode](/en/iam#permission-modes) | `claude --permission-mode plan` |

41| `--permission-prompt-tool` | Specify an MCP tool to handle permission prompts in non-interactive mode | `claude -p --permission-prompt-tool mcp_auth_tool "query"` |60| `--permission-prompt-tool` | Specify an MCP tool to handle permission prompts in non-interactive mode | `claude -p --permission-prompt-tool mcp_auth_tool "query"` |

42| `--resume` | Resume a specific session by ID, or by choosing in interactive mode | `claude --resume abc123 "query"` |61| `--plugin-dir` | Load plugins from directories for this session only (repeatable) | `claude --plugin-dir ./my-plugins` |

43| `--continue` | Load the most recent conversation in the current directory | `claude --continue` |62| `--print`, `-p` | Print response without interactive mode (see [SDK documentation](https://docs.claude.com/en/docs/agent-sdk) for programmatic usage details) | `claude -p "query"` |

44| `--dangerously-skip-permissions` | Skip permission prompts (use with caution) | `claude --dangerously-skip-permissions` |63| `--remote` | Create a new [web session](/en/claude-code-on-the-web) on claude.ai with the provided task description | `claude --remote "Fix the login bug"` |

64| `--resume`, `-r` | Resume a specific session by ID or name, or show an interactive picker to choose a session | `claude --resume auth-refactor` |

65| `--session-id` | Use a specific session ID for the conversation (must be a valid UUID) | `claude --session-id "550e8400-e29b-41d4-a716-446655440000"` |

66| `--setting-sources` | Comma-separated list of setting sources to load (`user`, `project`, `local`) | `claude --setting-sources user,project` |

67| `--settings` | Path to a settings JSON file or a JSON string to load additional settings from | `claude --settings ./settings.json` |

68| `--strict-mcp-config` | Only use MCP servers from `--mcp-config`, ignoring all other MCP configurations | `claude --strict-mcp-config --mcp-config ./mcp.json` |

69| `--system-prompt` | Replace the entire system prompt with custom text (works in both interactive and print modes) | `claude --system-prompt "You are a Python expert"` |

70| `--system-prompt-file` | Load system prompt from a file, replacing the default prompt (print mode only) | `claude -p --system-prompt-file ./custom-prompt.txt "query"` |

71| `--teleport` | Resume a [web session](/en/claude-code-on-the-web) in your local terminal | `claude --teleport` |

72| `--tools` | Restrict which built-in tools Claude can use (works in both interactive and print modes). Use `""` to disable all, `"default"` for all, or tool names like `"Bash,Edit,Read"` | `claude --tools "Bash,Edit,Read"` |

73| `--verbose` | Enable verbose logging, shows full turn-by-turn output (helpful for debugging in both print and interactive modes) | `claude --verbose` |

74| `--version`, `-v` | Output the version number | `claude -v` |

45 75 

46<Tip>76<Tip>

47 The `--output-format json` flag is particularly useful for scripting and77 The `--output-format json` flag is particularly useful for scripting and


53The `--agents` flag accepts a JSON object that defines one or more custom subagents. Each subagent requires a unique name (as the key) and a definition object with the following fields:83The `--agents` flag accepts a JSON object that defines one or more custom subagents. Each subagent requires a unique name (as the key) and a definition object with the following fields:

54 84 

55| Field | Required | Description |85| Field | Required | Description |

56| :------------ | :------- | :-------------------------------------------------------------------------------------------------------------- |86| :------------ | :------- | :---------------------------------------------------------------------------------------------------------------------------------- |

57| `description` | Yes | Natural language description of when the subagent should be invoked |87| `description` | Yes | Natural language description of when the subagent should be invoked |

58| `prompt` | Yes | The system prompt that guides the subagent's behavior |88| `prompt` | Yes | The system prompt that guides the subagent's behavior |

59| `tools` | No | Array of specific tools the subagent can use (e.g., `["Read", "Edit", "Bash"]`). If omitted, inherits all tools |89| `tools` | No | Array of specific tools the subagent can use (for example, `["Read", "Edit", "Bash"]`). If omitted, inherits all tools |

60| `model` | No | Model alias to use: `sonnet`, `opus`, or `haiku`. If omitted, uses the default subagent model |90| `model` | No | Model alias to use: `sonnet`, `opus`, `haiku`, or `inherit`. If omitted, defaults to `inherit` (uses the main conversation's model) |

61 91 

62Example:92Example:

63 93 


80 110 

81### System prompt flags111### System prompt flags

82 112 

83Claude Code provides three flags for customizing the system prompt, each serving a different purpose:113Claude Code provides four flags for customizing the system prompt, each serving a different purpose:

84 114 

85| Flag | Behavior | Modes | Use Case |115| Flag | Behavior | Modes | Use Case |

86| :----------------------- | :--------------------------------- | :------------------ | :------------------------------------------------------------------- |116| :---------------------------- | :------------------------------------------ | :------------------ | :------------------------------------------------------------------- |

87| `--system-prompt` | **Replaces** entire default prompt | Interactive + Print | Complete control over Claude's behavior and instructions |117| `--system-prompt` | **Replaces** entire default prompt | Interactive + Print | Complete control over Claude's behavior and instructions |

88| `--system-prompt-file` | **Replaces** with file contents | Print only | Load prompts from files for reproducibility and version control |118| `--system-prompt-file` | **Replaces** with file contents | Print only | Load prompts from files for reproducibility and version control |

89| `--append-system-prompt` | **Appends** to default prompt | Interactive + Print | Add specific instructions while keeping default Claude Code behavior |119| `--append-system-prompt` | **Appends** to default prompt | Interactive + Print | Add specific instructions while keeping default Claude Code behavior |

120| `--append-system-prompt-file` | **Appends** file contents to default prompt | Print only | Load additional instructions from files while keeping defaults |

90 121 

91**When to use each:**122**When to use each:**

92 123 


105 claude --append-system-prompt "Always use TypeScript and include JSDoc comments"136 claude --append-system-prompt "Always use TypeScript and include JSDoc comments"

106 ```137 ```

107 138 

108<Note>139* **`--append-system-prompt-file`**: Use when you want to append instructions from a file while keeping Claude Code's defaults. Useful for version-controlled additions.

109 `--system-prompt` and `--system-prompt-file` are mutually exclusive. You cannot use both flags simultaneously.140 ```bash theme={null}

110</Note>141 claude -p --append-system-prompt-file ./prompts/style-rules.txt "Review this PR"

142 ```

111 143 

112<Tip>144`--system-prompt` and `--system-prompt-file` are mutually exclusive. The append flags can be used together with either replacement flag.

113 For most use cases, `--append-system-prompt` is recommended as it preserves Claude Code's built-in capabilities while adding your custom requirements. Use `--system-prompt` or `--system-prompt-file` only when you need complete control over the system prompt.

114</Tip>

115 145 

116For detailed information about print mode (`-p`) including output formats,146For most use cases, `--append-system-prompt` or `--append-system-prompt-file` is recommended as they preserve Claude Code's built-in capabilities while adding your custom requirements. Use `--system-prompt` or `--system-prompt-file` only when you need complete control over the system prompt.

117streaming, verbose logging, and programmatic usage, see the

118[SDK documentation](https://docs.claude.com/en/docs/agent-sdk).

119 147 

120## See also148## See also

121 149 

150* [Chrome extension](/en/chrome) - Browser automation and web testing

122* [Interactive mode](/en/interactive-mode) - Shortcuts, input modes, and interactive features151* [Interactive mode](/en/interactive-mode) - Shortcuts, input modes, and interactive features

123* [Slash commands](/en/slash-commands) - Interactive session commands

124* [Quickstart guide](/en/quickstart) - Getting started with Claude Code152* [Quickstart guide](/en/quickstart) - Getting started with Claude Code

125* [Common workflows](/en/common-workflows) - Advanced workflows and patterns153* [Common workflows](/en/common-workflows) - Advanced workflows and patterns

126* [Settings](/en/settings) - Configuration options154* [Settings](/en/settings) - Configuration options

common-workflows.md +128 −211

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Common workflows5# Common workflows

2 6 

3> Learn about common workflows with Claude Code.7> Step-by-step guides for exploring codebases, fixing bugs, refactoring, testing, and other everyday tasks with Claude Code.

4 8 

5Each task in this document includes clear instructions, example commands, and best practices to help you get the most from Claude Code.9This page covers practical workflows for everyday development: exploring unfamiliar code, debugging, refactoring, writing tests, creating PRs, and managing sessions. Each section includes example prompts you can adapt to your own projects. For higher-level patterns and tips, see [Best practices](/en/best-practices).

6 10 

7## Understand new codebases11## Understand new codebases

8 12 


81 85 

82 * Be specific about what you're looking for86 * Be specific about what you're looking for

83 * Use domain language from the project87 * Use domain language from the project

88 * Install a [code intelligence plugin](/en/discover-plugins#code-intelligence) for your language to give Claude precise "go to definition" and "find references" navigation

84</Tip>89</Tip>

85 90 

86***91***


173 </Step>178 </Step>

174 179 

175 <Step title="Use subagents automatically">180 <Step title="Use subagents automatically">

176 Claude Code will automatically delegate appropriate tasks to specialized subagents:181 Claude Code automatically delegates appropriate tasks to specialized subagents:

177 182 

178 ```183 ```

179 > review my recent code changes for security issues184 > review my recent code changes for security issues


201 206 

202 Then select "Create New subagent" and follow the prompts to define:207 Then select "Create New subagent" and follow the prompts to define:

203 208 

204 * Subagent type (e.g., `api-designer`, `performance-optimizer`)209 * A unique identifier that describes the subagent's purpose (for example, `code-reviewer`, `api-designer`).

205 * When to use it210 * When Claude should use this agent

206 * Which tools it can access211 * Which tools it can access

207 * Its specialized system prompt212 * A system prompt describing the agent's role and behavior

208 </Step>213 </Step>

209</Steps>214</Steps>

210 215 


221 226 

222## Use Plan Mode for safe code analysis227## Use Plan Mode for safe code analysis

223 228 

224Plan Mode instructs Claude to create a plan by analyzing the codebase with read-only operations, perfect for exploring codebases, planning complex changes, or reviewing code safely.229Plan Mode instructs Claude to create a plan by analyzing the codebase with read-only operations, perfect for exploring codebases, planning complex changes, or reviewing code safely. In Plan Mode, Claude uses [`AskUserQuestion`](/en/settings#tools-available-to-claude) to gather requirements and clarify your goals before proposing a plan.

225 230 

226### When to use Plan Mode231### When to use Plan Mode

227 232 


235 240 

236You can switch into Plan Mode during a session using **Shift+Tab** to cycle through permission modes.241You can switch into Plan Mode during a session using **Shift+Tab** to cycle through permission modes.

237 242 

238If you are in Normal Mode, **Shift+Tab** will first switch into Auto-Accept Mode, indicated by `⏵⏵ accept edits on` at the bottom of the terminal. A subsequent **Shift+Tab** will switch into Plan Mode, indicated by `⏸ plan mode on`.243If you are in Normal Mode, **Shift+Tab** first switches into Auto-Accept Mode, indicated by `⏵⏵ accept edits on` at the bottom of the terminal. A subsequent **Shift+Tab** will switch into Plan Mode, indicated by `⏸ plan mode on`.

239 244 

240**Start a new session in Plan Mode**245**Start a new session in Plan Mode**

241 246 


247 252 

248**Run "headless" queries in Plan Mode**253**Run "headless" queries in Plan Mode**

249 254 

250You can also run a query in Plan Mode directly with `-p` (i.e., in ["headless mode"](/en/headless)):255You can also run a query in Plan Mode directly with `-p` (that is, in ["headless mode"](/en/headless)):

251 256 

252```bash theme={null}257```bash theme={null}

253claude --permission-mode plan -p "Analyze the authentication system and suggest improvements"258claude --permission-mode plan -p "Analyze the authentication system and suggest improvements"


263> I need to refactor our authentication system to use OAuth2. Create a detailed migration plan.268> I need to refactor our authentication system to use OAuth2. Create a detailed migration plan.

264```269```

265 270 

266Claude will analyze the current implementation and create a comprehensive plan. Refine with follow-ups:271Claude analyzes the current implementation and create a comprehensive plan. Refine with follow-ups:

267 272 

268```273```

269> What about backward compatibility?274> What about backward compatibility?

270> How should we handle database migration?275> How should we handle database migration?

271```276```

272 277 

278<Tip>Press `Ctrl+G` to open the plan in your default text editor, where you can edit it directly before Claude proceeds.</Tip>

279 

273### Configure Plan Mode as default280### Configure Plan Mode as default

274 281 

275```json theme={null}282```json theme={null}


315 </Step>322 </Step>

316</Steps>323</Steps>

317 324 

318<Tip>325Claude can generate tests that follow your project's existing patterns and conventions. When asking for tests, be specific about what behavior you want to verify. Claude examines your existing test files to match the style, frameworks, and assertion patterns already in use.

319 Tips:

320 326 

321 * Ask for tests that cover edge cases and error conditions327For comprehensive coverage, ask Claude to identify edge cases you might have missed. Claude can analyze your code paths and suggest tests for error conditions, boundary values, and unexpected inputs that are easy to overlook.

322 * Request both unit and integration tests when appropriate

323 * Have Claude explain the testing strategy

324</Tip>

325 328 

326***329***

327 330 


336 ```339 ```

337 </Step>340 </Step>

338 341 

339 <Step title="Generate a PR with Claude">342 <Step title="Generate a pull request with Claude">

340 ```343 ```

341 > create a pr 344 > create a pr

342 ```345 ```


458 * Include screenshots of errors, UI designs, or diagrams for better context461 * Include screenshots of errors, UI designs, or diagrams for better context

459 * You can work with multiple images in a conversation462 * You can work with multiple images in a conversation

460 * Image analysis works with diagrams, screenshots, mockups, and more463 * Image analysis works with diagrams, screenshots, mockups, and more

464 * When Claude references images (for example, `[Image #1]`), `Cmd+Click` (Mac) or `Ctrl+Click` (Windows/Linux) the link to open the image in your default viewer

461</Tip>465</Tip>

462 466 

463***467***


496 Tips:500 Tips:

497 501 

498 * File paths can be relative or absolute502 * File paths can be relative or absolute

499 * @ file references add CLAUDE.md in the file's directory and parent directories to context503 * @ file references add `CLAUDE.md` in the file's directory and parent directories to context

500 * Directory references show file listings, not contents504 * Directory references show file listings, not contents

501 * You can reference multiple files in a single message (e.g., "@file1.js and @file2.js")505 * You can reference multiple files in a single message (for example, "@file1.js and @file2.js")

502</Tip>506</Tip>

503 507 

504***508***

505 509 

506## Use extended thinking510## Use extended thinking (thinking mode)

511 

512[Extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) is enabled by default, reserving a portion of the output token budget (up to 31,999 tokens) for Claude to reason through complex problems step-by-step. This reasoning is visible in verbose mode, which you can toggle on with `Ctrl+O`.

507 513 

508Suppose you're working on complex architectural decisions, challenging bugs, or planning multi-step implementations that require deep reasoning.514Extended thinking is particularly valuable for complex architectural decisions, challenging bugs, multi-step implementation planning, and evaluating tradeoffs between different approaches. It provides more space for exploring multiple solutions, analyzing edge cases, and self-correcting mistakes.

509 515 

510<Note>516<Note>

511 [Extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) is disabled by default in Claude Code. You can enable it on-demand by using `Tab` to toggle Thinking on, or by using prompts like "think" or "think hard". You can also enable it permanently by setting the [`MAX_THINKING_TOKENS` environment variable](/en/settings#environment-variables) in your settings.517 Phrases like "think", "think hard", "ultrathink", and "think more" are interpreted as regular prompt instructions and don't allocate thinking tokens.

512</Note>518</Note>

513 519 

514<Steps>520### Configure thinking mode

515 <Step title="Provide context and ask Claude to think">

516 ```

517 > I need to implement a new authentication system using OAuth2 for our API. Think deeply about the best approach for implementing this in our codebase.

518 ```

519 521 

520 Claude will gather relevant information from your codebase and522Thinking is enabled by default, but you can adjust or disable it.

521 use extended thinking, which will be visible in the interface.

522 </Step>

523 523 

524 <Step title="Refine the thinking with follow-up prompts">524| Scope | How to configure | Details |

525 ```525| ---------------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |

526 > think about potential security vulnerabilities in this approach 526| **Toggle shortcut** | Press `Option+T` (macOS) or `Alt+T` (Windows/Linux) | Toggle thinking on/off for the current session. May require [terminal configuration](/en/terminal-config) to enable Option key shortcuts |

527 ```527| **Global default** | Use `/config` to toggle thinking mode | Sets your default across all projects.<br />Saved as `alwaysThinkingEnabled` in `~/.claude/settings.json` |

528| **Limit token budget** | Set [`MAX_THINKING_TOKENS`](/en/settings#environment-variables) environment variable | Limit the thinking budget to a specific number of tokens. Example: `export MAX_THINKING_TOKENS=10000` |

528 529 

529 ```530To view Claude's thinking process, press `Ctrl+O` to toggle verbose mode and see the internal reasoning displayed as gray italic text.

530 > think hard about edge cases we should handle

531 ```

532 </Step>

533</Steps>

534 531 

535<Tip>532### How extended thinking token budgets work

536 Tips to get the most value out of extended thinking:

537 533 

538 [Extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) is most valuable for complex tasks such as:534Extended thinking uses a **token budget** that controls how much internal reasoning Claude can perform before responding.

539 535 

540 * Planning complex architectural changes536A larger thinking token budget provides:

541 * Debugging intricate issues

542 * Creating implementation plans for new features

543 * Understanding complex codebases

544 * Evaluating tradeoffs between different approaches

545 537 

546 Use `Tab` to toggle Thinking on and off during a session.538* More space to explore multiple solution approaches step-by-step

539* Room to analyze edge cases and evaluate tradeoffs thoroughly

540* Ability to revise reasoning and self-correct mistakes

547 541 

548 The way you prompt for thinking results in varying levels of thinking depth:542Token budgets for thinking mode:

549 543 

550 * "think" triggers basic extended thinking544* When thinking is **enabled**, Claude can use up to **31,999 tokens** from your output budget for internal reasoning

551 * intensifying phrases such as "keep hard", "think more", "think a lot", or "think longer" triggers deeper thinking545* When thinking is **disabled** (via toggle or `/config`), Claude uses **0 tokens** for thinking

552 546 

553 For more extended thinking prompting tips, see [Extended thinking tips](https://docs.claude.com/en/docs/build-with-claude/prompt-engineering/extended-thinking-tips).547**Limit the thinking budget:**

554</Tip>

555 548 

556<Note>549* Use the [`MAX_THINKING_TOKENS` environment variable](/en/settings#environment-variables) to cap the thinking budget

557 Claude will display its thinking process as italic gray text above the550* When set, this value limits the maximum tokens Claude can use for thinking

558 response.551* See the [extended thinking documentation](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for valid token ranges

559</Note>552 

553<Warning>

554 You're charged for all thinking tokens used, even though Claude 4 models show summarized thinking

555</Warning>

560 556 

561***557***

562 558 

563## Resume previous conversations559## Resume previous conversations

564 560 

565Suppose you've been working on a task with Claude Code and need to continue where you left off in a later session.561When starting Claude Code, you can resume a previous session:

562 

563* `claude --continue` continues the most recent conversation in the current directory

564* `claude --resume` opens a conversation picker or resumes by name

566 565 

567Claude Code provides two options for resuming previous conversations:566From inside an active session, use `/resume` to switch to a different conversation.

568 567 

569* `--continue` to automatically continue the most recent conversation568Sessions are stored per project directory. The `/resume` picker shows sessions from the same git repository, including worktrees.

570* `--resume` to display a conversation picker569 

570### Name your sessions

571 

572Give sessions descriptive names to find them later. This is a best practice when working on multiple tasks or features.

571 573 

572<Steps>574<Steps>

573 <Step title="Continue the most recent conversation">575 <Step title="Name the current session">

574 ```bash theme={null}576 Use `/rename` during a session to give it a memorable name:

575 claude --continue577 

578 ```

579 > /rename auth-refactor

576 ```580 ```

577 581 

578 This immediately resumes your most recent conversation without any prompts.582 You can also rename any session from the picker: run `/resume`, navigate to a session, and press `R`.

579 </Step>583 </Step>

580 584 

581 <Step title="Continue in non-interactive mode">585 <Step title="Resume by name later">

586 From the command line:

587 

582 ```bash theme={null}588 ```bash theme={null}

583 claude --continue --print "Continue with my task"589 claude --resume auth-refactor

584 ```590 ```

585 591 

586 Use `--print` with `--continue` to resume the most recent conversation in non-interactive mode, perfect for scripts or automation.592 Or from inside an active session:

587 </Step>

588 593 

589 <Step title="Show conversation picker">

590 ```bash theme={null}

591 claude --resume

592 ```594 ```

595 > /resume auth-refactor

596 ```

597 </Step>

598</Steps>

593 599 

594 This displays an interactive conversation selector with a clean list view showing:600### Use the session picker

595 601 

596 * Session summary (or initial prompt)602The `/resume` command (or `claude --resume` without arguments) opens an interactive session picker with these features:

597 * Metadata: time elapsed, message count, and git branch

598 603 

599 Use arrow keys to navigate and press Enter to select a conversation. Press Esc to exit.604**Keyboard shortcuts in the picker:**

600 </Step>605 

601</Steps>606| Shortcut | Action |

607| :-------- | :------------------------------------------------ |

608| `↑` / `↓` | Navigate between sessions |

609| `→` / `←` | Expand or collapse grouped sessions |

610| `Enter` | Select and resume the highlighted session |

611| `P` | Preview the session content |

612| `R` | Rename the highlighted session |

613| `/` | Search to filter sessions |

614| `A` | Toggle between current directory and all projects |

615| `B` | Filter to sessions from your current git branch |

616| `Esc` | Exit the picker or search mode |

617 

618**Session organization:**

619 

620The picker displays sessions with helpful metadata:

621 

622* Session name or initial prompt

623* Time elapsed since last activity

624* Message count

625* Git branch (if applicable)

626 

627Forked sessions (created with `/rewind` or `--fork-session`) are grouped together under their root session, making it easier to find related conversations.

602 628 

603<Tip>629<Tip>

604 Tips:630 Tips:

605 631 

606 * Conversation history is stored locally on your machine632 * **Name sessions early**: Use `/rename` when starting work on a distinct task—it's much easier to find "payment-integration" than "explain this function" later

607 * Use `--continue` for quick access to your most recent conversation633 * Use `--continue` for quick access to your most recent conversation in the current directory

608 * Use `--resume` when you need to select a specific past conversation634 * Use `--resume session-name` when you know which session you need

609 * When resuming, you'll see the entire conversation history before continuing635 * Use `--resume` (without a name) when you need to browse and select

636 * For scripts, use `claude --continue --print "prompt"` to resume in non-interactive mode

637 * Press `P` in the picker to preview a session before resuming it

610 * The resumed conversation starts with the same model and configuration as the original638 * The resumed conversation starts with the same model and configuration as the original

611 639 

612 How it works:640 How it works:


615 2. **Message Deserialization**: When resuming, the entire message history is restored to maintain context643 2. **Message Deserialization**: When resuming, the entire message history is restored to maintain context

616 3. **Tool State**: Tool usage and results from the previous conversation are preserved644 3. **Tool State**: Tool usage and results from the previous conversation are preserved

617 4. **Context Restoration**: The conversation resumes with all previous context intact645 4. **Context Restoration**: The conversation resumes with all previous context intact

618 

619 Examples:

620 

621 ```bash theme={null}

622 # Continue most recent conversation

623 claude --continue

624 

625 # Continue most recent conversation with a specific prompt

626 claude --continue --print "Show me our progress"

627 

628 # Show conversation picker

629 claude --resume

630 

631 # Continue most recent conversation in non-interactive mode

632 claude --continue --print "Run the tests again"

633 ```

634</Tip>646</Tip>

635 647 

636***648***


789 801 

790***802***

791 803 

792## Create custom slash commands

793 

794Claude Code supports custom slash commands that you can create to quickly execute specific prompts or tasks.

795 

796For more details, see the [Slash commands](/en/slash-commands) reference page.

797 

798### Create project-specific commands

799 

800Suppose you want to create reusable slash commands for your project that all team members can use.

801 

802<Steps>

803 <Step title="Create a commands directory in your project">

804 ```bash theme={null}

805 mkdir -p .claude/commands

806 ```

807 </Step>

808 

809 <Step title="Create a Markdown file for each command">

810 ```bash theme={null}

811 echo "Analyze the performance of this code and suggest three specific optimizations:" > .claude/commands/optimize.md

812 ```

813 </Step>

814 

815 <Step title="Use your custom command in Claude Code">

816 ```

817 > /optimize

818 ```

819 </Step>

820</Steps>

821 

822<Tip>

823 Tips:

824 

825 * Command names are derived from the filename (e.g., `optimize.md` becomes `/optimize`)

826 * You can organize commands in subdirectories (e.g., `.claude/commands/frontend/component.md` creates `/component` with "(project:frontend)" shown in the description)

827 * Project commands are available to everyone who clones the repository

828 * The Markdown file content becomes the prompt sent to Claude when the command is invoked

829</Tip>

830 

831### Add command arguments with \$ARGUMENTS

832 

833Suppose you want to create flexible slash commands that can accept additional input from users.

834 

835<Steps>

836 <Step title="Create a command file with the $ARGUMENTS placeholder">

837 ```bash theme={null}

838 echo 'Find and fix issue #$ARGUMENTS. Follow these steps: 1.

839 Understand the issue described in the ticket 2. Locate the relevant code in

840 our codebase 3. Implement a solution that addresses the root cause 4. Add

841 appropriate tests 5. Prepare a concise PR description' >

842 .claude/commands/fix-issue.md

843 ```

844 </Step>

845 

846 <Step title="Use the command with an issue number">

847 In your Claude session, use the command with arguments.

848 

849 ```

850 > /fix-issue 123

851 ```

852 

853 This will replace \$ARGUMENTS with "123" in the prompt.

854 </Step>

855</Steps>

856 

857<Tip>

858 Tips:

859 

860 * The \$ARGUMENTS placeholder is replaced with any text that follows the command

861 * You can position \$ARGUMENTS anywhere in your command template

862 * Other useful applications: generating test cases for specific functions, creating documentation for components, reviewing code in particular files, or translating content to specified languages

863</Tip>

864 

865### Create personal slash commands

866 

867Suppose you want to create personal slash commands that work across all your projects.

868 

869<Steps>

870 <Step title="Create a commands directory in your home folder">

871 ```bash theme={null}

872 mkdir -p ~/.claude/commands

873 ```

874 </Step>

875 

876 <Step title="Create a Markdown file for each command">

877 ```bash theme={null}

878 echo "Review this code for security vulnerabilities, focusing on:" >

879 ~/.claude/commands/security-review.md

880 ```

881 </Step>

882 

883 <Step title="Use your personal custom command">

884 ```

885 > /security-review

886 ```

887 </Step>

888</Steps>

889 

890<Tip>

891 Tips:

892 

893 * Personal commands show "(user)" in their description when listed with `/help`

894 * Personal commands are only available to you and not shared with your team

895 * Personal commands work across all your projects

896 * You can use these for consistent workflows across different codebases

897</Tip>

898 

899***

900 

901## Ask Claude about its capabilities804## Ask Claude about its capabilities

902 805 

903Claude has built-in access to its documentation and can answer questions about its own features and limitations.806Claude has built-in access to its documentation and can answer questions about its own features and limitations.


913```816```

914 817 

915```818```

916> what slash commands are available?819> what skills are available?

917```820```

918 821 

919```822```


944 847 

945## Next steps848## Next steps

946 849 

947<Card title="Claude Code reference implementation" icon="code" href="https://github.com/anthropics/claude-code/tree/main/.devcontainer">850<CardGroup cols={2}>

948 Clone our development container reference implementation.851 <Card title="Best practices" icon="lightbulb" href="/en/best-practices">

949</Card>852 Patterns for getting the most out of Claude Code

853 </Card>

854 

855 <Card title="How Claude Code works" icon="gear" href="/en/how-claude-code-works">

856 Understand the agentic loop and context management

857 </Card>

858 

859 <Card title="Extend Claude Code" icon="puzzle-piece" href="/en/features-overview">

860 Add skills, hooks, MCP, subagents, and plugins

861 </Card>

862 

863 <Card title="Reference implementation" icon="code" href="https://github.com/anthropics/claude-code/tree/main/.devcontainer">

864 Clone our development container reference implementation

865 </Card>

866</CardGroup>

costs.md +111 −56

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Manage costs effectively5# Manage costs effectively

2 6 

3> Learn how to track and optimize token usage and costs when using Claude Code.7> Track token usage, set team spend limits, and reduce Claude Code costs with context management, model selection, extended thinking settings, and preprocessing hooks.

4 8 

5Claude Code consumes tokens for each interaction. The average cost is \$6 per developer per day, with daily costs remaining below \$12 for 90% of users.9Claude Code consumes tokens for each interaction. Costs vary based on codebase size, query complexity, and conversation length. The average cost is \$6 per developer per day, with daily costs remaining below \$12 for 90% of users.

6 10 

7For team usage, Claude Code charges by API token consumption. On average, Claude Code costs \~\$100-200/developer per month with Sonnet 4.5 though there is large variance depending on how many instances users are running and whether they're using it in automation.11For team usage, Claude Code charges by API token consumption. On average, Claude Code costs \~\$100-200/developer per month with Sonnet 4.5 though there is large variance depending on how many instances users are running and whether they're using it in automation.

8 12 

13This page covers how to [track your costs](#track-your-costs), [manage costs for teams](#managing-costs-for-teams), and [reduce token usage](#reduce-token-usage).

14 

9## Track your costs15## Track your costs

10 16 

11### Using the `/cost` command17### Using the `/cost` command

12 18 

13<Note>19<Note>

14 The `/cost` command is not intended for Claude Max and Pro subscribers.20 The `/cost` command shows API token usage and is intended for API users. Claude Max and Pro subscribers have usage included in their subscription, so `/cost` data isn't relevant for billing purposes. Subscribers can use `/stats` to view usage patterns.

15</Note>21</Note>

16 22 

17The `/cost` command provides detailed token usage statistics for your current session:23The `/cost` command provides detailed token usage statistics for your current session:


23Total code changes: 0 lines added, 0 lines removed29Total code changes: 0 lines added, 0 lines removed

24```30```

25 31 

26### Additional tracking options32## Managing costs for teams

27 33 

28Check [historical usage](https://support.claude.com/en/articles/9534590-cost-and-usage-reporting-in-console) in the Claude Console (requires Admin or Billing role) and set [workspace spend limits](https://support.claude.com/en/articles/9796807-creating-and-managing-workspaces) for the Claude Code workspace (requires Admin role).34When using Claude API, you can [set workspace spend limits](https://platform.claude.com/docs/en/build-with-claude/workspaces#workspace-limits) on the total Claude Code workspace spend. Admins can [view cost and usage reporting](https://platform.claude.com/docs/en/build-with-claude/workspaces#usage-and-cost-tracking) in the Console.

29 35 

30<Note>36<Note>

31 When you first authenticate Claude Code with your Claude Console account, a workspace called "Claude Code" is automatically created for you. This workspace provides centralized cost tracking and management for all Claude Code usage in your organization. You cannot create API keys for this workspace - it is exclusively for Claude Code authentication and usage.37 When you first authenticate Claude Code with your Claude Console account, a workspace called "Claude Code" is automatically created for you. This workspace provides centralized cost tracking and management for all Claude Code usage in your organization. You cannot create API keys for this workspace; it is exclusively for Claude Code authentication and usage.

32</Note>38</Note>

33 39 

34## Managing costs for teams40On Bedrock, Vertex, and Foundry, Claude Code does not send metrics from your cloud. To get cost metrics, several large enterprises reported using [LiteLLM](/en/llm-gateway#litellm-configuration), which is an open-source tool that helps companies [track spend by key](https://docs.litellm.ai/docs/proxy/virtual_keys#tracking-spend). This project is unaffiliated with Anthropic and we have not audited its security.

35 

36When using Claude API, you can limit the total Claude Code workspace spend. To configure, [follow these instructions](https://support.claude.com/en/articles/9796807-creating-and-managing-workspaces). Admins can view cost and usage reporting by [following these instructions](https://support.claude.com/en/articles/9534590-cost-and-usage-reporting-in-console).

37 

38On Bedrock and Vertex, Claude Code does not send metrics from your cloud. In order to get cost metrics, several large enterprises reported using [LiteLLM](/en/third-party-integrations#litellm), which is an open-source tool that helps companies [track spend by key](https://docs.litellm.ai/docs/proxy/virtual_keys#tracking-spend). This project is unaffiliated with Anthropic and we have not audited its security.

39 41 

40### Rate limit recommendations42### Rate limit recommendations

41 43 


60 62 

61## Reduce token usage63## Reduce token usage

62 64 

63* **Compact conversations:**65Token costs scale with context size: the more context Claude processes, the more tokens you use. Claude Code automatically optimizes costs through prompt caching (which reduces costs for repeated content like system prompts) and auto-compaction (which summarizes conversation history when approaching context limits).

64 66 

65 * Claude uses auto-compact by default when context exceeds 95% capacity67The following strategies help you keep context small and reduce per-message costs.

66 * Toggle auto-compact: Run `/config` and navigate to "Auto-compact enabled"

67 * Use `/compact` manually when context gets large

68 * Add custom instructions: `/compact Focus on code samples and API usage`

69 * Customize compaction by adding to CLAUDE.md:

70 68 

71 ```markdown theme={null}69### Manage context proactively

72 # Summary instructions

73 70 

74 When you are using compact, please focus on test output and code changes71Use `/cost` to check your current token usage, or [configure your status line](/en/statusline#context-window-usage) to display it continuously.

75 ```

76 72 

77* **Write specific queries:** Avoid vague requests that trigger unnecessary scanning73* **Clear between tasks**: Use `/clear` to start fresh when switching to unrelated work. Stale context wastes tokens on every subsequent message. Use `/rename` before clearing so you can easily find the session later, then `/resume` to return to it.

74* **Add custom compaction instructions**: `/compact Focus on code samples and API usage` tells Claude what to preserve during summarization.

78 75 

79* **Break down complex tasks:** Split large tasks into focused interactions76You can also customize compaction behavior in your CLAUDE.md:

80 77 

81* **Clear history between tasks:** Use `/clear` to reset context78```markdown theme={null}

79# Compact instructions

82 80 

83Costs can vary significantly based on:81When you are using compact, please focus on test output and code changes

82```

84 83 

85* Size of codebase being analyzed84### Choose the right model

86* Complexity of queries

87* Number of files being searched or modified

88* Length of conversation history

89* Frequency of compacting conversations

90 85 

91## Background token usage86Sonnet handles most coding tasks well and costs less than Opus. Reserve Opus for complex architectural decisions or multi-step reasoning. Use `/model` to switch models mid-session, or set a default in `/config`. For simple subagent tasks, specify `model: haiku` in your [subagent configuration](/en/sub-agents#choose-a-model).

92 87 

93Claude Code uses tokens for some background functionality even when idle:88### Reduce MCP server overhead

94 89 

95* **Conversation summarization**: Background jobs that summarize previous conversations for the `claude --resume` feature90Each MCP server adds tool definitions to your context, even when idle. Run `/context` to see what's consuming space.

96* **Command processing**: Some commands like `/cost` may generate requests to check status

97 91 

98These background processes consume a small amount of tokens (typically under \$0.04 per session) even without active interaction.92* **Prefer CLI tools when available**: Tools like `gh`, `aws`, `gcloud`, and `sentry-cli` are more context-efficient than MCP servers because they don't add persistent tool definitions. Claude can run CLI commands directly without the overhead.

93* **Disable unused servers**: Run `/mcp` to see configured servers and disable any you're not actively using.

94* **Tool search is automatic**: When MCP tool descriptions exceed 10% of your context window, Claude Code automatically defers them and loads tools on-demand via [tool search](/en/mcp#scale-with-mcp-tool-search). Since deferred tools only enter context when actually used, a lower threshold means fewer idle tool definitions consuming space. Set a lower threshold with `ENABLE_TOOL_SEARCH=auto:<N>` (for example, `auto:5` triggers when tools exceed 5% of your context window).

99 95 

100## Tracking version changes and updates96### Install code intelligence plugins for typed languages

101 97 

102### Current version information98[Code intelligence plugins](/en/discover-plugins#code-intelligence) give Claude precise symbol navigation instead of text-based search, reducing unnecessary file reads when exploring unfamiliar code. A single "go to definition" call replaces what might otherwise be a grep followed by reading multiple candidate files. Installed language servers also report type errors automatically after edits, so Claude catches mistakes without running a compiler.

103 99 

104To check your current Claude Code version and installation details:100### Offload processing to hooks and skills

105 101 

106```bash theme={null}102Custom [hooks](/en/hooks) can preprocess data before Claude sees it. Instead of Claude reading a 10,000-line log file to find errors, a hook can grep for `ERROR` and return only matching lines, reducing context from tens of thousands of tokens to hundreds.

107claude doctor

108```

109 103 

110This command shows your version, installation type, and system information.104A [skill](/en/skills) can give Claude domain knowledge so it doesn't have to explore. For example, a "codebase-overview" skill could describe your project's architecture, key directories, and naming conventions. When Claude invokes the skill, it gets this context immediately instead of spending tokens reading multiple files to understand the structure.

111 105 

112### Understanding changes in Claude Code behavior106For example, this PreToolUse hook filters test output to show only failures:

113 107 

114Claude Code regularly receives updates that may change how features work, including cost reporting:108<Tabs>

109 <Tab title="settings.json">

110 Add this to your [settings.json](/en/settings#settings-files) to run the hook before every Bash command:

115 111 

116* **Version tracking**: Use `claude doctor` to see your current version112 ```json theme={null}

117* **Behavior changes**: Features like `/cost` may display information differently across versions113 {

118* **Documentation access**: Claude always has access to the latest documentation, which can help explain current feature behavior114 "hooks": {

115 "PreToolUse": [

116 {

117 "matcher": "Bash",

118 "hooks": [

119 {

120 "type": "command",

121 "command": "~/.claude/hooks/filter-test-output.sh"

122 }

123 ]

124 }

125 ]

126 }

127 }

128 ```

129 </Tab>

130 

131 <Tab title="filter-test-output.sh">

132 The hook calls this script, which checks if the command is a test runner and modifies it to show only failures:

133 

134 ```bash theme={null}

135 #!/bin/bash

136 input=$(cat)

137 cmd=$(echo "$input" | jq -r '.tool_input.command')

138 

139 # If running tests, filter to show only failures

140 if [[ "$cmd" =~ ^(npm test|pytest|go test) ]]; then

141 filtered_cmd="$cmd 2>&1 | grep -A 5 -E '(FAIL|ERROR|error:)' | head -100"

142 echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"updatedInput\":{\"command\":\"$filtered_cmd\"}}}"

143 else

144 echo "{}"

145 fi

146 ```

147 </Tab>

148</Tabs>

119 149 

120### When cost reporting changes150### Move instructions from CLAUDE.md to skills

121 151 

122If you notice changes in how costs are displayed (such as the `/cost` command showing different information):152Your [CLAUDE.md](/en/memory) file is loaded into context at session start. If it contains detailed instructions for specific workflows (like PR reviews or database migrations), those tokens are present even when you're doing unrelated work. [Skills](/en/skills) load on-demand only when invoked, so moving specialized instructions into skills keeps your base context smaller. Aim to keep CLAUDE.md under \~500 lines by including only essentials.

123 153 

1241. **Verify your version**: Run `claude doctor` to confirm your current version154### Adjust extended thinking

1252. **Consult documentation**: Ask Claude directly about current feature behavior, as it has access to up-to-date documentation

1263. **Contact support**: For specific billing questions, contact Anthropic support through your Console account

127 155 

128<Note>156Extended thinking is enabled by default with a budget of 31,999 tokens because it significantly improves performance on complex planning and reasoning tasks. However, thinking tokens are billed as output tokens, so for simpler tasks where deep reasoning isn't needed, you can reduce costs by disabling it in `/config` or lowering the budget (for example, `MAX_THINKING_TOKENS=8000`).

129 For team deployments, we recommend starting with a small pilot group to157 

130 establish usage patterns before wider rollout.158### Delegate verbose operations to subagents

131</Note>159 

160Running tests, fetching documentation, or processing log files can consume significant context. Delegate these to [subagents](/en/sub-agents#isolate-high-volume-operations) so the verbose output stays in the subagent's context while only a summary returns to your main conversation.

161 

162### Write specific prompts

163 

164Vague requests like "improve this codebase" trigger broad scanning. Specific requests like "add input validation to the login function in auth.ts" let Claude work efficiently with minimal file reads.

165 

166### Work efficiently on complex tasks

167 

168For longer or more complex work, these habits help avoid wasted tokens from going down the wrong path:

169 

170* **Use plan mode for complex tasks**: Press Shift+Tab to enter [plan mode](/en/common-workflows#use-plan-mode-for-safe-code-analysis) before implementation. Claude explores the codebase and proposes an approach for your approval, preventing expensive re-work when the initial direction is wrong.

171* **Course-correct early**: If Claude starts heading the wrong direction, press Escape to stop immediately. Use `/rewind` or double-tap Escape to restore conversation and code to a previous checkpoint.

172* **Give verification targets**: Include test cases, paste screenshots, or define expected output in your prompt. When Claude can verify its own work, it catches issues before you need to request fixes.

173* **Test incrementally**: Write one file, test it, then continue. This catches issues early when they're cheap to fix.

174 

175## Background token usage

176 

177Claude Code uses tokens for some background functionality even when idle:

178 

179* **Conversation summarization**: Background jobs that summarize previous conversations for the `claude --resume` feature

180* **Command processing**: Some commands like `/cost` may generate requests to check status

181 

182These background processes consume a small amount of tokens (typically under \$0.04 per session) even without active interaction.

183 

184## Understanding changes in Claude Code behavior

185 

186Claude Code regularly receives updates that may change how features work, including cost reporting. Run `claude --version` to check your current version. For specific billing questions, contact Anthropic support through your [Console account](https://platform.claude.com/login). For team deployments, start with a small pilot group to establish usage patterns before wider rollout.

data-usage.md +19 −22

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Data usage5# Data usage

2 6 

3> Learn about Anthropic's data usage policies for Claude7> Learn about Anthropic's data usage policies for Claude


7### Data training policy11### Data training policy

8 12 

9**Consumer users (Free, Pro, and Max plans)**:13**Consumer users (Free, Pro, and Max plans)**:

10Starting August 28, 2025, we're giving you the choice to allow your data to be used to improve future Claude models.14We give you the choice to allow your data to be used to improve future Claude models. We will train new models using data from Free, Pro, and Max accounts when this setting is on (including when you use Claude Code from these accounts).

11 

12We will train new models using data from Free, Pro, and Max accounts when this setting is on (including when you use Claude Code from these accounts).

13 15 

14* If you're a current user, you can select your preference now and your selection will immediately go into effect.16**Commercial users**: (Team and Enterprise plans, API, 3rd-party platforms, and Claude Gov) maintain existing policies: Anthropic does not train generative models using code or prompts sent to Claude Code under commercial terms, unless the customer has chosen to provide their data to us for model improvement (for example, the [Developer Partner Program](https://support.claude.com/en/articles/11174108-about-the-development-partner-program)).

15 This setting will only apply to new or resumed chats and coding sessions on Claude. Previous chats with no additional activity will not be used for model training.

16* You have until October 8, 2025 to make your selection.

17 If you're a new user, you can pick your setting for model training during the signup process.

18 You can change your selection at any time in your Privacy Settings.

19 

20**Commercial users**: (Team and Enterprise plans, API, 3rd-party platforms, and Claude Gov) maintain existing policies: Anthropic does not train generative models using code or prompts sent to Claude Code under commercial terms, unless the customer has chosen to provide their data to us for model improvement (e.g. [Developer Partner Program](https://support.claude.com/en/articles/11174108-about-the-development-partner-program)).

21 17 

22### Development Partner Program18### Development Partner Program

23 19 


51 47 

52For full details, please review our [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms) (for Team, Enterprise, and API users) or [Consumer Terms](https://www.anthropic.com/legal/consumer-terms) (for Free, Pro, and Max users) and [Privacy Policy](https://www.anthropic.com/legal/privacy).48For full details, please review our [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms) (for Team, Enterprise, and API users) or [Consumer Terms](https://www.anthropic.com/legal/consumer-terms) (for Free, Pro, and Max users) and [Privacy Policy](https://www.anthropic.com/legal/privacy).

53 49 

54## Data flow and dependencies50## Data access

51 

52For all first party users, you can learn more about what data is logged for [local Claude Code](#local-claude-code-data-flow-and-dependencies) and [remote Claude Code](#cloud-execution-data-flow-and-dependencies). Note for remote Claude Code, Claude accesses the repository where you initiate your Claude Code session. Claude does not access repositories that you have connected but have not started a session in.

55 53 

56<img src="https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/claude-code-data-flow.png?fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=4672f138596e864633b4b7c7ae4ae812" alt="Claude Code data flow diagram" data-og-width="1597" width="1597" data-og-height="1285" height="1285" data-path="images/claude-code-data-flow.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/claude-code-data-flow.png?w=280&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=5d9bdaf7ea50fc38dc01bbde7b952835 280w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/claude-code-data-flow.png?w=560&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=525736e5860ac9f262de4b40c9c68a0e 560w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/claude-code-data-flow.png?w=840&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=5262f9d1a1d0cffb0d5944e49b2d72be 840w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/claude-code-data-flow.png?w=1100&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=ec74e6b2f87b667f6d0e2278c20944de 1100w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/claude-code-data-flow.png?w=1650&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=05f11b1d061b6ddbb69969d4e535547a 1650w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/claude-code-data-flow.png?w=2500&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=9b9cce0fb5989bd1d27f143825be73ff 2500w" />54## Local Claude Code: Data flow and dependencies

55 

56The diagram below shows how Claude Code connects to external services during installation and normal operation. Solid lines indicate required connections, while dashed lines represent optional or user-initiated data flows.

57 

58<img src="https://mintcdn.com/claude-code/I9Dpo7RZuIbc86cX/images/claude-code-data-flow.svg?fit=max&auto=format&n=I9Dpo7RZuIbc86cX&q=85&s=9e77f476347e7c9983f6e211d27cf6a9" alt="Diagram showing Claude Code's external connections: install/update connects to NPM, and user requests connect to Anthropic services including Console auth, public-api, and optionally Statsig, Sentry, and bug reporting" data-og-width="720" width="720" data-og-height="520" height="520" data-path="images/claude-code-data-flow.svg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/I9Dpo7RZuIbc86cX/images/claude-code-data-flow.svg?w=280&fit=max&auto=format&n=I9Dpo7RZuIbc86cX&q=85&s=94c033b9b6db3d10b9e2d7c6d681d9dc 280w, https://mintcdn.com/claude-code/I9Dpo7RZuIbc86cX/images/claude-code-data-flow.svg?w=560&fit=max&auto=format&n=I9Dpo7RZuIbc86cX&q=85&s=430aaaf77c28c501d5753ffa456ee227 560w, https://mintcdn.com/claude-code/I9Dpo7RZuIbc86cX/images/claude-code-data-flow.svg?w=840&fit=max&auto=format&n=I9Dpo7RZuIbc86cX&q=85&s=63c3c3f160b522220a8291fe2f93f970 840w, https://mintcdn.com/claude-code/I9Dpo7RZuIbc86cX/images/claude-code-data-flow.svg?w=1100&fit=max&auto=format&n=I9Dpo7RZuIbc86cX&q=85&s=a7f6e838482f4a1a0a0b4683439369ea 1100w, https://mintcdn.com/claude-code/I9Dpo7RZuIbc86cX/images/claude-code-data-flow.svg?w=1650&fit=max&auto=format&n=I9Dpo7RZuIbc86cX&q=85&s=5fbf749c2f94babb3ef72edfb7aba1e9 1650w, https://mintcdn.com/claude-code/I9Dpo7RZuIbc86cX/images/claude-code-data-flow.svg?w=2500&fit=max&auto=format&n=I9Dpo7RZuIbc86cX&q=85&s=7a1babbdccc4986957698d9c5c30c4a8 2500w" />

57 59 

58Claude Code is installed from [NPM](https://www.npmjs.com/package/@anthropic-ai/claude-code). Claude Code runs locally. In order to interact with the LLM, Claude Code sends data over the network. This data includes all user prompts and model outputs. The data is encrypted in transit via TLS and is not encrypted at rest. Claude Code is compatible with most popular VPNs and LLM proxies.60Claude Code is installed from [NPM](https://www.npmjs.com/package/@anthropic-ai/claude-code). Claude Code runs locally. In order to interact with the LLM, Claude Code sends data over the network. This data includes all user prompts and model outputs. The data is encrypted in transit via TLS and is not encrypted at rest. Claude Code is compatible with most popular VPNs and LLM proxies.

59 61 

60Claude Code is built on Anthropic's APIs. For details regarding our API's security controls, including our API logging procedures, please refer to compliance artifacts offered in the [Anthropic Trust Center](https://trust.anthropic.com).62Claude Code is built on Anthropic's APIs. For details regarding our API's security controls, including our API logging procedures, please refer to compliance artifacts offered in the [Anthropic Trust Center](https://trust.anthropic.com).

61 63 

62### Cloud execution64### Cloud execution: Data flow and dependencies

63 

64<Note>

65 The above data flow diagram and description applies to Claude Code CLI running locally on your machine. For cloud-based sessions using Claude Code on the web, see the section below.

66</Note>

67 65 

68When using [Claude Code on the web](/en/claude-code-on-the-web), sessions run in Anthropic-managed virtual machines instead of locally. In cloud environments:66When using [Claude Code on the web](/en/claude-code-on-the-web), sessions run in Anthropic-managed virtual machines instead of locally. In cloud environments:

69 67 

70* **Code storage**: Your repository is cloned to an isolated VM and automatically deleted after session completion68* **Code and data storage:** Your repository is cloned to an isolated VM. Code and session data are subject to the retention and usage policies for your account type (see Data retention section above)

71* **Credentials**: GitHub authentication is handled through a secure proxy; your GitHub credentials never enter the sandbox69* **Credentials:** GitHub authentication is handled through a secure proxy; your GitHub credentials never enter the sandbox

72* **Network traffic**: All outbound traffic goes through a security proxy for audit logging and abuse prevention70* **Network traffic:** All outbound traffic goes through a security proxy for audit logging and abuse prevention

73* **Data retention**: Code and session data are subject to the retention and usage policies for your account type71* **Session data:** Prompts, code changes, and outputs follow the same data policies as local Claude Code usage

74* **Session data**: Prompts, code changes, and outputs follow the same data policies as local Claude Code usage

75 72 

76For security details about cloud execution, see [Security](/en/security#cloud-execution-security).73For security details about cloud execution, see [Security](/en/security#cloud-execution-security).

77 74 

desktop.md +61 −7

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Claude Code on desktop5# Claude Code on desktop

2 6 

3> Run Claude Code tasks locally or on secure cloud infrastructure with the Claude desktop app7> Run Claude Code tasks locally or on secure cloud infrastructure with the Claude desktop app


8 12 

9The Claude desktop app provides a native interface for running multiple Claude Code sessions on your local machine and seamless integration with Claude Code on the web.13The Claude desktop app provides a native interface for running multiple Claude Code sessions on your local machine and seamless integration with Claude Code on the web.

10 14 

15## Installation

16 

17Download the Claude desktop app for your platform:

18 

19<CardGroup cols={2}>

20 <Card title="macOS" icon="apple" href="https://claude.ai/api/desktop/darwin/universal/dmg/latest/redirect?utm_source=claude_code&utm_medium=docs">

21 Universal build for Intel and Apple Silicon

22 </Card>

23 

24 <Card title="Windows" icon="windows" href="https://claude.ai/api/desktop/win32/x64/exe/latest/redirect?utm_source=claude_code&utm_medium=docs">

25 For x64 processors

26 </Card>

27</CardGroup>

28 

29For Windows ARM64, [download here](https://claude.ai/api/desktop/win32/arm64/exe/latest/redirect?utm_source=claude_code\&utm_medium=docs).

30 

31<Note>

32 Local sessions are not available on Windows ARM64.

33</Note>

34 

11## Features35## Features

12 36 

13Claude Code on desktop provides:37Claude Code on desktop provides:

14 38 

39* **Diff view**: Review Claude's changes file by file before creating a pull request, and comment on specific lines to iterate further

15* **Parallel local sessions with `git` worktrees**: Run multiple Claude Code sessions simultaneously in the same repository, each with its own isolated `git` worktree40* **Parallel local sessions with `git` worktrees**: Run multiple Claude Code sessions simultaneously in the same repository, each with its own isolated `git` worktree

16* **Include `.gitignored` files in your worktrees**: Automatically copy gitignored files like `.env` to new worktrees using `.worktreeinclude`41* **Include files listed in your `.gitignore` in your worktrees**: Automatically copy files in your `.gitignore`, like `.env`, to new worktrees using `.worktreeinclude`

17* **Launch Claude Code on the web**: Kick off secure cloud sessions directly from the desktop app42* **Launch Claude Code on the web**: Kick off secure cloud sessions directly from the desktop app

18 43 

19## Installation44## Review changes with diff view

20 45 

21Download and install the Claude Desktop app from [claude.ai/download](https://claude.ai/download)46After Claude makes changes to your code, the diff view lets you review modifications file by file before creating a pull request.

22 47 

23<Note>48When Claude makes changes to files, a diff stats indicator appears showing the number of lines added and removed (for example, `+12 -1`). Click this indicator to open the diff viewer, which displays a file list on the left and the changes for each file on the right.

24 Local sessions are not available on Windows arm64 architectures.49 

25</Note>50### Comment on specific lines

51 

52Click on any line in the diff to open a comment box. Type your feedback and press **Enter** to send. In the full diff view, press **Enter** to accept each comment, then **Cmd+Enter** to send them all. Claude reads your comments and makes the requested changes, which appear as a new diff you can review.

26 53 

27## Using Git worktrees54## Using Git worktrees

28 55 


53 80 

54### Launch Claude Code on the web81### Launch Claude Code on the web

55 82 

56From the desktop app, you can kick off Claude Code sessions that run on Anthropic's secure cloud infrastructure. This is useful for:83From the desktop app, you can kick off Claude Code sessions that run on Anthropic's secure cloud infrastructure.

57 84 

58To start a web session from desktop, select a remote environment when creating a new session.85To start a web session from desktop, select a remote environment when creating a new session.

59 86 


67 The bundled Claude Code version in Desktop may differ from the latest CLI version. Desktop prioritizes stability while the CLI may have newer features.94 The bundled Claude Code version in Desktop may differ from the latest CLI version. Desktop prioritizes stability while the CLI may have newer features.

68</Note>95</Note>

69 96 

97## Environment configuration

98 

99For local environments, Claude Code on desktop automatically extracts your `$PATH` environment variable from your shell configuration. This allows local sessions to access development tools like `yarn`, `npm`, `node`, and other commands available in your terminal without additional setup.

100 

101### Custom environment variables

102 

103Select "Local" environment, then to the right, select the settings button. This will open a dialog where you can update local environment variables. This is useful for setting project-specific variables or API keys that your development workflows require. Environment variable values are masked in the UI for security reasons.

104 

105<Note>

106 Environment variables must be specified as key-value pairs, in [`.env` format](https://www.dotenv.org/). For example:

107 

108 ```

109 API_KEY=your_api_key

110 DEBUG=true

111 

112 # Multiline values - wrap in quotes

113 CERT="-----BEGIN CERT-----

114 MIIE...

115 -----END CERT-----"

116 ```

117</Note>

118 

119## Enterprise configuration

120 

121Organizations can disable local Claude Code use in the desktop application with the `isClaudeCodeForDesktopEnabled` [enterprise policy option](https://support.claude.com/en/articles/12622667-enterprise-configuration#h_003283c7cb). Additionally, Claude Code on the web can be disabled in your [admin settings](https://claude.ai/admin-settings/claude-code).

122 

70## Related resources123## Related resources

71 124 

72* [Claude Code on the web](/en/claude-code-on-the-web)125* [Claude Code on the web](/en/claude-code-on-the-web)

73* [Claude Desktop support articles](https://support.claude.com/en/collections/16163169-claude-desktop)126* [Claude Desktop support articles](https://support.claude.com/en/collections/16163169-claude-desktop)

127* [Enterprise Configuration](https://support.claude.com/en/articles/12622667-enterprise-configuration)

74* [Common workflows](/en/common-workflows)128* [Common workflows](/en/common-workflows)

75* [Settings reference](/en/settings)129* [Settings reference](/en/settings)

devcontainer.md +5 −1

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Development containers5# Development containers

2 6 

3> Learn about the Claude Code development container for teams that need consistent, secure environments.7> Learn about the Claude Code development container for teams that need consistent, secure environments.


8 12 

9<Warning>13<Warning>

10 While the devcontainer provides substantial protections, no system is completely immune to all attacks.14 While the devcontainer provides substantial protections, no system is completely immune to all attacks.

11 When executed with `--dangerously-skip-permissions`, devcontainers do not prevent a malicious project from exfiltrating anything accessible in the devcontainer including Claude Code credentials.15 When executed with `--dangerously-skip-permissions`, devcontainers don't prevent a malicious project from exfiltrating anything accessible in the devcontainer including Claude Code credentials.

12 We recommend only using devcontainers when developing with trusted repositories.16 We recommend only using devcontainers when developing with trusted repositories.

13 Always maintain good security practices and monitor Claude's activities.17 Always maintain good security practices and monitor Claude's activities.

14</Warning>18</Warning>

discover-plugins.md +393 −0 added

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

5# Discover and install prebuilt plugins through marketplaces

6 

7> Find and install plugins from marketplaces to extend Claude Code with new commands, agents, and capabilities.

8 

9Plugins extend Claude Code with skills, agents, hooks, and MCP servers. Plugin marketplaces are catalogs that help you discover and install these extensions without building them yourself.

10 

11Looking to create and distribute your own marketplace? See [Create and distribute a plugin marketplace](/en/plugin-marketplaces).

12 

13## How marketplaces work

14 

15A marketplace is a catalog of plugins that someone else has created and shared. Using a marketplace is a two-step process:

16 

17<Steps>

18 <Step title="Add the marketplace">

19 This registers the catalog with Claude Code so you can browse what's available. No plugins are installed yet.

20 </Step>

21 

22 <Step title="Install individual plugins">

23 Browse the catalog and install the plugins you want.

24 </Step>

25</Steps>

26 

27Think of it like adding an app store: adding the store gives you access to browse its collection, but you still choose which apps to download individually.

28 

29## Official Anthropic marketplace

30 

31The official Anthropic marketplace (`claude-plugins-official`) is automatically available when you start Claude Code. Run `/plugin` and go to the **Discover** tab to browse what's available.

32 

33To install a plugin from the official marketplace:

34 

35```shell theme={null}

36/plugin install plugin-name@claude-plugins-official

37```

38 

39<Note>

40 The official marketplace is maintained by Anthropic. To distribute your own plugins, [create your own marketplace](/en/plugin-marketplaces) and share it with users.

41</Note>

42 

43The official marketplace includes several categories of plugins:

44 

45### Code intelligence

46 

47Code intelligence plugins enable Claude Code's built-in LSP tool, giving Claude the ability to jump to definitions, find references, and see type errors immediately after edits. These plugins configure [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) connections, the same technology that powers VS Code's code intelligence.

48 

49These plugins require the language server binary to be installed on your system. If you already have a language server installed, Claude may prompt you to install the corresponding plugin when you open a project.

50 

51| Language | Plugin | Binary required |

52| :--------- | :------------------ | :--------------------------- |

53| C/C++ | `clangd-lsp` | `clangd` |

54| C# | `csharp-lsp` | `csharp-ls` |

55| Go | `gopls-lsp` | `gopls` |

56| Java | `jdtls-lsp` | `jdtls` |

57| Kotlin | `kotlin-lsp` | `kotlin-language-server` |

58| Lua | `lua-lsp` | `lua-language-server` |

59| PHP | `php-lsp` | `intelephense` |

60| Python | `pyright-lsp` | `pyright-langserver` |

61| Rust | `rust-analyzer-lsp` | `rust-analyzer` |

62| Swift | `swift-lsp` | `sourcekit-lsp` |

63| TypeScript | `typescript-lsp` | `typescript-language-server` |

64 

65You can also [create your own LSP plugin](/en/plugins-reference#lsp-servers) for other languages.

66 

67<Note>

68 If you see `Executable not found in $PATH` in the `/plugin` Errors tab after installing a plugin, install the required binary from the table above.

69</Note>

70 

71#### What Claude gains from code intelligence plugins

72 

73Once a code intelligence plugin is installed and its language server binary is available, Claude gains two capabilities:

74 

75* **Automatic diagnostics**: after every file edit Claude makes, the language server analyzes the changes and reports errors and warnings back automatically. Claude sees type errors, missing imports, and syntax issues without needing to run a compiler or linter. If Claude introduces an error, it notices and fixes the issue in the same turn. This requires no configuration beyond installing the plugin. You can see diagnostics inline by pressing **Ctrl+O** when the "diagnostics found" indicator appears.

76* **Code navigation**: Claude can use the language server to jump to definitions, find references, get type info on hover, list symbols, find implementations, and trace call hierarchies. These operations give Claude more precise navigation than grep-based search, though availability may vary by language and environment.

77 

78If you run into issues, see [Code intelligence troubleshooting](#code-intelligence-issues).

79 

80### External integrations

81 

82These plugins bundle pre-configured [MCP servers](/en/mcp) so you can connect Claude to external services without manual setup:

83 

84* **Source control**: `github`, `gitlab`

85* **Project management**: `atlassian` (Jira/Confluence), `asana`, `linear`, `notion`

86* **Design**: `figma`

87* **Infrastructure**: `vercel`, `firebase`, `supabase`

88* **Communication**: `slack`

89* **Monitoring**: `sentry`

90 

91### Development workflows

92 

93Plugins that add commands and agents for common development tasks:

94 

95* **commit-commands**: Git commit workflows including commit, push, and PR creation

96* **pr-review-toolkit**: Specialized agents for reviewing pull requests

97* **agent-sdk-dev**: Tools for building with the Claude Agent SDK

98* **plugin-dev**: Toolkit for creating your own plugins

99 

100### Output styles

101 

102Customize how Claude responds:

103 

104* **explanatory-output-style**: Educational insights about implementation choices

105* **learning-output-style**: Interactive learning mode for skill building

106 

107## Try it: add the demo marketplace

108 

109Anthropic also maintains a [demo plugins marketplace](https://github.com/anthropics/claude-code/tree/main/plugins) (`claude-code-plugins`) with example plugins that show what's possible with the plugin system. Unlike the official marketplace, you need to add this one manually.

110 

111<Steps>

112 <Step title="Add the marketplace">

113 From within Claude Code, run the `plugin marketplace add` command for the `anthropics/claude-code` marketplace:

114 

115 ```shell theme={null}

116 /plugin marketplace add anthropics/claude-code

117 ```

118 

119 This downloads the marketplace catalog and makes its plugins available to you.

120 </Step>

121 

122 <Step title="Browse available plugins">

123 Run `/plugin` to open the plugin manager. This opens a tabbed interface with four tabs you can cycle through using **Tab** (or **Shift+Tab** to go backward):

124 

125 * **Discover**: browse available plugins from all your marketplaces

126 * **Installed**: view and manage your installed plugins

127 * **Marketplaces**: add, remove, or update your added marketplaces

128 * **Errors**: view any plugin loading errors

129 

130 Go to the **Discover** tab to see plugins from the marketplace you just added.

131 </Step>

132 

133 <Step title="Install a plugin">

134 Select a plugin to view its details, then choose an installation scope:

135 

136 * **User scope**: install for yourself across all projects

137 * **Project scope**: install for all collaborators on this repository

138 * **Local scope**: install for yourself in this repository only

139 

140 For example, select **commit-commands** (a plugin that adds git workflow commands) and install it to your user scope.

141 

142 You can also install directly from the command line:

143 

144 ```shell theme={null}

145 /plugin install commit-commands@anthropics-claude-code

146 ```

147 

148 See [Configuration scopes](/en/settings#configuration-scopes) to learn more about scopes.

149 </Step>

150 

151 <Step title="Use your new plugin">

152 After installing, the plugin's commands are immediately available. Plugin commands are namespaced by the plugin name, so **commit-commands** provides commands like `/commit-commands:commit`.

153 

154 Try it out by making a change to a file and running:

155 

156 ```shell theme={null}

157 /commit-commands:commit

158 ```

159 

160 This stages your changes, generates a commit message, and creates the commit.

161 

162 Each plugin works differently. Check the plugin's description in the **Discover** tab or its homepage to learn what commands and capabilities it provides.

163 </Step>

164</Steps>

165 

166The rest of this guide covers all the ways you can add marketplaces, install plugins, and manage your configuration.

167 

168## Add marketplaces

169 

170Use the `/plugin marketplace add` command to add marketplaces from different sources.

171 

172<Tip>

173 **Shortcuts**: You can use `/plugin market` instead of `/plugin marketplace`, and `rm` instead of `remove`.

174</Tip>

175 

176* **GitHub repositories**: `owner/repo` format (for example, `anthropics/claude-code`)

177* **Git URLs**: any git repository URL (GitLab, Bitbucket, self-hosted)

178* **Local paths**: directories or direct paths to `marketplace.json` files

179* **Remote URLs**: direct URLs to hosted `marketplace.json` files

180 

181### Add from GitHub

182 

183Add a GitHub repository that contains a `.claude-plugin/marketplace.json` file using the `owner/repo` format—where `owner` is the GitHub username or organization and `repo` is the repository name.

184 

185For example, `anthropics/claude-code` refers to the `claude-code` repository owned by `anthropics`:

186 

187```shell theme={null}

188/plugin marketplace add anthropics/claude-code

189```

190 

191### Add from other Git hosts

192 

193Add any git repository by providing the full URL. This works with any Git host, including GitLab, Bitbucket, and self-hosted servers:

194 

195Using HTTPS:

196 

197```shell theme={null}

198/plugin marketplace add https://gitlab.com/company/plugins.git

199```

200 

201Using SSH:

202 

203```shell theme={null}

204/plugin marketplace add git@gitlab.com:company/plugins.git

205```

206 

207To add a specific branch or tag, append `#` followed by the ref:

208 

209```shell theme={null}

210/plugin marketplace add https://gitlab.com/company/plugins.git#v1.0.0

211```

212 

213### Add from local paths

214 

215Add a local directory that contains a `.claude-plugin/marketplace.json` file:

216 

217```shell theme={null}

218/plugin marketplace add ./my-marketplace

219```

220 

221You can also add a direct path to a `marketplace.json` file:

222 

223```shell theme={null}

224/plugin marketplace add ./path/to/marketplace.json

225```

226 

227### Add from remote URLs

228 

229Add a remote `marketplace.json` file via URL:

230 

231```shell theme={null}

232/plugin marketplace add https://example.com/marketplace.json

233```

234 

235<Note>

236 URL-based marketplaces have some limitations compared to Git-based marketplaces. If you encounter "path not found" errors when installing plugins, see [Troubleshooting](/en/plugin-marketplaces#plugins-with-relative-paths-fail-in-url-based-marketplaces).

237</Note>

238 

239## Install plugins

240 

241Once you've added marketplaces, you can install plugins directly (installs to user scope by default):

242 

243```shell theme={null}

244/plugin install plugin-name@marketplace-name

245```

246 

247To choose a different [installation scope](/en/settings#configuration-scopes), use the interactive UI: run `/plugin`, go to the **Discover** tab, and press **Enter** on a plugin. You'll see options for:

248 

249* **User scope** (default): install for yourself across all projects

250* **Project scope**: install for all collaborators on this repository (adds to `.claude/settings.json`)

251* **Local scope**: install for yourself in this repository only (not shared with collaborators)

252 

253You may also see plugins with **managed** scope—these are installed by administrators via [managed settings](/en/settings#settings-files) and cannot be modified.

254 

255Run `/plugin` and go to the **Installed** tab to see your plugins grouped by scope.

256 

257<Warning>

258 Make sure you trust a plugin before installing it. Anthropic does not control what MCP servers, files, or other software are included in plugins and cannot verify that they work as intended. Check each plugin's homepage for more information.

259</Warning>

260 

261## Manage installed plugins

262 

263Run `/plugin` and go to the **Installed** tab to view, enable, disable, or uninstall your plugins. Type to filter the list by plugin name or description.

264 

265You can also manage plugins with direct commands.

266 

267Disable a plugin without uninstalling:

268 

269```shell theme={null}

270/plugin disable plugin-name@marketplace-name

271```

272 

273Re-enable a disabled plugin:

274 

275```shell theme={null}

276/plugin enable plugin-name@marketplace-name

277```

278 

279Completely remove a plugin:

280 

281```shell theme={null}

282/plugin uninstall plugin-name@marketplace-name

283```

284 

285The `--scope` option lets you target a specific scope with CLI commands:

286 

287```shell theme={null}

288claude plugin install formatter@your-org --scope project

289claude plugin uninstall formatter@your-org --scope project

290```

291 

292## Manage marketplaces

293 

294You can manage marketplaces through the interactive `/plugin` interface or with CLI commands.

295 

296### Use the interactive interface

297 

298Run `/plugin` and go to the **Marketplaces** tab to:

299 

300* View all your added marketplaces with their sources and status

301* Add new marketplaces

302* Update marketplace listings to fetch the latest plugins

303* Remove marketplaces you no longer need

304 

305### Use CLI commands

306 

307You can also manage marketplaces with direct commands.

308 

309List all configured marketplaces:

310 

311```shell theme={null}

312/plugin marketplace list

313```

314 

315Refresh plugin listings from a marketplace:

316 

317```shell theme={null}

318/plugin marketplace update marketplace-name

319```

320 

321Remove a marketplace:

322 

323```shell theme={null}

324/plugin marketplace remove marketplace-name

325```

326 

327<Warning>

328 Removing a marketplace will uninstall any plugins you installed from it.

329</Warning>

330 

331### Configure auto-updates

332 

333Claude Code can automatically update marketplaces and their installed plugins at startup. When auto-update is enabled for a marketplace, Claude Code refreshes the marketplace data and updates installed plugins to their latest versions. If any plugins were updated, you'll see a notification suggesting you restart Claude Code.

334 

335Toggle auto-update for individual marketplaces through the UI:

336 

3371. Run `/plugin` to open the plugin manager

3382. Select **Marketplaces**

3393. Choose a marketplace from the list

3404. Select **Enable auto-update** or **Disable auto-update**

341 

342Official Anthropic marketplaces have auto-update enabled by default. Third-party and local development marketplaces have auto-update disabled by default.

343 

344To disable all automatic updates entirely for both Claude Code and all plugins, set the `DISABLE_AUTOUPDATER` environment variable. See [Auto updates](/en/setup#auto-updates) for details.

345 

346To keep plugin auto-updates enabled while disabling Claude Code auto-updates, set `FORCE_AUTOUPDATE_PLUGINS=true` along with `DISABLE_AUTOUPDATER`:

347 

348```shell theme={null}

349export DISABLE_AUTOUPDATER=true

350export FORCE_AUTOUPDATE_PLUGINS=true

351```

352 

353This is useful when you want to manage Claude Code updates manually but still receive automatic plugin updates.

354 

355## Configure team marketplaces

356 

357Team admins can set up automatic marketplace installation for projects by adding marketplace configuration to `.claude/settings.json`. When team members trust the repository folder, Claude Code prompts them to install these marketplaces and plugins.

358 

359For full configuration options including `extraKnownMarketplaces` and `enabledPlugins`, see [Plugin settings](/en/settings#plugin-settings).

360 

361## Troubleshooting

362 

363### /plugin command not recognized

364 

365If you see "unknown command" or the `/plugin` command doesn't appear:

366 

3671. **Check your version**: Run `claude --version`. Plugins require version 1.0.33 or later.

3682. **Update Claude Code**:

369 * **Homebrew**: `brew upgrade claude-code`

370 * **npm**: `npm update -g @anthropic-ai/claude-code`

371 * **Native installer**: Re-run the install command from [Setup](/en/setup)

3723. **Restart Claude Code**: After updating, restart your terminal and run `claude` again.

373 

374### Common issues

375 

376* **Marketplace not loading**: Verify the URL is accessible and that `.claude-plugin/marketplace.json` exists at the path

377* **Plugin installation failures**: Check that plugin source URLs are accessible and repositories are public (or you have access)

378* **Files not found after installation**: Plugins are copied to a cache, so paths referencing files outside the plugin directory won't work

379* **Plugin skills not appearing**: Clear the cache with `rm -rf ~/.claude/plugins/cache`, restart Claude Code, and reinstall the plugin.

380 

381For detailed troubleshooting with solutions, see [Troubleshooting](/en/plugin-marketplaces#troubleshooting) in the marketplace guide. For debugging tools, see [Debugging and development tools](/en/plugins-reference#debugging-and-development-tools).

382 

383### Code intelligence issues

384 

385* **Language server not starting**: verify the binary is installed and available in your `$PATH`. Check the `/plugin` Errors tab for details.

386* **High memory usage**: language servers like `rust-analyzer` and `pyright` can consume significant memory on large projects. If you experience memory issues, disable the plugin with `/plugin disable <plugin-name>` and rely on Claude's built-in search tools instead.

387* **False positive diagnostics in monorepos**: language servers may report unresolved import errors for internal packages if the workspace isn't configured correctly. These don't affect Claude's ability to edit code.

388 

389## Next steps

390 

391* **Build your own plugins**: See [Plugins](/en/plugins) to create skills, agents, and hooks

392* **Create a marketplace**: See [Create a plugin marketplace](/en/plugin-marketplaces) to distribute plugins to your team or community

393* **Technical reference**: See [Plugins reference](/en/plugins-reference) for complete specifications

features-overview.md +247 −0 added

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

5# Extend Claude Code

6 

7> Understand when to use CLAUDE.md, Skills, subagents, hooks, MCP, and plugins.

8 

9Claude Code combines a model that reasons about your code with [built-in tools](/en/how-claude-code-works#tools) for file operations, search, execution, and web access. The built-in tools cover most coding tasks. This guide covers the extension layer: features you add to customize what Claude knows, connect it to external services, and automate workflows.

10 

11<Note>

12 For how the core agentic loop works, see [How Claude Code works](/en/how-claude-code-works).

13</Note>

14 

15**New to Claude Code?** Start with [CLAUDE.md](/en/memory) for project conventions. Add other extensions as you need them.

16 

17## Overview

18 

19Extensions plug into different parts of the agentic loop:

20 

21* **[CLAUDE.md](/en/memory)** adds persistent context Claude sees every session

22* **[Skills](/en/skills)** add reusable knowledge and invocable workflows

23* **[MCP](/en/mcp)** connects Claude to external services and tools

24* **[Subagents](/en/sub-agents)** run their own loops in isolated context, returning summaries

25* **[Hooks](/en/hooks)** run outside the loop entirely as deterministic scripts

26* **[Plugins](/en/plugins)** and **[marketplaces](/en/plugin-marketplaces)** package and distribute these features

27 

28[Skills](/en/skills) are the most flexible extension. A skill is a markdown file containing knowledge, workflows, or instructions. You can invoke skills with a slash command like `/deploy`, or Claude can load them automatically when relevant. Skills can run in your current conversation or in an isolated context via subagents.

29 

30## Match features to your goal

31 

32Features range from always-on context that Claude sees every session, to on-demand capabilities you or Claude can invoke, to background automation that runs on specific events. The table below shows what's available and when each one makes sense.

33 

34| Feature | What it does | When to use it | Example |

35| ------------- | ---------------------------------------------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------- |

36| **CLAUDE.md** | Persistent context loaded every conversation | Project conventions, "always do X" rules | "Use pnpm, not npm. Run tests before committing." |

37| **Skill** | Instructions, knowledge, and workflows Claude can use | Reusable content, reference docs, repeatable tasks | `/review` runs your code review checklist; API docs skill with endpoint patterns |

38| **Subagent** | Isolated execution context that returns summarized results | Context isolation, parallel tasks, specialized workers | Research task that reads many files but returns only key findings |

39| **MCP** | Connect to external services | External data or actions | Query your database, post to Slack, control a browser |

40| **Hook** | Deterministic script that runs on events | Predictable automation, no LLM involved | Run ESLint after every file edit |

41 

42**[Plugins](/en/plugins)** are the packaging layer. A plugin bundles skills, hooks, subagents, and MCP servers into a single installable unit. Plugin skills are namespaced (like `/my-plugin:review`) so multiple plugins can coexist. Use plugins when you want to reuse the same setup across multiple repositories or distribute to others via a **[marketplace](/en/plugin-marketplaces)**.

43 

44### Compare similar features

45 

46Some features can seem similar. Here's how to tell them apart.

47 

48<Tabs>

49 <Tab title="Skill vs Subagent">

50 Skills and subagents solve different problems:

51 

52 * **Skills** are reusable content you can load into any context

53 * **Subagents** are isolated workers that run separately from your main conversation

54 

55 | Aspect | Skill | Subagent |

56 | --------------- | ---------------------------------------------- | ---------------------------------------------------------------- |

57 | **What it is** | Reusable instructions, knowledge, or workflows | Isolated worker with its own context |

58 | **Key benefit** | Share content across contexts | Context isolation. Work happens separately, only summary returns |

59 | **Best for** | Reference material, invocable workflows | Tasks that read many files, parallel work, specialized workers |

60 

61 **Skills can be reference or action.** Reference skills provide knowledge Claude uses throughout your session (like your API style guide). Action skills tell Claude to do something specific (like `/deploy` that runs your deployment workflow).

62 

63 **Use a subagent** when you need context isolation or when your context window is getting full. The subagent might read dozens of files or run extensive searches, but your main conversation only receives a summary. Since subagent work doesn't consume your main context, this is also useful when you don't need the intermediate work to remain visible. Custom subagents can have their own instructions and can preload skills.

64 

65 **They can combine.** A subagent can preload specific skills (`skills:` field). A skill can run in isolated context using `context: fork`. See [Skills](/en/skills) for details.

66 </Tab>

67 

68 <Tab title="CLAUDE.md vs Skill">

69 Both store instructions, but they load differently and serve different purposes.

70 

71 | Aspect | CLAUDE.md | Skill |

72 | ------------------------- | ---------------------------- | --------------------------------------- |

73 | **Loads** | Every session, automatically | On demand |

74 | **Can include files** | Yes, with `@path` imports | Yes, with `@path` imports |

75 | **Can trigger workflows** | No | Yes, with `/<name>` |

76 | **Best for** | "Always do X" rules | Reference material, invocable workflows |

77 

78 **Put it in CLAUDE.md** if Claude should always know it: coding conventions, build commands, project structure, "never do X" rules.

79 

80 **Put it in a skill** if it's reference material Claude needs sometimes (API docs, style guides) or a workflow you trigger with `/<name>` (deploy, review, release).

81 

82 **Rule of thumb:** Keep CLAUDE.md under \~500 lines. If it's growing, move reference content to skills.

83 </Tab>

84 

85 <Tab title="MCP vs Skill">

86 MCP connects Claude to external services. Skills extend what Claude knows, including how to use those services effectively.

87 

88 | Aspect | MCP | Skill |

89 | -------------- | ---------------------------------------------------- | ------------------------------------------------------- |

90 | **What it is** | Protocol for connecting to external services | Knowledge, workflows, and reference material |

91 | **Provides** | Tools and data access | Knowledge, workflows, reference material |

92 | **Examples** | Slack integration, database queries, browser control | Code review checklist, deploy workflow, API style guide |

93 

94 These solve different problems and work well together:

95 

96 **MCP** gives Claude the ability to interact with external systems. Without MCP, Claude can't query your database or post to Slack.

97 

98 **Skills** give Claude knowledge about how to use those tools effectively, plus workflows you can trigger with `/<name>`. A skill might include your team's database schema and query patterns, or a `/post-to-slack` workflow with your team's message formatting rules.

99 

100 Example: An MCP server connects Claude to your database. A skill teaches Claude your data model, common query patterns, and which tables to use for different tasks.

101 </Tab>

102</Tabs>

103 

104### Understand how features layer

105 

106Features can be defined at multiple levels: user-wide, per-project, via plugins, or through managed policies. You can also nest CLAUDE.md files in subdirectories or place skills in specific packages of a monorepo. When the same feature exists at multiple levels, here's how they layer:

107 

108* **CLAUDE.md files** are additive: all levels contribute content to Claude's context simultaneously. Files from your working directory and above load at launch; subdirectories load as you work in them. When instructions conflict, Claude uses judgment to reconcile them, with more specific instructions typically taking precedence. See [how Claude looks up memories](/en/memory#how-claude-looks-up-memories).

109* **Skills and subagents** override by name: when the same name exists at multiple levels, one definition wins based on priority (managed > user > project for skills; managed > CLI flag > project > user > plugin for subagents). Plugin skills are [namespaced](/en/plugins#add-skills-to-your-plugin) to avoid conflicts. See [skill discovery](/en/skills#where-skills-live) and [subagent scope](/en/sub-agents#choose-the-subagent-scope).

110* **MCP servers** override by name: local > project > user. See [MCP scope](/en/mcp#scope-hierarchy-and-precedence).

111* **Hooks** merge: all registered hooks fire for their matching events regardless of source. See [hooks](/en/hooks).

112 

113### Combine features

114 

115Each extension solves a different problem: CLAUDE.md handles always-on context, skills handle on-demand knowledge and workflows, MCP handles external connections, subagents handle isolation, and hooks handle automation. Real setups combine them based on your workflow.

116 

117For example, you might use CLAUDE.md for project conventions, a skill for your deployment workflow, MCP to connect to your database, and a hook to run linting after every edit. Each feature handles what it's best at.

118 

119| Pattern | How it works | Example |

120| ---------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |

121| **Skill + MCP** | MCP provides the connection; a skill teaches Claude how to use it well | MCP connects to your database, a skill documents your schema and query patterns |

122| **Skill + Subagent** | A skill spawns subagents for parallel work | `/review` skill kicks off security, performance, and style subagents that work in isolated context |

123| **CLAUDE.md + Skills** | CLAUDE.md holds always-on rules; skills hold reference material loaded on demand | CLAUDE.md says "follow our API conventions," a skill contains the full API style guide |

124| **Hook + MCP** | A hook triggers external actions through MCP | Post-edit hook sends a Slack notification when Claude modifies critical files |

125 

126## Understand context costs

127 

128Every feature you add consumes some of Claude's context. Too much can fill up your context window, but it can also add noise that makes Claude less effective; skills may not trigger correctly, or Claude may lose track of your conventions. Understanding these trade-offs helps you build an effective setup.

129 

130### Context cost by feature

131 

132Each feature has a different loading strategy and context cost:

133 

134| Feature | When it loads | What loads | Context cost |

135| --------------- | ------------------------- | --------------------------------------------- | -------------------------------------------- |

136| **CLAUDE.md** | Session start | Full content | Every request |

137| **Skills** | Session start + when used | Descriptions at start, full content when used | Low (descriptions every request)\* |

138| **MCP servers** | Session start | All tool definitions and schemas | Every request |

139| **Subagents** | When spawned | Fresh context with specified skills | Isolated from main session |

140| **Hooks** | On trigger | Nothing (runs externally) | Zero, unless hook returns additional context |

141 

142\*By default, skill descriptions load at session start so Claude can decide when to use them. Set `disable-model-invocation: true` in a skill's frontmatter to hide it from Claude entirely until you invoke it manually. This reduces context cost to zero for skills you only trigger yourself.

143 

144### Understand how features load

145 

146Each feature loads at different points in your session. The tabs below explain when each one loads and what goes into context.

147 

148<img src="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=bd2e24b8e6a99b31ecfffb63f5b23bf5" alt="Context loading: CLAUDE.md and MCP load at session start and stay in every request. Skills load descriptions at start, full content on invocation. Subagents get isolated context. Hooks run externally." data-og-width="720" width="720" data-og-height="410" height="410" data-path="images/context-loading.svg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=280&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=aebaadd1f484f285dd9cb4e0ea6d49b9 280w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=560&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=030c9b46126d750de315612560082727 560w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=840&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=6c73f8b0389da4f3190843140c810fe9 840w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=1100&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=9844c55d08d2c386672447f2e8518669 1100w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=1650&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=21a9522d0e4bd10ced146aab850ede76 1650w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/context-loading.svg?w=2500&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=d318525915aee1a1a6a4215cfaa61fb9 2500w" />

149 

150<Tabs>

151 <Tab title="CLAUDE.md">

152 **When:** Session start

153 

154 **What loads:** Full content of all CLAUDE.md files (managed, user, and project levels).

155 

156 **Inheritance:** Claude reads CLAUDE.md files from your working directory up to the root, and discovers nested ones in subdirectories as it accesses those files. See [How Claude looks up memories](/en/memory#how-claude-looks-up-memories) for details.

157 

158 <Tip>Keep CLAUDE.md under \~500 lines. Move reference material to skills, which load on-demand.</Tip>

159 </Tab>

160 

161 <Tab title="Skills">

162 Skills are extra capabilities in Claude's toolkit. They can be reference material (like an API style guide) or invocable workflows you trigger with `/<name>` (like `/deploy`). Some are built-in; you can also create your own. Claude uses skills when appropriate, or you can invoke one directly.

163 

164 **When:** Depends on the skill's configuration. By default, descriptions load at session start and full content loads when used. For user-only skills (`disable-model-invocation: true`), nothing loads until you invoke them.

165 

166 **What loads:** For model-invocable skills, Claude sees names and descriptions in every request. When you invoke a skill with `/<name>` or Claude loads it automatically, the full content loads into your conversation.

167 

168 **How Claude chooses skills:** Claude matches your task against skill descriptions to decide which are relevant. If descriptions are vague or overlap, Claude may load the wrong skill or miss one that would help. To tell Claude to use a specific skill, invoke it with `/<name>`. Skills with `disable-model-invocation: true` are invisible to Claude until you invoke them.

169 

170 **Context cost:** Low until used. User-only skills have zero cost until invoked.

171 

172 **In subagents:** Skills work differently in subagents. Instead of on-demand loading, skills passed to a subagent are fully preloaded into its context at launch. Subagents don't inherit skills from the main session; you must specify them explicitly.

173 

174 <Tip>Use `disable-model-invocation: true` for skills with side effects. This saves context and ensures only you trigger them.</Tip>

175 </Tab>

176 

177 <Tab title="MCP servers">

178 **When:** Session start.

179 

180 **What loads:** All tool definitions and JSON schemas from connected servers.

181 

182 **Context cost:** [Tool search](/en/mcp#scale-with-mcp-tool-search) (enabled by default) loads MCP tools up to 10% of context and defers the rest until needed.

183 

184 **Reliability note:** MCP connections can fail silently mid-session. If a server disconnects, its tools disappear without warning. Claude may try to use a tool that no longer exists. If you notice Claude failing to use an MCP tool it previously could access, check the connection with `/mcp`.

185 

186 <Tip>Run `/mcp` to see token costs per server. Disconnect servers you're not actively using.</Tip>

187 </Tab>

188 

189 <Tab title="Subagents">

190 **When:** On demand, when you or Claude spawns one for a task.

191 

192 **What loads:** Fresh, isolated context containing:

193 

194 * The system prompt (shared with parent for cache efficiency)

195 * Full content of skills listed in the agent's `skills:` field

196 * CLAUDE.md and git status (inherited from parent)

197 * Whatever context the lead agent passes in the prompt

198 

199 **Context cost:** Isolated from main session. Subagents don't inherit your conversation history or invoked skills.

200 

201 <Tip>Use subagents for work that doesn't need your full conversation context. Their isolation prevents bloating your main session.</Tip>

202 </Tab>

203 

204 <Tab title="Hooks">

205 **When:** On trigger. Hooks can run before or after tool executions, at session start, before compaction, and at other lifecycle events. See [Hooks](/en/hooks) for the full list.

206 

207 **What loads:** Nothing by default. Hooks run as external scripts.

208 

209 **Context cost:** Zero, unless the hook returns output that gets added as messages to your conversation.

210 

211 <Tip>Hooks are ideal for side effects (linting, logging) that don't need to affect Claude's context.</Tip>

212 </Tab>

213</Tabs>

214 

215## Learn more

216 

217Each feature has its own guide with setup instructions, examples, and configuration options.

218 

219<CardGroup cols={2}>

220 <Card title="CLAUDE.md" icon="file-lines" href="/en/memory">

221 Store project context, conventions, and instructions

222 </Card>

223 

224 <Card title="Skills" icon="brain" href="/en/skills">

225 Give Claude domain expertise and reusable workflows

226 </Card>

227 

228 <Card title="Subagents" icon="users" href="/en/sub-agents">

229 Offload work to isolated context

230 </Card>

231 

232 <Card title="MCP" icon="plug" href="/en/mcp">

233 Connect Claude to external services

234 </Card>

235 

236 <Card title="Hooks" icon="bolt" href="/en/hooks">

237 Run scripts on Claude Code events

238 </Card>

239 

240 <Card title="Plugins" icon="puzzle-piece" href="/en/plugins">

241 Bundle and share feature sets

242 </Card>

243 

244 <Card title="Marketplaces" icon="store" href="/en/plugin-marketplaces">

245 Host and distribute plugin collections

246 </Card>

247</CardGroup>

github-actions.md +16 −13

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Claude Code GitHub Actions5# Claude Code GitHub Actions

2 6 

3> Learn about integrating Claude Code into your development workflow with Claude Code GitHub Actions7> Learn about integrating Claude Code into your development workflow with Claude Code GitHub Actions


673. **Copy the workflow file** from [examples/claude.yml](https://github.com/anthropics/claude-code-action/blob/main/examples/claude.yml) into your repository's `.github/workflows/`713. **Copy the workflow file** from [examples/claude.yml](https://github.com/anthropics/claude-code-action/blob/main/examples/claude.yml) into your repository's `.github/workflows/`

68 72 

69<Tip>73<Tip>

70 After completing either the quickstart or manual setup, test the action by74 After completing either the quickstart or manual setup, test the action by tagging `@claude` in an issue or PR comment.

71 tagging `@claude` in an issue or PR comment!

72</Tip>75</Tip>

73 76 

74## Upgrading from Beta77## Upgrading from Beta


91### Breaking Changes Reference94### Breaking Changes Reference

92 95 

93| Old Beta Input | New v1.0 Input |96| Old Beta Input | New v1.0 Input |

94| --------------------- | -------------------------------- |97| --------------------- | ------------------------------------- |

95| `mode` | *(Removed - auto-detected)* |98| `mode` | *(Removed - auto-detected)* |

96| `direct_prompt` | `prompt` |99| `direct_prompt` | `prompt` |

97| `override_prompt` | `prompt` with GitHub variables |100| `override_prompt` | `prompt` with GitHub variables |

98| `custom_instructions` | `claude_args: --system-prompt` |101| `custom_instructions` | `claude_args: --append-system-prompt` |

99| `max_turns` | `claude_args: --max-turns` |102| `max_turns` | `claude_args: --max-turns` |

100| `model` | `claude_args: --model` |103| `model` | `claude_args: --model` |

101| `allowed_tools` | `claude_args: --allowedTools` |104| `allowed_tools` | `claude_args: --allowedTools` |


125 prompt: "Review this PR for security issues"128 prompt: "Review this PR for security issues"

126 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}129 anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

127 claude_args: |130 claude_args: |

128 --system-prompt "Follow our coding standards"131 --append-system-prompt "Follow our coding standards"

129 --max-turns 10132 --max-turns 10

130 --model claude-sonnet-4-5-20250929133 --model claude-sonnet-4-5-20250929

131```134```


157 # Responds to @claude mentions in comments160 # Responds to @claude mentions in comments

158```161```

159 162 

160### Using slash commands163### Using skills

161 164 

162```yaml theme={null}165```yaml theme={null}

163name: Code Review166name: Code Review


213 216 

214### Security considerations217### Security considerations

215 218 

216<Warning>Never commit API keys directly to your repository!</Warning>219<Warning>Never commit API keys directly to your repository.</Warning>

217 220 

218For comprehensive security guidance including permissions, authentication, and best practices, see the [Claude Code Action security documentation](https://github.com/anthropics/claude-code-action/blob/main/docs/security.md).221For comprehensive security guidance including permissions, authentication, and best practices, see the [Claude Code Action security documentation](https://github.com/anthropics/claude-code-action/blob/main/docs/security.md).

219 222 


224* Limit action permissions to only what's necessary227* Limit action permissions to only what's necessary

225* Review Claude's suggestions before merging228* Review Claude's suggestions before merging

226 229 

227Always use GitHub Secrets (e.g., `${{ secrets.ANTHROPIC_API_KEY }}`) rather than hardcoding API keys directly in your workflow files.230Always use GitHub Secrets (for example, `${{ secrets.ANTHROPIC_API_KEY }}`) rather than hardcoding API keys directly in your workflow files.

228 231 

229### Optimizing performance232### Optimizing performance

230 233 


267Key features:270Key features:

268 271 

269* **Unified prompt interface** - Use `prompt` for all instructions272* **Unified prompt interface** - Use `prompt` for all instructions

270* **Slash commands** - Pre-built prompts like `/review` or `/fix`273* **Commands** - Prebuilt prompts like `/review` or `/fix`

271* **CLI passthrough** - Any Claude Code CLI argument via `claude_args`274* **CLI passthrough** - Any Claude Code CLI argument via `claude_args`

272* **Flexible triggers** - Works with any GitHub event275* **Flexible triggers** - Works with any GitHub event

273 276 


625The Claude Code Action v1 uses a simplified configuration:628The Claude Code Action v1 uses a simplified configuration:

626 629 

627| Parameter | Description | Required |630| Parameter | Description | Required |

628| ------------------- | ----------------------------------------------- | -------- |631| ------------------- | ------------------------------------------------------ | -------- |

629| `prompt` | Instructions for Claude (text or slash command) | No\* |632| `prompt` | Instructions for Claude (text or skill like `/review`) | No\* |

630| `claude_args` | CLI arguments passed to Claude Code | No |633| `claude_args` | CLI arguments passed to Claude Code | No |

631| `anthropic_api_key` | Claude API key | Yes\*\* |634| `anthropic_api_key` | Claude API key | Yes\*\* |

632| `github_token` | GitHub token for API access | No |635| `github_token` | GitHub token for API access | No |


637\*Prompt is optional - when omitted for issue/PR comments, Claude responds to trigger phrase\640\*Prompt is optional - when omitted for issue/PR comments, Claude responds to trigger phrase\

638\*\*Required for direct Claude API, not for Bedrock/Vertex641\*\*Required for direct Claude API, not for Bedrock/Vertex

639 642 

640#### Using claude\_args643#### Pass CLI arguments

641 644 

642The `claude_args` parameter accepts any Claude Code CLI arguments:645The `claude_args` parameter accepts any Claude Code CLI arguments:

643 646 


648Common arguments:651Common arguments:

649 652 

650* `--max-turns`: Maximum conversation turns (default: 10)653* `--max-turns`: Maximum conversation turns (default: 10)

651* `--model`: Model to use (e.g., `claude-sonnet-4-5-20250929`)654* `--model`: Model to use (for example, `claude-sonnet-4-5-20250929`)

652* `--mcp-config`: Path to MCP configuration655* `--mcp-config`: Path to MCP configuration

653* `--allowed-tools`: Comma-separated list of allowed tools656* `--allowed-tools`: Comma-separated list of allowed tools

654* `--debug`: Enable debug output657* `--debug`: Enable debug output

gitlab-ci-cd.md +14 −10

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Claude Code GitLab CI/CD5# Claude Code GitLab CI/CD

2 6 

3> Learn about integrating Claude Code into your development workflow with GitLab CI/CD7> Learn about integrating Claude Code into your development workflow with GitLab CI/CD


77 before_script:81 before_script:

78 - apk update82 - apk update

79 - apk add --no-cache git curl bash83 - apk add --no-cache git curl bash

80 - npm install -g @anthropic-ai/claude-code84 - curl -fsSL https://claude.ai/install.sh | bash

81 script:85 script:

82 # Optional: start a GitLab MCP server if your setup provides one86 # Optional: start a GitLab MCP server if your setup provides one

83 - /bin/gitlab-mcp-server || true87 - /bin/gitlab-mcp-server || true


87 claude91 claude

88 -p "${AI_FLOW_INPUT:-'Review this MR and implement the requested changes'}"92 -p "${AI_FLOW_INPUT:-'Review this MR and implement the requested changes'}"

89 --permission-mode acceptEdits93 --permission-mode acceptEdits

90 --allowedTools "Bash(*) Read(*) Edit(*) Write(*) mcp__gitlab"94 --allowedTools "Bash Read Edit Write mcp__gitlab"

91 --debug95 --debug

92```96```

93 97 


255 before_script:259 before_script:

256 - apk update260 - apk update

257 - apk add --no-cache git curl bash261 - apk add --no-cache git curl bash

258 - npm install -g @anthropic-ai/claude-code262 - curl -fsSL https://claude.ai/install.sh | bash

259 script:263 script:

260 - /bin/gitlab-mcp-server || true264 - /bin/gitlab-mcp-server || true

261 - >265 - >

262 claude266 claude

263 -p "${AI_FLOW_INPUT:-'Summarize recent changes and suggest improvements'}"267 -p "${AI_FLOW_INPUT:-'Summarize recent changes and suggest improvements'}"

264 --permission-mode acceptEdits268 --permission-mode acceptEdits

265 --allowedTools "Bash(*) Read(*) Edit(*) Write(*) mcp__gitlab"269 --allowedTools "Bash Read Edit Write mcp__gitlab"

266 --debug270 --debug

267 # Claude Code will use ANTHROPIC_API_KEY from CI/CD variables271 # Claude Code will use ANTHROPIC_API_KEY from CI/CD variables

268```272```


289 before_script:293 before_script:

290 - apk add --no-cache bash curl jq git python3 py3-pip294 - apk add --no-cache bash curl jq git python3 py3-pip

291 - pip install --no-cache-dir awscli295 - pip install --no-cache-dir awscli

292 - npm install -g @anthropic-ai/claude-code296 - curl -fsSL https://claude.ai/install.sh | bash

293 # Exchange GitLab OIDC token for AWS credentials297 # Exchange GitLab OIDC token for AWS credentials

294 - export AWS_WEB_IDENTITY_TOKEN_FILE="${CI_JOB_JWT_FILE:-/tmp/oidc_token}"298 - export AWS_WEB_IDENTITY_TOKEN_FILE="${CI_JOB_JWT_FILE:-/tmp/oidc_token}"

295 - if [ -n "${CI_JOB_JWT_V2}" ]; then printf "%s" "$CI_JOB_JWT_V2" > "$AWS_WEB_IDENTITY_TOKEN_FILE"; fi299 - if [ -n "${CI_JOB_JWT_V2}" ]; then printf "%s" "$CI_JOB_JWT_V2" > "$AWS_WEB_IDENTITY_TOKEN_FILE"; fi


308 claude312 claude

309 -p "${AI_FLOW_INPUT:-'Implement the requested changes and open an MR'}"313 -p "${AI_FLOW_INPUT:-'Implement the requested changes and open an MR'}"

310 --permission-mode acceptEdits314 --permission-mode acceptEdits

311 --allowedTools "Bash(*) Read(*) Edit(*) Write(*) mcp__gitlab"315 --allowedTools "Bash Read Edit Write mcp__gitlab"

312 --debug316 --debug

313 variables:317 variables:

314 AWS_REGION: "us-west-2"318 AWS_REGION: "us-west-2"


339 rules:343 rules:

340 - if: '$CI_PIPELINE_SOURCE == "web"'344 - if: '$CI_PIPELINE_SOURCE == "web"'

341 before_script:345 before_script:

342 - apt-get update && apt-get install -y git nodejs npm && apt-get clean346 - apt-get update && apt-get install -y git && apt-get clean

343 - npm install -g @anthropic-ai/claude-code347 - curl -fsSL https://claude.ai/install.sh | bash

344 # Authenticate to Google Cloud via WIF (no downloaded keys)348 # Authenticate to Google Cloud via WIF (no downloaded keys)

345 - >349 - >

346 gcloud auth login --cred-file=<(cat <<EOF350 gcloud auth login --cred-file=<(cat <<EOF


361 claude365 claude

362 -p "${AI_FLOW_INPUT:-'Review and update code as requested'}"366 -p "${AI_FLOW_INPUT:-'Review and update code as requested'}"

363 --permission-mode acceptEdits367 --permission-mode acceptEdits

364 --allowedTools "Bash(*) Read(*) Edit(*) Write(*) mcp__gitlab"368 --allowedTools "Bash Read Edit Write mcp__gitlab"

365 --debug369 --debug

366 variables:370 variables:

367 CLOUD_ML_REGION: "us-east5"371 CLOUD_ML_REGION: "us-east5"


379 383 

380### Security considerations384### Security considerations

381 385 

382Never commit API keys or cloud credentials to your repository! Always use GitLab CI/CD variables:386**Never commit API keys or cloud credentials to your repository**. Always use GitLab CI/CD variables:

383 387 

384* Add `ANTHROPIC_API_KEY` as a masked variable (and protect it if needed)388* Add `ANTHROPIC_API_KEY` as a masked variable (and protect it if needed)

385* Use provider-specific OIDC where possible (no long-lived keys)389* Use provider-specific OIDC where possible (no long-lived keys)

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Claude Code on Google Vertex AI5# Claude Code on Google Vertex AI

2 6 

3> Learn about configuring Claude Code through Google Vertex AI, including setup, IAM configuration, and troubleshooting.7> Learn about configuring Claude Code through Google Vertex AI, including setup, IAM configuration, and troubleshooting.


8 12 

9* A Google Cloud Platform (GCP) account with billing enabled13* A Google Cloud Platform (GCP) account with billing enabled

10* A GCP project with Vertex AI API enabled14* A GCP project with Vertex AI API enabled

11* Access to desired Claude models (e.g., Claude Sonnet 4.5)15* Access to desired Claude models (for example, Claude Sonnet 4.5)

12* Google Cloud SDK (`gcloud`) installed and configured16* Google Cloud SDK (`gcloud`) installed and configured

13* Quota allocated in desired GCP region17* Quota allocated in desired GCP region

14 18 


44 48 

451. Navigate to the [Vertex AI Model Garden](https://console.cloud.google.com/vertex-ai/model-garden)491. Navigate to the [Vertex AI Model Garden](https://console.cloud.google.com/vertex-ai/model-garden)

462. Search for "Claude" models502. Search for "Claude" models

473. Request access to desired Claude models (e.g., Claude Sonnet 4.5)513. Request access to desired Claude models (for example, Claude Sonnet 4.5)

484. Wait for approval (may take 24-48 hours)524. Wait for approval (may take 24-48 hours)

49 53 

50### 3. Configure GCP credentials54### 3. Configure GCP credentials


99| Small/fast model | `claude-haiku-4-5@20251001` |103| Small/fast model | `claude-haiku-4-5@20251001` |

100 104 

101<Note>105<Note>

102 For Vertex AI users, Claude Code will not automatically upgrade from Haiku 3.5 to Haiku 4.5. To manually switch to a newer Haiku model, set the `ANTHROPIC_DEFAULT_HAIKU_MODEL` environment variable to the full model name (e.g., `claude-haiku-4-5@20251001`).106 For Vertex AI users, Claude Code will not automatically upgrade from Haiku 3.5 to Haiku 4.5. To manually switch to a newer Haiku model, set the `ANTHROPIC_DEFAULT_HAIKU_MODEL` environment variable to the full model name (for example, `claude-haiku-4-5@20251001`).

103</Note>107</Note>

104 108 

105To customize models:109To customize models:

headless.md +93 −143

Details

1# Headless mode1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

2 4 

3> Run Claude Code programmatically without interactive UI5# Run Claude Code programmatically

4 6 

5## Overview7> Use the Agent SDK to run Claude Code programmatically from the CLI, Python, or TypeScript.

6 8 

7The headless mode allows you to run Claude Code programmatically from command line scripts and automation tools without any interactive UI.9The [Agent SDK](https://platform.claude.com/docs/en/agent-sdk/overview) gives you the same tools, agent loop, and context management that power Claude Code. It's available as a CLI for scripts and CI/CD, or as [Python](https://platform.claude.com/docs/en/agent-sdk/python) and [TypeScript](https://platform.claude.com/docs/en/agent-sdk/typescript) packages for full programmatic control.

8 10 

9## Basic usage11<Note>

12 The CLI was previously called "headless mode." The `-p` flag and all CLI options work the same way.

13</Note>

10 14 

11The primary command-line interface to Claude Code is the `claude` command. Use the `--print` (or `-p`) flag to run in non-interactive mode and print the final result:15To run Claude Code programmatically from the CLI, pass `-p` with your prompt and any [CLI options](/en/cli-reference):

12 16 

13```bash theme={null}17```bash theme={null}

14claude -p "Stage my changes and write a set of commits for them" \18claude -p "Find and fix the bug in auth.py" --allowedTools "Read,Edit,Bash"

15 --allowedTools "Bash,Read" \

16 --permission-mode acceptEdits

17```19```

18 20 

19## Configuration Options21This page covers using the Agent SDK via the CLI (`claude -p`). For the Python and TypeScript SDK packages with structured outputs, tool approval callbacks, and native message objects, see the [full Agent SDK documentation](https://platform.claude.com/docs/en/agent-sdk/overview).

20 

21Headless mode leverages all the CLI options available in Claude Code. Here are the key ones for automation and scripting:

22 22 

23| Flag | Description | Example |23## Basic usage

24| :------------------------- | :----------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------ |

25| `--print`, `-p` | Run in non-interactive mode | `claude -p "query"` |

26| `--output-format` | Specify output format (`text`, `json`, `stream-json`) | `claude -p --output-format json` |

27| `--resume`, `-r` | Resume a conversation by session ID | `claude --resume abc123` |

28| `--continue`, `-c` | Continue the most recent conversation | `claude --continue` |

29| `--verbose` | Enable verbose logging | `claude --verbose` |

30| `--append-system-prompt` | Append to system prompt (only with `--print`) | `claude --append-system-prompt "Custom instruction"` |

31| `--allowedTools` | Space-separated list of allowed tools, or <br /><br /> string of comma-separated list of allowed tools | `claude --allowedTools mcp__slack mcp__filesystem`<br /><br />`claude --allowedTools "Bash(npm install),mcp__filesystem"` |

32| `--disallowedTools` | Space-separated list of denied tools, or <br /><br /> string of comma-separated list of denied tools | `claude --disallowedTools mcp__splunk mcp__github`<br /><br />`claude --disallowedTools "Bash(git commit),mcp__github"` |

33| `--mcp-config` | Load MCP servers from a JSON file | `claude --mcp-config servers.json` |

34| `--permission-prompt-tool` | MCP tool for handling permission prompts (only with `--print`) | `claude --permission-prompt-tool mcp__auth__prompt` |

35 24 

36For a complete list of CLI options and features, see the [CLI reference](/en/cli-reference) documentation.25Add the `-p` (or `--print`) flag to any `claude` command to run it non-interactively. All [CLI options](/en/cli-reference) work with `-p`, including:

37 26 

38## Multi-turn conversations27* `--continue` for [continuing conversations](#continue-conversations)

28* `--allowedTools` for [auto-approving tools](#auto-approve-tools)

29* `--output-format` for [structured output](#get-structured-output)

39 30 

40For multi-turn conversations, you can resume conversations or continue from the most recent session:31This example asks Claude a question about your codebase and prints the response:

41 32 

42```bash theme={null}33```bash theme={null}

43# Continue the most recent conversation34claude -p "What does the auth module do?"

44claude --continue "Now refactor this for better performance"

45 

46# Resume a specific conversation by session ID

47claude --resume 550e8400-e29b-41d4-a716-446655440000 "Update the tests"

48 

49# Resume in non-interactive mode

50claude --resume 550e8400-e29b-41d4-a716-446655440000 "Fix all linting issues" --no-interactive

51```35```

52 36 

53## Output Formats37## Examples

54 38 

55### Text Output (Default)39These examples highlight common CLI patterns.

56 40 

57```bash theme={null}41### Get structured output

58claude -p "Explain file src/components/Header.tsx"

59# Output: This is a React component showing...

60```

61 42 

62### JSON Output43Use `--output-format` to control how responses are returned:

63 44 

64Returns structured data including metadata:45* `text` (default): plain text output

46* `json`: structured JSON with result, session ID, and metadata

47* `stream-json`: newline-delimited JSON for real-time streaming

65 48 

66```bash theme={null}49This example returns a project summary as JSON with session metadata, with the text result in the `result` field:

67claude -p "How does the data layer work?" --output-format json

68```

69 50 

70Response format:51```bash theme={null}

71 52claude -p "Summarize this project" --output-format json

72```json theme={null}

73{

74 "type": "result",

75 "subtype": "success",

76 "total_cost_usd": 0.003,

77 "is_error": false,

78 "duration_ms": 1234,

79 "duration_api_ms": 800,

80 "num_turns": 6,

81 "result": "The response text here...",

82 "session_id": "abc123"

83}

84```53```

85 54 

86### Streaming JSON Output55To get output conforming to a specific schema, use `--output-format json` with `--json-schema` and a [JSON Schema](https://json-schema.org/) definition. The response includes metadata about the request (session ID, usage, etc.) with the structured output in the `structured_output` field.

87 56 

88Streams each message as it is received:57This example extracts function names and returns them as an array of strings:

89 58 

90```bash theme={null}59```bash theme={null}

91claude -p "Build an application" --output-format stream-json60claude -p "Extract the main function names from auth.py" \

61 --output-format json \

62 --json-schema '{"type":"object","properties":{"functions":{"type":"array","items":{"type":"string"}}},"required":["functions"]}'

92```63```

93 64 

94Each conversation begins with an initial `init` system message, followed by a list of user and assistant messages, followed by a final `result` system message with stats. Each message is emitted as a separate JSON object.65<Tip>

95 66 Use a tool like [jq](https://jqlang.github.io/jq/) to parse the response and extract specific fields:

96## Input Formats

97 

98### Text Input (Default)

99 

100```bash theme={null}

101# Direct argument

102claude -p "Explain this code"

103 67 

104# From stdin68 ```bash theme={null}

105echo "Explain this code" | claude -p69 # Extract the text result

106```70 claude -p "Summarize this project" --output-format json | jq -r '.result'

107 71 

108### Streaming JSON Input72 # Extract structured output

73 claude -p "Extract function names from auth.py" \

74 --output-format json \

75 --json-schema '{"type":"object","properties":{"functions":{"type":"array","items":{"type":"string"}}},"required":["functions"]}' \

76 | jq '.structured_output'

77 ```

78</Tip>

109 79 

110A stream of messages provided via `stdin` where each message represents a user turn. This allows multiple turns of a conversation without re-launching the `claude` binary and allows providing guidance to the model while it is processing a request.80### Auto-approve tools

111 81 

112Each message is a JSON 'User message' object, following the same format as the output message schema. Messages are formatted using the [jsonl](https://jsonlines.org/) format where each line of input is a complete JSON object. Streaming JSON input requires `-p` and `--output-format stream-json`.82Use `--allowedTools` to let Claude use certain tools without prompting. This example runs a test suite and fixes failures, allowing Claude to execute Bash commands and read/edit files without asking for permission:

113 83 

114```bash theme={null}84```bash theme={null}

115echo '{"type":"user","message":{"role":"user","content":[{"type":"text","text":"Explain this code"}]}}' | claude -p --output-format=stream-json --input-format=stream-json --verbose85claude -p "Run the test suite and fix any failures" \

86 --allowedTools "Bash,Read,Edit"

116```87```

117 88 

118## Agent Integration Examples89### Create a commit

119 90 

120### SRE Incident Response Bot91This example reviews staged changes and creates a commit with an appropriate message:

121 92 

122```bash theme={null}93```bash theme={null}

123#!/bin/bash94claude -p "Look at my staged changes and create an appropriate commit" \

95 --allowedTools "Bash(git diff:*),Bash(git log:*),Bash(git status:*),Bash(git commit:*)"

96```

124 97 

125# Automated incident response agent98The `--allowedTools` flag uses [permission rule syntax](/en/settings#permission-rule-syntax). The `:*` suffix enables prefix matching, so `Bash(git diff:*)` allows any command starting with `git diff`.

126investigate_incident() {

127 local incident_description="$1"

128 local severity="${2:-medium}"

129 99 

130 claude -p "Incident: $incident_description (Severity: $severity)" \100<Note>

131 --append-system-prompt "You are an SRE expert. Diagnose the issue, assess impact, and provide immediate action items." \101 User-invoked [skills](/en/skills) like `/commit` and [built-in commands](/en/interactive-mode#built-in-commands) are only available in interactive mode. In `-p` mode, describe the task you want to accomplish instead.

132 --output-format json \102</Note>

133 --allowedTools "Bash,Read,WebSearch,mcp__datadog" \

134 --mcp-config monitoring-tools.json

135}

136 103 

137# Usage104### Customize the system prompt

138investigate_incident "Payment API returning 500 errors" "high"

139```

140 105 

141### Automated Security Review106Use `--append-system-prompt` to add instructions while keeping Claude Code's default behavior. This example pipes a PR diff to Claude and instructs it to review for security vulnerabilities:

142 107 

143```bash theme={null}108```bash theme={null}

144# Security audit agent for pull requests109gh pr diff "$1" | claude -p \

145audit_pr() {110 --append-system-prompt "You are a security engineer. Review for vulnerabilities." \

146 local pr_number="$1"111 --output-format json

112```

147 113 

148 gh pr diff "$pr_number" | claude -p \114See [system prompt flags](/en/cli-reference#system-prompt-flags) for more options including `--system-prompt` to fully replace the default prompt.

149 --append-system-prompt "You are a security engineer. Review this PR for vulnerabilities, insecure patterns, and compliance issues." \

150 --output-format json \

151 --allowedTools "Read,Grep,WebSearch"

152}

153 115 

154# Usage and save to file116### Continue conversations

155audit_pr 123 > security-report.json

156```

157 117 

158### Multi-turn Legal Assistant118Use `--continue` to continue the most recent conversation, or `--resume` with a session ID to continue a specific conversation. This example runs a review, then sends follow-up prompts:

159 119 

160```bash theme={null}120```bash theme={null}

161# Legal document review with session persistence121# First request

162session_id=$(claude -p "Start legal review session" --output-format json | jq -r '.session_id')122claude -p "Review this codebase for performance issues"

163 123 

164# Review contract in multiple steps124# Continue the most recent conversation

165claude -p --resume "$session_id" "Review contract.pdf for liability clauses"125claude -p "Now focus on the database queries" --continue

166claude -p --resume "$session_id" "Check compliance with GDPR requirements"126claude -p "Generate a summary of all issues found" --continue

167claude -p --resume "$session_id" "Generate executive summary of risks"

168```127```

169 128 

170## Best Practices129If you're running multiple conversations, capture the session ID to resume a specific one:

171 

172* **Use JSON output format** for programmatic parsing of responses:

173 130 

174 ```bash theme={null}131```bash theme={null}

175 # Parse JSON response with jq132session_id=$(claude -p "Start a review" --output-format json | jq -r '.session_id')

176 result=$(claude -p "Generate code" --output-format json)133claude -p "Continue that review" --resume "$session_id"

177 code=$(echo "$result" | jq -r '.result')134```

178 cost=$(echo "$result" | jq -r '.cost_usd')

179 ```

180 

181* **Handle errors gracefully** - check exit codes and stderr:

182 

183 ```bash theme={null}

184 if ! claude -p "$prompt" 2>error.log; then

185 echo "Error occurred:" >&2

186 cat error.log >&2

187 exit 1

188 fi

189 ```

190 

191* **Use session management** for maintaining context in multi-turn conversations

192 135 

193* **Consider timeouts** for long-running operations:136## Next steps

194 137 

195 ```bash theme={null}138<CardGroup cols={2}>

196 timeout 300 claude -p "$complex_prompt" || echo "Timed out after 5 minutes"139 <Card title="Agent SDK quickstart" icon="play" href="https://platform.claude.com/docs/en/agent-sdk/quickstart">

197 ```140 Build your first agent with Python or TypeScript

141 </Card>

198 142 

199* **Respect rate limits** when making multiple requests by adding delays between calls143 <Card title="CLI reference" icon="terminal" href="/en/cli-reference">

144 Explore all CLI flags and options

145 </Card>

200 146 

201## Related Resources147 <Card title="GitHub Actions" icon="github" href="/en/github-actions">

148 Use the Agent SDK in GitHub workflows

149 </Card>

202 150 

203* [CLI usage and controls](/en/cli-reference) - Complete CLI documentation151 <Card title="GitLab CI/CD" icon="gitlab" href="/en/gitlab-ci-cd">

204* [Common workflows](/en/common-workflows) - Step-by-step guides for common use cases152 Use the Agent SDK in GitLab pipelines

153 </Card>

154</CardGroup>

hooks.md +278 −31

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Hooks reference5# Hooks reference

2 6 

3> This page provides reference documentation for implementing hooks in Claude Code.7> This page provides reference documentation for implementing hooks in Claude Code.


6 For a quickstart guide with examples, see [Get started with Claude Code hooks](/en/hooks-guide).10 For a quickstart guide with examples, see [Get started with Claude Code hooks](/en/hooks-guide).

7</Tip>11</Tip>

8 12 

13## Hook lifecycle

14 

15Hooks fire at specific points during a Claude Code session.

16 

17<div style={{maxWidth: "500px", margin: "0 auto"}}>

18 <Frame>

19 <img src="https://mintcdn.com/claude-code/z2YM37Ycg6eMbID3/images/hooks-lifecycle.png?fit=max&auto=format&n=z2YM37Ycg6eMbID3&q=85&s=5c25fedbc3db6f8882af50c3cc478c32" alt="Hook lifecycle diagram showing the sequence of hooks from SessionStart through the agentic loop to SessionEnd" data-og-width="8876" width="8876" data-og-height="12492" height="12492" data-path="images/hooks-lifecycle.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/z2YM37Ycg6eMbID3/images/hooks-lifecycle.png?w=280&fit=max&auto=format&n=z2YM37Ycg6eMbID3&q=85&s=62406fcd5d4a189cc8842ee1bd946b84 280w, https://mintcdn.com/claude-code/z2YM37Ycg6eMbID3/images/hooks-lifecycle.png?w=560&fit=max&auto=format&n=z2YM37Ycg6eMbID3&q=85&s=fa3049022a6973c5f974e0f95b28169d 560w, https://mintcdn.com/claude-code/z2YM37Ycg6eMbID3/images/hooks-lifecycle.png?w=840&fit=max&auto=format&n=z2YM37Ycg6eMbID3&q=85&s=bd2890897db61a03160b93d4f972ff8e 840w, https://mintcdn.com/claude-code/z2YM37Ycg6eMbID3/images/hooks-lifecycle.png?w=1100&fit=max&auto=format&n=z2YM37Ycg6eMbID3&q=85&s=7ae8e098340479347135e39df4a13454 1100w, https://mintcdn.com/claude-code/z2YM37Ycg6eMbID3/images/hooks-lifecycle.png?w=1650&fit=max&auto=format&n=z2YM37Ycg6eMbID3&q=85&s=848a8606aab22c2ccaa16b6a18431e32 1650w, https://mintcdn.com/claude-code/z2YM37Ycg6eMbID3/images/hooks-lifecycle.png?w=2500&fit=max&auto=format&n=z2YM37Ycg6eMbID3&q=85&s=f3a9ef7feb61fa8fe362005aa185efbc 2500w" />

20 </Frame>

21</div>

22 

23| Hook | When it fires |

24| :------------------- | :------------------------------ |

25| `SessionStart` | Session begins or resumes |

26| `UserPromptSubmit` | User submits a prompt |

27| `PreToolUse` | Before tool execution |

28| `PermissionRequest` | When permission dialog appears |

29| `PostToolUse` | After tool succeeds |

30| `PostToolUseFailure` | After tool fails |

31| `SubagentStart` | When spawning a subagent |

32| `SubagentStop` | When subagent finishes |

33| `Stop` | Claude finishes responding |

34| `PreCompact` | Before context compaction |

35| `SessionEnd` | Session terminates |

36| `Notification` | Claude Code sends notifications |

37 

9## Configuration38## Configuration

10 39 

11Claude Code hooks are configured in your [settings files](/en/settings):40Claude Code hooks are configured in your [settings files](/en/settings):


13* `~/.claude/settings.json` - User settings42* `~/.claude/settings.json` - User settings

14* `.claude/settings.json` - Project settings43* `.claude/settings.json` - Project settings

15* `.claude/settings.local.json` - Local project settings (not committed)44* `.claude/settings.local.json` - Local project settings (not committed)

16* Enterprise managed policy settings45* Managed policy settings

46 

47<Note>

48 Enterprise administrators can use `allowManagedHooksOnly` to block user, project, and plugin hooks. See [Hook configuration](/en/settings#hook-configuration).

49</Note>

17 50 

18### Structure51### Structure

19 52 


49 * `prompt`: (For `type: "prompt"`) The prompt to send to the LLM for evaluation82 * `prompt`: (For `type: "prompt"`) The prompt to send to the LLM for evaluation

50 * `timeout`: (Optional) How long a hook should run, in seconds, before canceling that specific hook83 * `timeout`: (Optional) How long a hook should run, in seconds, before canceling that specific hook

51 84 

52For events like `UserPromptSubmit`, `Stop`, and `SubagentStop`85For events like `UserPromptSubmit`, `Stop`, `SubagentStop`, and `Setup`

53that don't use matchers, you can omit the matcher field:86that don't use matchers, you can omit the matcher field:

54 87 

55```json theme={null}88```json theme={null}


142 175 

143See the [plugin components reference](/en/plugins-reference#hooks) for details on creating plugin hooks.176See the [plugin components reference](/en/plugins-reference#hooks) for details on creating plugin hooks.

144 177 

178### Hooks in skills and agents

179 

180In addition to settings files and plugins, hooks can be defined directly in [skills](/en/skills) and [subagents](/en/sub-agents) using frontmatter. These hooks are scoped to the component's lifecycle and only run when that component is active.

181 

182**Supported events**: `PreToolUse`, `PostToolUse`, and `Stop`

183 

184**Example in a Skill**:

185 

186```yaml theme={null}

187---

188name: secure-operations

189description: Perform operations with security checks

190hooks:

191 PreToolUse:

192 - matcher: "Bash"

193 hooks:

194 - type: command

195 command: "./scripts/security-check.sh"

196---

197```

198 

199**Example in an agent**:

200 

201```yaml theme={null}

202---

203name: code-reviewer

204description: Review code changes

205hooks:

206 PostToolUse:

207 - matcher: "Edit|Write"

208 hooks:

209 - type: command

210 command: "./scripts/run-linter.sh"

211---

212```

213 

214Component-scoped hooks follow the same configuration format as settings-based hooks but are automatically cleaned up when the component finishes executing.

215 

216**Additional option for skills:**

217 

218* `once`: Set to `true` to run the hook only once per session. After the first successful execution, the hook is removed. Note: This option is currently only supported for skills, not for agents.

219 

145## Prompt-Based Hooks220## Prompt-Based Hooks

146 221 

147In addition to bash command hooks (`type: "command"`), Claude Code supports prompt-based hooks (`type: "prompt"`) that use an LLM to evaluate whether to allow or block an action. Prompt-based hooks are currently only supported for `Stop` and `SubagentStop` hooks, where they enable intelligent, context-aware decisions.222In addition to bash command hooks (`type: "command"`), Claude Code supports prompt-based hooks (`type: "prompt"`) that use an LLM to evaluate whether to allow or block an action. Prompt-based hooks are currently only supported for `Stop` and `SubagentStop` hooks, where they enable intelligent, context-aware decisions.


187 262 

188```json theme={null}263```json theme={null}

189{264{

190 "decision": "approve" | "block",265 "ok": true | false,

191 "reason": "Explanation for the decision",266 "reason": "Explanation for the decision"

192 "continue": false, // Optional: stops Claude entirely

193 "stopReason": "Message shown to user", // Optional: custom stop message

194 "systemMessage": "Warning or context" // Optional: shown to user

195}267}

196```268```

197 269 

198**Response fields:**270**Response fields:**

199 271 

200* `decision`: `"approve"` allows the action, `"block"` prevents it272* `ok`: `true` allows the action, `false` prevents it

201* `reason`: Explanation shown to Claude when decision is `"block"`273* `reason`: Required when `ok` is `false`. Explanation shown to Claude

202* `continue`: (Optional) If `false`, stops Claude's execution entirely

203* `stopReason`: (Optional) Message shown when `continue` is false

204* `systemMessage`: (Optional) Additional message shown to the user

205 274 

206### Supported hook events275### Supported hook events

207 276 


223 "hooks": [292 "hooks": [

224 {293 {

225 "type": "prompt",294 "type": "prompt",

226 "prompt": "You are evaluating whether Claude should stop working. Context: $ARGUMENTS\n\nAnalyze the conversation and determine if:\n1. All user-requested tasks are complete\n2. Any errors need to be addressed\n3. Follow-up work is needed\n\nRespond with JSON: {\"decision\": \"approve\" or \"block\", \"reason\": \"your explanation\"}",295 "prompt": "You are evaluating whether Claude should stop working. Context: $ARGUMENTS\n\nAnalyze the conversation and determine if:\n1. All user-requested tasks are complete\n2. Any errors need to be addressed\n3. Follow-up work is needed\n\nRespond with JSON: {\"ok\": true} to allow stopping, or {\"ok\": false, \"reason\": \"your explanation\"} to continue working.",

227 "timeout": 30296 "timeout": 30

228 }297 }

229 ]298 ]


243 "hooks": [312 "hooks": [

244 {313 {

245 "type": "prompt",314 "type": "prompt",

246 "prompt": "Evaluate if this subagent should stop. Input: $ARGUMENTS\n\nCheck if:\n- The subagent completed its assigned task\n- Any errors occurred that need fixing\n- Additional context gathering is needed\n\nReturn: {\"decision\": \"approve\" or \"block\", \"reason\": \"explanation\"}"315 "prompt": "Evaluate if this subagent should stop. Input: $ARGUMENTS\n\nCheck if:\n- The subagent completed its assigned task\n- Any errors occurred that need fixing\n- Additional context gathering is needed\n\nReturn: {\"ok\": true} to allow stopping, or {\"ok\": false, \"reason\": \"explanation\"} to continue."

247 }316 }

248 ]317 ]

249 }318 }


258| --------------------- | ----------------------- | ------------------------------ |327| --------------------- | ----------------------- | ------------------------------ |

259| **Execution** | Runs bash script | Queries LLM |328| **Execution** | Runs bash script | Queries LLM |

260| **Decision logic** | You implement in code | LLM evaluates context |329| **Decision logic** | You implement in code | LLM evaluates context |

261| **Setup complexity** | Requires script file | Just configure prompt |330| **Setup complexity** | Requires script file | Configure prompt |

262| **Context awareness** | Limited to script logic | Natural language understanding |331| **Context awareness** | Limited to script logic | Natural language understanding |

263| **Performance** | Fast (local execution) | Slower (API call) |332| **Performance** | Fast (local execution) | Slower (API call) |

264| **Use case** | Deterministic rules | Context-aware decisions |333| **Use case** | Deterministic rules | Context-aware decisions |


371* `manual` - Invoked from `/compact`440* `manual` - Invoked from `/compact`

372* `auto` - Invoked from auto-compact (due to full context window)441* `auto` - Invoked from auto-compact (due to full context window)

373 442 

443### Setup

444 

445Runs when Claude Code is invoked with repository setup and maintenance flags (`--init`, `--init-only`, or `--maintenance`). Use this hook for operations you don't want on every session—such as installing dependencies, running migrations, or periodic maintenance tasks.

446 

447<Note>

448 Use **Setup** hooks for one-time or occasional operations (dependency installation, migrations, cleanup). Use **SessionStart** hooks for things you want on every session (loading context, setting environment variables). Setup hooks require explicit flags because running them automatically would slow down every session start.

449</Note>

450 

451**Matchers:**

452 

453* `init` - Invoked from `--init` or `--init-only` flags

454* `maintenance` - Invoked from `--maintenance` flag

455 

456Setup hooks have access to the `CLAUDE_ENV_FILE` environment variable for persisting environment variables, similar to SessionStart hooks.

457 

374### SessionStart458### SessionStart

375 459 

376Runs when Claude Code starts a new session or resumes an existing session (which460Runs when Claude Code starts a new session or resumes an existing session (which

377currently does start a new session under the hood). Useful for loading in461currently does start a new session under the hood). Useful for loading development context like existing issues or recent changes to your codebase, or setting up environment variables.

378development context like existing issues or recent changes to your codebase, installing dependencies, or setting up environment variables.462 

463<Note>

464 For one-time operations like installing dependencies or running migrations, use [Setup hooks](#setup) instead. SessionStart runs on every session, so keep these hooks fast.

465</Note>

379 466 

380**Matchers:**467**Matchers:**

381 468 


404 491 

405**Example: Persisting all environment changes from the hook**492**Example: Persisting all environment changes from the hook**

406 493 

407When your setup modifies the environment (e.g., `nvm use`), capture and persist all changes by diffing the environment:494When your setup modifies the environment (for example, `nvm use`), capture and persist all changes by diffing the environment:

408 495 

409```bash theme={null}496```bash theme={null}

410#!/bin/bash497#!/bin/bash


452 session_id: string539 session_id: string

453 transcript_path: string // Path to conversation JSON540 transcript_path: string // Path to conversation JSON

454 cwd: string // The current working directory when the hook is invoked541 cwd: string // The current working directory when the hook is invoked

455 permission_mode: string // Current permission mode: "default", "plan", "acceptEdits", or "bypassPermissions"542 permission_mode: string // Current permission mode: "default", "plan", "acceptEdits", "dontAsk", or "bypassPermissions"

456 543 

457 // Event-specific fields544 // Event-specific fields

458 hook_event_name: string545 hook_event_name: string


462 549 

463### PreToolUse Input550### PreToolUse Input

464 551 

465The exact schema for `tool_input` depends on the tool.552The exact schema for `tool_input` depends on the tool. Here are examples for commonly hooked tools.

553 

554#### Bash tool

555 

556The Bash tool is the most commonly hooked tool for command validation:

557 

558```json theme={null}

559{

560 "session_id": "abc123",

561 "transcript_path": "/Users/.../.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",

562 "cwd": "/Users/...",

563 "permission_mode": "default",

564 "hook_event_name": "PreToolUse",

565 "tool_name": "Bash",

566 "tool_input": {

567 "command": "psql -c 'SELECT * FROM users'",

568 "description": "Query the users table",

569 "timeout": 120000

570 },

571 "tool_use_id": "toolu_01ABC123..."

572}

573```

574 

575| Field | Type | Description |

576| :------------------ | :------ | :-------------------------------------------- |

577| `command` | string | The shell command to execute |

578| `description` | string | Optional description of what the command does |

579| `timeout` | number | Optional timeout in milliseconds |

580| `run_in_background` | boolean | Whether to run the command in background |

581 

582#### Write tool

466 583 

467```json theme={null}584```json theme={null}

468{585{


480}597}

481```598```

482 599 

600| Field | Type | Description |

601| :---------- | :----- | :--------------------------------- |

602| `file_path` | string | Absolute path to the file to write |

603| `content` | string | Content to write to the file |

604 

605#### Edit tool

606 

607```json theme={null}

608{

609 "session_id": "abc123",

610 "transcript_path": "/Users/.../.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",

611 "cwd": "/Users/...",

612 "permission_mode": "default",

613 "hook_event_name": "PreToolUse",

614 "tool_name": "Edit",

615 "tool_input": {

616 "file_path": "/path/to/file.txt",

617 "old_string": "original text",

618 "new_string": "replacement text"

619 },

620 "tool_use_id": "toolu_01ABC123..."

621}

622```

623 

624| Field | Type | Description |

625| :------------ | :------ | :-------------------------------------------------- |

626| `file_path` | string | Absolute path to the file to edit |

627| `old_string` | string | Text to find and replace |

628| `new_string` | string | Replacement text |

629| `replace_all` | boolean | Whether to replace all occurrences (default: false) |

630 

631#### Read tool

632 

633```json theme={null}

634{

635 "session_id": "abc123",

636 "transcript_path": "/Users/.../.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",

637 "cwd": "/Users/...",

638 "permission_mode": "default",

639 "hook_event_name": "PreToolUse",

640 "tool_name": "Read",

641 "tool_input": {

642 "file_path": "/path/to/file.txt"

643 },

644 "tool_use_id": "toolu_01ABC123..."

645}

646```

647 

648| Field | Type | Description |

649| :---------- | :----- | :----------------------------------------- |

650| `file_path` | string | Absolute path to the file to read |

651| `offset` | number | Optional line number to start reading from |

652| `limit` | number | Optional number of lines to read |

653 

483### PostToolUse Input654### PostToolUse Input

484 655 

485The exact schema for `tool_input` and `tool_response` depends on the tool.656The exact schema for `tool_input` and `tool_response` depends on the tool.


531}702}

532```703```

533 704 

534### Stop and SubagentStop Input705### Stop Input

535 706 

536`stop_hook_active` is true when Claude Code is already continuing as a result of707`stop_hook_active` is true when Claude Code is already continuing as a result of

537a stop hook. Check this value or process the transcript to prevent Claude Code708a stop hook. Check this value or process the transcript to prevent Claude Code


541{712{

542 "session_id": "abc123",713 "session_id": "abc123",

543 "transcript_path": "~/.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",714 "transcript_path": "~/.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",

715 "cwd": "/Users/...",

544 "permission_mode": "default",716 "permission_mode": "default",

545 "hook_event_name": "Stop",717 "hook_event_name": "Stop",

546 "stop_hook_active": true718 "stop_hook_active": true

547}719}

548```720```

549 721 

722### SubagentStop Input

723 

724Triggered when a subagent finishes. The `transcript_path` is the main session's transcript, while `agent_transcript_path` is the subagent's own transcript stored in a nested `subagents/` folder.

725 

726```json theme={null}

727{

728 "session_id": "abc123",

729 "transcript_path": "~/.claude/projects/.../abc123.jsonl",

730 "cwd": "/Users/...",

731 "permission_mode": "default",

732 "hook_event_name": "SubagentStop",

733 "stop_hook_active": false,

734 "agent_id": "def456",

735 "agent_transcript_path": "~/.claude/projects/.../abc123/subagents/agent-def456.jsonl"

736}

737```

738 

550### PreCompact Input739### PreCompact Input

551 740 

552For `manual`, `custom_instructions` comes from what the user passes into741For `manual`, `custom_instructions` comes from what the user passes into


563}752}

564```753```

565 754 

755### Setup Input

756 

757```json theme={null}

758{

759 "session_id": "abc123",

760 "transcript_path": "~/.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",

761 "cwd": "/Users/...",

762 "permission_mode": "default",

763 "hook_event_name": "Setup",

764 "trigger": "init"

765}

766```

767 

768The `trigger` field will be either `"init"` (from `--init` or `--init-only`) or `"maintenance"` (from `--maintenance`).

769 

566### SessionStart Input770### SessionStart Input

567 771 

568```json theme={null}772```json theme={null}

569{773{

570 "session_id": "abc123",774 "session_id": "abc123",

571 "transcript_path": "~/.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",775 "transcript_path": "~/.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",

776 "cwd": "/Users/...",

572 "permission_mode": "default",777 "permission_mode": "default",

573 "hook_event_name": "SessionStart",778 "hook_event_name": "SessionStart",

574 "source": "startup"779 "source": "startup",

780 "model": "claude-sonnet-4-20250514"

781}

782```

783 

784The `source` field indicates how the session started: `"startup"` for new sessions, `"resume"` for resumed sessions, `"clear"` after `/clear`, or `"compact"` after compaction. The `model` field contains the model identifier when available. If you start Claude Code with `claude --agent <name>`, an `agent_type` field contains the agent name.

785 

786### SubagentStart Input

787 

788```json theme={null}

789{

790 "session_id": "abc123",

791 "transcript_path": "~/.claude/projects/.../00893aaf-19fa-41d2-8238-13269b9b3ca0.jsonl",

792 "cwd": "/Users/...",

793 "permission_mode": "default",

794 "hook_event_name": "SubagentStart",

795 "agent_id": "agent-abc123",

796 "agent_type": "Explore"

575}797}

576```798```

577 799 

800Triggered when a subagent is spawned. The `agent_id` field contains the unique identifier for the subagent, and `agent_type` contains the agent name (built-in agents like `"Bash"`, `"Explore"`, `"Plan"`, or custom agent names).

801 

578### SessionEnd Input802### SessionEnd Input

579 803 

580```json theme={null}804```json theme={null}


590 814 

591## Hook Output815## Hook Output

592 816 

593There are two mutually-exclusive ways for hooks to return output back to Claude Code. The output817There are two mutually exclusive ways for hooks to return output back to Claude Code. The output

594communicates whether to block and any feedback that should be shown to Claude818communicates whether to block and any feedback that should be shown to Claude

595and the user.819and the user.

596 820 


626| `Stop` | Blocks stoppage, shows stderr to Claude |850| `Stop` | Blocks stoppage, shows stderr to Claude |

627| `SubagentStop` | Blocks stoppage, shows stderr to Claude subagent |851| `SubagentStop` | Blocks stoppage, shows stderr to Claude subagent |

628| `PreCompact` | N/A, shows stderr to user only |852| `PreCompact` | N/A, shows stderr to user only |

853| `Setup` | N/A, shows stderr to user only |

629| `SessionStart` | N/A, shows stderr to user only |854| `SessionStart` | N/A, shows stderr to user only |

630| `SessionEnd` | N/A, shows stderr to user only |855| `SessionEnd` | N/A, shows stderr to user only |

631 856 


681 906 

682Additionally, hooks can modify tool inputs before execution using `updatedInput`:907Additionally, hooks can modify tool inputs before execution using `updatedInput`:

683 908 

684* `updatedInput` allows you to modify the tool's input parameters before the tool executes.909* `updatedInput` modifies the tool's input parameters before the tool executes

685* This is most useful with `"permissionDecision": "allow"` to modify and approve tool calls.910* Combine with `"permissionDecision": "allow"` to modify the input and auto-approve the tool call

911* Combine with `"permissionDecision": "ask"` to modify the input and show it to the user for confirmation

912 

913Hooks can also provide context to Claude using `additionalContext`:

914 

915* `"hookSpecificOutput.additionalContext"` adds a string to Claude's context before the tool executes.

686 916 

687```json theme={null}917```json theme={null}

688{918{

689 "hookSpecificOutput": {919 "hookSpecificOutput": {

690 "hookEventName": "PreToolUse",920 "hookEventName": "PreToolUse",

691 "permissionDecision": "allow"921 "permissionDecision": "allow",

692 "permissionDecisionReason": "My reason here",922 "permissionDecisionReason": "My reason here",

693 "updatedInput": {923 "updatedInput": {

694 "field_to_modify": "new value"924 "field_to_modify": "new value"

695 }925 },

926 "additionalContext": "Current environment: production. Proceed with caution."

696 }927 }

697}928}

698```929```


779```1010```

780 1011 

781<Note>1012<Note>

782 The JSON format is not required for simple use cases. To add context, you can1013 The JSON format isn't required for simple use cases. To add context, you can print plain text to stdout with exit code 0. Use JSON when you need to

783 just print plain text to stdout with exit code 0. Use JSON when you need to

784 block prompts or want more structured control.1014 block prompts or want more structured control.

785</Note>1015</Note>

786 1016 


799}1029}

800```1030```

801 1031 

1032#### `Setup` Decision Control

1033 

1034`Setup` hooks allow you to load context and configure the environment during repository initialization or maintenance.

1035 

1036* `"hookSpecificOutput.additionalContext"` adds the string to the context.

1037* Multiple hooks' `additionalContext` values are concatenated.

1038* Setup hooks have access to `CLAUDE_ENV_FILE` for persisting environment variables.

1039 

1040```json theme={null}

1041{

1042 "hookSpecificOutput": {

1043 "hookEventName": "Setup",

1044 "additionalContext": "Repository initialized with custom configuration"

1045 }

1046}

1047```

1048 

802#### `SessionStart` Decision Control1049#### `SessionStart` Decision Control

803 1050 

804`SessionStart` hooks allow you to load in context at the start of a session.1051`SessionStart` hooks allow you to load in context at the start of a session.


877<Note>1124<Note>

878 For `UserPromptSubmit` hooks, you can inject context using either method:1125 For `UserPromptSubmit` hooks, you can inject context using either method:

879 1126 

880 * **Plain text stdout** with exit code 0: Simplest approach—just print text1127 * **Plain text stdout** with exit code 0: Simplest approach, prints text

881 * **JSON output** with exit code 0: Use `"decision": "block"` to reject prompts,1128 * **JSON output** with exit code 0: Use `"decision": "block"` to reject prompts,

882 or `additionalContext` for structured context injection1129 or `additionalContext` for structured context injection

883 1130 


1074* **Output**:1321* **Output**:

1075 * PreToolUse/PermissionRequest/PostToolUse/Stop/SubagentStop: Progress shown in verbose mode (ctrl+o)1322 * PreToolUse/PermissionRequest/PostToolUse/Stop/SubagentStop: Progress shown in verbose mode (ctrl+o)

1076 * Notification/SessionEnd: Logged to debug only (`--debug`)1323 * Notification/SessionEnd: Logged to debug only (`--debug`)

1077 * UserPromptSubmit/SessionStart: stdout added as context for Claude1324 * UserPromptSubmit/SessionStart/Setup: stdout added as context for Claude

1078 1325 

1079## Debugging1326## Debugging

1080 1327 

hooks-guide.md +7 −2

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Get started with Claude Code hooks5# Get started with Claude Code hooks

2 6 

3> Learn how to customize and extend Claude Code's behavior by registering shell commands7> Learn how to customize and extend Claude Code's behavior by registering shell commands


47* **Stop**: Runs when Claude Code finishes responding51* **Stop**: Runs when Claude Code finishes responding

48* **SubagentStop**: Runs when subagent tasks complete52* **SubagentStop**: Runs when subagent tasks complete

49* **PreCompact**: Runs before Claude Code is about to run a compact operation53* **PreCompact**: Runs before Claude Code is about to run a compact operation

54* **Setup**: Runs when Claude Code is invoked with `--init`, `--init-only`, or `--maintenance` flags

50* **SessionStart**: Runs when Claude Code starts a new session or resumes an existing session55* **SessionStart**: Runs when Claude Code starts a new session or resumes an existing session

51* **SessionEnd**: Runs when Claude Code session ends56* **SessionEnd**: Runs when Claude Code session ends

52 57 


64 69 

65### Step 1: Open hooks configuration70### Step 1: Open hooks configuration

66 71 

67Run the `/hooks` [slash command](/en/slash-commands) and select72Run the `/hooks` command and select

68the `PreToolUse` hook event.73the `PreToolUse` hook event.

69 74 

70`PreToolUse` hooks run before tool calls and can block them while providing75`PreToolUse` hooks run before tool calls and can block them while providing


92directory. This hook will then apply to all projects, not just your current97directory. This hook will then apply to all projects, not just your current

93project.98project.

94 99 

95Then press Esc until you return to the REPL. Your hook is now registered!100Then press `Esc` until you return to the REPL. Your hook is now registered.

96 101 

97### Step 5: Verify your hook102### Step 5: Verify your hook

98 103 

how-claude-code-works.md +239 −0 added

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

5# How Claude Code works

6 

7> Understand the agentic loop, built-in tools, and how Claude Code interacts with your project.

8 

9Claude Code is an agentic assistant that runs in your terminal. While it excels at coding, it can help with anything you can do from the command line: writing docs, running builds, searching files, researching topics, and more.

10 

11This guide covers the core architecture, built-in capabilities, and [tips for working effectively](#work-effectively-with-claude-code). For step-by-step walkthroughs, see [Common workflows](/en/common-workflows). For extensibility features like skills, MCP, and hooks, see [Extend Claude Code](/en/features-overview).

12 

13## The agentic loop

14 

15When you give Claude a task, it works through three phases: **gather context**, **take action**, and **verify results**. These phases blend together. Claude uses tools throughout, whether searching files to understand your code, editing to make changes, or running tests to check its work.

16 

17<img src="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=e30acfc80d6ff01ec877dd19c7af58b2" alt="The agentic loop: Your prompt leads to Claude gathering context, taking action, verifying results, and repeating until task complete. You can interrupt at any point." data-og-width="720" width="720" data-og-height="280" height="280" data-path="images/agentic-loop.svg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=280&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=8620f6ebce761a1e8bbf7f0a0255cc15 280w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=560&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=7b46b5ff4454aa4a03725eee625b39a0 560w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=840&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=7fa0397bc37d147e3bf3bb6296c6477f 840w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=1100&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=73b2a7040c4c93821c4d5bbee9f4a2d4 1100w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=1650&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=17703cbeb6f59b40a00ab24f56d5f8f9 1650w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/agentic-loop.svg?w=2500&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=20dedb60b95d45a1bd60a0cccaf3e1ff 2500w" />

18 

19The loop adapts to what you ask. A question about your codebase might only need context gathering. A bug fix cycles through all three phases repeatedly. A refactor might involve extensive verification. Claude decides what each step requires based on what it learned from the previous step, chaining dozens of actions together and course-correcting along the way.

20 

21You're part of this loop too. You can interrupt at any point to steer Claude in a different direction, provide additional context, or ask it to try a different approach. Claude works autonomously but stays responsive to your input.

22 

23The agentic loop is powered by two components: [models](#models) that reason and [tools](#tools) that act. Claude Code serves as the **agentic harness** around Claude: it provides the tools, context management, and execution environment that turn a language model into a capable coding agent.

24 

25### Models

26 

27Claude Code uses Claude models to understand your code and reason about tasks. Claude can read code in any language, understand how components connect, and figure out what needs to change to accomplish your goal. For complex tasks, it breaks work into steps, executes them, and adjusts based on what it learns.

28 

29[Multiple models](/en/model-config) are available with different tradeoffs. Sonnet handles most coding tasks well. Opus provides stronger reasoning for complex architectural decisions. Switch with `/model` during a session or start with `claude --model <name>`.

30 

31When this guide says "Claude chooses" or "Claude decides," it's the model doing the reasoning.

32 

33### Tools

34 

35Tools are what make Claude Code agentic. Without tools, Claude can only respond with text. With tools, Claude can act: read your code, edit files, run commands, search the web, and interact with external services. Each tool use returns information that feeds back into the loop, informing Claude's next decision.

36 

37The built-in tools generally fall into four categories, each representing a different kind of agency.

38 

39| Category | What Claude can do |

40| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |

41| **File operations** | Read files, edit code, create new files, rename and reorganize |

42| **Search** | Find files by pattern, search content with regex, explore codebases |

43| **Execution** | Run shell commands, start servers, run tests, use git |

44| **Web** | Search the web, fetch documentation, look up error messages |

45| **Code intelligence** | See type errors and warnings after edits, jump to definitions, find references (requires [code intelligence plugins](/en/discover-plugins#code-intelligence)) |

46 

47These are the primary capabilities. Claude also has tools for spawning subagents, asking you questions, and other orchestration tasks. See [Tools available to Claude](/en/settings#tools-available-to-claude) for the complete list.

48 

49Claude chooses which tools to use based on your prompt and what it learns along the way. When you say "fix the failing tests," Claude might:

50 

511. Run the test suite to see what's failing

522. Read the error output

533. Search for the relevant source files

544. Read those files to understand the code

555. Edit the files to fix the issue

566. Run the tests again to verify

57 

58Each tool use gives Claude new information that informs the next step. This is the agentic loop in action.

59 

60**Extending the base capabilities:** The built-in tools are the foundation. You can extend what Claude knows with [skills](/en/skills), connect to external services with [MCP](/en/mcp), automate workflows with [hooks](/en/hooks), and offload tasks to [subagents](/en/sub-agents). These extensions form a layer on top of the core agentic loop. See [Extend Claude Code](/en/features-overview) for guidance on choosing the right extension for your needs.

61 

62## What Claude can access

63 

64This guide focuses on the terminal. Claude Code also runs in [VS Code, JetBrains IDEs, and other environments](/en/ide-integrations).

65 

66When you run `claude` in a directory, Claude Code gains access to:

67 

68* **Your project.** Files in your directory and subdirectories, plus files elsewhere with your permission.

69* **Your terminal.** Any command you could run: build tools, git, package managers, system utilities, scripts. If you can do it from the command line, Claude can too.

70* **Your git state.** Current branch, uncommitted changes, and recent commit history.

71* **Your [CLAUDE.md](/en/memory).** A markdown file where you store project-specific instructions, conventions, and context that Claude should know every session.

72* **Extensions you configure.** [MCP servers](/en/mcp) for external services, [skills](/en/skills) for workflows, [subagents](/en/sub-agents) for delegated work, and [Claude in Chrome](/en/chrome) for browser interaction.

73 

74Because Claude sees your whole project, it can work across it. When you ask Claude to "fix the authentication bug," it searches for relevant files, reads multiple files to understand context, makes coordinated edits across them, runs tests to verify the fix, and commits the changes if you ask. This is different from inline code assistants that only see the current file.

75 

76## Work with sessions

77 

78Claude Code saves your conversation locally as you work. Each message, tool use, and result is stored, which enables [rewinding](#undo-changes-with-checkpoints), [resuming, and forking](#resume-or-fork-sessions) sessions. Before Claude makes code changes, it also snapshots the affected files so you can revert if needed.

79 

80**Sessions are ephemeral.** Unlike claude.ai, Claude Code has no persistent memory between sessions. Each new session starts fresh. Claude doesn't "learn" your preferences over time or remember what you worked on last week. If you want Claude to know something across sessions, put it in your [CLAUDE.md](/en/memory).

81 

82### Work across branches

83 

84Each Claude Code conversation is a session tied to your current directory. When you resume, you only see sessions from that directory.

85 

86Claude sees your current branch's files. When you switch branches, Claude sees the new branch's files, but your conversation history stays the same. Claude remembers what you discussed even after switching.

87 

88Since sessions are tied to directories, you can run parallel Claude sessions by using [git worktrees](/en/common-workflows#run-parallel-claude-code-sessions-with-git-worktrees), which create separate directories for individual branches.

89 

90### Resume or fork sessions

91 

92When you resume a session with `claude --continue` or `claude --resume`, you pick up where you left off using the same session ID. New messages append to the existing conversation. Your full conversation history is restored, but session-scoped permissions are not. You'll need to re-approve those.

93 

94<img src="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=f671b603cc856119c95475b9084ebfef" alt="Session continuity: resume continues the same session, fork creates a new branch with a new ID." data-og-width="560" width="560" data-og-height="280" height="280" data-path="images/session-continuity.svg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=280&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=bddf1f33d419a27d7427acdf06058804 280w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=560&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=417478eb9b86003b8eebaac058a8618a 560w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=840&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=1d89d26e2c0487f067d187c3fa5f7170 840w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=1100&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=8ea739a1f7860e4edbbcf74d444e37b2 1100w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=1650&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=9cb5095d6a8920f04c3b78d31a69c809 1650w, https://mintcdn.com/claude-code/ELkJZG54dIaeldDC/images/session-continuity.svg?w=2500&fit=max&auto=format&n=ELkJZG54dIaeldDC&q=85&s=d67e1744e4878813d20c6c3f39d9459d 2500w" />

95 

96To branch off and try a different approach without affecting the original session, use the `--fork-session` flag:

97 

98```bash theme={null}

99claude --continue --fork-session

100```

101 

102This creates a new session ID while preserving the conversation history up to that point. The original session remains unchanged. Like resume, forked sessions don't inherit session-scoped permissions.

103 

104**Same session in multiple terminals**: If you resume the same session in multiple terminals, both terminals write to the same session file. Messages from both get interleaved, like two people writing in the same notebook. Nothing corrupts, but the conversation becomes jumbled. Each terminal only sees its own messages during the session, but if you resume that session later, you'll see everything interleaved. For parallel work from the same starting point, use `--fork-session` to give each terminal its own clean session.

105 

106### The context window

107 

108Claude's context window holds your conversation history, file contents, command outputs, [CLAUDE.md](/en/memory), loaded skills, and system instructions. As you work, context fills up. Claude compacts automatically, but instructions from early in the conversation can get lost. Put persistent rules in CLAUDE.md, and run `/context` to see what's using space.

109 

110#### When context fills up

111 

112Claude Code manages context automatically as you approach the limit. It clears older tool outputs first, then summarizes the conversation if needed. Your requests and key code snippets are preserved; detailed instructions from early in the conversation may be lost. Put persistent rules in CLAUDE.md rather than relying on conversation history.

113 

114To control what's preserved during compaction, add a "Compact Instructions" section to CLAUDE.md or run `/compact` with a focus (like `/compact focus on the API changes`).

115 

116Run `/context` to see what's using space. MCP servers add tool definitions to every request, so a few servers can consume significant context before you start working. Run `/mcp` to check per-server costs.

117 

118#### Manage context with skills and subagents

119 

120Beyond compaction, you can use other features to control what loads into context.

121 

122[Skills](/en/skills) load on demand. Claude sees skill descriptions at session start, but the full content only loads when a skill is used. For skills you invoke manually, set `disable-model-invocation: true` to keep descriptions out of context until you need them.

123 

124[Subagents](/en/sub-agents) get their own fresh context, completely separate from your main conversation. Their work doesn't bloat your context. When done, they return a summary. This isolation is why subagents help with long sessions.

125 

126See [context costs](/en/features-overview#understand-context-costs) for what each feature costs, and [reduce token usage](/en/costs#reduce-token-usage) for tips on managing context.

127 

128## Stay safe with checkpoints and permissions

129 

130Claude has two safety mechanisms: checkpoints let you undo file changes, and permissions control what Claude can do without asking.

131 

132### Undo changes with checkpoints

133 

134**Every file edit is reversible.** Before Claude edits any file, it snapshots the current contents. If something goes wrong, press `Esc` twice to rewind to a previous state, or ask Claude to undo.

135 

136Checkpoints are local to your session, separate from git. They only cover file changes. Actions that affect remote systems (databases, APIs, deployments) can't be checkpointed, which is why Claude asks before running commands with external side effects.

137 

138### Control what Claude can do

139 

140Press `Shift+Tab` to cycle through permission modes:

141 

142* **Default**: Claude asks before file edits and shell commands

143* **Auto-accept edits**: Claude edits files without asking, still asks for commands

144* **Plan mode**: Claude uses read-only tools only, creating a plan you can approve before execution

145 

146You can also allow specific commands in `.claude/settings.json` so Claude doesn't ask each time. This is useful for trusted commands like `npm test` or `git status`. Settings can be scoped from organization-wide policies down to personal preferences. See [Permissions](/en/iam) for details.

147 

148***

149 

150## Work effectively with Claude Code

151 

152These tips help you get better results from Claude Code.

153 

154### Ask Claude Code for help

155 

156Claude Code can teach you how to use it. Ask questions like "how do I set up hooks?" or "what's the best way to structure my CLAUDE.md?" and Claude will explain.

157 

158Built-in commands also guide you through setup:

159 

160* `/init` walks you through creating a CLAUDE.md for your project

161* `/agents` helps you configure custom subagents

162* `/doctor` diagnoses common issues with your installation

163 

164### It's a conversation

165 

166Claude Code is conversational. You don't need perfect prompts. Start with what you want, then refine:

167 

168```

169> Fix the login bug

170 

171[Claude investigates, tries something]

172 

173> That's not quite right. The issue is in the session handling.

174 

175[Claude adjusts approach]

176```

177 

178When the first attempt isn't right, you don't start over. You iterate.

179 

180#### Interrupt and steer

181 

182You can interrupt Claude at any point. If it's going down the wrong path, just type your correction and press Enter. Claude will stop what it's doing and adjust its approach based on your input. You don't have to wait for it to finish or start over.

183 

184### Be specific upfront

185 

186The more precise your initial prompt, the fewer corrections you'll need. Reference specific files, mention constraints, and point to example patterns.

187 

188```

189> The checkout flow is broken for users with expired cards.

190> Check src/payments/ for the issue, especially token refresh.

191> Write a failing test first, then fix it.

192```

193 

194Vague prompts like "fix the login bug" work, but you'll spend more time steering. Specific prompts like the above often succeed on the first attempt.

195 

196### Give Claude something to verify against

197 

198Claude performs better when it can check its own work. Include test cases, paste screenshots of expected UI, or define the output you want.

199 

200```

201> Implement validateEmail. Test cases: 'user@example.com' → true,

202> 'invalid' → false, 'user@.com' → false. Run the tests after.

203```

204 

205For visual work, paste a screenshot of the design and ask Claude to compare its implementation against it.

206 

207### Explore before implementing

208 

209For complex problems, separate research from coding. Use plan mode (`Shift+Tab` twice) to analyze the codebase first:

210 

211```

212> Read src/auth/ and understand how we handle sessions.

213> Then create a plan for adding OAuth support.

214```

215 

216Review the plan, refine it through conversation, then let Claude implement. This two-phase approach produces better results than jumping straight to code.

217 

218### Delegate, don't dictate

219 

220Think of delegating to a capable colleague. Give context and direction, then trust Claude to figure out the details:

221 

222```

223> The checkout flow is broken for users with expired cards.

224> The relevant code is in src/payments/. Can you investigate and fix it?

225```

226 

227You don't need to specify which files to read or what commands to run. Claude figures that out.

228 

229## What's next

230 

231<CardGroup cols={2}>

232 <Card title="Extend with features" icon="puzzle-piece" href="/en/features-overview">

233 Add Skills, MCP connections, and custom commands

234 </Card>

235 

236 <Card title="Common workflows" icon="graduation-cap" href="/en/common-workflows">

237 Step-by-step guides for typical tasks

238 </Card>

239</CardGroup>

iam.md +79 −42

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Identity and Access Management5# Identity and Access Management

2 6 

3> Learn how to configure user authentication, authorization, and access controls for Claude Code in your organization.7> Learn how to configure user authentication, authorization, and access controls for Claude Code in your organization.

4 8 

5## Authentication methods9## Authentication methods

6 10 

7Setting up Claude Code requires access to Anthropic models. For teams, you can set up Claude Code access in one of four ways:11Setting up Claude Code requires access to Anthropic models. For teams, you can set up Claude Code access in one of these ways:

12 

13* [Claude for Teams or Enterprise](/en/setup#for-teams-and-organizations) (recommended)

14* [Claude Console with team billing](/en/setup#for-teams-and-organizations)

15* [Amazon Bedrock](/en/amazon-bedrock)

16* [Google Vertex AI](/en/google-vertex-ai)

17* [Microsoft Foundry](/en/microsoft-foundry)

18 

19### Claude for Teams or Enterprise (recommended)

20 

21[Claude for Teams](https://claude.com/pricing#team-&-enterprise) and [Claude for Enterprise](https://anthropic.com/contact-sales) provide the best experience for organizations using Claude Code. Team members get access to both Claude Code and Claude on the web with centralized billing and team management.

22 

23* **Claude for Teams**: Self-service plan with collaboration features, admin tools, and billing management. Best for smaller teams.

24* **Claude for Enterprise**: Adds SSO, domain capture, role-based permissions, compliance API, and managed policy settings for organization-wide Claude Code configurations. Best for larger organizations with security and compliance requirements.

8 25 

9* Claude API via the Claude Console26**To set up Claude Code access:**

10* Amazon Bedrock

11* Microsoft Foundry

12* Google Vertex AI

13 27 

14### Claude API authentication281. Subscribe to [Claude for Teams](https://claude.com/pricing#team-&-enterprise) or contact sales for [Claude for Enterprise](https://anthropic.com/contact-sales)

292. Invite team members from the admin dashboard

303. Team members install Claude Code and log in with their Claude.ai accounts

15 31 

16**To set up Claude Code access for your team via Claude API:**32### Claude Console authentication

33 

34For organizations that prefer API-based billing, you can set up access through the Claude Console.

35 

36**To set up Claude Code access for your team via Claude Console:**

17 37 

181. Use your existing Claude Console account or create a new Claude Console account381. Use your existing Claude Console account or create a new Claude Console account

192. You can add users through either method below:392. You can add users through either method below:

20 * Bulk invite users from within the Console (Console -> Settings -> Members -> Invite)40 * Bulk invite users from within the Console (Console -> Settings -> Members -> Invite)

21 * [Set up SSO](https://support.claude.com/en/articles/10280258-setting-up-single-sign-on-on-the-api-console)41 * [Set up SSO](https://support.claude.com/en/articles/13132885-setting-up-single-sign-on-sso)

223. When inviting users, they need one of the following roles:423. When inviting users, they need one of the following roles:

23 * "Claude Code" role means users can only create Claude Code API keys43 * "Claude Code" role means users can only create Claude Code API keys

24 * "Developer" role means users can create any kind of API key44 * "Developer" role means users can create any kind of API key


45Claude Code uses a tiered permission system to balance power and safety:65Claude Code uses a tiered permission system to balance power and safety:

46 66 

47| Tool Type | Example | Approval Required | "Yes, don't ask again" Behavior |67| Tool Type | Example | Approval Required | "Yes, don't ask again" Behavior |

48| :---------------- | :------------------- | :---------------- | :-------------------------------------------- |68| :---------------- | :--------------- | :---------------- | :-------------------------------------------- |

49| Read-only | File reads, LS, Grep | No | N/A |69| Read-only | File reads, Grep | No | N/A |

50| Bash Commands | Shell execution | Yes | Permanently per project directory and command |70| Bash Commands | Shell execution | Yes | Permanently per project directory and command |

51| File Modification | Edit/write files | Yes | Until session end |71| File Modification | Edit/write files | Yes | Until session end |

52 72 


54 74 

55You can view & manage Claude Code's tool permissions with `/permissions`. This UI lists all permission rules and the settings.json file they are sourced from.75You can view & manage Claude Code's tool permissions with `/permissions`. This UI lists all permission rules and the settings.json file they are sourced from.

56 76 

57* **Allow** rules will allow Claude Code to use the specified tool without further manual approval.77* **Allow** rules let Claude Code use the specified tool without manual approval.

58* **Ask** rules will ask the user for confirmation whenever Claude Code tries to use the specified tool. Ask rules take precedence over allow rules.78* **Ask** rules prompt for confirmation whenever Claude Code tries to use the specified tool.

59* **Deny** rules will prevent Claude Code from using the specified tool. Deny rules take precedence over allow and ask rules.79* **Deny** rules prevent Claude Code from using the specified tool.

80 

81Rules are evaluated in order: **deny → ask → allow**. The first matching rule wins, so deny rules always take precedence.

82 

60* **Additional directories** extend Claude's file access to directories beyond the initial working directory.83* **Additional directories** extend Claude's file access to directories beyond the initial working directory.

61* **Default mode** controls Claude's permission behavior when encountering new requests.84* **Default mode** controls Claude's permission behavior when encountering new requests.

62 85 

63Permission rules use the format: `Tool` or `Tool(optional-specifier)`86Permission rules use the format: `Tool` or `Tool(optional-specifier)`

64 87 

65A rule that is just the tool name matches any use of that tool. For example, adding `Bash` to the list of allow rules would allow Claude Code to use the Bash tool without requiring user approval.88A rule that is just the tool name matches any use of that tool. For example, adding `Bash` to the allow list allows Claude Code to use the Bash tool without requiring user approval. `Bash(*)` is equivalent to `Bash` and can be used interchangeably.

89 

90<Note>

91 For a quick reference on permission rule syntax including wildcards, see [Permission rule syntax](/en/settings#permission-rule-syntax) in the settings documentation.

92</Note>

66 93 

67#### Permission modes94#### Permission modes

68 95 

69Claude Code supports several permission modes that can be set as the `defaultMode` in [settings files](/en/settings#settings-files):96Claude Code supports several permission modes that can be set as the `defaultMode` in [settings files](/en/settings#settings-files):

70 97 

71| Mode | Description |98| Mode | Description |

72| :------------------ | :--------------------------------------------------------------------------- |99| :------------------ | :------------------------------------------------------------------------------------------------------------------------ |

73| `default` | Standard behavior - prompts for permission on first use of each tool |100| `default` | Standard behavior - prompts for permission on first use of each tool |

74| `acceptEdits` | Automatically accepts file edit permissions for the session |101| `acceptEdits` | Automatically accepts file edit permissions for the session |

75| `plan` | Plan Mode - Claude can analyze but not modify files or execute commands |102| `plan` | Plan Mode - Claude can analyze but not modify files or execute commands |

103| `dontAsk` | Auto-denies tools unless pre-approved via `/permissions` or [`permissions.allow`](/en/settings#permission-settings) rules |

76| `bypassPermissions` | Skips all permission prompts (requires safe environment - see warning below) |104| `bypassPermissions` | Skips all permission prompts (requires safe environment - see warning below) |

77 105 

78#### Working directories106#### Working directories


80By default, Claude has access to files in the directory where it was launched. You can extend this access:108By default, Claude has access to files in the directory where it was launched. You can extend this access:

81 109 

82* **During startup**: Use `--add-dir <path>` CLI argument110* **During startup**: Use `--add-dir <path>` CLI argument

83* **During session**: Use `/add-dir` slash command111* **During session**: Use `/add-dir` command

84* **Persistent configuration**: Add to `additionalDirectories` in [settings files](/en/settings#settings-files)112* **Persistent configuration**: Add to `additionalDirectories` in [settings files](/en/settings#settings-files)

85 113 

86Files in additional directories follow the same permission rules as the original working directory - they become readable without prompts, and file editing permissions follow the current permission mode.114Files in additional directories follow the same permission rules as the original working directory - they become readable without prompts, and file editing permissions follow the current permission mode.


91 119 

92**Bash**120**Bash**

93 121 

122Bash permission rules support both prefix matching with `:*` and wildcard matching with `*`:

123 

94* `Bash(npm run build)` Matches the exact Bash command `npm run build`124* `Bash(npm run build)` Matches the exact Bash command `npm run build`

95* `Bash(npm run test:*)` Matches Bash commands starting with `npm run test`125* `Bash(npm run test:*)` Matches Bash commands starting with `npm run test`

96* `Bash(curl http://site.com/:*)` Matches curl commands that start with exactly `curl http://site.com/`126* `Bash(npm *)` Matches any command starting with `npm ` (e.g., `npm install`, `npm run build`)

127* `Bash(* install)` Matches any command ending with ` install` (e.g., `npm install`, `yarn install`)

128* `Bash(git * main)` Matches commands like `git checkout main`, `git merge main`

129 

130The key difference between `:*` and `*`: the `:*` suffix enforces a word boundary, requiring the prefix to be followed by a space or end-of-string. For example, `Bash(ls:*)` matches `ls -la` but not `lsof`. In contrast, `Bash(ls*)` with a bare `*` matches both `ls -la` and `lsof` because `*` has no word boundary constraint.

97 131 

98<Tip>132<Tip>

99 Claude Code is aware of shell operators (like `&&`) so a prefix match rule like `Bash(safe-cmd:*)` won't give it permission to run the command `safe-cmd && other-cmd`133 Claude Code is aware of shell operators (like `&&`) so a prefix match rule like `Bash(safe-cmd:*)` won't give it permission to run the command `safe-cmd && other-cmd`


102<Warning>136<Warning>

103 Important limitations of Bash permission patterns:137 Important limitations of Bash permission patterns:

104 138 

105 1. This tool uses **prefix matches**, not regex or glob patterns139 1. The `:*` wildcard only works at the end of a pattern for prefix matching

106 2. The wildcard `:*` only works at the end of a pattern to match any continuation140 2. The `*` wildcard can appear at any position and matches any sequence of characters

107 3. Patterns like `Bash(curl http://github.com/:*)` can be bypassed in many ways:141 3. Patterns like `Bash(curl http://github.com/:*)` can be bypassed in many ways:

108 * Options before URL: `curl -X GET http://github.com/...` won't match142 * Options before URL: `curl -X GET http://github.com/...` won't match

109 * Different protocol: `curl https://github.com/...` won't match143 * Different protocol: `curl https://github.com/...` won't match


113 147 

114 For more reliable URL filtering, consider:148 For more reliable URL filtering, consider:

115 149 

116 * Using the WebFetch tool with `WebFetch(domain:github.com)` permission150 * **Restrict Bash network tools**: Use deny rules to block `curl`, `wget`, and similar commands, then use the WebFetch tool with `WebFetch(domain:github.com)` permission for allowed domains

151 * **Use PreToolUse hooks**: Implement a hook that validates URLs in Bash commands and blocks disallowed domains

117 * Instructing Claude Code about your allowed curl patterns via CLAUDE.md152 * Instructing Claude Code about your allowed curl patterns via CLAUDE.md

118 * Using hooks for custom permission validation153 

154 Note that using WebFetch alone does not prevent network access. If Bash is allowed, Claude can still use `curl`, `wget`, or other tools to reach any URL.

119</Warning>155</Warning>

120 156 

121**Read & Edit**157**Read & Edit**

122 158 

123`Edit` rules apply to all built-in tools that edit files. Claude will make a best-effort attempt to apply `Read` rules to all built-in tools that read files like Grep, Glob, and LS.159`Edit` rules apply to all built-in tools that edit files. Claude will make a best-effort attempt to apply `Read` rules to all built-in tools that read files like Grep and Glob.

124 160 

125Read & Edit rules both follow the [gitignore](https://git-scm.com/docs/gitignore) specification with four distinct pattern types:161Read & Edit rules both follow the [gitignore](https://git-scm.com/docs/gitignore) specification with four distinct pattern types:

126 162 


140* `Edit(//tmp/scratch.txt)` - Edits the absolute path `/tmp/scratch.txt`176* `Edit(//tmp/scratch.txt)` - Edits the absolute path `/tmp/scratch.txt`

141* `Read(src/**)` - Reads from `<current-directory>/src/`177* `Read(src/**)` - Reads from `<current-directory>/src/`

142 178 

179<Note>

180 In gitignore patterns, `*` matches files in a single directory while `**` matches recursively across directories. To allow all file access, use just the tool name without parentheses: `Read`, `Edit`, or `Write`.

181</Note>

182 

143**WebFetch**183**WebFetch**

144 184 

145* `WebFetch(domain:example.com)` Matches fetch requests to example.com185* `WebFetch(domain:example.com)` Matches fetch requests to example.com


147**MCP**187**MCP**

148 188 

149* `mcp__puppeteer` Matches any tool provided by the `puppeteer` server (name configured in Claude Code)189* `mcp__puppeteer` Matches any tool provided by the `puppeteer` server (name configured in Claude Code)

190* `mcp__puppeteer__*` Wildcard syntax that also matches all tools from the `puppeteer` server

150* `mcp__puppeteer__puppeteer_navigate` Matches the `puppeteer_navigate` tool provided by the `puppeteer` server191* `mcp__puppeteer__puppeteer_navigate` Matches the `puppeteer_navigate` tool provided by the `puppeteer` server

151 192 

152<Warning>193**Task (Subagents)**

153 Unlike other permission types, MCP permissions do NOT support wildcards (`*`).

154 194 

155 To approve all tools from an MCP server:195Use `Task(AgentName)` rules to control which [subagents](/en/sub-agents) Claude can use:

156 196 

157 * ✅ Use: `mcp__github` (approves ALL GitHub tools)197* `Task(Explore)` Matches the Explore subagent

158 * ❌ Don't use: `mcp__github__*` (wildcards are not supported)198* `Task(Plan)` Matches the Plan subagent

199* `Task(Verify)` Matches the Verify subagent

159 200 

160 To approve specific tools only, list each one:201Add these rules to the `deny` array in your [settings](/en/settings#permission-settings) or use the `--disallowedTools` CLI flag to disable specific agents. For example, to disable the Explore agent:

161 202 

162 * ✅ Use: `mcp__github__get_issue`203```json theme={null}

163 * ✅ Use: `mcp__github__list_issues`204{

164</Warning>205 "permissions": {

206 "deny": ["Task(Explore)"]

207 }

208}

209```

165 210 

166### Additional permission control with hooks211### Additional permission control with hooks

167 212 

168[Claude Code hooks](/en/hooks-guide) provide a way to register custom shell commands to perform permission evaluation at runtime. When Claude Code makes a tool call, PreToolUse hooks run before the permission system runs, and the hook output can determine whether to approve or deny the tool call in place of the permission system.213[Claude Code hooks](/en/hooks-guide) provide a way to register custom shell commands to perform permission evaluation at runtime. When Claude Code makes a tool call, PreToolUse hooks run before the permission system runs, and the hook output can determine whether to approve or deny the tool call in place of the permission system.

169 214 

170### Enterprise managed policy settings215### Managed settings

171 

172For enterprise deployments of Claude Code, we support enterprise managed policy settings that take precedence over user and project settings. This allows system administrators to enforce security policies that users cannot override.

173 

174System administrators can deploy policies to:

175 

176* macOS: `/Library/Application Support/ClaudeCode/managed-settings.json`

177* Linux and WSL: `/etc/claude-code/managed-settings.json`

178* Windows: `C:\ProgramData\ClaudeCode\managed-settings.json`

179 216 

180These policy files follow the same format as regular [settings files](/en/settings#settings-files) but cannot be overridden by user or project settings. This ensures consistent security policies across your organization.217For organizations that need centralized control over Claude Code configuration, administrators can deploy `managed-settings.json` files to [system directories](/en/settings#settings-files). These policy files follow the same format as regular settings files and cannot be overridden by user or project settings.

181 218 

182### Settings precedence219### Settings precedence

183 220 

184When multiple settings sources exist, they are applied in the following order (highest to lowest precedence):221When multiple settings sources exist, they are applied in the following order (highest to lowest precedence):

185 222 

1861. Enterprise policies2231. Managed settings (`managed-settings.json`)

1872. Command line arguments2242. Command line arguments

1883. Local project settings (`.claude/settings.local.json`)2253. Local project settings (`.claude/settings.local.json`)

1894. Shared project settings (`.claude/settings.json`)2264. Shared project settings (`.claude/settings.json`)

interactive-mode.md +127 −12

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Interactive mode5# Interactive mode

2 6 

3> Complete reference for keyboard shortcuts, input modes, and interactive features in Claude Code sessions.7> Complete reference for keyboard shortcuts, input modes, and interactive features in Claude Code sessions.


6 10 

7<Note>11<Note>

8 Keyboard shortcuts may vary by platform and terminal. Press `?` to see available shortcuts for your environment.12 Keyboard shortcuts may vary by platform and terminal. Press `?` to see available shortcuts for your environment.

13 

14 **macOS users**: Option/Alt key shortcuts (`Alt+B`, `Alt+F`, `Alt+Y`, `Alt+M`, `Alt+P`) require configuring Option as Meta in your terminal:

15 

16 * **iTerm2**: Settings → Profiles → Keys → Set Left/Right Option key to "Esc+"

17 * **Terminal.app**: Settings → Profiles → Keyboard → Check "Use Option as Meta Key"

18 * **VS Code**: Settings → Profiles → Keys → Set Left/Right Option key to "Esc+"

19 

20 See [Terminal configuration](/en/terminal-config) for details.

9</Note>21</Note>

10 22 

11### General controls23### General controls

12 24 

13| Shortcut | Description | Context |25| Shortcut | Description | Context |

14| :------------------------------------------- | :---------------------------------------------------------------------------------------------- | :---------------------------------------------------------- |26| :------------------------------------------------ | :--------------------------------- | :-------------------------------------------------------------------------------------------- |

15| `Ctrl+C` | Cancel current input or generation | Standard interrupt |27| `Ctrl+C` | Cancel current input or generation | Standard interrupt |

16| `Ctrl+D` | Exit Claude Code session | EOF signal |28| `Ctrl+D` | Exit Claude Code session | EOF signal |

29| `Ctrl+G` | Open in default text editor | Edit your prompt or custom response in your default text editor |

17| `Ctrl+L` | Clear terminal screen | Keeps conversation history |30| `Ctrl+L` | Clear terminal screen | Keeps conversation history |

18| `Ctrl+O` | Toggle verbose output | Shows detailed tool usage and execution |31| `Ctrl+O` | Toggle verbose output | Shows detailed tool usage and execution |

19| `Ctrl+R` | Reverse search command history | Search through previous commands interactively |32| `Ctrl+R` | Reverse search command history | Search through previous commands interactively |

20| `Ctrl+V` (macOS/Linux) or `Alt+V` (Windows) | Paste image from clipboard | Pastes an image or path to an image file |33| `Ctrl+V` or `Cmd+V` (iTerm2) or `Alt+V` (Windows) | Paste image from clipboard | Pastes an image or path to an image file |

34| `Ctrl+B` | Background running tasks | Backgrounds bash commands and agents. Tmux users press twice |

35| `Left/Right arrows` | Cycle through dialog tabs | Navigate between tabs in permission dialogs and menus |

21| `Up/Down arrows` | Navigate command history | Recall previous inputs |36| `Up/Down arrows` | Navigate command history | Recall previous inputs |

22| `Esc` + `Esc` | Rewind the code/conversation | Restore the code and/or conversation to a previous point |37| `Esc` + `Esc` | Rewind the code/conversation | Restore the code and/or conversation to a previous point |

23| `Tab` | Toggle [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) | Switch between Thinking on and Thinking off |

24| `Shift+Tab` or `Alt+M` (some configurations) | Toggle permission modes | Switch between Auto-Accept Mode, Plan Mode, and normal mode |38| `Shift+Tab` or `Alt+M` (some configurations) | Toggle permission modes | Switch between Auto-Accept Mode, Plan Mode, and normal mode |

39| `Option+P` (macOS) or `Alt+P` (Windows/Linux) | Switch model | Switch models without clearing your prompt |

40| `Option+T` (macOS) or `Alt+T` (Windows/Linux) | Toggle extended thinking | Enable or disable extended thinking mode. Run `/terminal-setup` first to enable this shortcut |

41 

42### Text editing

43 

44| Shortcut | Description | Context |

45| :----------------------- | :--------------------------- | :------------------------------------------------------------------------------------------------------------ |

46| `Ctrl+K` | Delete to end of line | Stores deleted text for pasting |

47| `Ctrl+U` | Delete entire line | Stores deleted text for pasting |

48| `Ctrl+Y` | Paste deleted text | Paste text deleted with `Ctrl+K` or `Ctrl+U` |

49| `Alt+Y` (after `Ctrl+Y`) | Cycle paste history | After pasting, cycle through previously deleted text. Requires [Option as Meta](#keyboard-shortcuts) on macOS |

50| `Alt+B` | Move cursor back one word | Word navigation. Requires [Option as Meta](#keyboard-shortcuts) on macOS |

51| `Alt+F` | Move cursor forward one word | Word navigation. Requires [Option as Meta](#keyboard-shortcuts) on macOS |

52 

53### Theme and display

54 

55| Shortcut | Description | Context |

56| :------- | :----------------------------------------- | :----------------------------------------------------------------------------------------------------------- |

57| `Ctrl+T` | Toggle syntax highlighting for code blocks | Only works inside the `/theme` picker menu. Controls whether code in Claude's responses uses syntax coloring |

58 

59<Note>

60 Syntax highlighting is only available in the native build of Claude Code.

61</Note>

25 62 

26### Multiline input63### Multiline input

27 64 

28| Method | Shortcut | Context |65| Method | Shortcut | Context |

29| :--------------- | :------------- | :-------------------------------- |66| :--------------- | :------------- | :------------------------------------------------------ |

30| Quick escape | `\` + `Enter` | Works in all terminals |67| Quick escape | `\` + `Enter` | Works in all terminals |

31| macOS default | `Option+Enter` | Default on macOS |68| macOS default | `Option+Enter` | Default on macOS |

32| Terminal setup | `Shift+Enter` | After `/terminal-setup` |69| Shift+Enter | `Shift+Enter` | Works out of the box in iTerm2, WezTerm, Ghostty, Kitty |

33| Control sequence | `Ctrl+J` | Line feed character for multiline |70| Control sequence | `Ctrl+J` | Line feed character for multiline |

34| Paste mode | Paste directly | For code blocks, logs |71| Paste mode | Paste directly | For code blocks, logs |

35 72 

36<Tip>73<Tip>

37 Configure your preferred line break behavior in terminal settings. Run `/terminal-setup` to install Shift+Enter binding for iTerm2 and VS Code terminals.74 Shift+Enter works without configuration in iTerm2, WezTerm, Ghostty, and Kitty. For other terminals (VS Code, Alacritty, Zed, Warp), run `/terminal-setup` to install the binding.

38</Tip>75</Tip>

39 76 

40### Quick commands77### Quick commands

41 78 

42| Shortcut | Description | Notes |79| Shortcut | Description | Notes |

43| :----------- | :--------------------------------- | :------------------------------------------------------------ |80| :----------- | :---------------- | :------------------------------------------------------------------- |

44| `#` at start | Memory shortcut - add to CLAUDE.md | Prompts for file selection |81| `/` at start | Command or skill | See [built-in commands](#built-in-commands) and [skills](/en/skills) |

45| `/` at start | Slash command | See [slash commands](/en/slash-commands) |

46| `!` at start | Bash mode | Run commands directly and add execution output to the session |82| `!` at start | Bash mode | Run commands directly and add execution output to the session |

47| `@` | File path mention | Trigger file path autocomplete |83| `@` | File path mention | Trigger file path autocomplete |

48 84 

85## Built-in commands

86 

87Built-in commands are shortcuts for common actions. The table below covers commonly used commands but not all available options. Type `/` in Claude Code to see the full list, or type `/` followed by any letters to filter.

88 

89To create your own commands you can invoke with `/`, see [skills](/en/skills).

90 

91| Command | Purpose |

92| :------------------------ | :-------------------------------------------------------------------------------------------------------------------------- |

93| `/clear` | Clear conversation history |

94| `/compact [instructions]` | Compact conversation with optional focus instructions |

95| `/config` | Open the Settings interface (Config tab) |

96| `/context` | Visualize current context usage as a colored grid |

97| `/cost` | Show token usage statistics. See [cost tracking guide](/en/costs#using-the-cost-command) for subscription-specific details. |

98| `/doctor` | Checks the health of your Claude Code installation |

99| `/exit` | Exit the REPL |

100| `/export [filename]` | Export the current conversation to a file or clipboard |

101| `/help` | Get usage help |

102| `/init` | Initialize project with `CLAUDE.md` guide |

103| `/mcp` | Manage MCP server connections and OAuth authentication |

104| `/memory` | Edit `CLAUDE.md` memory files |

105| `/model` | Select or change the AI model |

106| `/permissions` | View or update [permissions](/en/iam#configuring-permissions) |

107| `/plan` | Enter plan mode directly from the prompt |

108| `/rename <name>` | Rename the current session for easier identification |

109| `/resume [session]` | Resume a conversation by ID or name, or open the session picker |

110| `/rewind` | Rewind the conversation and/or code |

111| `/stats` | Visualize daily usage, session history, streaks, and model preferences |

112| `/status` | Open the Settings interface (Status tab) showing version, model, account, and connectivity |

113| `/statusline` | Set up Claude Code's status line UI |

114| `/tasks` | List and manage background tasks |

115| `/teleport` | Resume a remote session from claude.ai (subscribers only) |

116| `/theme` | Change the color theme |

117| `/todos` | List current TODO items |

118| `/usage` | For subscription plans only: show plan usage limits and rate limit status |

119 

120### MCP prompts

121 

122MCP servers can expose prompts that appear as commands. These use the format `/mcp__<server>__<prompt>` and are dynamically discovered from connected servers. See [MCP prompts](/en/mcp#use-mcp-prompts-as-commands) for details.

123 

49## Vim editor mode124## Vim editor mode

50 125 

51Enable vim-style editing with `/vim` command or configure permanently via `/config`.126Enable vim-style editing with `/vim` command or configure permanently via `/config`.


65### Navigation (NORMAL mode)140### Navigation (NORMAL mode)

66 141 

67| Command | Action |142| Command | Action |

68| :-------------- | :------------------------ |143| :-------------- | :-------------------------------------------------- |

69| `h`/`j`/`k`/`l` | Move left/down/up/right |144| `h`/`j`/`k`/`l` | Move left/down/up/right |

70| `w` | Next word |145| `w` | Next word |

71| `e` | End of word |146| `e` | End of word |


75| `^` | First non-blank character |150| `^` | First non-blank character |

76| `gg` | Beginning of input |151| `gg` | Beginning of input |

77| `G` | End of input |152| `G` | End of input |

153| `f{char}` | Jump to next occurrence of character |

154| `F{char}` | Jump to previous occurrence of character |

155| `t{char}` | Jump to just before next occurrence of character |

156| `T{char}` | Jump to just after previous occurrence of character |

157| `;` | Repeat last f/F/t/T motion |

158| `,` | Repeat last f/F/t/T motion in reverse |

78 159 

79### Editing (NORMAL mode)160### Editing (NORMAL mode)

80 161 


87| `cc` | Change line |168| `cc` | Change line |

88| `C` | Change to end of line |169| `C` | Change to end of line |

89| `cw`/`ce`/`cb` | Change word/to end/back |170| `cw`/`ce`/`cb` | Change word/to end/back |

171| `yy`/`Y` | Yank (copy) line |

172| `yw`/`ye`/`yb` | Yank word/to end/back |

173| `p` | Paste after cursor |

174| `P` | Paste before cursor |

175| `>>` | Indent line |

176| `<<` | Dedent line |

177| `J` | Join lines |

90| `.` | Repeat last change |178| `.` | Repeat last change |

91 179 

180### Text objects (NORMAL mode)

181 

182Text objects work with operators like `d`, `c`, and `y`:

183 

184| Command | Action |

185| :-------- | :--------------------------------------- |

186| `iw`/`aw` | Inner/around word |

187| `iW`/`aW` | Inner/around WORD (whitespace-delimited) |

188| `i"`/`a"` | Inner/around double quotes |

189| `i'`/`a'` | Inner/around single quotes |

190| `i(`/`a(` | Inner/around parentheses |

191| `i[`/`a[` | Inner/around brackets |

192| `i{`/`a{` | Inner/around braces |

193 

92## Command history194## Command history

93 195 

94Claude Code maintains command history for the current session:196Claude Code maintains command history for the current session:


129 231 

130**Key features:**232**Key features:**

131 233 

132* Output is buffered and Claude can retrieve it using the BashOutput tool234* Output is buffered and Claude can retrieve it using the TaskOutput tool

133* Background tasks have unique IDs for tracking and output retrieval235* Background tasks have unique IDs for tracking and output retrieval

134* Background tasks are automatically cleaned up when Claude Code exits236* Background tasks are automatically cleaned up when Claude Code exits

135 237 

238To disable all background task functionality, set the `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` environment variable to `1`. See [Environment variables](/en/settings#environment-variables) for details.

239 

136**Common backgrounded commands:**240**Common backgrounded commands:**

137 241 

138* Build tools (webpack, vite, make)242* Build tools (webpack, vite, make)


157* Shows real-time progress and output261* Shows real-time progress and output

158* Supports the same `Ctrl+B` backgrounding for long-running commands262* Supports the same `Ctrl+B` backgrounding for long-running commands

159* Does not require Claude to interpret or approve the command263* Does not require Claude to interpret or approve the command

264* Supports history-based autocomplete: type a partial command and press **Tab** to complete from previous `!` commands in the current project

160 265 

161This is useful for quick shell operations while maintaining conversation context.266This is useful for quick shell operations while maintaining conversation context.

162 267 

268## Task list

269 

270When working on complex, multi-step work, Claude creates a task list to track progress. Tasks appear in the status area of your terminal with indicators showing what's pending, in progress, or complete.

271 

272* Press `Ctrl+T` to toggle the task list view. The display shows up to 10 tasks at a time

273* To see all tasks or clear them, ask Claude directly: "show me all tasks" or "clear all tasks"

274* Tasks persist across context compactions, helping Claude stay organized on larger projects

275* To share a task list across sessions, set `CLAUDE_CODE_TASK_LIST_ID` to use a named directory in `~/.claude/tasks/`: `CLAUDE_CODE_TASK_LIST_ID=my-project claude`

276* To revert to the previous TODO list, set `CLAUDE_CODE_ENABLE_TASKS=false`.

277 

163## See also278## See also

164 279 

165* [Slash commands](/en/slash-commands) - Interactive session commands280* [Skills](/en/skills) - Custom prompts and workflows

166* [Checkpointing](/en/checkpointing) - Rewind Claude's edits and restore previous states281* [Checkpointing](/en/checkpointing) - Rewind Claude's edits and restore previous states

167* [CLI reference](/en/cli-reference) - Command-line flags and options282* [CLI reference](/en/cli-reference) - Command-line flags and options

168* [Settings](/en/settings) - Configuration options283* [Settings](/en/settings) - Configuration options

jetbrains.md +8 −6

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# JetBrains IDEs5# JetBrains IDEs

2 6 

3> Use Claude Code with JetBrains IDEs including IntelliJ, PyCharm, WebStorm, and more7> Use Claude Code with JetBrains IDEs including IntelliJ, PyCharm, WebStorm, and more


20* **Quick launch**: Use `Cmd+Esc` (Mac) or `Ctrl+Esc` (Windows/Linux) to open Claude Code directly from your editor, or click the Claude Code button in the UI24* **Quick launch**: Use `Cmd+Esc` (Mac) or `Ctrl+Esc` (Windows/Linux) to open Claude Code directly from your editor, or click the Claude Code button in the UI

21* **Diff viewing**: Code changes can be displayed directly in the IDE diff viewer instead of the terminal25* **Diff viewing**: Code changes can be displayed directly in the IDE diff viewer instead of the terminal

22* **Selection context**: The current selection/tab in the IDE is automatically shared with Claude Code26* **Selection context**: The current selection/tab in the IDE is automatically shared with Claude Code

23* **File reference shortcuts**: Use `Cmd+Option+K` (Mac) or `Alt+Ctrl+K` (Linux/Windows) to insert file references (e.g., @File#L1-99)27* **File reference shortcuts**: Use `Cmd+Option+K` (Mac) or `Alt+Ctrl+K` (Linux/Windows) to insert file references (for example, @File#L1-99)

24* **Diagnostic sharing**: Diagnostic errors (lint, syntax, etc.) from the IDE are automatically shared with Claude as you work28* **Diagnostic sharing**: Diagnostic errors (lint, syntax, etc.) from the IDE are automatically shared with Claude as you work

25 29 

26## Installation30## Installation


29 33 

30Find and install the [Claude Code plugin](https://plugins.jetbrains.com/plugin/27310-claude-code-beta-) from the JetBrains marketplace and restart your IDE.34Find and install the [Claude Code plugin](https://plugins.jetbrains.com/plugin/27310-claude-code-beta-) from the JetBrains marketplace and restart your IDE.

31 35 

32### Auto-Installation36If you haven't installed Claude Code yet, see [our quickstart guide](/en/quickstart) for installation instructions.

33 

34The plugin may also be auto-installed when you run `claude` in the integrated terminal. The IDE must be restarted completely to take effect.

35 37 

36<Note>38<Note>

37 After installing the plugin, you must restart your IDE completely for it to take effect. You may need to restart multiple times.39 After installing the plugin, you may need to restart your IDE completely for it to take effect.

38</Note>40</Note>

39 41 

40## Usage42## Usage


70 72 

71#### General Settings73#### General Settings

72 74 

73* **Claude command**: Specify a custom command to run Claude (e.g., `claude`, `/usr/local/bin/claude`, or `npx @anthropic/claude`)75* **Claude command**: Specify a custom command to run Claude (for example, `claude`, `/usr/local/bin/claude`, or `npx @anthropic/claude`)

74* **Suppress notification for Claude command not found**: Skip notifications about not finding the Claude command76* **Suppress notification for Claude command not found**: Skip notifications about not finding the Claude command

75* **Enable using Option+Enter for multi-line prompts** (macOS only): When enabled, Option+Enter inserts new lines in Claude Code prompts. Disable if experiencing issues with the Option key being captured unexpectedly (requires terminal restart)77* **Enable using Option+Enter for multi-line prompts** (macOS only): When enabled, Option+Enter inserts new lines in Claude Code prompts. Disable if experiencing issues with the Option key being captured unexpectedly (requires terminal restart)

76* **Enable automatic updates**: Automatically check for and install plugin updates (applied on restart)78* **Enable automatic updates**: Automatically check for and install plugin updates (applied on restart)

llm-gateway.md +4 −0

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# LLM gateway configuration5# LLM gateway configuration

2 6 

3> Learn how to configure Claude Code to work with LLM gateway solutions. Covers gateway requirements, authentication configuration, model selection, and provider-specific endpoint setup.7> Learn how to configure Claude Code to work with LLM gateway solutions. Covers gateway requirements, authentication configuration, model selection, and provider-specific endpoint setup.

mcp.md +263 −40

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Connect Claude Code to tools via MCP5# Connect Claude Code to tools via MCP

2 6 

3> Learn how to connect Claude Code to your tools with the Model Context Protocol.7> Learn how to connect Claude Code to your tools with the Model Context Protocol.

4 8 

5Claude Code can connect to hundreds of external tools and data sources through the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction), an open-source standard for AI-tool integrations. MCP servers give Claude Code access to your tools, databases, and APIs.9 

10Claude Code can connect to hundreds of external tools and data sources through the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction), an open source standard for AI-tool integrations. MCP servers give Claude Code access to your tools, databases, and APIs.

6 11 

7## What you can do with MCP12## What you can do with MCP

8 13 


10 15 

11* **Implement features from issue trackers**: "Add the feature described in JIRA issue ENG-4521 and create a PR on GitHub."16* **Implement features from issue trackers**: "Add the feature described in JIRA issue ENG-4521 and create a PR on GitHub."

12* **Analyze monitoring data**: "Check Sentry and Statsig to check the usage of the feature described in ENG-4521."17* **Analyze monitoring data**: "Check Sentry and Statsig to check the usage of the feature described in ENG-4521."

13* **Query databases**: "Find emails of 10 random users who used feature ENG-4521, based on our Postgres database."18* **Query databases**: "Find emails of 10 random users who used feature ENG-4521, based on our PostgreSQL database."

14* **Integrate designs**: "Update our standard email template based on the new Figma designs that were posted in Slack"19* **Integrate designs**: "Update our standard email template based on the new Figma designs that were posted in Slack"

15* **Automate workflows**: "Create Gmail drafts inviting these 10 users to a feedback session about the new feature."20* **Automate workflows**: "Create Gmail drafts inviting these 10 users to a feedback session about the new feature."

16 21 


76 81 

77```bash theme={null}82```bash theme={null}

78# Basic syntax83# Basic syntax

79claude mcp add --transport stdio <name> <command> [args...]84claude mcp add [options] <name> -- <command> [args...]

80 85 

81# Real example: Add Airtable server86# Real example: Add Airtable server

82claude mcp add --transport stdio airtable --env AIRTABLE_API_KEY=YOUR_KEY \87claude mcp add --transport stdio --env AIRTABLE_API_KEY=YOUR_KEY airtable \

83 -- npx -y airtable-mcp-server88 -- npx -y airtable-mcp-server

84```89```

85 90 

86<Note>91<Note>

87 **Understanding the "--" parameter:**92 **Important: Option ordering**

88 The `--` (double dash) separates Claude's own CLI flags from the command and arguments that get passed to the MCP server. Everything before `--` are options for Claude (like `--env`, `--scope`), and everything after `--` is the actual command to run the MCP server.93 

94 All options (`--transport`, `--env`, `--scope`, `--header`) must come **before** the server name. The `--` (double dash) then separates the server name from the command and arguments that get passed to the MCP server.

89 95 

90 For example:96 For example:

91 97 

92 * `claude mcp add --transport stdio myserver -- npx server` → runs `npx server`98 * `claude mcp add --transport stdio myserver -- npx server` → runs `npx server`

93 * `claude mcp add --transport stdio myserver --env KEY=value -- python server.py --port 8080` → runs `python server.py --port 8080` with `KEY=value` in environment99 * `claude mcp add --transport stdio --env KEY=value myserver -- python server.py --port 8080` → runs `python server.py --port 8080` with `KEY=value` in environment

94 100 

95 This prevents conflicts between Claude's flags and the server's flags.101 This prevents conflicts between Claude's flags and the server's flags.

96</Note>102</Note>


113/mcp119/mcp

114```120```

115 121 

122### Dynamic tool updates

123 

124Claude Code supports MCP `list_changed` notifications, allowing MCP servers to dynamically update their available tools, prompts, and resources without requiring you to disconnect and reconnect. When an MCP server sends a `list_changed` notification, Claude Code automatically refreshes the available capabilities from that server.

125 

116<Tip>126<Tip>

117 Tips:127 Tips:

118 128 


120 * `local` (default): Available only to you in the current project (was called `project` in older versions)130 * `local` (default): Available only to you in the current project (was called `project` in older versions)

121 * `project`: Shared with everyone in the project via `.mcp.json` file131 * `project`: Shared with everyone in the project via `.mcp.json` file

122 * `user`: Available to you across all projects (was called `global` in older versions)132 * `user`: Available to you across all projects (was called `global` in older versions)

123 * Set environment variables with `--env` flags (e.g., `--env KEY=value`)133 * Set environment variables with `--env` flags (for example, `--env KEY=value`)

124 * Configure MCP server startup timeout using the MCP\_TIMEOUT environment variable (e.g., `MCP_TIMEOUT=10000 claude` sets a 10-second timeout)134 * Configure MCP server startup timeout using the MCP\_TIMEOUT environment variable (for example, `MCP_TIMEOUT=10000 claude` sets a 10-second timeout)

125 * Claude Code will display a warning when MCP tool output exceeds 10,000 tokens. To increase this limit, set the `MAX_MCP_OUTPUT_TOKENS` environment variable (e.g., `MAX_MCP_OUTPUT_TOKENS=50000`)135 * Claude Code will display a warning when MCP tool output exceeds 10,000 tokens. To increase this limit, set the `MAX_MCP_OUTPUT_TOKENS` environment variable (for example, `MAX_MCP_OUTPUT_TOKENS=50000`)

126 * Use `/mcp` to authenticate with remote servers that require OAuth 2.0 authentication136 * Use `/mcp` to authenticate with remote servers that require OAuth 2.0 authentication

127</Tip>137</Tip>

128 138 


208 218 

209### Local scope219### Local scope

210 220 

211Local-scoped servers represent the default configuration level and are stored in your project-specific user settings. These servers remain private to you and are only accessible when working within the current project directory. This scope is ideal for personal development servers, experimental configurations, or servers containing sensitive credentials that shouldn't be shared.221Local-scoped servers represent the default configuration level and are stored in `~/.claude.json` under your project's path. These servers remain private to you and are only accessible when working within the current project directory. This scope is ideal for personal development servers, experimental configurations, or servers containing sensitive credentials that shouldn't be shared.

222 

223<Note>

224 The term "local scope" for MCP servers differs from general local settings. MCP local-scoped servers are stored in `~/.claude.json` (your home directory), while general local settings use `.claude/settings.local.json` (in the project directory). See [Settings](/en/settings#settings-files) for details on settings file locations.

225</Note>

212 226 

213```bash theme={null}227```bash theme={null}

214# Add a local-scoped server (default)228# Add a local-scoped server (default)


245 259 

246### User scope260### User scope

247 261 

248User-scoped servers provide cross-project accessibility, making them available across all projects on your machine while remaining private to your user account. This scope works well for personal utility servers, development tools, or services you frequently use across different projects.262User-scoped servers are stored in `~/.claude.json` and provide cross-project accessibility, making them available across all projects on your machine while remaining private to your user account. This scope works well for personal utility servers, development tools, or services you frequently use across different projects.

249 263 

250```bash theme={null}264```bash theme={null}

251# Add a user server265# Add a user server


258 272 

259* **Local scope**: Personal servers, experimental configurations, or sensitive credentials specific to one project273* **Local scope**: Personal servers, experimental configurations, or sensitive credentials specific to one project

260* **Project scope**: Team-shared servers, project-specific tools, or services required for collaboration274* **Project scope**: Team-shared servers, project-specific tools, or services required for collaboration

261* **User scope**: Personal utilities needed across multiple projects, development tools, or frequently-used services275* **User scope**: Personal utilities needed across multiple projects, development tools, or frequently used services

276 

277<Note>

278 **Where are MCP servers stored?**

279 

280 * **User and local scope**: `~/.claude.json` (in the `mcpServers` field or under project paths)

281 * **Project scope**: `.mcp.json` in your project root (checked into source control)

282 * **Managed**: `managed-mcp.json` in system directories (see [Managed MCP configuration](#managed-mcp-configuration))

283</Note>

262 284 

263### Scope hierarchy and precedence285### Scope hierarchy and precedence

264 286 


454 * It reads the Claude Desktop configuration file from its standard location on those platforms476 * It reads the Claude Desktop configuration file from its standard location on those platforms

455 * Use the `--scope user` flag to add servers to your user configuration477 * Use the `--scope user` flag to add servers to your user configuration

456 * Imported servers will have the same names as in Claude Desktop478 * Imported servers will have the same names as in Claude Desktop

457 * If servers with the same names already exist, they will get a numerical suffix (e.g., `server_1`)479 * If servers with the same names already exist, they will get a numerical suffix (for example, `server_1`)

458</Tip>480</Tip>

459 481 

460## Use Claude Code as an MCP server482## Use Claude Code as an MCP server


513 535 

514 * The server provides access to Claude's tools like View, Edit, LS, etc.536 * The server provides access to Claude's tools like View, Edit, LS, etc.

515 * In Claude Desktop, try asking Claude to read files in a directory, make edits, and more.537 * In Claude Desktop, try asking Claude to read files in a directory, make edits, and more.

516 * Note that this MCP server is simply exposing Claude Code's tools to your MCP client, so your own client is responsible for implementing user confirmation for individual tool calls.538 * Note that this MCP server is only exposing Claude Code's tools to your MCP client, so your own client is responsible for implementing user confirmation for individual tool calls.

517</Tip>539</Tip>

518 540 

519## MCP output limits and warnings541## MCP output limits and warnings


583 * Resources can contain any type of content that the MCP server provides (text, JSON, structured data, etc.)605 * Resources can contain any type of content that the MCP server provides (text, JSON, structured data, etc.)

584</Tip>606</Tip>

585 607 

586## Use MCP prompts as slash commands608## Scale with MCP Tool Search

609 

610When you have many MCP servers configured, tool definitions can consume a significant portion of your context window. MCP Tool Search solves this by dynamically loading tools on-demand instead of preloading all of them.

611 

612### How it works

587 613 

588MCP servers can expose prompts that become available as slash commands in Claude Code.614Claude Code automatically enables Tool Search when your MCP tool descriptions would consume more than 10% of the context window. You can [adjust this threshold](#configure-tool-search) or disable tool search entirely. When triggered:

615 

6161. MCP tools are deferred rather than loaded into context upfront

6172. Claude uses a search tool to discover relevant MCP tools when needed

6183. Only the tools Claude actually needs are loaded into context

6194. MCP tools continue to work exactly as before from your perspective

620 

621### For MCP server authors

622 

623If you're building an MCP server, the server instructions field becomes more useful with Tool Search enabled. Server instructions help Claude understand when to search for your tools, similar to how [skills](/en/skills) work.

624 

625Add clear, descriptive server instructions that explain:

626 

627* What category of tasks your tools handle

628* When Claude should search for your tools

629* Key capabilities your server provides

630 

631### Configure tool search

632 

633Tool search runs in auto mode by default, meaning it activates only when your MCP tool definitions exceed the context threshold. If you have few tools, they load normally without tool search. This feature requires models that support `tool_reference` blocks: Sonnet 4 and later, or Opus 4 and later. Haiku models do not support tool search.

634 

635Control tool search behavior with the `ENABLE_TOOL_SEARCH` environment variable:

636 

637| Value | Behavior |

638| :--------- | :--------------------------------------------------------------------------------- |

639| `auto` | Activates when MCP tools exceed 10% of context (default) |

640| `auto:<N>` | Activates at custom threshold, where `<N>` is a percentage (e.g., `auto:5` for 5%) |

641| `true` | Always enabled |

642| `false` | Disabled, all MCP tools loaded upfront |

643 

644```bash theme={null}

645# Use a custom 5% threshold

646ENABLE_TOOL_SEARCH=auto:5 claude

647 

648# Disable tool search entirely

649ENABLE_TOOL_SEARCH=false claude

650```

651 

652Or set the value in your [settings.json `env` field](/en/settings#available-settings).

653 

654You can also disable the MCPSearch tool specifically using the `disallowedTools` setting:

655 

656```json theme={null}

657{

658 "permissions": {

659 "deny": ["MCPSearch"]

660 }

661}

662```

663 

664## Use MCP prompts as commands

665 

666MCP servers can expose prompts that become available as commands in Claude Code.

589 667 

590### Execute MCP prompts668### Execute MCP prompts

591 669 


622 * Server and prompt names are normalized (spaces become underscores)700 * Server and prompt names are normalized (spaces become underscores)

623</Tip>701</Tip>

624 702 

625## Enterprise MCP configuration703## Managed MCP configuration

626 704 

627For organizations that need centralized control over MCP servers, Claude Code supports enterprise-managed MCP configurations. This allows IT administrators to:705For organizations that need centralized control over MCP servers, Claude Code supports two configuration options:

706 

7071. **Exclusive control with `managed-mcp.json`**: Deploy a fixed set of MCP servers that users cannot modify or extend

7082. **Policy-based control with allowlists/denylists**: Allow users to add their own servers, but restrict which ones are permitted

709 

710These options allow IT administrators to:

628 711 

629* **Control which MCP servers employees can access**: Deploy a standardized set of approved MCP servers across the organization712* **Control which MCP servers employees can access**: Deploy a standardized set of approved MCP servers across the organization

630* **Prevent unauthorized MCP servers**: Optionally restrict users from adding their own MCP servers713* **Prevent unauthorized MCP servers**: Restrict users from adding unapproved MCP servers

631* **Disable MCP entirely**: Remove MCP functionality completely if needed714* **Disable MCP entirely**: Remove MCP functionality completely if needed

632 715 

633### Setting up enterprise MCP configuration716### Option 1: Exclusive control with managed-mcp.json

717 

718When you deploy a `managed-mcp.json` file, it takes **exclusive control** over all MCP servers. Users cannot add, modify, or use any MCP servers other than those defined in this file. This is the simplest approach for organizations that want complete control.

634 719 

635System administrators can deploy an enterprise MCP configuration file alongside the managed settings file:720System administrators deploy the configuration file to a system-wide directory:

636 721 

637* **macOS**: `/Library/Application Support/ClaudeCode/managed-mcp.json`722* macOS: `/Library/Application Support/ClaudeCode/managed-mcp.json`

638* **Windows**: `C:\ProgramData\ClaudeCode\managed-mcp.json`723* Linux and WSL: `/etc/claude-code/managed-mcp.json`

639* **Linux**: `/etc/claude-code/managed-mcp.json`724* Windows: `C:\Program Files\ClaudeCode\managed-mcp.json`

725 

726<Note>

727 These are system-wide paths (not user home directories like `~/Library/...`) that require administrator privileges. They are designed to be deployed by IT administrators.

728</Note>

640 729 

641The `managed-mcp.json` file uses the same format as a standard `.mcp.json` file:730The `managed-mcp.json` file uses the same format as a standard `.mcp.json` file:

642 731 


663}752}

664```753```

665 754 

666### Restricting MCP servers with allowlists and denylists755### Option 2: Policy-based control with allowlists and denylists

756 

757Instead of taking exclusive control, administrators can allow users to configure their own MCP servers while enforcing restrictions on which servers are permitted. This approach uses `allowedMcpServers` and `deniedMcpServers` in the [managed settings file](/en/settings#settings-files).

758 

759<Note>

760 **Choosing between options**: Use Option 1 (`managed-mcp.json`) when you want to deploy a fixed set of servers with no user customization. Use Option 2 (allowlists/denylists) when you want to allow users to add their own servers within policy constraints.

761</Note>

667 762 

668In addition to providing enterprise-managed servers, administrators can control which MCP servers users are allowed to configure using `allowedMcpServers` and `deniedMcpServers` in the `managed-settings.json` file:763#### Restriction options

669 764 

670* **macOS**: `/Library/Application Support/ClaudeCode/managed-settings.json`765Each entry in the allowlist or denylist can restrict servers in three ways:

671* **Windows**: `C:\ProgramData\ClaudeCode\managed-settings.json`766 

672* **Linux**: `/etc/claude-code/managed-settings.json`7671. **By server name** (`serverName`): Matches the configured name of the server

7682. **By command** (`serverCommand`): Matches the exact command and arguments used to start stdio servers

7693. **By URL pattern** (`serverUrl`): Matches remote server URLs with wildcard support

770 

771**Important**: Each entry must have exactly one of `serverName`, `serverCommand`, or `serverUrl`.

772 

773#### Example configuration

673 774 

674```json theme={null}775```json theme={null}

675{776{

676 "allowedMcpServers": [777 "allowedMcpServers": [

778 // Allow by server name

677 { "serverName": "github" },779 { "serverName": "github" },

678 { "serverName": "sentry" },780 { "serverName": "sentry" },

679 { "serverName": "company-internal" }781 

782 // Allow by exact command (for stdio servers)

783 { "serverCommand": ["npx", "-y", "@modelcontextprotocol/server-filesystem"] },

784 { "serverCommand": ["python", "/usr/local/bin/approved-server.py"] },

785 

786 // Allow by URL pattern (for remote servers)

787 { "serverUrl": "https://mcp.company.com/*" },

788 { "serverUrl": "https://*.internal.corp/*" }

680 ],789 ],

681 "deniedMcpServers": [790 "deniedMcpServers": [

682 { "serverName": "filesystem" }791 // Block by server name

792 { "serverName": "dangerous-server" },

793 

794 // Block by exact command (for stdio servers)

795 { "serverCommand": ["npx", "-y", "unapproved-package"] },

796 

797 // Block by URL pattern (for remote servers)

798 { "serverUrl": "https://*.untrusted.com/*" }

683 ]799 ]

684}800}

685```801```

686 802 

687**Allowlist behavior (`allowedMcpServers`)**:803#### How command-based restrictions work

804 

805**Exact matching**:

806 

807* Command arrays must match **exactly** - both the command and all arguments in the correct order

808* Example: `["npx", "-y", "server"]` will NOT match `["npx", "server"]` or `["npx", "-y", "server", "--flag"]`

809 

810**Stdio server behavior**:

811 

812* When the allowlist contains **any** `serverCommand` entries, stdio servers **must** match one of those commands

813* Stdio servers cannot pass by name alone when command restrictions are present

814* This ensures administrators can enforce which commands are allowed to run

815 

816**Non-stdio server behavior**:

817 

818* Remote servers (HTTP, SSE, WebSocket) use URL-based matching when `serverUrl` entries exist in the allowlist

819* If no URL entries exist, remote servers fall back to name-based matching

820* Command restrictions do not apply to remote servers

821 

822#### How URL-based restrictions work

823 

824URL patterns support wildcards using `*` to match any sequence of characters. This is useful for allowing entire domains or subdomains.

825 

826**Wildcard examples**:

827 

828* `https://mcp.company.com/*` - Allow all paths on a specific domain

829* `https://*.example.com/*` - Allow any subdomain of example.com

830* `http://localhost:*/*` - Allow any port on localhost

831 

832**Remote server behavior**:

833 

834* When the allowlist contains **any** `serverUrl` entries, remote servers **must** match one of those URL patterns

835* Remote servers cannot pass by name alone when URL restrictions are present

836* This ensures administrators can enforce which remote endpoints are allowed

837 

838<Accordion title="Example: URL-only allowlist">

839 ```json theme={null}

840 {

841 "allowedMcpServers": [

842 { "serverUrl": "https://mcp.company.com/*" },

843 { "serverUrl": "https://*.internal.corp/*" }

844 ]

845 }

846 ```

847 

848 **Result**:

849 

850 * HTTP server at `https://mcp.company.com/api`: ✅ Allowed (matches URL pattern)

851 * HTTP server at `https://api.internal.corp/mcp`: ✅ Allowed (matches wildcard subdomain)

852 * HTTP server at `https://external.com/mcp`: ❌ Blocked (doesn't match any URL pattern)

853 * Stdio server with any command: ❌ Blocked (no name or command entries to match)

854</Accordion>

855 

856<Accordion title="Example: Command-only allowlist">

857 ```json theme={null}

858 {

859 "allowedMcpServers": [

860 { "serverCommand": ["npx", "-y", "approved-package"] }

861 ]

862 }

863 ```

864 

865 **Result**:

866 

867 * Stdio server with `["npx", "-y", "approved-package"]`: ✅ Allowed (matches command)

868 * Stdio server with `["node", "server.js"]`: ❌ Blocked (doesn't match command)

869 * HTTP server named "my-api": ❌ Blocked (no name entries to match)

870</Accordion>

871 

872<Accordion title="Example: Mixed name and command allowlist">

873 ```json theme={null}

874 {

875 "allowedMcpServers": [

876 { "serverName": "github" },

877 { "serverCommand": ["npx", "-y", "approved-package"] }

878 ]

879 }

880 ```

881 

882 **Result**:

883 

884 * Stdio server named "local-tool" with `["npx", "-y", "approved-package"]`: ✅ Allowed (matches command)

885 * Stdio server named "local-tool" with `["node", "server.js"]`: ❌ Blocked (command entries exist but doesn't match)

886 * Stdio server named "github" with `["node", "server.js"]`: ❌ Blocked (stdio servers must match commands when command entries exist)

887 * HTTP server named "github": ✅ Allowed (matches name)

888 * HTTP server named "other-api": ❌ Blocked (name doesn't match)

889</Accordion>

890 

891<Accordion title="Example: Name-only allowlist">

892 ```json theme={null}

893 {

894 "allowedMcpServers": [

895 { "serverName": "github" },

896 { "serverName": "internal-tool" }

897 ]

898 }

899 ```

900 

901 **Result**:

902 

903 * Stdio server named "github" with any command: ✅ Allowed (no command restrictions)

904 * Stdio server named "internal-tool" with any command: ✅ Allowed (no command restrictions)

905 * HTTP server named "github": ✅ Allowed (matches name)

906 * Any server named "other": ❌ Blocked (name doesn't match)

907</Accordion>

908 

909#### Allowlist behavior (`allowedMcpServers`)

688 910 

689* `undefined` (default): No restrictions - users can configure any MCP server911* `undefined` (default): No restrictions - users can configure any MCP server

690* Empty array `[]`: Complete lockdown - users cannot configure any MCP servers912* Empty array `[]`: Complete lockdown - users cannot configure any MCP servers

691* List of server names: Users can only configure the specified servers913* List of entries: Users can only configure servers that match by name, command, or URL pattern

692 914 

693**Denylist behavior (`deniedMcpServers`)**:915#### Denylist behavior (`deniedMcpServers`)

694 916 

695* `undefined` (default): No servers are blocked917* `undefined` (default): No servers are blocked

696* Empty array `[]`: No servers are blocked918* Empty array `[]`: No servers are blocked

697* List of server names: Specified servers are explicitly blocked across all scopes919* List of entries: Specified servers are explicitly blocked across all scopes

698 920 

699**Important notes**:921#### Important notes

700 922 

701* These restrictions apply to all scopes: user, project, local, and even enterprise servers from `managed-mcp.json`923* **Option 1 and Option 2 can be combined**: If `managed-mcp.json` exists, it has exclusive control and users cannot add servers. Allowlists/denylists still apply to the managed servers themselves.

702* **Denylist takes absolute precedence**: If a server appears in both lists, it will be blocked924* **Denylist takes absolute precedence**: If a server matches a denylist entry (by name, command, or URL), it will be blocked even if it's on the allowlist

925* Name-based, command-based, and URL-based restrictions work together: a server passes if it matches **either** a name entry, a command entry, or a URL pattern (unless blocked by denylist)

703 926 

704<Note>927<Note>

705 **Enterprise configuration precedence**: The enterprise MCP configuration has the highest precedence and cannot be overridden by user, local, or project configurations.928 **When using `managed-mcp.json`**: Users cannot add MCP servers through `claude mcp add` or configuration files. The `allowedMcpServers` and `deniedMcpServers` settings still apply to filter which managed servers are actually loaded.

706</Note>929</Note>

memory.md +143 −21

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Manage Claude's memory5# Manage Claude's memory

2 6 

3> Learn how to manage Claude Code's memory across sessions with different memory locations and best practices.7> Learn how to manage Claude Code's memory across sessions with different memory locations and best practices.


9Claude Code offers four memory locations in a hierarchical structure, each serving a different purpose:13Claude Code offers four memory locations in a hierarchical structure, each serving a different purpose:

10 14 

11| Memory Type | Location | Purpose | Use Case Examples | Shared With |15| Memory Type | Location | Purpose | Use Case Examples | Shared With |

12| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------- |16| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------- |

13| **Enterprise policy** | macOS: `/Library/Application Support/ClaudeCode/CLAUDE.md`<br />Linux: `/etc/claude-code/CLAUDE.md`<br />Windows: `C:\ProgramData\ClaudeCode\CLAUDE.md` | Organization-wide instructions managed by IT/DevOps | Company coding standards, security policies, compliance requirements | All users in organization |17| **Managed policy** | macOS: `/Library/Application Support/ClaudeCode/CLAUDE.md`<br />Linux: `/etc/claude-code/CLAUDE.md`<br />Windows: `C:\Program Files\ClaudeCode\CLAUDE.md` | Organization-wide instructions managed by IT/DevOps | Company coding standards, security policies, compliance requirements | All users in organization |

14| **Project memory** | `./CLAUDE.md` or `./.claude/CLAUDE.md` | Team-shared instructions for the project | Project architecture, coding standards, common workflows | Team members via source control |18| **Project memory** | `./CLAUDE.md` or `./.claude/CLAUDE.md` | Team-shared instructions for the project | Project architecture, coding standards, common workflows | Team members via source control |

19| **Project rules** | `./.claude/rules/*.md` | Modular, topic-specific project instructions | Language-specific guidelines, testing conventions, API standards | Team members via source control |

15| **User memory** | `~/.claude/CLAUDE.md` | Personal preferences for all projects | Code styling preferences, personal tooling shortcuts | Just you (all projects) |20| **User memory** | `~/.claude/CLAUDE.md` | Personal preferences for all projects | Code styling preferences, personal tooling shortcuts | Just you (all projects) |

16| **Project memory (local)** | `./CLAUDE.local.md` | Personal project-specific preferences | *(Deprecated, see below)* Your sandbox URLs, preferred test data | Just you (current project) |21| **Project memory (local)** | `./CLAUDE.local.md` | Personal project-specific preferences | Your sandbox URLs, preferred test data | Just you (current project) |

17 22 

18All memory files are automatically loaded into Claude Code's context when launched. Files higher in the hierarchy take precedence and are loaded first, providing a foundation that more specific memories build upon.23All memory files are automatically loaded into Claude Code's context when launched. Files higher in the hierarchy take precedence and are loaded first, providing a foundation that more specific memories build upon.

19 24 

25<Note>

26 CLAUDE.local.md files are automatically added to .gitignore, making them ideal for private project-specific preferences that shouldn't be checked into version control.

27</Note>

28 

20## CLAUDE.md imports29## CLAUDE.md imports

21 30 

22CLAUDE.md files can import additional files using `@path/to/import` syntax. The following example imports 3 files:31CLAUDE.md files can import additional files using `@path/to/import` syntax. The following example imports 3 files:


28- git workflow @docs/git-instructions.md37- git workflow @docs/git-instructions.md

29```38```

30 39 

31Both relative and absolute paths are allowed. In particular, importing files in user's home dir is a convenient way for your team members to provide individual instructions that are not checked into the repository. Previously CLAUDE.local.md served a similar purpose, but is now deprecated in favor of imports since they work better across multiple git worktrees.40Both relative and absolute paths are allowed. In particular, importing files in user's home dir is a convenient way for your team members to provide individual instructions that are not checked into the repository. Imports are an alternative to CLAUDE.local.md that work better across multiple git worktrees.

32 41 

33```42```

34# Individual Preferences43# Individual Preferences


49 58 

50Claude will also discover CLAUDE.md nested in subtrees under your current working directory. Instead of loading them at launch, they are only included when Claude reads files in those subtrees.59Claude will also discover CLAUDE.md nested in subtrees under your current working directory. Instead of loading them at launch, they are only included when Claude reads files in those subtrees.

51 60 

52## Quickly add memories with the `#` shortcut

53 

54The fastest way to add a memory is to start your input with the `#` character:

55 

56```

57# Always use descriptive variable names

58```

59 

60You'll be prompted to select which memory file to store this in.

61 

62## Directly edit memories with `/memory`61## Directly edit memories with `/memory`

63 62 

64Use the `/memory` slash command during a session to open any memory file in your system editor for more extensive additions or organization.63Use the `/memory` command during a session to open any memory file in your system editor for more extensive additions or organization.

65 64 

66## Set up project memory65## Set up project memory

67 66 


82 * CLAUDE.md memories can be used for both instructions shared with your team and for your individual preferences.81 * CLAUDE.md memories can be used for both instructions shared with your team and for your individual preferences.

83</Tip>82</Tip>

84 83 

84## Modular rules with `.claude/rules/`

85 

86For larger projects, you can organize instructions into multiple files using the `.claude/rules/` directory. This allows teams to maintain focused, well-organized rule files instead of one large CLAUDE.md.

87 

88### Basic structure

89 

90Place markdown files in your project's `.claude/rules/` directory:

91 

92```

93your-project/

94├── .claude/

95│ ├── CLAUDE.md # Main project instructions

96│ └── rules/

97│ ├── code-style.md # Code style guidelines

98│ ├── testing.md # Testing conventions

99│ └── security.md # Security requirements

100```

101 

102All `.md` files in `.claude/rules/` are automatically loaded as project memory, with the same priority as `.claude/CLAUDE.md`.

103 

104### Path-specific rules

105 

106Rules can be scoped to specific files using YAML frontmatter with the `paths` field. These conditional rules only apply when Claude is working with files matching the specified patterns.

107 

108```markdown theme={null}

109---

110paths:

111 - "src/api/**/*.ts"

112---

113 

114# API Development Rules

115 

116- All API endpoints must include input validation

117- Use the standard error response format

118- Include OpenAPI documentation comments

119```

120 

121Rules without a `paths` field are loaded unconditionally and apply to all files.

122 

123### Glob patterns

124 

125The `paths` field supports standard glob patterns:

126 

127| Pattern | Matches |

128| ---------------------- | ---------------------------------------- |

129| `**/*.ts` | All TypeScript files in any directory |

130| `src/**/*` | All files under `src/` directory |

131| `*.md` | Markdown files in the project root |

132| `src/components/*.tsx` | React components in a specific directory |

133 

134You can specify multiple patterns:

135 

136```markdown theme={null}

137---

138paths:

139 - "src/**/*.ts"

140 - "lib/**/*.ts"

141 - "tests/**/*.test.ts"

142---

143```

144 

145Brace expansion is supported for matching multiple extensions or directories:

146 

147```markdown theme={null}

148---

149paths:

150 - "src/**/*.{ts,tsx}"

151 - "{src,lib}/**/*.ts"

152---

153 

154# TypeScript/React Rules

155```

156 

157This expands `src/**/*.{ts,tsx}` to match both `.ts` and `.tsx` files.

158 

159### Subdirectories

160 

161Rules can be organized into subdirectories for better structure:

162 

163```

164.claude/rules/

165├── frontend/

166│ ├── react.md

167│ └── styles.md

168├── backend/

169│ ├── api.md

170│ └── database.md

171└── general.md

172```

173 

174All `.md` files are discovered recursively.

175 

176### Symlinks

177 

178The `.claude/rules/` directory supports symlinks, allowing you to share common rules across multiple projects:

179 

180```bash theme={null}

181# Symlink a shared rules directory

182ln -s ~/shared-claude-rules .claude/rules/shared

183 

184# Symlink individual rule files

185ln -s ~/company-standards/security.md .claude/rules/security.md

186```

187 

188Symlinks are resolved and their contents are loaded normally. Circular symlinks are detected and handled gracefully.

189 

190### User-level rules

191 

192You can create personal rules that apply to all your projects in `~/.claude/rules/`:

193 

194```

195~/.claude/rules/

196├── preferences.md # Your personal coding preferences

197└── workflows.md # Your preferred workflows

198```

199 

200User-level rules are loaded before project rules, giving project rules higher priority.

201 

202<Tip>

203 Best practices for `.claude/rules/`:

204 

205 * **Keep rules focused**: Each file should cover one topic (e.g., `testing.md`, `api-design.md`)

206 * **Use descriptive filenames**: The filename should indicate what the rules cover

207 * **Use conditional rules sparingly**: Only add `paths` frontmatter when rules truly apply to specific file types

208 * **Organize with subdirectories**: Group related rules (e.g., `frontend/`, `backend/`)

209</Tip>

210 

85## Organization-level memory management211## Organization-level memory management

86 212 

87Enterprise organizations can deploy centrally managed CLAUDE.md files that apply to all users.213Organizations can deploy centrally managed CLAUDE.md files that apply to all users.

88 214 

89To set up organization-level memory management:215To set up organization-level memory management:

90 216 

911. Create the enterprise memory file in the appropriate location for your operating system:2171. Create the managed memory file at the **Managed policy** location shown in the [memory types table above](#determine-memory-type).

92 

93* macOS: `/Library/Application Support/ClaudeCode/CLAUDE.md`

94* Linux/WSL: `/etc/claude-code/CLAUDE.md`

95* Windows: `C:\ProgramData\ClaudeCode\CLAUDE.md`

96 218 

972. Deploy via your configuration management system (MDM, Group Policy, Ansible, etc.) to ensure consistent distribution across all developer machines.2192. Deploy via your configuration management system (MDM, Group Policy, Ansible, etc.) to ensure consistent distribution across all developer machines.

98 220 

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Claude Code on Microsoft Foundry5# Claude Code on Microsoft Foundry

2 6 

3> Learn about configuring Claude Code through Microsoft Foundry, including setup, configuration, and troubleshooting.7> Learn about configuring Claude Code through Microsoft Foundry, including setup, configuration, and troubleshooting.


64# Azure resource name (replace {resource} with your resource name)68# Azure resource name (replace {resource} with your resource name)

65export ANTHROPIC_FOUNDRY_RESOURCE={resource}69export ANTHROPIC_FOUNDRY_RESOURCE={resource}

66# Or provide the full base URL:70# Or provide the full base URL:

67# export ANTHROPIC_FOUNDRY_BASE_URL=https://{resource}.services.ai.azure.com71# export ANTHROPIC_FOUNDRY_BASE_URL=https://{resource}.services.ai.azure.com/anthropic

68 72 

69# Set models to your resource's deployment names73# Set models to your resource's deployment names

70export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-5'74export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-5'

model-config.md +6 −2

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Model configuration5# Model configuration

2 6 

3> Learn about the Claude Code model configuration, including model aliases like `opusplan`7> Learn about the Claude Code model configuration, including model aliases like `opusplan`


105You can use the following environment variables, which must be full **model109You can use the following environment variables, which must be full **model

106names** (or equivalent for your API provider), to control the model names that the aliases map to.110names** (or equivalent for your API provider), to control the model names that the aliases map to.

107 111 

108| Env var | Description |112| Environment variable | Description |

109| -------------------------------- | --------------------------------------------------------------------------------------------- |113| -------------------------------- | --------------------------------------------------------------------------------------------- |

110| `ANTHROPIC_DEFAULT_OPUS_MODEL` | The model to use for `opus`, or for `opusplan` when Plan Mode is active. |114| `ANTHROPIC_DEFAULT_OPUS_MODEL` | The model to use for `opus`, or for `opusplan` when Plan Mode is active. |

111| `ANTHROPIC_DEFAULT_SONNET_MODEL` | The model to use for `sonnet`, or for `opusplan` when Plan Mode is not active. |115| `ANTHROPIC_DEFAULT_SONNET_MODEL` | The model to use for `sonnet`, or for `opusplan` when Plan Mode is not active. |


119 123 

120Claude Code automatically uses [prompt caching](https://docs.claude.com/en/docs/build-with-claude/prompt-caching) to optimize performance and reduce costs. You can disable prompt caching globally or for specific model tiers:124Claude Code automatically uses [prompt caching](https://docs.claude.com/en/docs/build-with-claude/prompt-caching) to optimize performance and reduce costs. You can disable prompt caching globally or for specific model tiers:

121 125 

122| Env var | Description |126| Environment variable | Description |

123| ------------------------------- | ---------------------------------------------------------------------------------------------- |127| ------------------------------- | ---------------------------------------------------------------------------------------------- |

124| `DISABLE_PROMPT_CACHING` | Set to `1` to disable prompt caching for all models (takes precedence over per-model settings) |128| `DISABLE_PROMPT_CACHING` | Set to `1` to disable prompt caching for all models (takes precedence over per-model settings) |

125| `DISABLE_PROMPT_CACHING_HAIKU` | Set to `1` to disable prompt caching for Haiku models only |129| `DISABLE_PROMPT_CACHING_HAIKU` | Set to `1` to disable prompt caching for Haiku models only |

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Monitoring5# Monitoring

2 6 

3> Learn how to enable and configure OpenTelemetry for Claude Code.7> Learn how to enable and configure OpenTelemetry for Claude Code.


6 10 

7All metrics are time series data exported via OpenTelemetry's standard metrics protocol, and events are exported via OpenTelemetry's logs/events protocol. It is the user's responsibility to ensure their metrics and logs backends are properly configured and that the aggregation granularity meets their monitoring requirements.11All metrics are time series data exported via OpenTelemetry's standard metrics protocol, and events are exported via OpenTelemetry's logs/events protocol. It is the user's responsibility to ensure their metrics and logs backends are properly configured and that the aggregation granularity meets their monitoring requirements.

8 12 

9## Quick Start13## Quick start

10 14 

11Configure OpenTelemetry using environment variables:15Configure OpenTelemetry using environment variables:

12 16 


39 43 

40For full configuration options, see the [OpenTelemetry specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options).44For full configuration options, see the [OpenTelemetry specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options).

41 45 

42## Administrator Configuration46## Administrator configuration

43 

44Administrators can configure OpenTelemetry settings for all users through the managed settings file. This allows for centralized control of telemetry settings across an organization. See the [settings precedence](/en/settings#settings-precedence) for more information about how settings are applied.

45 47 

46The managed settings file is located at:48Administrators can configure OpenTelemetry settings for all users through the [managed settings file](/en/settings#settings-files). This allows for centralized control of telemetry settings across an organization. See the [settings precedence](/en/settings#settings-precedence) for more information about how settings are applied.

47 

48* macOS: `/Library/Application Support/ClaudeCode/managed-settings.json`

49* Linux and WSL: `/etc/claude-code/managed-settings.json`

50* Windows: `C:\ProgramData\ClaudeCode\managed-settings.json`

51 49 

52Example managed settings configuration:50Example managed settings configuration:

53 51 


68 Managed settings can be distributed via MDM (Mobile Device Management) or other device management solutions. Environment variables defined in the managed settings file have high precedence and cannot be overridden by users.66 Managed settings can be distributed via MDM (Mobile Device Management) or other device management solutions. Environment variables defined in the managed settings file have high precedence and cannot be overridden by users.

69</Note>67</Note>

70 68 

71## Configuration Details69## Configuration details

72 70 

73### Common Configuration Variables71### Common configuration variables

74 72 

75| Environment Variable | Description | Example Values |73| Environment Variable | Description | Example Values |

76| ----------------------------------------------- | --------------------------------------------------------- | ------------------------------------ |74| ----------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------ |

77| `CLAUDE_CODE_ENABLE_TELEMETRY` | Enables telemetry collection (required) | `1` |75| `CLAUDE_CODE_ENABLE_TELEMETRY` | Enables telemetry collection (required) | `1` |

78| `OTEL_METRICS_EXPORTER` | Metrics exporter type(s) (comma-separated) | `console`, `otlp`, `prometheus` |76| `OTEL_METRICS_EXPORTER` | Metrics exporter type(s) (comma-separated) | `console`, `otlp`, `prometheus` |

79| `OTEL_LOGS_EXPORTER` | Logs/events exporter type(s) (comma-separated) | `console`, `otlp` |77| `OTEL_LOGS_EXPORTER` | Logs/events exporter type(s) (comma-separated) | `console`, `otlp` |


89| `OTEL_METRIC_EXPORT_INTERVAL` | Export interval in milliseconds (default: 60000) | `5000`, `60000` |87| `OTEL_METRIC_EXPORT_INTERVAL` | Export interval in milliseconds (default: 60000) | `5000`, `60000` |

90| `OTEL_LOGS_EXPORT_INTERVAL` | Logs export interval in milliseconds (default: 5000) | `1000`, `10000` |88| `OTEL_LOGS_EXPORT_INTERVAL` | Logs export interval in milliseconds (default: 5000) | `1000`, `10000` |

91| `OTEL_LOG_USER_PROMPTS` | Enable logging of user prompt content (default: disabled) | `1` to enable |89| `OTEL_LOG_USER_PROMPTS` | Enable logging of user prompt content (default: disabled) | `1` to enable |

90| `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS` | Interval for refreshing dynamic headers (default: 1740000ms / 29 minutes) | `900000` |

92 91 

93### Metrics Cardinality Control92### Metrics cardinality control

94 93 

95The following environment variables control which attributes are included in metrics to manage cardinality:94The following environment variables control which attributes are included in metrics to manage cardinality:

96 95 


102 101 

103These variables help control the cardinality of metrics, which affects storage requirements and query performance in your metrics backend. Lower cardinality generally means better performance and lower storage costs but less granular data for analysis.102These variables help control the cardinality of metrics, which affects storage requirements and query performance in your metrics backend. Lower cardinality generally means better performance and lower storage costs but less granular data for analysis.

104 103 

105### Dynamic Headers104### Dynamic headers

106 105 

107For enterprise environments that require dynamic authentication, you can configure a script to generate headers dynamically:106For enterprise environments that require dynamic authentication, you can configure a script to generate headers dynamically:

108 107 

109#### Settings Configuration108#### Settings configuration

110 109 

111Add to your `.claude/settings.json`:110Add to your `.claude/settings.json`:

112 111 


116}115}

117```116```

118 117 

119#### Script Requirements118#### Script requirements

120 119 

121The script must output valid JSON with string key-value pairs representing HTTP headers:120The script must output valid JSON with string key-value pairs representing HTTP headers:

122 121 


126echo "{\"Authorization\": \"Bearer $(get-token.sh)\", \"X-API-Key\": \"$(get-api-key.sh)\"}"125echo "{\"Authorization\": \"Bearer $(get-token.sh)\", \"X-API-Key\": \"$(get-api-key.sh)\"}"

127```126```

128 127 

129#### Important Limitations128#### Refresh behavior

130 

131**Headers are fetched only at startup, not during runtime.** This is due to OpenTelemetry exporter architecture limitations.

132 129 

133For scenarios requiring frequent token refresh, use an OpenTelemetry Collector as a proxy that can refresh its own headers.130The headers helper script runs at startup and periodically thereafter to support token refresh. By default, the script runs every 29 minutes. Customize the interval with the `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS` environment variable.

134 131 

135### Multi-Team Organization Support132### Multi-team organization support

136 133 

137Organizations with multiple teams or departments can add custom attributes to distinguish between different groups using the `OTEL_RESOURCE_ATTRIBUTES` environment variable:134Organizations with multiple teams or departments can add custom attributes to distinguish between different groups using the `OTEL_RESOURCE_ATTRIBUTES` environment variable:

138 135 


172 export OTEL_RESOURCE_ATTRIBUTES="org.name=John%27s%20Organization"169 export OTEL_RESOURCE_ATTRIBUTES="org.name=John%27s%20Organization"

173 ```170 ```

174 171 

175 Note: Quoting the entire key=value pair (e.g., `"key=value with spaces"`) is not supported by the OpenTelemetry specification and will result in attributes being prefixed with quotes.172 Note: wrapping values in quotes doesn't escape spaces. For example, `org.name="My Company"` results in the literal value `"My Company"` (with quotes included), not `My Company`.

176</Warning>173</Warning>

177 174 

178### Example Configurations175### Example configurations

179 176 

180```bash theme={null}177```bash theme={null}

181# Console debugging (1-second intervals)178# Console debugging (1-second intervals)


220export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317217export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

221```218```

222 219 

223## Available Metrics and Events220## Available metrics and events

224 221 

225### Standard Attributes222### Standard attributes

226 223 

227All metrics and events share these standard attributes:224All metrics and events share these standard attributes:

228 225 

229| Attribute | Description | Controlled By |226| Attribute | Description | Controlled By |

230| ------------------- | ------------------------------------------------------------- | --------------------------------------------------- |227| ------------------- | -------------------------------------------------------------------- | --------------------------------------------------- |

231| `session.id` | Unique session identifier | `OTEL_METRICS_INCLUDE_SESSION_ID` (default: true) |228| `session.id` | Unique session identifier | `OTEL_METRICS_INCLUDE_SESSION_ID` (default: true) |

232| `app.version` | Current Claude Code version | `OTEL_METRICS_INCLUDE_VERSION` (default: false) |229| `app.version` | Current Claude Code version | `OTEL_METRICS_INCLUDE_VERSION` (default: false) |

233| `organization.id` | Organization UUID (when authenticated) | Always included when available |230| `organization.id` | Organization UUID (when authenticated) | Always included when available |

234| `user.account_uuid` | Account UUID (when authenticated) | `OTEL_METRICS_INCLUDE_ACCOUNT_UUID` (default: true) |231| `user.account_uuid` | Account UUID (when authenticated) | `OTEL_METRICS_INCLUDE_ACCOUNT_UUID` (default: true) |

235| `terminal.type` | Terminal type (e.g., `iTerm.app`, `vscode`, `cursor`, `tmux`) | Always included when detected |232| `terminal.type` | Terminal type (for example, `iTerm.app`, `vscode`, `cursor`, `tmux`) | Always included when detected |

236 233 

237### Metrics234### Metrics

238 235 


249| `claude_code.code_edit_tool.decision` | Count of code editing tool permission decisions | count |246| `claude_code.code_edit_tool.decision` | Count of code editing tool permission decisions | count |

250| `claude_code.active_time.total` | Total active time in seconds | s |247| `claude_code.active_time.total` | Total active time in seconds | s |

251 248 

252### Metric Details249### Metric details

253 250 

254#### Session Counter251#### Session counter

255 252 

256Incremented at the start of each session.253Incremented at the start of each session.

257 254 


259 256 

260* All [standard attributes](#standard-attributes)257* All [standard attributes](#standard-attributes)

261 258 

262#### Lines of Code Counter259#### Lines of code counter

263 260 

264Incremented when code is added or removed.261Incremented when code is added or removed.

265 262 


268* All [standard attributes](#standard-attributes)265* All [standard attributes](#standard-attributes)

269* `type`: (`"added"`, `"removed"`)266* `type`: (`"added"`, `"removed"`)

270 267 

271#### Pull Request Counter268#### Pull request counter

272 269 

273Incremented when creating pull requests via Claude Code.270Incremented when creating pull requests via Claude Code.

274 271 


276 273 

277* All [standard attributes](#standard-attributes)274* All [standard attributes](#standard-attributes)

278 275 

279#### Commit Counter276#### Commit counter

280 277 

281Incremented when creating git commits via Claude Code.278Incremented when creating git commits via Claude Code.

282 279 


284 281 

285* All [standard attributes](#standard-attributes)282* All [standard attributes](#standard-attributes)

286 283 

287#### Cost Counter284#### Cost counter

288 285 

289Incremented after each API request.286Incremented after each API request.

290 287 

291**Attributes**:288**Attributes**:

292 289 

293* All [standard attributes](#standard-attributes)290* All [standard attributes](#standard-attributes)

294* `model`: Model identifier (e.g., "claude-sonnet-4-5-20250929")291* `model`: Model identifier (for example, "claude-sonnet-4-5-20250929")

295 292 

296#### Token Counter293#### Token counter

297 294 

298Incremented after each API request.295Incremented after each API request.

299 296 


301 298 

302* All [standard attributes](#standard-attributes)299* All [standard attributes](#standard-attributes)

303* `type`: (`"input"`, `"output"`, `"cacheRead"`, `"cacheCreation"`)300* `type`: (`"input"`, `"output"`, `"cacheRead"`, `"cacheCreation"`)

304* `model`: Model identifier (e.g., "claude-sonnet-4-5-20250929")301* `model`: Model identifier (for example, "claude-sonnet-4-5-20250929")

305 302 

306#### Code Edit Tool Decision Counter303#### Code edit tool decision counter

307 304 

308Incremented when user accepts or rejects Edit, Write, or NotebookEdit tool usage.305Incremented when user accepts or rejects Edit, Write, or NotebookEdit tool usage.

309 306 


312* All [standard attributes](#standard-attributes)309* All [standard attributes](#standard-attributes)

313* `tool`: Tool name (`"Edit"`, `"Write"`, `"NotebookEdit"`)310* `tool`: Tool name (`"Edit"`, `"Write"`, `"NotebookEdit"`)

314* `decision`: User decision (`"accept"`, `"reject"`)311* `decision`: User decision (`"accept"`, `"reject"`)

315* `language`: Programming language of the edited file (e.g., `"TypeScript"`, `"Python"`, `"JavaScript"`, `"Markdown"`). Returns `"unknown"` for unrecognized file extensions.312* `language`: Programming language of the edited file (for example, `"TypeScript"`, `"Python"`, `"JavaScript"`, `"Markdown"`). Returns `"unknown"` for unrecognized file extensions.

316 313 

317#### Active Time Counter314#### Active time counter

318 315 

319Tracks actual time spent actively using Claude Code (not idle time). This metric is incremented during user interactions such as typing prompts or receiving responses.316Tracks actual time spent actively using Claude Code (not idle time). This metric is incremented during user interactions such as typing prompts or receiving responses.

320 317 


326 323 

327Claude Code exports the following events via OpenTelemetry logs/events (when `OTEL_LOGS_EXPORTER` is configured):324Claude Code exports the following events via OpenTelemetry logs/events (when `OTEL_LOGS_EXPORTER` is configured):

328 325 

329#### User Prompt Event326#### User prompt event

330 327 

331Logged when a user submits a prompt.328Logged when a user submits a prompt.

332 329 


340* `prompt_length`: Length of the prompt337* `prompt_length`: Length of the prompt

341* `prompt`: Prompt content (redacted by default, enable with `OTEL_LOG_USER_PROMPTS=1`)338* `prompt`: Prompt content (redacted by default, enable with `OTEL_LOG_USER_PROMPTS=1`)

342 339 

343#### Tool Result Event340#### Tool result event

344 341 

345Logged when a tool completes execution.342Logged when a tool completes execution.

346 343 


360* `tool_parameters`: JSON string containing tool-specific parameters (when available)357* `tool_parameters`: JSON string containing tool-specific parameters (when available)

361 * For Bash tool: includes `bash_command`, `full_command`, `timeout`, `description`, `sandbox`358 * For Bash tool: includes `bash_command`, `full_command`, `timeout`, `description`, `sandbox`

362 359 

363#### API Request Event360#### API request event

364 361 

365Logged for each API request to Claude.362Logged for each API request to Claude.

366 363 


371* All [standard attributes](#standard-attributes)368* All [standard attributes](#standard-attributes)

372* `event.name`: `"api_request"`369* `event.name`: `"api_request"`

373* `event.timestamp`: ISO 8601 timestamp370* `event.timestamp`: ISO 8601 timestamp

374* `model`: Model used (e.g., "claude-sonnet-4-5-20250929")371* `model`: Model used (for example, "claude-sonnet-4-5-20250929")

375* `cost_usd`: Estimated cost in USD372* `cost_usd`: Estimated cost in USD

376* `duration_ms`: Request duration in milliseconds373* `duration_ms`: Request duration in milliseconds

377* `input_tokens`: Number of input tokens374* `input_tokens`: Number of input tokens


379* `cache_read_tokens`: Number of tokens read from cache376* `cache_read_tokens`: Number of tokens read from cache

380* `cache_creation_tokens`: Number of tokens used for cache creation377* `cache_creation_tokens`: Number of tokens used for cache creation

381 378 

382#### API Error Event379#### API error event

383 380 

384Logged when an API request to Claude fails.381Logged when an API request to Claude fails.

385 382 


390* All [standard attributes](#standard-attributes)387* All [standard attributes](#standard-attributes)

391* `event.name`: `"api_error"`388* `event.name`: `"api_error"`

392* `event.timestamp`: ISO 8601 timestamp389* `event.timestamp`: ISO 8601 timestamp

393* `model`: Model used (e.g., "claude-sonnet-4-5-20250929")390* `model`: Model used (for example, "claude-sonnet-4-5-20250929")

394* `error`: Error message391* `error`: Error message

395* `status_code`: HTTP status code (if applicable)392* `status_code`: HTTP status code (if applicable)

396* `duration_ms`: Request duration in milliseconds393* `duration_ms`: Request duration in milliseconds

397* `attempt`: Attempt number (for retried requests)394* `attempt`: Attempt number (for retried requests)

398 395 

399#### Tool Decision Event396#### Tool decision event

400 397 

401Logged when a tool permission decision is made (accept/reject).398Logged when a tool permission decision is made (accept/reject).

402 399 


407* All [standard attributes](#standard-attributes)404* All [standard attributes](#standard-attributes)

408* `event.name`: `"tool_decision"`405* `event.name`: `"tool_decision"`

409* `event.timestamp`: ISO 8601 timestamp406* `event.timestamp`: ISO 8601 timestamp

410* `tool_name`: Name of the tool (e.g., "Read", "Edit", "Write", "NotebookEdit", etc.)407* `tool_name`: Name of the tool (for example, "Read", "Edit", "Write", "NotebookEdit")

411* `decision`: Either `"accept"` or `"reject"`408* `decision`: Either `"accept"` or `"reject"`

412* `source`: Decision source - `"config"`, `"user_permanent"`, `"user_temporary"`, `"user_abort"`, or `"user_reject"`409* `source`: Decision source - `"config"`, `"user_permanent"`, `"user_temporary"`, `"user_abort"`, or `"user_reject"`

413 410 

414## Interpreting Metrics and Events Data411## Interpreting metrics and events data

415 412 

416The metrics exported by Claude Code provide valuable insights into usage patterns and productivity. Here are some common visualizations and analyses you can create:413The metrics exported by Claude Code provide valuable insights into usage patterns and productivity. Here are some common visualizations and analyses you can create:

417 414 

418### Usage Monitoring415### Usage monitoring

419 416 

420| Metric | Analysis Opportunity |417| Metric | Analysis Opportunity |

421| ------------------------------------------------------------- | --------------------------------------------------------- |418| ------------------------------------------------------------- | --------------------------------------------------------- |


424| `claude_code.lines_of_code.count` | Measure productivity by tracking code additions/removals |421| `claude_code.lines_of_code.count` | Measure productivity by tracking code additions/removals |

425| `claude_code.commit.count` & `claude_code.pull_request.count` | Understand impact on development workflows |422| `claude_code.commit.count` & `claude_code.pull_request.count` | Understand impact on development workflows |

426 423 

427### Cost Monitoring424### Cost monitoring

428 425 

429The `claude_code.cost.usage` metric helps with:426The `claude_code.cost.usage` metric helps with:

430 427 


435 Cost metrics are approximations. For official billing data, refer to your API provider (Claude Console, AWS Bedrock, or Google Cloud Vertex).432 Cost metrics are approximations. For official billing data, refer to your API provider (Claude Console, AWS Bedrock, or Google Cloud Vertex).

436</Note>433</Note>

437 434 

438### Alerting and Segmentation435### Alerting and segmentation

439 436 

440Common alerts to consider:437Common alerts to consider:

441 438 


445 442 

446All metrics can be segmented by `user.account_uuid`, `organization.id`, `session.id`, `model`, and `app.version`.443All metrics can be segmented by `user.account_uuid`, `organization.id`, `session.id`, `model`, and `app.version`.

447 444 

448### Event Analysis445### Event analysis

449 446 

450The event data provides detailed insights into Claude Code interactions:447The event data provides detailed insights into Claude Code interactions:

451 448 

452**Tool Usage Patterns**: Analyze tool result events to identify:449**Tool Usage Patterns**: analyze tool result events to identify:

453 450 

454* Most frequently used tools451* Most frequently used tools

455* Tool success rates452* Tool success rates

456* Average tool execution times453* Average tool execution times

457* Error patterns by tool type454* Error patterns by tool type

458 455 

459**Performance Monitoring**: Track API request durations and tool execution times to identify performance bottlenecks.456**Performance Monitoring**: track API request durations and tool execution times to identify performance bottlenecks.

460 457 

461## Backend Considerations458## Backend considerations

462 459 

463Your choice of metrics and logs backends will determine the types of analyses you can perform:460Your choice of metrics and logs backends determines the types of analyses you can perform:

464 461 

465### For Metrics:462### For metrics

466 463 

467* **Time series databases (e.g., Prometheus)**: Rate calculations, aggregated metrics464* **Time series databases (for example, Prometheus)**: Rate calculations, aggregated metrics

468* **Columnar stores (e.g., ClickHouse)**: Complex queries, unique user analysis465* **Columnar stores (for example, ClickHouse)**: Complex queries, unique user analysis

469* **Full-featured observability platforms (e.g., Honeycomb, Datadog)**: Advanced querying, visualization, alerting466* **Full-featured observability platforms (for example, Honeycomb, Datadog)**: Advanced querying, visualization, alerting

470 467 

471### For Events/Logs:468### For events/logs

472 469 

473* **Log aggregation systems (e.g., Elasticsearch, Loki)**: Full-text search, log analysis470* **Log aggregation systems (for example, Elasticsearch, Loki)**: Full-text search, log analysis

474* **Columnar stores (e.g., ClickHouse)**: Structured event analysis471* **Columnar stores (for example, ClickHouse)**: Structured event analysis

475* **Full-featured observability platforms (e.g., Honeycomb, Datadog)**: Correlation between metrics and events472* **Full-featured observability platforms (for example, Honeycomb, Datadog)**: Correlation between metrics and events

476 473 

477For organizations requiring Daily/Weekly/Monthly Active User (DAU/WAU/MAU) metrics, consider backends that support efficient unique value queries.474For organizations requiring Daily/Weekly/Monthly Active User (DAU/WAU/MAU) metrics, consider backends that support efficient unique value queries.

478 475 

479## Service Information476## Service information

480 477 

481All metrics and events are exported with the following resource attributes:478All metrics and events are exported with the following resource attributes:

482 479 

483* `service.name`: `claude-code`480* `service.name`: `claude-code`

484* `service.version`: Current Claude Code version481* `service.version`: Current Claude Code version

485* `os.type`: Operating system type (e.g., `linux`, `darwin`, `windows`)482* `os.type`: Operating system type (for example, `linux`, `darwin`, `windows`)

486* `os.version`: Operating system version string483* `os.version`: Operating system version string

487* `host.arch`: Host architecture (e.g., `amd64`, `arm64`)484* `host.arch`: Host architecture (for example, `amd64`, `arm64`)

488* `wsl.version`: WSL version number (only present when running on Windows Subsystem for Linux)485* `wsl.version`: WSL version number (only present when running on Windows Subsystem for Linux)

489* Meter Name: `com.anthropic.claude_code`486* Meter Name: `com.anthropic.claude_code`

490 487 

491## ROI Measurement Resources488## ROI measurement resources

492 489 

493For a comprehensive guide on measuring return on investment for Claude Code, including telemetry setup, cost analysis, productivity metrics, and automated reporting, see the [Claude Code ROI Measurement Guide](https://github.com/anthropics/claude-code-monitoring-guide). This repository provides ready-to-use Docker Compose configurations, Prometheus and OpenTelemetry setups, and templates for generating productivity reports integrated with tools like Linear.490For a comprehensive guide on measuring return on investment for Claude Code, including telemetry setup, cost analysis, productivity metrics, and automated reporting, see the [Claude Code ROI Measurement Guide](https://github.com/anthropics/claude-code-monitoring-guide). This repository provides ready-to-use Docker Compose configurations, Prometheus and OpenTelemetry setups, and templates for generating productivity reports integrated with tools like Linear.

494 491 

495## Security/Privacy Considerations492## Security/privacy considerations

496 493 

497* Telemetry is opt-in and requires explicit configuration494* Telemetry is opt-in and requires explicit configuration

498* Sensitive information like API keys or file contents are never included in metrics or events495* Sensitive information like API keys or file contents are never included in metrics or events

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Enterprise network configuration5# Enterprise network configuration

2 6 

3> Configure Claude Code for enterprise environments with proxy servers, custom Certificate Authorities (CA), and mutual Transport Layer Security (mTLS) authentication.7> Configure Claude Code for enterprise environments with proxy servers, custom Certificate Authorities (CA), and mutual Transport Layer Security (mTLS) authentication.

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Output styles5# Output styles

2 6 

3> Adapt Claude Code for uses beyond software engineering7> Adapt Claude Code for uses beyond software engineering


103settings like the model to use, the tools they have available, and some context107settings like the model to use, the tools they have available, and some context

104about when to use the agent.108about when to use the agent.

105 109 

106### Output Styles vs. [Custom Slash Commands](/en/slash-commands)110### Output Styles vs. [Skills](/en/skills)

107 111 

108You can think of output styles as "stored system prompts" and custom slash112Output styles modify how Claude responds (formatting, tone, structure) and are always active once selected. Skills are task-specific prompts that you invoke with `/skill-name` or that Claude loads automatically when relevant. Use output styles for consistent formatting preferences; use skills for reusable workflows and tasks.

109commands as "stored prompts".

overview.md +60 −22

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Claude Code overview5# Claude Code overview

2 6 

3> Learn about Claude Code, Anthropic's agentic coding tool that lives in your terminal and helps you turn ideas into code faster than ever before.7> Learn about Claude Code, Anthropic's agentic coding tool that lives in your terminal and helps you turn ideas into code faster than ever before.


6 10 

7Prerequisites:11Prerequisites:

8 12 

9* A [Claude.ai](https://claude.ai) (recommended) or [Claude Console](https://console.anthropic.com/) account13* A [Claude subscription](https://claude.com/pricing) (Pro, Max, Teams, or Enterprise) or [Claude Console](https://console.anthropic.com/) account

10 14 

11**Install Claude Code:**15**Install Claude Code:**

12 16 

17To install Claude Code, use one of the following methods:

18 

13<Tabs>19<Tabs>

14 <Tab title="macOS/Linux">20 <Tab title="Native Install (Recommended)">

15 ```bash theme={null}21 **macOS, Linux, WSL:**

22 

23 ```bash theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}

16 curl -fsSL https://claude.ai/install.sh | bash24 curl -fsSL https://claude.ai/install.sh | bash

17 ```25 ```

26 

27 **Windows PowerShell:**

28 

29 ```powershell theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}

30 irm https://claude.ai/install.ps1 | iex

31 ```

32 

33 **Windows CMD:**

34 

35 ```batch theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}

36 curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

37 ```

38 

39 <Info>

40 Native installations automatically update in the background to keep you on the latest version.

41 </Info>

18 </Tab>42 </Tab>

19 43 

20 <Tab title="Homebrew">44 <Tab title="Homebrew">

21 ```bash theme={null}45 ```sh theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}

22 brew install --cask claude-code46 brew install --cask claude-code

23 ```47 ```

24 </Tab>

25 48 

26 <Tab title="Windows">49 <Info>

27 ```powershell theme={null}50 Homebrew installations do not auto-update. Run `brew upgrade claude-code` periodically to get the latest features and security fixes.

28 irm https://claude.ai/install.ps1 | iex51 </Info>

29 ```

30 </Tab>52 </Tab>

31 53 

32 <Tab title="NPM">54 <Tab title="WinGet">

33 ```bash theme={null}55 ```powershell theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}

34 npm install -g @anthropic-ai/claude-code56 winget install Anthropic.ClaudeCode

35 ```57 ```

36 58 

37 Requires [Node.js 18+](https://nodejs.org/en/download/)59 <Info>

60 WinGet installations do not auto-update. Run `winget upgrade Anthropic.ClaudeCode` periodically to get the latest features and security fixes.

61 </Info>

38 </Tab>62 </Tab>

39</Tabs>63</Tabs>

40 64 


45claude69claude

46```70```

47 71 

48You'll be prompted to log in on first use. That's it! [Continue with Quickstart (5 mins) →](/en/quickstart)72You'll be prompted to log in on first use. That's it! [Continue with Quickstart (5 minutes) →](/en/quickstart)

49 73 

50<Tip>74<Tip>

51 See [advanced setup](/en/setup) for installation options or [troubleshooting](/en/troubleshooting) if you hit issues.75 See [advanced setup](/en/setup) for installation options, manual updates, or uninstallation instructions. Visit [troubleshooting](/en/troubleshooting) if you hit issues.

52</Tip>76</Tip>

53 77 

54<Note>

55 **New VS Code Extension (Beta)**: Prefer a graphical interface? Our new [VS Code extension](/en/vs-code) provides an easy-to-use native IDE experience without requiring terminal familiarity. Simply install from the marketplace and start coding with Claude directly in your sidebar.

56</Note>

57 

58## What Claude Code does for you78## What Claude Code does for you

59 79 

60* **Build features from descriptions**: Tell Claude what you want to build in plain English. It will make a plan, write the code, and ensure it works.80* **Build features from descriptions**: Tell Claude what you want to build in plain English. It will make a plan, write the code, and ensure it works.

61* **Debug and fix issues**: Describe a bug or paste an error message. Claude Code will analyze your codebase, identify the problem, and implement a fix.81* **Debug and fix issues**: Describe a bug or paste an error message. Claude Code will analyze your codebase, identify the problem, and implement a fix.

62* **Navigate any codebase**: Ask anything about your team's codebase, and get a thoughtful answer back. Claude Code maintains awareness of your entire project structure, can find up-to-date information from the web, and with [MCP](/en/mcp) can pull from external datasources like Google Drive, Figma, and Slack.82* **Navigate any codebase**: Ask anything about your team's codebase, and get a thoughtful answer back. Claude Code maintains awareness of your entire project structure, can find up-to-date information from the web, and with [MCP](/en/mcp) can pull from external data sources like Google Drive, Figma, and Slack.

63* **Automate tedious tasks**: Fix fiddly lint issues, resolve merge conflicts, and write release notes. Do all this in a single command from your developer machines, or automatically in CI.83* **Automate tedious tasks**: Fix fiddly lint issues, resolve merge conflicts, and write release notes. Do all this in a single command from your developer machines, or automatically in CI.

64 84 

65## Why developers love Claude Code85## Why developers love Claude Code


69* **Unix philosophy**: Claude Code is composable and scriptable. `tail -f app.log | claude -p "Slack me if you see any anomalies appear in this log stream"` *works*. Your CI can run `claude -p "If there are new text strings, translate them into French and raise a PR for @lang-fr-team to review"`.89* **Unix philosophy**: Claude Code is composable and scriptable. `tail -f app.log | claude -p "Slack me if you see any anomalies appear in this log stream"` *works*. Your CI can run `claude -p "If there are new text strings, translate them into French and raise a PR for @lang-fr-team to review"`.

70* **Enterprise-ready**: Use the Claude API, or host on AWS or GCP. Enterprise-grade [security](/en/security), [privacy](/en/data-usage), and [compliance](https://trust.anthropic.com/) is built-in.90* **Enterprise-ready**: Use the Claude API, or host on AWS or GCP. Enterprise-grade [security](/en/security), [privacy](/en/data-usage), and [compliance](https://trust.anthropic.com/) is built-in.

71 91 

92## Use Claude Code everywhere

93 

94Claude Code works across your development environment: in your terminal, in your IDE, in the cloud, and in Slack.

95 

96* **[Terminal (CLI)](/en/quickstart)**: the core Claude Code experience. Run `claude` in any terminal to start coding.

97* **[Claude Code on the web](/en/claude-code-on-the-web)**: use Claude Code from your browser at [claude.ai/code](https://claude.ai/code) or the Claude iOS app, with no local setup required. Run tasks in parallel, work on repos you don't have locally, and review changes in a built-in diff view.

98* **[Desktop app](/en/desktop)**: a standalone application with diff review, parallel sessions via git worktrees, and the ability to launch cloud sessions.

99* **[VS Code](/en/vs-code)**: a native extension with inline diffs, @-mentions, and plan review.

100* **[JetBrains IDEs](/en/jetbrains)**: a plugin for IntelliJ IDEA, PyCharm, WebStorm, and other JetBrains IDEs with IDE diff viewing and context sharing.

101* **[GitHub Actions](/en/github-actions)**: automate code review, issue triage, and other workflows in CI/CD with `@claude` mentions.

102* **[GitLab CI/CD](/en/gitlab-ci-cd)**: event-driven automation for GitLab merge requests and issues.

103* **[Slack](/en/slack)**: mention Claude in Slack to route coding tasks to Claude Code on the web and get PRs back.

104* **[Chrome](/en/chrome)**: connect Claude Code to your browser for live debugging, design verification, and web app testing.

105 

72## Next steps106## Next steps

73 107 

74<CardGroup>108<CardGroup>


84 Solutions for common issues with Claude Code118 Solutions for common issues with Claude Code

85 </Card>119 </Card>

86 120 

87 <Card title="IDE setup" icon="laptop" href="/en/vs-code">121 <Card title="Desktop app" icon="laptop" href="/en/desktop">

88 Add Claude Code to your IDE122 Run Claude Code as a standalone application

89 </Card>123 </Card>

90</CardGroup>124</CardGroup>

91 125 

92## Additional resources126## Additional resources

93 127 

94<CardGroup>128<CardGroup>

129 <Card title="About Claude Code" icon="sparkles" href="https://claude.com/product/claude-code">

130 Learn more about Claude Code on claude.com

131 </Card>

132 

95 <Card title="Build with the Agent SDK" icon="code-branch" href="https://docs.claude.com/en/docs/agent-sdk/overview">133 <Card title="Build with the Agent SDK" icon="code-branch" href="https://docs.claude.com/en/docs/agent-sdk/overview">

96 Create custom AI agents with the Claude Agent SDK134 Create custom AI agents with the Claude Agent SDK

97 </Card>135 </Card>

Details

1# Plugin marketplaces1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

2 4 

3> Create and manage plugin marketplaces to distribute Claude Code extensions across teams and communities.5# Create and distribute a plugin marketplace

4 6 

5Plugin marketplaces are catalogs of available plugins that make it easy to discover, install, and manage Claude Code extensions. This guide shows you how to use existing marketplaces and create your own for team distribution.7> Build and host plugin marketplaces to distribute Claude Code extensions across teams and communities.

6 8 

7## Overview9A plugin marketplace is a catalog that lets you distribute plugins to others. Marketplaces provide centralized discovery, version tracking, automatic updates, and support for multiple source types (git repositories, local paths, and more). This guide shows you how to create your own marketplace to share plugins with your team or community.

8 

9A marketplace is a JSON file that lists available plugins and describes where to find them. Marketplaces provide:

10 

11* **Centralized discovery**: Browse plugins from multiple sources in one place

12* **Version management**: Track and update plugin versions automatically

13* **Team distribution**: Share required plugins across your organization

14* **Flexible sources**: Support for git repositories, GitHub repos, local paths, and package managers

15 

16### Prerequisites

17 

18* Claude Code installed and running

19* Basic familiarity with JSON file format

20* For creating marketplaces: Git repository or local development environment

21 

22## Add and use marketplaces

23 10 

24Add marketplaces using the `/plugin marketplace` commands to access plugins from different sources:11Looking to install plugins from an existing marketplace? See [Discover and install prebuilt plugins](/en/discover-plugins).

25 12 

26### Add GitHub marketplaces13## Overview

27 

28```shell Add a GitHub repository containing .claude-plugin/marketplace.json theme={null}

29/plugin marketplace add owner/repo

30```

31 

32### Add Git repositories

33 

34```shell Add any git repository theme={null}

35/plugin marketplace add https://gitlab.com/company/plugins.git

36```

37 14 

38### Add local marketplaces for development15Creating and distributing a marketplace involves:

39 16 

40```shell Add local directory containing .claude-plugin/marketplace.json theme={null}171. **Creating plugins**: build one or more plugins with commands, agents, hooks, MCP servers, or LSP servers. This guide assumes you already have plugins to distribute; see [Create plugins](/en/plugins) for details on how to create them.

41/plugin marketplace add ./my-marketplace182. **Creating a marketplace file**: define a `marketplace.json` that lists your plugins and where to find them (see [Create the marketplace file](#create-the-marketplace-file)).

42```193. **Host the marketplace**: push to GitHub, GitLab, or another git host (see [Host and distribute marketplaces](#host-and-distribute-marketplaces)).

204. **Share with users**: users add your marketplace with `/plugin marketplace add` and install individual plugins (see [Discover and install plugins](/en/discover-plugins)).

43 21 

44```shell Add direct path to marketplace.json file theme={null}22Once your marketplace is live, you can update it by pushing changes to your repository. Users refresh their local copy with `/plugin marketplace update`.

45/plugin marketplace add ./path/to/marketplace.json

46```

47 23 

48```shell Add remote marketplace.json via URL theme={null}24## Walkthrough: create a local marketplace

49/plugin marketplace add https://url.of/marketplace.json

50```

51 25 

52### Install plugins from marketplaces26This example creates a marketplace with one plugin: a `/review` skill for code reviews. You'll create the directory structure, add a skill, create the plugin manifest and marketplace catalog, then install and test it.

53 27 

54Once you've added marketplaces, install plugins directly:28<Steps>

29 <Step title="Create the directory structure">

30 ```bash theme={null}

31 mkdir -p my-marketplace/.claude-plugin

32 mkdir -p my-marketplace/plugins/review-plugin/.claude-plugin

33 mkdir -p my-marketplace/plugins/review-plugin/skills/review

34 ```

35 </Step>

55 36 

56```shell Install from any known marketplace theme={null}37 <Step title="Create the skill">

57/plugin install plugin-name@marketplace-name38 Create a `SKILL.md` file that defines what the `/review` skill does.

58```

59 39 

60```shell Browse available plugins interactively theme={null}40 ```markdown my-marketplace/plugins/review-plugin/skills/review/SKILL.md theme={null}

61/plugin41 ---

62```42 description: Review code for bugs, security, and performance

43 disable-model-invocation: true

44 ---

63 45 

64### Verify marketplace installation46 Review the code I've selected or the recent changes for:

47 - Potential bugs or edge cases

48 - Security concerns

49 - Performance issues

50 - Readability improvements

65 51 

66After adding a marketplace:52 Be concise and actionable.

53 ```

54 </Step>

67 55 

681. **List marketplaces**: Run `/plugin marketplace list` to confirm it's added56 <Step title="Create the plugin manifest">

692. **Browse plugins**: Use `/plugin` to see available plugins from your marketplace57 Create a `plugin.json` file that describes the plugin. The manifest goes in the `.claude-plugin/` directory.

703. **Test installation**: Try installing a plugin to verify the marketplace works correctly

71 58 

72## Configure team marketplaces59 ```json my-marketplace/plugins/review-plugin/.claude-plugin/plugin.json theme={null}

60 {

61 "name": "review-plugin",

62 "description": "Adds a /review skill for quick code reviews",

63 "version": "1.0.0"

64 }

65 ```

66 </Step>

73 67 

74Set up automatic marketplace installation for team projects by specifying required marketplaces in `.claude/settings.json`:68 <Step title="Create the marketplace file">

69 Create the marketplace catalog that lists your plugin.

75 70 

76```json theme={null}71 ```json my-marketplace/.claude-plugin/marketplace.json theme={null}

77{72 {

78 "extraKnownMarketplaces": {73 "name": "my-plugins",

79 "team-tools": {74 "owner": {

80 "source": {75 "name": "Your Name"

81 "source": "github",

82 "repo": "your-org/claude-plugins"

83 }

84 },76 },

85 "project-specific": {77 "plugins": [

86 "source": {78 {

87 "source": "git",79 "name": "review-plugin",

88 "url": "https://git.company.com/project-plugins.git"80 "source": "./plugins/review-plugin",

89 }81 "description": "Adds a /review skill for quick code reviews"

90 }82 }

83 ]

91 }84 }

92}85 ```

93```86 </Step>

87 

88 <Step title="Add and install">

89 Add the marketplace and install the plugin.

90 

91 ```shell theme={null}

92 /plugin marketplace add ./my-marketplace

93 /plugin install review-plugin@my-plugins

94 ```

95 </Step>

94 96 

95When team members trust the repository folder, Claude Code automatically installs these marketplaces and any plugins specified in the `enabledPlugins` field.97 <Step title="Try it out">

98 Select some code in your editor and run your new command.

96 99 

97***100 ```shell theme={null}

101 /review

102 ```

103 </Step>

104</Steps>

98 105 

99## Create your own marketplace106To learn more about what plugins can do, including hooks, agents, MCP servers, and LSP servers, see [Plugins](/en/plugins).

100 107 

101Build and distribute custom plugin collections for your team or community.108<Note>

109 **How plugins are installed**: When users install a plugin, Claude Code copies the plugin directory to a cache location. This means plugins can't reference files outside their directory using paths like `../shared-utils`, because those files won't be copied.

102 110 

103### Prerequisites for marketplace creation111 If you need to share files across plugins, use symlinks (which are followed during copying) or restructure your marketplace so the shared directory is inside the plugin source path. See [Plugin caching and file resolution](/en/plugins-reference#plugin-caching-and-file-resolution) for details.

112</Note>

104 113 

105* Git repository (GitHub, GitLab, or other git hosting)114## Create the marketplace file

106* Understanding of JSON file format

107* One or more plugins to distribute

108 115 

109### Create the marketplace file116Create `.claude-plugin/marketplace.json` in your repository root. This file defines your marketplace's name, owner information, and a list of plugins with their sources.

110 117 

111Create `.claude-plugin/marketplace.json` in your repository root:118Each plugin entry needs at minimum a `name` and `source` (where to fetch it from). See the [full schema](#marketplace-schema) below for all available fields.

112 119 

113```json theme={null}120```json theme={null}

114{121{

115 "name": "company-tools",122 "name": "company-tools",

116 "owner": {123 "owner": {

117 "name": "DevTools Team",124 "name": "DevTools Team",

118 "email": "devtools@company.com"125 "email": "devtools@example.com"

119 },126 },

120 "plugins": [127 "plugins": [

121 {128 {


139}146}

140```147```

141 148 

142### Marketplace schema149## Marketplace schema

143 150 

144#### Required fields151### Required fields

145 152 

146| Field | Type | Description |153| Field | Type | Description | Example |

147| :-------- | :----- | :--------------------------------------------- |154| :-------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------- |

148| `name` | string | Marketplace identifier (kebab-case, no spaces) |155| `name` | string | Marketplace identifier (kebab-case, no spaces). This is public-facing: users see it when installing plugins (for example, `/plugin install my-tool@your-marketplace`). | `"acme-tools"` |

149| `owner` | object | Marketplace maintainer information |156| `owner` | object | Marketplace maintainer information ([see fields below](#owner-fields)) | |

150| `plugins` | array | List of available plugins |157| `plugins` | array | List of available plugins | See below |

158 

159<Note>

160 **Reserved names**: The following marketplace names are reserved for official Anthropic use and cannot be used by third-party marketplaces: `claude-code-marketplace`, `claude-code-plugins`, `claude-plugins-official`, `anthropic-marketplace`, `anthropic-plugins`, `agent-skills`, `life-sciences`. Names that impersonate official marketplaces (like `official-claude-plugins` or `anthropic-tools-v2`) are also blocked.

161</Note>

162 

163### Owner fields

164 

165| Field | Type | Required | Description |

166| :------ | :----- | :------- | :------------------------------- |

167| `name` | string | Yes | Name of the maintainer or team |

168| `email` | string | No | Contact email for the maintainer |

151 169 

152#### Optional metadata170### Optional metadata

153 171 

154| Field | Type | Description |172| Field | Type | Description |

155| :--------------------- | :----- | :------------------------------------ |173| :--------------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

156| `metadata.description` | string | Brief marketplace description |174| `metadata.description` | string | Brief marketplace description |

157| `metadata.version` | string | Marketplace version |175| `metadata.version` | string | Marketplace version |

158| `metadata.pluginRoot` | string | Base path for relative plugin sources |176| `metadata.pluginRoot` | string | Base directory prepended to relative plugin source paths (for example, `"./plugins"` lets you write `"source": "formatter"` instead of `"source": "./plugins/formatter"`) |

159 177 

160### Plugin entries178## Plugin entries

161 179 

162<Note>180Each plugin entry in the `plugins` array describes a plugin and where to find it. You can include any field from the [plugin manifest schema](/en/plugins-reference#plugin-manifest-schema) (like `description`, `version`, `author`, `commands`, `hooks`, etc.), plus these marketplace-specific fields: `source`, `category`, `tags`, and `strict`.

163 Plugin entries are based on the *plugin manifest schema* (with all fields made optional) plus marketplace-specific fields (`source`, `category`, `tags`, `strict`), with `name` being required.

164</Note>

165 181 

166**Required fields:**182### Required fields

167 183 

168| Field | Type | Description |184| Field | Type | Description |

169| :------- | :------------- | :---------------------------------------- |185| :------- | :------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- |

170| `name` | string | Plugin identifier (kebab-case, no spaces) |186| `name` | string | Plugin identifier (kebab-case, no spaces). This is public-facing: users see it when installing (for example, `/plugin install my-plugin@marketplace`). |

171| `source` | string\|object | Where to fetch the plugin from |187| `source` | string\|object | Where to fetch the plugin from (see [Plugin sources](#plugin-sources) below) |

172 188 

173#### Optional plugin fields189### Optional plugin fields

174 190 

175**Standard metadata fields:**191**Standard metadata fields:**

176 192 

177| Field | Type | Description |193| Field | Type | Description |

178| :------------ | :------ | :---------------------------------------------------------------- |194| :------------ | :------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

179| `description` | string | Brief plugin description |195| `description` | string | Brief plugin description |

180| `version` | string | Plugin version |196| `version` | string | Plugin version |

181| `author` | object | Plugin author information |197| `author` | object | Plugin author information (`name` required, `email` optional) |

182| `homepage` | string | Plugin homepage or documentation URL |198| `homepage` | string | Plugin homepage or documentation URL |

183| `repository` | string | Source code repository URL |199| `repository` | string | Source code repository URL |

184| `license` | string | SPDX license identifier (e.g., MIT, Apache-2.0) |200| `license` | string | SPDX license identifier (for example, MIT, Apache-2.0) |

185| `keywords` | array | Tags for plugin discovery and categorization |201| `keywords` | array | Tags for plugin discovery and categorization |

186| `category` | string | Plugin category for organization |202| `category` | string | Plugin category for organization |

187| `tags` | array | Tags for searchability |203| `tags` | array | Tags for searchability |

188| `strict` | boolean | Require plugin.json in plugin folder (default: true) <sup>1</sup> |204| `strict` | boolean | Controls whether plugins need their own `plugin.json` file. When `true` (default), the plugin source must contain a `plugin.json`, and any fields you add here in the marketplace entry get merged with it. When `false`, the plugin doesn't need its own `plugin.json`; the marketplace entry itself defines everything about the plugin. Use `false` when you want to define simple plugins entirely in your marketplace file. |

189 205 

190**Component configuration fields:**206**Component configuration fields:**

191 207 


195| `agents` | string\|array | Custom paths to agent files |211| `agents` | string\|array | Custom paths to agent files |

196| `hooks` | string\|object | Custom hooks configuration or path to hooks file |212| `hooks` | string\|object | Custom hooks configuration or path to hooks file |

197| `mcpServers` | string\|object | MCP server configurations or path to MCP config |213| `mcpServers` | string\|object | MCP server configurations or path to MCP config |

214| `lspServers` | string\|object | LSP server configurations or path to LSP config |

198 215 

199*<sup>1 - When `strict: true` (default), the plugin must include a `plugin.json` manifest file, and marketplace fields supplement those values. When `strict: false`, the plugin.json is optional. If it's missing, the marketplace entry serves as the complete plugin manifest.</sup>*216## Plugin sources

200 

201### Plugin sources

202 217 

203#### Relative paths218### Relative paths

204 219 

205For plugins in the same repository:220For plugins in the same repository:

206 221 


211}226}

212```227```

213 228 

214#### GitHub repositories229<Note>

230 Relative paths only work when users add your marketplace via Git (GitHub, GitLab, or git URL). If users add your marketplace via a direct URL to the `marketplace.json` file, relative paths will not resolve correctly. For URL-based distribution, use GitHub, npm, or git URL sources instead. See [Troubleshooting](#plugins-with-relative-paths-fail-in-url-based-marketplaces) for details.

231</Note>

232 

233### GitHub repositories

215 234 

216```json theme={null}235```json theme={null}

217{236{


223}242}

224```243```

225 244 

226#### Git repositories245You can pin to a specific branch, tag, or commit:

246 

247```json theme={null}

248{

249 "name": "github-plugin",

250 "source": {

251 "source": "github",

252 "repo": "owner/plugin-repo",

253 "ref": "v2.0.0",

254 "sha": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"

255 }

256}

257```

258 

259| Field | Type | Description |

260| :----- | :----- | :-------------------------------------------------------------------- |

261| `repo` | string | Required. GitHub repository in `owner/repo` format |

262| `ref` | string | Optional. Git branch or tag (defaults to repository default branch) |

263| `sha` | string | Optional. Full 40-character git commit SHA to pin to an exact version |

264 

265### Git repositories

227 266 

228```json theme={null}267```json theme={null}

229{268{


235}274}

236```275```

237 276 

238#### Advanced plugin entries277You can pin to a specific branch, tag, or commit:

278 

279```json theme={null}

280{

281 "name": "git-plugin",

282 "source": {

283 "source": "url",

284 "url": "https://gitlab.com/team/plugin.git",

285 "ref": "main",

286 "sha": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"

287 }

288}

289```

290 

291| Field | Type | Description |

292| :---- | :----- | :-------------------------------------------------------------------- |

293| `url` | string | Required. Full git repository URL (must end with `.git`) |

294| `ref` | string | Optional. Git branch or tag (defaults to repository default branch) |

295| `sha` | string | Optional. Full 40-character git commit SHA to pin to an exact version |

296 

297### Advanced plugin entries

239 298 

240Plugin entries can override default component locations and provide additional metadata. Note that `${CLAUDE_PLUGIN_ROOT}` is an environment variable that resolves to the plugin's installation directory (for details see [Environment variables](/en/plugins-reference#environment-variables)):299This example shows a plugin entry using many of the optional fields, including custom paths for commands, agents, hooks, and MCP servers:

241 300 

242```json theme={null}301```json theme={null}

243{302{


250 "version": "2.1.0",309 "version": "2.1.0",

251 "author": {310 "author": {

252 "name": "Enterprise Team",311 "name": "Enterprise Team",

253 "email": "enterprise@company.com"312 "email": "enterprise@example.com"

254 },313 },

255 "homepage": "https://docs.company.com/plugins/enterprise-tools",314 "homepage": "https://docs.example.com/plugins/enterprise-tools",

256 "repository": "https://github.com/company/enterprise-plugin",315 "repository": "https://github.com/company/enterprise-plugin",

257 "license": "MIT",316 "license": "MIT",

258 "keywords": ["enterprise", "workflow", "automation"],317 "keywords": ["enterprise", "workflow", "automation"],


262 "./commands/enterprise/",321 "./commands/enterprise/",

263 "./commands/experimental/preview.md"322 "./commands/experimental/preview.md"

264 ],323 ],

265 "agents": [324 "agents": ["./agents/security-reviewer.md", "./agents/compliance-checker.md"],

266 "./agents/security-reviewer.md",

267 "./agents/compliance-checker.md"

268 ],

269 "hooks": {325 "hooks": {

270 "PostToolUse": [326 "PostToolUse": [

271 {327 {

272 "matcher": "Write|Edit",328 "matcher": "Write|Edit",

273 "hooks": [{"type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh"}]329 "hooks": [

330 {

331 "type": "command",

332 "command": "${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh"

333 }

334 ]

274 }335 }

275 ]336 ]

276 },337 },


284}345}

285```346```

286 347 

287<Note>348Key things to notice:

288 **Schema relationship**: Plugin entries use the plugin manifest schema with all fields made optional, plus marketplace-specific fields (`source`, `strict`, `category`, `tags`). This means any field valid in a `plugin.json` file can also be used in a marketplace entry. When `strict: false`, the marketplace entry serves as the complete plugin manifest if no `plugin.json` exists. When `strict: true` (default), marketplace fields supplement the plugin's own manifest file.

289</Note>

290 349 

291***350* **`commands` and `agents`**: You can specify multiple directories or individual files. Paths are relative to the plugin root.

351* **`${CLAUDE_PLUGIN_ROOT}`**: Use this variable in hooks and MCP server configs to reference files within the plugin's installation directory. This is necessary because plugins are copied to a cache location when installed.

352* **`strict: false`**: Since this is set to false, the plugin doesn't need its own `plugin.json`. The marketplace entry defines everything.

292 353 

293## Host and distribute marketplaces354## Host and distribute marketplaces

294 355 

295Choose the best hosting strategy for your plugin distribution needs.

296 

297### Host on GitHub (recommended)356### Host on GitHub (recommended)

298 357 

299GitHub provides the easiest distribution method:358GitHub provides the easiest distribution method:

300 359 

3011. **Create a repository**: Set up a new repository for your marketplace3601. **Create a repository**: Set up a new repository for your marketplace

3022. **Add marketplace file**: Create `.claude-plugin/marketplace.json` with your plugin definitions3612. **Add marketplace file**: Create `.claude-plugin/marketplace.json` with your plugin definitions

3033. **Share with teams**: Team members add with `/plugin marketplace add owner/repo`3623. **Share with teams**: Users add your marketplace with `/plugin marketplace add owner/repo`

304 363 

305**Benefits**: Built-in version control, issue tracking, and team collaboration features.364**Benefits**: Built-in version control, issue tracking, and team collaboration features.

306 365 

307### Host on other git services366### Host on other git services

308 367 

309Any git hosting service works for marketplace distribution, using a URL to an arbitrary git repository.368Any git hosting service works, such as GitLab, Bitbucket, and self-hosted servers. Users add with the full repository URL:

310 

311For example, using GitLab:

312 369 

313```shell theme={null}370```shell theme={null}

314/plugin marketplace add https://gitlab.com/company/plugins.git371/plugin marketplace add https://gitlab.com/company/plugins.git

315```372```

316 373 

317### Use local marketplaces for development374### Private repositories

318 375 

319Test your marketplace locally before distribution:376Claude Code supports installing plugins from private repositories. For manual installation and updates, Claude Code uses your existing git credential helpers. If `git clone` works for a private repository in your terminal, it works in Claude Code too. Common credential helpers include `gh auth login` for GitHub, macOS Keychain, and `git-credential-store`.

320 377 

321```shell Add local marketplace for testing theme={null}378Background auto-updates run at startup without credential helpers, since interactive prompts would block Claude Code from starting. To enable auto-updates for private marketplaces, set the appropriate authentication token in your environment:

322/plugin marketplace add ./my-local-marketplace379 

380| Provider | Environment variables | Notes |

381| :-------- | :--------------------------- | :---------------------------------------- |

382| GitHub | `GITHUB_TOKEN` or `GH_TOKEN` | Personal access token or GitHub App token |

383| GitLab | `GITLAB_TOKEN` or `GL_TOKEN` | Personal access token or project token |

384| Bitbucket | `BITBUCKET_TOKEN` | App password or repository access token |

385 

386Set the token in your shell configuration (for example, `.bashrc`, `.zshrc`) or pass it when running Claude Code:

387 

388```bash theme={null}

389export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx

323```390```

324 391 

325```shell Test plugin installation theme={null}392<Note>

393 For CI/CD environments, configure the token as a secret environment variable. GitHub Actions automatically provides `GITHUB_TOKEN` for repositories in the same organization.

394</Note>

395 

396### Test locally before distribution

397 

398Test your marketplace locally before sharing:

399 

400```shell theme={null}

401/plugin marketplace add ./my-local-marketplace

326/plugin install test-plugin@my-local-marketplace402/plugin install test-plugin@my-local-marketplace

327```403```

328 404 

329## Manage marketplace operations405For the full range of add commands (GitHub, Git URLs, local paths, remote URLs), see [Add marketplaces](/en/discover-plugins#add-marketplaces).

330 406 

331### List known marketplaces407### Require marketplaces for your team

332 408 

333```shell List all configured marketplaces theme={null}409You can configure your repository so team members are automatically prompted to install your marketplace when they trust the project folder. Add your marketplace to `.claude/settings.json`:

334/plugin marketplace list410 

411```json theme={null}

412{

413 "extraKnownMarketplaces": {

414 "company-tools": {

415 "source": {

416 "source": "github",

417 "repo": "your-org/claude-plugins"

418 }

419 }

420 }

421}

335```422```

336 423 

337Shows all configured marketplaces with their sources and status.424You can also specify which plugins should be enabled by default:

425 

426```json theme={null}

427{

428 "enabledPlugins": {

429 "code-formatter@company-tools": true,

430 "deployment-tools@company-tools": true

431 }

432}

433```

434 

435For full configuration options, see [Plugin settings](/en/settings#plugin-settings).

436 

437### Managed marketplace restrictions

438 

439For organizations requiring strict control over plugin sources, administrators can restrict which plugin marketplaces users are allowed to add using the [`strictKnownMarketplaces`](/en/settings#strictknownmarketplaces) setting in managed settings.

338 440 

339### Update marketplace metadata441When `strictKnownMarketplaces` is configured in managed settings, the restriction behavior depends on the value:

340 442 

341```shell Refresh marketplace metadata theme={null}443| Value | Behavior |

342/plugin marketplace update marketplace-name444| ------------------- | ---------------------------------------------------------------- |

445| Undefined (default) | No restrictions. Users can add any marketplace |

446| Empty array `[]` | Complete lockdown. Users cannot add any new marketplaces |

447| List of sources | Users can only add marketplaces that match the allowlist exactly |

448 

449#### Common configurations

450 

451Disable all marketplace additions:

452 

453```json theme={null}

454{

455 "strictKnownMarketplaces": []

456}

343```457```

344 458 

345Refreshes plugin listings and metadata from the marketplace source.459Allow specific marketplaces only:

346 460 

347### Remove a marketplace461```json theme={null}

462{

463 "strictKnownMarketplaces": [

464 {

465 "source": "github",

466 "repo": "acme-corp/approved-plugins"

467 },

468 {

469 "source": "github",

470 "repo": "acme-corp/security-tools",

471 "ref": "v2.0"

472 },

473 {

474 "source": "url",

475 "url": "https://plugins.example.com/marketplace.json"

476 }

477 ]

478}

479```

480 

481Allow all marketplaces from an internal git server using regex pattern matching:

348 482 

349```shell Remove a marketplace theme={null}483```json theme={null}

350/plugin marketplace remove marketplace-name484{

485 "strictKnownMarketplaces": [

486 {

487 "source": "hostPattern",

488 "hostPattern": "^github\\.example\\.com$"

489 }

490 ]

491}

351```492```

352 493 

353Removes the marketplace from your configuration.494#### How restrictions work

495 

496Restrictions are validated early in the plugin installation process, before any network requests or filesystem operations occur. This prevents unauthorized marketplace access attempts.

497 

498The allowlist uses exact matching for most source types. For a marketplace to be allowed, all specified fields must match exactly:

354 499 

355<Warning>500* For GitHub sources: `repo` is required, and `ref` or `path` must also match if specified in the allowlist

356 Removing a marketplace will uninstall any plugins you installed from it.501* For URL sources: the full URL must match exactly

357</Warning>502* For `hostPattern` sources: the marketplace host is matched against the regex pattern

358 503 

359***504Because `strictKnownMarketplaces` is set in [managed settings](/en/settings#settings-files), individual users and project configurations cannot override these restrictions.

360 505 

361## Troubleshooting marketplaces506For complete configuration details including all supported source types and comparison with `extraKnownMarketplaces`, see the [strictKnownMarketplaces reference](/en/settings#strictknownmarketplaces).

362 507 

363### Common marketplace issues508## Validation and testing

364 509 

365#### Marketplace not loading510Test your marketplace before sharing.

511 

512Validate your marketplace JSON syntax:

513 

514```bash theme={null}

515claude plugin validate .

516```

517 

518Or from within Claude Code:

519 

520```shell theme={null}

521/plugin validate .

522```

523 

524Add the marketplace for testing:

525 

526```shell theme={null}

527/plugin marketplace add ./path/to/marketplace

528```

529 

530Install a test plugin to verify everything works:

531 

532```shell theme={null}

533/plugin install test-plugin@marketplace-name

534```

535 

536For complete plugin testing workflows, see [Test your plugins locally](/en/plugins#test-your-plugins-locally). For technical troubleshooting, see [Plugins reference](/en/plugins-reference).

537 

538## Troubleshooting

539 

540### Marketplace not loading

366 541 

367**Symptoms**: Can't add marketplace or see plugins from it542**Symptoms**: Can't add marketplace or see plugins from it

368 543 


370 545 

371* Verify the marketplace URL is accessible546* Verify the marketplace URL is accessible

372* Check that `.claude-plugin/marketplace.json` exists at the specified path547* Check that `.claude-plugin/marketplace.json` exists at the specified path

373* Ensure JSON syntax is valid using `claude plugin validate`548* Ensure JSON syntax is valid using `claude plugin validate` or `/plugin validate`

374* For private repositories, confirm you have access permissions549* For private repositories, confirm you have access permissions

375 550 

376#### Plugin installation failures551### Marketplace validation errors

552 

553Run `claude plugin validate .` or `/plugin validate .` from your marketplace directory to check for issues. Common errors:

554 

555| Error | Cause | Solution |

556| :------------------------------------------------ | :------------------------------ | :------------------------------------------------------------ |

557| `File not found: .claude-plugin/marketplace.json` | Missing manifest | Create `.claude-plugin/marketplace.json` with required fields |

558| `Invalid JSON syntax: Unexpected token...` | JSON syntax error | Check for missing commas, extra commas, or unquoted strings |

559| `Duplicate plugin name "x" found in marketplace` | Two plugins share the same name | Give each plugin a unique `name` value |

560| `plugins[0].source: Path traversal not allowed` | Source path contains `..` | Use paths relative to marketplace root without `..` |

561 

562**Warnings** (non-blocking):

563 

564* `Marketplace has no plugins defined`: add at least one plugin to the `plugins` array

565* `No marketplace description provided`: add `metadata.description` to help users understand your marketplace

566* `Plugin "x" uses npm source which is not yet fully implemented`: use `github` or local path sources instead

567 

568### Plugin installation failures

377 569 

378**Symptoms**: Marketplace appears but plugin installation fails570**Symptoms**: Marketplace appears but plugin installation fails

379 571 


384* For GitHub sources, ensure repositories are public or you have access576* For GitHub sources, ensure repositories are public or you have access

385* Test plugin sources manually by cloning/downloading577* Test plugin sources manually by cloning/downloading

386 578 

387### Validation and testing579### Private repository authentication fails

388 580 

389Test your marketplace before sharing:581**Symptoms**: Authentication errors when installing plugins from private repositories

390 582 

391```bash Validate marketplace JSON syntax theme={null}583**Solutions**:

392claude plugin validate .

393```

394 584 

395```shell Add marketplace for testing theme={null}585For manual installation and updates:

396/plugin marketplace add ./path/to/marketplace

397```

398 586 

399```shell Install test plugin theme={null}587* Verify you're authenticated with your git provider (for example, run `gh auth status` for GitHub)

400/plugin install test-plugin@marketplace-name588* Check that your credential helper is configured correctly: `git config --global credential.helper`

401```589* Try cloning the repository manually to verify your credentials work

402 590 

403For complete plugin testing workflows, see [Test your plugins locally](/en/plugins#test-your-plugins-locally). For technical troubleshooting, see [Plugins reference](/en/plugins-reference).591For background auto-updates:

592 

593* Set the appropriate token in your environment: `echo $GITHUB_TOKEN`

594* Check that the token has the required permissions (read access to the repository)

595* For GitHub, ensure the token has the `repo` scope for private repositories

596* For GitLab, ensure the token has at least `read_repository` scope

597* Verify the token hasn't expired

598 

599### Plugins with relative paths fail in URL-based marketplaces

404 600 

405***601**Symptoms**: Added a marketplace via URL (such as `https://example.com/marketplace.json`), but plugins with relative path sources like `"./plugins/my-plugin"` fail to install with "path not found" errors.

406 602 

407## Next steps603**Cause**: URL-based marketplaces only download the `marketplace.json` file itself. They do not download plugin files from the server. Relative paths in the marketplace entry reference files on the remote server that were not downloaded.

604 

605**Solutions**:

408 606 

409### For marketplace users607* **Use external sources**: Change plugin entries to use GitHub, npm, or git URL sources instead of relative paths:

608 ```json theme={null}

609 { "name": "my-plugin", "source": { "source": "github", "repo": "owner/repo" } }

610 ```

611* **Use a Git-based marketplace**: Host your marketplace in a Git repository and add it with the git URL. Git-based marketplaces clone the entire repository, making relative paths work correctly.

410 612 

411* **Discover community marketplaces**: Search GitHub for Claude Code plugin collections613### Files not found after installation

412* **Contribute feedback**: Report issues and suggest improvements to marketplace maintainers

413* **Share useful marketplaces**: Help your team discover valuable plugin collections

414 614 

415### For marketplace creators615**Symptoms**: Plugin installs but references to files fail, especially files outside the plugin directory

416 616 

417* **Build plugin collections**: Create themed marketplace around specific use cases617**Cause**: Plugins are copied to a cache directory rather than used in-place. Paths that reference files outside the plugin's directory (such as `../shared-utils`) won't work because those files aren't copied.

418* **Establish versioning**: Implement clear versioning and update policies

419* **Community engagement**: Gather feedback and maintain active marketplace communities

420* **Documentation**: Provide clear README files explaining your marketplace contents

421 618 

422### For organizations619**Solutions**: See [Plugin caching and file resolution](/en/plugins-reference#plugin-caching-and-file-resolution) for workarounds including symlinks and directory restructuring.

423 620 

424* **Private marketplaces**: Set up internal marketplaces for proprietary tools621For additional debugging tools and common issues, see [Debugging and development tools](/en/plugins-reference#debugging-and-development-tools).

425* **Governance policies**: Establish guidelines for plugin approval and security review

426* **Training resources**: Help teams discover and adopt useful plugins effectively

427 622 

428## See also623## See also

429 624 

430* [Plugins](/en/plugins) - Installing and using plugins625* [Discover and install prebuilt plugins](/en/discover-plugins) - Installing plugins from existing marketplaces

626* [Plugins](/en/plugins) - Creating your own plugins

431* [Plugins reference](/en/plugins-reference) - Complete technical specifications and schemas627* [Plugins reference](/en/plugins-reference) - Complete technical specifications and schemas

432* [Plugin development](/en/plugins#develop-more-complex-plugins) - Creating your own plugins628* [Plugin settings](/en/settings#plugin-settings) - Plugin configuration options

433* [Settings](/en/settings#plugin-configuration) - Plugin configuration options629* [strictKnownMarketplaces reference](/en/settings#strictknownmarketplaces) - Managed marketplace restrictions

plugins.md +272 −253

Details

1# Plugins1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

2 4 

3> Extend Claude Code with custom commands, agents, hooks, Skills, and MCP servers through the plugin system.5# Create plugins

6 

7> Create custom plugins to extend Claude Code with skills, agents, hooks, and MCP servers.

8 

9Plugins let you extend Claude Code with custom functionality that can be shared across projects and teams. This guide covers creating your own plugins with skills, agents, hooks, and MCP servers.

10 

11Looking to install existing plugins? See [Discover and install plugins](/en/discover-plugins). For complete technical specifications, see [Plugins reference](/en/plugins-reference).

12 

13## When to use plugins vs standalone configuration

14 

15Claude Code supports two ways to add custom skills, agents, and hooks:

16 

17| Approach | Skill names | Best for |

18| :---------------------------------------------------------- | :------------------- | :---------------------------------------------------------------------------------------------- |

19| **Standalone** (`.claude/` directory) | `/hello` | Personal workflows, project-specific customizations, quick experiments |

20| **Plugins** (directories with `.claude-plugin/plugin.json`) | `/plugin-name:hello` | Sharing with teammates, distributing to community, versioned releases, reusable across projects |

21 

22**Use standalone configuration when**:

23 

24* You're customizing Claude Code for a single project

25* The configuration is personal and doesn't need to be shared

26* You're experimenting with skills or hooks before packaging them

27* You want short skill names like `/hello` or `/review`

28 

29**Use plugins when**:

30 

31* You want to share functionality with your team or community

32* You need the same skills/agents across multiple projects

33* You want version control and easy updates for your extensions

34* You're distributing through a marketplace

35* You're okay with namespaced skills like `/my-plugin:hello` (namespacing prevents conflicts between plugins)

4 36 

5<Tip>37<Tip>

6 For complete technical specifications and schemas, see [Plugins reference](/en/plugins-reference). For marketplace management, see [Plugin marketplaces](/en/plugin-marketplaces).38 Start with standalone configuration in `.claude/` for quick iteration, then [convert to a plugin](#convert-existing-configurations-to-plugins) when you're ready to share.

7</Tip>39</Tip>

8 40 

9Plugins let you extend Claude Code with custom functionality that can be shared across projects and teams. Install plugins from [marketplaces](/en/plugin-marketplaces) to add pre-built commands, agents, hooks, Skills, and MCP servers, or create your own to automate your workflows.

10 

11## Quickstart41## Quickstart

12 42 

13Let's create a simple greeting plugin to get you familiar with the plugin system. We'll build a working plugin that adds a custom command, test it locally, and understand the core concepts.43This quickstart walks you through creating a plugin with a custom skill. You'll create a manifest (the configuration file that defines your plugin), add a skill, and test it locally using the `--plugin-dir` flag.

14 44 

15### Prerequisites45### Prerequisites

16 46 

17* Claude Code installed on your machine47* Claude Code [installed and authenticated](/en/quickstart#step-1-install-claude-code)

18* Basic familiarity with command-line tools48* Claude Code version 1.0.33 or later (run `claude --version` to check)

49 

50<Note>

51 If you don't see the `/plugin` command, update Claude Code to the latest version. See [Troubleshooting](/en/troubleshooting) for upgrade instructions.

52</Note>

19 53 

20### Create your first plugin54### Create your first plugin

21 55 

22<Steps>56<Steps>

23 <Step title="Create the marketplace structure">

24 ```bash theme={null}

25 mkdir test-marketplace

26 cd test-marketplace

27 ```

28 </Step>

29 

30 <Step title="Create the plugin directory">57 <Step title="Create the plugin directory">

58 Every plugin lives in its own directory containing a manifest and your skills, agents, or hooks. Create one now:

59 

31 ```bash theme={null}60 ```bash theme={null}

32 mkdir my-first-plugin61 mkdir my-first-plugin

33 cd my-first-plugin

34 ```62 ```

35 </Step>63 </Step>

36 64 

37 <Step title="Create the plugin manifest">65 <Step title="Create the plugin manifest">

38 ```bash Create .claude-plugin/plugin.json theme={null}66 The manifest file at `.claude-plugin/plugin.json` defines your plugin's identity: its name, description, and version. Claude Code uses this metadata to display your plugin in the plugin manager.

39 mkdir .claude-plugin67 

40 cat > .claude-plugin/plugin.json << 'EOF'68 Create the `.claude-plugin` directory inside your plugin folder:

69 

70 ```bash theme={null}

71 mkdir my-first-plugin/.claude-plugin

72 ```

73 

74 Then create `my-first-plugin/.claude-plugin/plugin.json` with this content:

75 

76 ```json my-first-plugin/.claude-plugin/plugin.json theme={null}

41 {77 {

42 "name": "my-first-plugin",78 "name": "my-first-plugin",

43 "description": "A simple greeting plugin to learn the basics",79 "description": "A greeting plugin to learn the basics",

44 "version": "1.0.0",80 "version": "1.0.0",

45 "author": {81 "author": {

46 "name": "Your Name"82 "name": "Your Name"

47 }83 }

48 }84 }

49 EOF

50 ```85 ```

86 

87 | Field | Purpose |

88 | :------------ | :----------------------------------------------------------------------------------------------------- |

89 | `name` | Unique identifier and skill namespace. Skills are prefixed with this (e.g., `/my-first-plugin:hello`). |

90 | `description` | Shown in the plugin manager when browsing or installing plugins. |

91 | `version` | Track releases using [semantic versioning](/en/plugins-reference#version-management). |

92 | `author` | Optional. Helpful for attribution. |

93 

94 For additional fields like `homepage`, `repository`, and `license`, see the [full manifest schema](/en/plugins-reference#plugin-manifest-schema).

51 </Step>95 </Step>

52 96 

53 <Step title="Add a custom command">97 <Step title="Add a skill">

54 ```bash Create commands/hello.md theme={null}98 Skills live in the `skills/` directory. Each skill is a folder containing a `SKILL.md` file. The folder name becomes the skill name, prefixed with the plugin's namespace (`hello/` in a plugin named `my-first-plugin` creates `/my-first-plugin:hello`).

55 mkdir commands

56 cat > commands/hello.md << 'EOF'

57 ---

58 description: Greet the user with a personalized message

59 ---

60 99 

61 # Hello Command100 Create a skill directory in your plugin folder:

62 101 

63 Greet the user warmly and ask how you can help them today. Make the greeting personal and encouraging.102 ```bash theme={null}

64 EOF103 mkdir -p my-first-plugin/skills/hello

65 ```104 ```

66 </Step>

67 105 

68 <Step title="Create the marketplace manifest">106 Then create `my-first-plugin/skills/hello/SKILL.md` with this content:

69 ```bash Create marketplace.json theme={null}107 

70 cd ..108 ```markdown my-first-plugin/skills/hello/SKILL.md theme={null}

71 mkdir .claude-plugin109 ---

72 cat > .claude-plugin/marketplace.json << 'EOF'110 description: Greet the user with a friendly message

73 {111 disable-model-invocation: true

74 "name": "test-marketplace",112 ---

75 "owner": {113 

76 "name": "Test User"114 Greet the user warmly and ask how you can help them today.

77 },

78 "plugins": [

79 {

80 "name": "my-first-plugin",

81 "source": "./my-first-plugin",

82 "description": "My first test plugin"

83 }

84 ]

85 }

86 EOF

87 ```115 ```

88 </Step>116 </Step>

89 117 

90 <Step title="Install and test your plugin">118 <Step title="Test your plugin">

91 ```bash Start Claude Code from parent directory theme={null}119 Run Claude Code with the `--plugin-dir` flag to load your plugin:

92 cd ..120 

93 claude121 ```bash theme={null}

122 claude --plugin-dir ./my-first-plugin

94 ```123 ```

95 124 

96 ```shell Add the test marketplace theme={null}125 Once Claude Code starts, try your new command:

97 /plugin marketplace add ./test-marketplace126 

127 ```shell theme={null}

128 /my-first-plugin:hello

98 ```129 ```

99 130 

100 ```shell Install your plugin theme={null}131 You'll see Claude respond with a greeting. Run `/help` to see your command listed under the plugin namespace.

101 /plugin install my-first-plugin@test-marketplace132 

133 <Note>

134 **Why namespacing?** Plugin skills are always namespaced (like `/greet:hello`) to prevent conflicts when multiple plugins have skills with the same name.

135 

136 To change the namespace prefix, update the `name` field in `plugin.json`.

137 </Note>

138 </Step>

139 

140 <Step title="Add skill arguments">

141 Make your skill dynamic by accepting user input. The `$ARGUMENTS` placeholder captures any text the user provides after the skill name.

142 

143 Update your `hello.md` file:

144 

145 ```markdown my-first-plugin/commands/hello.md theme={null}

146 ---

147 description: Greet the user with a personalized message

148 ---

149 

150 # Hello Command

151 

152 Greet the user named "$ARGUMENTS" warmly and ask how you can help them today. Make the greeting personal and encouraging.

102 ```153 ```

103 154 

104 Select "Install now". You'll then need to restart Claude Code in order to use the new plugin.155 Restart Claude Code to pick up the changes, then try the command with your name:

105 156 

106 ```shell Try your new command theme={null}157 ```shell theme={null}

107 /hello158 /my-first-plugin:hello Alex

108 ```159 ```

109 160 

110 You'll see Claude use your greeting command! Check `/help` to see your new command listed.161 Claude will greet you by name. For more on passing arguments to skills, see [Skills](/en/skills#pass-arguments-to-skills).

111 </Step>162 </Step>

112</Steps>163</Steps>

113 164 

114You've successfully created and tested a plugin with these key components:165You've successfully created and tested a plugin with these key components:

115 166 

116* **Plugin manifest** (`.claude-plugin/plugin.json`) - Describes your plugin's metadata167* **Plugin manifest** (`.claude-plugin/plugin.json`): describes your plugin's metadata

117* **Commands directory** (`commands/`) - Contains your custom slash commands168* **Commands directory** (`commands/`): contains your custom skills

118* **Test marketplace** - Allows you to test your plugin locally169* **Skill arguments** (`$ARGUMENTS`): captures user input for dynamic behavior

119 170 

120### Plugin structure overview171<Tip>

172 The `--plugin-dir` flag is useful for development and testing. When you're ready to share your plugin with others, see [Create and distribute a plugin marketplace](/en/plugin-marketplaces).

173</Tip>

121 174 

122Your plugin follows this basic structure:175## Plugin structure overview

123 176 

124```177You've created a plugin with a skill, but plugins can include much more: custom agents, hooks, MCP servers, and LSP servers.

125my-first-plugin/

126├── .claude-plugin/

127│ └── plugin.json # Plugin metadata

128├── commands/ # Custom slash commands (optional)

129│ └── hello.md

130├── agents/ # Custom agents (optional)

131│ └── helper.md

132├── skills/ # Agent Skills (optional)

133│ └── my-skill/

134│ └── SKILL.md

135└── hooks/ # Event handlers (optional)

136 └── hooks.json

137```

138 178 

139**Additional components you can add:**179<Warning>

180 **Common mistake**: Don't put `commands/`, `agents/`, `skills/`, or `hooks/` inside the `.claude-plugin/` directory. Only `plugin.json` goes inside `.claude-plugin/`. All other directories must be at the plugin root level.

181</Warning>

140 182 

141* **Commands**: Create markdown files in `commands/` directory183| Directory | Location | Purpose |

142* **Agents**: Create agent definitions in `agents/` directory184| :---------------- | :---------- | :---------------------------------------------- |

143* **Skills**: Create `SKILL.md` files in `skills/` directory185| `.claude-plugin/` | Plugin root | Contains only `plugin.json` manifest (required) |

144* **Hooks**: Create `hooks/hooks.json` for event handling186| `commands/` | Plugin root | Skills as Markdown files |

145* **MCP servers**: Create `.mcp.json` for external tool integration187| `agents/` | Plugin root | Custom agent definitions |

188| `skills/` | Plugin root | Agent Skills with `SKILL.md` files |

189| `hooks/` | Plugin root | Event handlers in `hooks.json` |

190| `.mcp.json` | Plugin root | MCP server configurations |

191| `.lsp.json` | Plugin root | LSP server configurations for code intelligence |

146 192 

147<Note>193<Note>

148 **Next steps**: Ready to add more features? Jump to [Develop more complex plugins](#develop-more-complex-plugins) to add agents, hooks, and MCP servers. For complete technical specifications of all plugin components, see [Plugins reference](/en/plugins-reference).194 **Next steps**: Ready to add more features? Jump to [Develop more complex plugins](#develop-more-complex-plugins) to add agents, hooks, MCP servers, and LSP servers. For complete technical specifications of all plugin components, see [Plugins reference](/en/plugins-reference).

149</Note>195</Note>

150 196 

151***197## Develop more complex plugins

152 

153## Install and manage plugins

154 

155Learn how to discover, install, and manage plugins to extend your Claude Code capabilities.

156 198 

157### Prerequisites199Once you're comfortable with basic plugins, you can create more sophisticated extensions.

158 200 

159* Claude Code installed and running201### Add Skills to your plugin

160* Basic familiarity with command-line interfaces

161 202 

162### Add marketplaces203Plugins can include [Agent Skills](/en/skills) to extend Claude's capabilities. Skills are model-invoked: Claude automatically uses them based on the task context.

163 204 

164Marketplaces are catalogs of available plugins. Add them to discover and install plugins:205Add a `skills/` directory at your plugin root with Skill folders containing `SKILL.md` files:

165 206 

166```shell Add a marketplace theme={null}

167/plugin marketplace add your-org/claude-plugins

168```207```

169 208my-plugin/

170```shell Browse available plugins theme={null}209├── .claude-plugin/

171/plugin210│ └── plugin.json

211└── skills/

212 └── code-review/

213 └── SKILL.md

172```214```

173 215 

174For detailed marketplace management including Git repositories, local development, and team distribution, see [Plugin marketplaces](/en/plugin-marketplaces).216Each `SKILL.md` needs frontmatter with `name` and `description` fields, followed by instructions:

175 

176### Install plugins

177 217 

178#### Via interactive menu (recommended for discovery)218```yaml theme={null}

219---

220name: code-review

221description: Reviews code for best practices and potential issues. Use when reviewing code, checking PRs, or analyzing code quality.

222---

179 223 

180```shell Open the plugin management interface theme={null}224When reviewing code, check for:

181/plugin2251. Code organization and structure

2262. Error handling

2273. Security concerns

2284. Test coverage

182```229```

183 230 

184Select "Browse Plugins" to see available options with descriptions, features, and installation options.231After installing the plugin, restart Claude Code to load the Skills. For complete Skill authoring guidance including progressive disclosure and tool restrictions, see [Agent Skills](/en/skills).

185 232 

186#### Via direct commands (for quick installation)233### Add LSP servers to your plugin

187 234 

188```shell Install a specific plugin theme={null}235<Tip>

189/plugin install formatter@your-org236 For common languages like TypeScript, Python, and Rust, install the pre-built LSP plugins from the official marketplace. Create custom LSP plugins only when you need support for languages not already covered.

190```237</Tip>

191 238 

192```shell Enable a disabled plugin theme={null}239LSP (Language Server Protocol) plugins give Claude real-time code intelligence. If you need to support a language that doesn't have an official LSP plugin, you can create your own by adding an `.lsp.json` file to your plugin:

193/plugin enable plugin-name@marketplace-name

194```

195 240 

196```shell Disable without uninstalling theme={null}241```json .lsp.json theme={null}

197/plugin disable plugin-name@marketplace-name242{

243 "go": {

244 "command": "gopls",

245 "args": ["serve"],

246 "extensionToLanguage": {

247 ".go": "go"

248 }

249 }

250}

198```251```

199 252 

200```shell Completely remove a plugin theme={null}253Users installing your plugin must have the language server binary installed on their machine.

201/plugin uninstall plugin-name@marketplace-name

202```

203 254 

204### Verify installation255For complete LSP configuration options, see [LSP servers](/en/plugins-reference#lsp-servers).

205 256 

206After installing a plugin:257### Organize complex plugins

207 258 

2081. **Check available commands**: Run `/help` to see new commands259For plugins with many components, organize your directory structure by functionality. For complete directory layouts and organization patterns, see [Plugin directory structure](/en/plugins-reference#plugin-directory-structure).

2092. **Test plugin features**: Try the plugin's commands and features

2103. **Review plugin details**: Use `/plugin` → "Manage Plugins" to see what the plugin provides

211 260 

212## Set up team plugin workflows261### Test your plugins locally

213 262 

214Configure plugins at the repository level to ensure consistent tooling across your team. When team members trust your repository folder, Claude Code automatically installs specified marketplaces and plugins.263Use the `--plugin-dir` flag to test plugins during development. This loads your plugin directly without requiring installation.

215 264 

216**To set up team plugins:**265```bash theme={null}

266claude --plugin-dir ./my-plugin

267```

217 268 

2181. Add marketplace and plugin configuration to your repository's `.claude/settings.json`269As you make changes to your plugin, restart Claude Code to pick up the updates. Test your plugin components:

2192. Team members trust the repository folder

2203. Plugins install automatically for all team members

221 270 

222For complete instructions including configuration examples, marketplace setup, and rollout best practices, see [Configure team marketplaces](/en/plugin-marketplaces#how-to-configure-team-marketplaces).271* Try your commands with `/command-name`

272* Check that agents appear in `/agents`

273* Verify hooks work as expected

223 274 

224***275<Tip>

276 You can load multiple plugins at once by specifying the flag multiple times:

225 277 

226## Develop more complex plugins278 ```bash theme={null}

279 claude --plugin-dir ./plugin-one --plugin-dir ./plugin-two

280 ```

281</Tip>

227 282 

228Once you're comfortable with basic plugins, you can create more sophisticated extensions.283### Debug plugin issues

229 284 

230### Add Skills to your plugin285If your plugin isn't working as expected:

231 286 

232Plugins can include [Agent Skills](/en/skills) to extend Claude's capabilities. Skills are model-invoked—Claude autonomously uses them based on the task context.2871. **Check the structure**: Ensure your directories are at the plugin root, not inside `.claude-plugin/`

2882. **Test components individually**: Check each command, agent, and hook separately

2893. **Use validation and debugging tools**: See [Debugging and development tools](/en/plugins-reference#debugging-and-development-tools) for CLI commands and troubleshooting techniques

233 290 

234To add Skills to your plugin, create a `skills/` directory at your plugin root and add Skill folders with `SKILL.md` files. Plugin Skills are automatically available when the plugin is installed.291### Share your plugins

235 292 

236For complete Skill authoring guidance, see [Agent Skills](/en/skills).293When your plugin is ready to share:

237 294 

238### Organize complex plugins2951. **Add documentation**: Include a `README.md` with installation and usage instructions

2962. **Version your plugin**: Use [semantic versioning](/en/plugins-reference#version-management) in your `plugin.json`

2973. **Create or use a marketplace**: Distribute through [plugin marketplaces](/en/plugin-marketplaces) for installation

2984. **Test with others**: Have team members test the plugin before wider distribution

239 299 

240For plugins with many components, organize your directory structure by functionality. For complete directory layouts and organization patterns, see [Plugin directory structure](/en/plugins-reference#plugin-directory-structure).300Once your plugin is in a marketplace, others can install it using the instructions in [Discover and install plugins](/en/discover-plugins).

241 301 

242### Test your plugins locally302<Note>

303 For complete technical specifications, debugging techniques, and distribution strategies, see [Plugins reference](/en/plugins-reference).

304</Note>

243 305 

244When developing plugins, use a local marketplace to test changes iteratively. This workflow builds on the quickstart pattern and works for plugins of any complexity.306## Convert existing configurations to plugins

245 307 

246<Steps>308If you already have skills or hooks in your `.claude/` directory, you can convert them into a plugin for easier sharing and distribution.

247 <Step title="Set up your development structure">

248 Organize your plugin and marketplace for testing:

249 309 

250 ```bash Create directory structure theme={null}310### Migration steps

251 mkdir dev-marketplace

252 cd dev-marketplace

253 mkdir my-plugin

254 ```

255 311 

256 This creates:312<Steps>

313 <Step title="Create the plugin structure">

314 Create a new plugin directory:

257 315 

316 ```bash theme={null}

317 mkdir -p my-plugin/.claude-plugin

258 ```318 ```

259 dev-marketplace/

260 ├── .claude-plugin/marketplace.json (you'll create this)

261 └── my-plugin/ (your plugin under development)

262 ├── .claude-plugin/plugin.json

263 ├── commands/

264 ├── agents/

265 └── hooks/

266 ```

267 </Step>

268 319 

269 <Step title="Create the marketplace manifest">320 Create the manifest file at `my-plugin/.claude-plugin/plugin.json`:

270 ```bash Create marketplace.json theme={null}321 

271 mkdir .claude-plugin322 ```json my-plugin/.claude-plugin/plugin.json theme={null}

272 cat > .claude-plugin/marketplace.json << 'EOF'

273 {

274 "name": "dev-marketplace",

275 "owner": {

276 "name": "Developer"

277 },

278 "plugins": [

279 {323 {

280 "name": "my-plugin",324 "name": "my-plugin",

281 "source": "./my-plugin",325 "description": "Migrated from standalone configuration",

282 "description": "Plugin under development"326 "version": "1.0.0"

283 }

284 ]

285 }327 }

286 EOF

287 ```328 ```

288 </Step>329 </Step>

289 330 

290 <Step title="Install and test">331 <Step title="Copy your existing files">

291 ```bash Start Claude Code from parent directory theme={null}332 Copy your existing configurations to the plugin directory:

292 cd ..

293 claude

294 ```

295 

296 ```shell Add your development marketplace theme={null}

297 /plugin marketplace add ./dev-marketplace

298 ```

299 333 

300 ```shell Install your plugin theme={null}334 ```bash theme={null}

301 /plugin install my-plugin@dev-marketplace335 # Copy commands

302 ```336 cp -r .claude/commands my-plugin/

303 337 

304 Test your plugin components:338 # Copy agents (if any)

339 cp -r .claude/agents my-plugin/

305 340 

306 * Try your commands with `/command-name`341 # Copy skills (if any)

307 * Check that agents appear in `/agents`342 cp -r .claude/skills my-plugin/

308 * Verify hooks work as expected343 ```

309 </Step>344 </Step>

310 345 

311 <Step title="Iterate on your plugin">346 <Step title="Migrate hooks">

312 After making changes to your plugin code:347 If you have hooks in your settings, create a hooks directory:

313 348 

314 ```shell Uninstall the current version theme={null}349 ```bash theme={null}

315 /plugin uninstall my-plugin@dev-marketplace350 mkdir my-plugin/hooks

316 ```351 ```

317 352 

318 ```shell Reinstall to test changes theme={null}353 Create `my-plugin/hooks/hooks.json` with your hooks configuration. Copy the `hooks` object from your `.claude/settings.json` or `settings.local.json`—the format is the same:

319 /plugin install my-plugin@dev-marketplace

320 ```

321 354 

322 Repeat this cycle as you develop and refine your plugin.355 ```json my-plugin/hooks/hooks.json theme={null}

356 {

357 "hooks": {

358 "PostToolUse": [

359 {

360 "matcher": "Write|Edit",

361 "hooks": [{ "type": "command", "command": "npm run lint:fix $FILE" }]

362 }

363 ]

364 }

365 }

366 ```

323 </Step>367 </Step>

324</Steps>

325 368 

326<Note>369 <Step title="Test your migrated plugin">

327 **For multiple plugins**: Organize plugins in subdirectories like `./plugins/plugin-name` and update your marketplace.json accordingly. See [Plugin sources](/en/plugin-marketplaces#plugin-sources) for organization patterns.370 Load your plugin to verify everything works:

328</Note>

329 371 

330### Debug plugin issues372 ```bash theme={null}

331 373 claude --plugin-dir ./my-plugin

332If your plugin isn't working as expected:374 ```

333 

3341. **Check the structure**: Ensure your directories are at the plugin root, not inside `.claude-plugin/`

3352. **Test components individually**: Check each command, agent, and hook separately

3363. **Use validation and debugging tools**: See [Debugging and development tools](/en/plugins-reference#debugging-and-development-tools) for CLI commands and troubleshooting techniques

337 375 

338### Share your plugins376 Test each component: run your commands, check agents appear in `/agents`, and verify hooks trigger correctly.

377 </Step>

378</Steps>

339 379 

340When your plugin is ready to share:380### What changes when migrating

341 381 

3421. **Add documentation**: Include a README.md with installation and usage instructions382| Standalone (`.claude/`) | Plugin |

3432. **Version your plugin**: Use semantic versioning in your `plugin.json`383| :---------------------------- | :------------------------------- |

3443. **Create or use a marketplace**: Distribute through plugin marketplaces for easy installation384| Only available in one project | Can be shared via marketplaces |

3454. **Test with others**: Have team members test the plugin before wider distribution385| Files in `.claude/commands/` | Files in `plugin-name/commands/` |

386| Hooks in `settings.json` | Hooks in `hooks/hooks.json` |

387| Must manually copy to share | Install with `/plugin install` |

346 388 

347<Note>389<Note>

348 For complete technical specifications, debugging techniques, and distribution strategies, see [Plugins reference](/en/plugins-reference).390 After migrating, you can remove the original files from `.claude/` to avoid duplicates. The plugin version will take precedence when loaded.

349</Note>391</Note>

350 392 

351***

352 

353## Next steps393## Next steps

354 394 

355Now that you understand Claude Code's plugin system, here are suggested paths for different goals:395Now that you understand Claude Code's plugin system, here are suggested paths for different goals:

356 396 

357### For plugin users397### For plugin users

358 398 

359* **Discover plugins**: Browse community marketplaces for useful tools399* [Discover and install plugins](/en/discover-plugins): browse marketplaces and install plugins

360* **Team adoption**: Set up repository-level plugins for your projects400* [Configure team marketplaces](/en/discover-plugins#configure-team-marketplaces): set up repository-level plugins for your team

361* **Marketplace management**: Learn to manage multiple plugin sources

362* **Advanced usage**: Explore plugin combinations and workflows

363 401 

364### For plugin developers402### For plugin developers

365 403 

366* **Create your first marketplace**: [Plugin marketplaces guide](/en/plugin-marketplaces)404* [Create and distribute a marketplace](/en/plugin-marketplaces): package and share your plugins

367* **Advanced components**: Dive deeper into specific plugin components:405* [Plugins reference](/en/plugins-reference): complete technical specifications

368 * [Slash commands](/en/slash-commands) - Command development details406* Dive deeper into specific plugin components:

369 * [Subagents](/en/sub-agents) - Agent configuration and capabilities407 * [Skills](/en/skills): skill development details

370 * [Agent Skills](/en/skills) - Extend Claude's capabilities408 * [Subagents](/en/sub-agents): agent configuration and capabilities

371 * [Hooks](/en/hooks) - Event handling and automation409 * [Hooks](/en/hooks): event handling and automation

372 * [MCP](/en/mcp) - External tool integration410 * [MCP](/en/mcp): external tool integration

373* **Distribution strategies**: Package and share your plugins effectively

374* **Community contribution**: Consider contributing to community plugin collections

375 

376### For team leads and administrators

377 

378* **Repository configuration**: Set up automatic plugin installation for team projects

379* **Plugin governance**: Establish guidelines for plugin approval and security review

380* **Marketplace maintenance**: Create and maintain organization-specific plugin catalogs

381* **Training and documentation**: Help team members adopt plugin workflows effectively

382 

383## See also

384 

385* [Plugin marketplaces](/en/plugin-marketplaces) - Creating and managing plugin catalogs

386* [Slash commands](/en/slash-commands) - Understanding custom commands

387* [Subagents](/en/sub-agents) - Creating and using specialized agents

388* [Agent Skills](/en/skills) - Extend Claude's capabilities

389* [Hooks](/en/hooks) - Automating workflows with event handlers

390* [MCP](/en/mcp) - Connecting to external tools and services

391* [Settings](/en/settings) - Configuration options for plugins

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Plugins reference5# Plugins reference

2 6 

3> Complete technical reference for Claude Code plugin system, including schemas, CLI commands, and component specifications.7> Complete technical reference for Claude Code plugin system, including schemas, CLI commands, and component specifications.

4 8 

5<Tip>9<Tip>

6 For hands-on tutorials and practical usage, see [Plugins](/en/plugins). For plugin management across teams and communities, see [Plugin marketplaces](/en/plugin-marketplaces).10 Looking to install plugins? See [Discover and install plugins](/en/discover-plugins). For creating plugins, see [Plugins](/en/plugins). For distributing plugins, see [Plugin marketplaces](/en/plugin-marketplaces).

7</Tip>11</Tip>

8 12 

9This reference provides complete technical specifications for the Claude Code plugin system, including component schemas, CLI commands, and development tools.13This reference provides complete technical specifications for the Claude Code plugin system, including component schemas, CLI commands, and development tools.

10 14 

11## Plugin components reference15## Plugin components reference

12 16 

13This section documents the five types of components that plugins can provide.17This section documents the types of components that plugins can provide.

18 

19### Skills

14 20 

15### Commands21Plugins add skills to Claude Code, creating `/name` shortcuts that you or Claude can invoke.

16 22 

17Plugins add custom slash commands that integrate seamlessly with Claude Code's command system.23**Location**: `skills/` or `commands/` directory in plugin root

18 24 

19**Location**: `commands/` directory in plugin root25**File format**: Skills are directories with `SKILL.md`; commands are simple markdown files

20 26 

21**File format**: Markdown files with frontmatter27**Skill structure**:

22 28 

23For complete details on plugin command structure, invocation patterns, and features, see [Plugin commands](/en/slash-commands#plugin-commands).29```

30skills/

31├── pdf-processor/

32│ ├── SKILL.md

33│ ├── reference.md (optional)

34│ └── scripts/ (optional)

35└── code-reviewer/

36 └── SKILL.md

37```

38 

39**Integration behavior**:

40 

41* Skills and commands are automatically discovered when the plugin is installed

42* Claude can invoke them automatically based on task context

43* Skills can include supporting files alongside SKILL.md

44 

45For complete details, see [Skills](/en/skills).

24 46 

25### Agents47### Agents

26 48 


58* Agents can be invoked manually by users80* Agents can be invoked manually by users

59* Plugin agents work alongside built-in Claude agents81* Plugin agents work alongside built-in Claude agents

60 82 

61### Skills

62 

63Plugins can provide Agent Skills that extend Claude's capabilities. Skills are model-invoked—Claude autonomously decides when to use them based on the task context.

64 

65**Location**: `skills/` directory in plugin root

66 

67**File format**: Directories containing `SKILL.md` files with frontmatter

68 

69**Skill structure**:

70 

71```

72skills/

73├── pdf-processor/

74│ ├── SKILL.md

75│ ├── reference.md (optional)

76│ └── scripts/ (optional)

77└── code-reviewer/

78 └── SKILL.md

79```

80 

81**Integration behavior**:

82 

83* Plugin Skills are automatically discovered when the plugin is installed

84* Claude autonomously invokes Skills based on matching task context

85* Skills can include supporting files alongside SKILL.md

86 

87For SKILL.md format and complete Skill authoring guidance, see:

88 

89* [Use Skills in Claude Code](/en/skills)

90* [Agent Skills overview](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/overview#skill-structure)

91 

92### Hooks83### Hooks

93 84 

94Plugins can provide event handlers that respond to Claude Code events automatically.85Plugins can provide event handlers that respond to Claude Code events automatically.


120**Available events**:111**Available events**:

121 112 

122* `PreToolUse`: Before Claude uses any tool113* `PreToolUse`: Before Claude uses any tool

114* `PostToolUse`: After Claude successfully uses any tool

115* `PostToolUseFailure`: After Claude tool execution fails

123* `PermissionRequest`: When a permission dialog is shown116* `PermissionRequest`: When a permission dialog is shown

124* `PostToolUse`: After Claude uses any tool

125* `UserPromptSubmit`: When user submits a prompt117* `UserPromptSubmit`: When user submits a prompt

126* `Notification`: When Claude Code sends notifications118* `Notification`: When Claude Code sends notifications

127* `Stop`: When Claude attempts to stop119* `Stop`: When Claude attempts to stop

120* `SubagentStart`: When a subagent is started

128* `SubagentStop`: When a subagent attempts to stop121* `SubagentStop`: When a subagent attempts to stop

122* `Setup`: When `--init`, `--init-only`, or `--maintenance` flags are used

129* `SessionStart`: At the beginning of sessions123* `SessionStart`: At the beginning of sessions

130* `SessionEnd`: At the end of sessions124* `SessionEnd`: At the end of sessions

131* `PreCompact`: Before conversation history is compacted125* `PreCompact`: Before conversation history is compacted


133**Hook types**:127**Hook types**:

134 128 

135* `command`: Execute shell commands or scripts129* `command`: Execute shell commands or scripts

136* `validation`: Validate file contents or project state130* `prompt`: Evaluate a prompt with an LLM (uses `$ARGUMENTS` placeholder for context)

137* `notification`: Send alerts or status updates131* `agent`: Run an agentic verifier with tools for complex verification tasks

138 132 

139### MCP servers133### MCP servers

140 134 


172* Server capabilities integrate seamlessly with Claude's existing tools166* Server capabilities integrate seamlessly with Claude's existing tools

173* Plugin servers can be configured independently of user MCP servers167* Plugin servers can be configured independently of user MCP servers

174 168 

169### LSP servers

170 

171<Tip>

172 Looking to use LSP plugins? Install them from the official marketplace—search for "lsp" in the `/plugin` Discover tab. This section documents how to create LSP plugins for languages not covered by the official marketplace.

173</Tip>

174 

175Plugins can provide [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) (LSP) servers to give Claude real-time code intelligence while working on your codebase.

176 

177LSP integration provides:

178 

179* **Instant diagnostics**: Claude sees errors and warnings immediately after each edit

180* **Code navigation**: go to definition, find references, and hover information

181* **Language awareness**: type information and documentation for code symbols

182 

183**Location**: `.lsp.json` in plugin root, or inline in `plugin.json`

184 

185**Format**: JSON configuration mapping language server names to their configurations

186 

187**`.lsp.json` file format**:

188 

189```json theme={null}

190{

191 "go": {

192 "command": "gopls",

193 "args": ["serve"],

194 "extensionToLanguage": {

195 ".go": "go"

196 }

197 }

198}

199```

200 

201**Inline in `plugin.json`**:

202 

203```json theme={null}

204{

205 "name": "my-plugin",

206 "lspServers": {

207 "go": {

208 "command": "gopls",

209 "args": ["serve"],

210 "extensionToLanguage": {

211 ".go": "go"

212 }

213 }

214 }

215}

216```

217 

218**Required fields:**

219 

220| Field | Description |

221| :-------------------- | :------------------------------------------- |

222| `command` | The LSP binary to execute (must be in PATH) |

223| `extensionToLanguage` | Maps file extensions to language identifiers |

224 

225**Optional fields:**

226 

227| Field | Description |

228| :---------------------- | :-------------------------------------------------------- |

229| `args` | Command-line arguments for the LSP server |

230| `transport` | Communication transport: `stdio` (default) or `socket` |

231| `env` | Environment variables to set when starting the server |

232| `initializationOptions` | Options passed to the server during initialization |

233| `settings` | Settings passed via `workspace/didChangeConfiguration` |

234| `workspaceFolder` | Workspace folder path for the server |

235| `startupTimeout` | Max time to wait for server startup (milliseconds) |

236| `shutdownTimeout` | Max time to wait for graceful shutdown (milliseconds) |

237| `restartOnCrash` | Whether to automatically restart the server if it crashes |

238| `maxRestarts` | Maximum number of restart attempts before giving up |

239 

240<Warning>

241 **You must install the language server binary separately.** LSP plugins configure how Claude Code connects to a language server, but they don't include the server itself. If you see `Executable not found in $PATH` in the `/plugin` Errors tab, install the required binary for your language.

242</Warning>

243 

244**Available LSP plugins:**

245 

246| Plugin | Language server | Install command |

247| :--------------- | :------------------------- | :----------------------------------------------------------------------------------------- |

248| `pyright-lsp` | Pyright (Python) | `pip install pyright` or `npm install -g pyright` |

249| `typescript-lsp` | TypeScript Language Server | `npm install -g typescript-language-server typescript` |

250| `rust-lsp` | rust-analyzer | [See rust-analyzer installation](https://rust-analyzer.github.io/manual.html#installation) |

251 

252Install the language server first, then install the plugin from the marketplace.

253 

254***

255 

256## Plugin installation scopes

257 

258When you install a plugin, you choose a **scope** that determines where the plugin is available and who else can use it:

259 

260| Scope | Settings file | Use case |

261| :-------- | :---------------------------- | :------------------------------------------------------- |

262| `user` | `~/.claude/settings.json` | Personal plugins available across all projects (default) |

263| `project` | `.claude/settings.json` | Team plugins shared via version control |

264| `local` | `.claude/settings.local.json` | Project-specific plugins, gitignored |

265| `managed` | `managed-settings.json` | Managed plugins (read-only, update only) |

266 

267Plugins use the same scope system as other Claude Code configurations. For installation instructions and scope flags, see [Install plugins](/en/discover-plugins#install-plugins). For a complete explanation of scopes, see [Configuration scopes](/en/settings#configuration-scopes).

268 

175***269***

176 270 

177## Plugin manifest schema271## Plugin manifest schema


196 "keywords": ["keyword1", "keyword2"],290 "keywords": ["keyword1", "keyword2"],

197 "commands": ["./custom/commands/special.md"],291 "commands": ["./custom/commands/special.md"],

198 "agents": "./custom/agents/",292 "agents": "./custom/agents/",

293 "skills": "./custom/skills/",

199 "hooks": "./config/hooks.json",294 "hooks": "./config/hooks.json",

200 "mcpServers": "./mcp-config.json"295 "mcpServers": "./mcp-config.json",

296 "outputStyles": "./styles/",

297 "lspServers": "./.lsp.json"

201}298}

202```299```

203 300 


222### Component path fields319### Component path fields

223 320 

224| Field | Type | Description | Example |321| Field | Type | Description | Example |

225| :----------- | :------------- | :----------------------------------- | :------------------------------------- |322| :------------- | :------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------- |

226| `commands` | string\|array | Additional command files/directories | `"./custom/cmd.md"` or `["./cmd1.md"]` |323| `commands` | string\|array | Additional command files/directories | `"./custom/cmd.md"` or `["./cmd1.md"]` |

227| `agents` | string\|array | Additional agent files | `"./custom/agents/"` |324| `agents` | string\|array | Additional agent files | `"./custom/agents/"` |

325| `skills` | string\|array | Additional skill directories | `"./custom/skills/"` |

228| `hooks` | string\|object | Hook config path or inline config | `"./hooks.json"` |326| `hooks` | string\|object | Hook config path or inline config | `"./hooks.json"` |

229| `mcpServers` | string\|object | MCP config path or inline config | `"./mcp.json"` |327| `mcpServers` | string\|object | MCP config path or inline config | `"./mcp-config.json"` |

328| `outputStyles` | string\|array | Additional output style files/directories | `"./styles/"` |

329| `lspServers` | string\|object | [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) config for code intelligence (go to definition, find references, etc.) | `"./.lsp.json"` |

230 330 

231### Path behavior rules331### Path behavior rules

232 332 


275 375 

276***376***

277 377 

378## Plugin caching and file resolution

379 

380For security and verification purposes, Claude Code copies plugins to a cache directory rather than using them in-place. Understanding this behavior is important when developing plugins that reference external files.

381 

382### How plugin caching works

383 

384When you install a plugin, Claude Code copies the plugin files to a cache directory:

385 

386* **For marketplace plugins with relative paths**: The path specified in the `source` field is copied recursively. For example, if your marketplace entry specifies `"source": "./plugins/my-plugin"`, the entire `./plugins` directory is copied.

387* **For plugins with `.claude-plugin/plugin.json`**: The implicit root directory (the directory containing `.claude-plugin/plugin.json`) is copied recursively.

388 

389### Path traversal limitations

390 

391Plugins cannot reference files outside their copied directory structure. Paths that traverse outside the plugin root (such as `../shared-utils`) will not work after installation because those external files are not copied to the cache.

392 

393### Working with external dependencies

394 

395If your plugin needs to access files outside its directory, you have two options:

396 

397**Option 1: Use symlinks**

398 

399Create symbolic links to external files within your plugin directory. Symlinks are honored during the copy process:

400 

401```bash theme={null}

402# Inside your plugin directory

403ln -s /path/to/shared-utils ./shared-utils

404```

405 

406The symlinked content will be copied into the plugin cache.

407 

408**Option 2: Restructure your marketplace**

409 

410Set the plugin path to a parent directory that contains all required files, then provide the rest of the plugin manifest directly in the marketplace entry:

411 

412```json theme={null}

413{

414 "name": "my-plugin",

415 "source": "./",

416 "description": "Plugin that needs root-level access",

417 "commands": ["./plugins/my-plugin/commands/"],

418 "agents": ["./plugins/my-plugin/agents/"],

419 "strict": false

420}

421```

422 

423This approach copies the entire marketplace root, giving your plugin access to sibling directories.

424 

425<Note>

426 Symlinks that point to locations outside the plugin's logical root are followed during copying. This provides flexibility while maintaining the security benefits of the caching system.

427</Note>

428 

429***

430 

278## Plugin directory structure431## Plugin directory structure

279 432 

280### Standard plugin layout433### Standard plugin layout


302│ ├── hooks.json # Main hook config455│ ├── hooks.json # Main hook config

303│ └── security-hooks.json # Additional hooks456│ └── security-hooks.json # Additional hooks

304├── .mcp.json # MCP server definitions457├── .mcp.json # MCP server definitions

458├── .lsp.json # LSP server configurations

305├── scripts/ # Hook and utility scripts459├── scripts/ # Hook and utility scripts

306│ ├── security-scan.sh460│ ├── security-scan.sh

307│ ├── format-code.py461│ ├── format-code.py


317### File locations reference471### File locations reference

318 472 

319| Component | Default Location | Purpose |473| Component | Default Location | Purpose |

320| :-------------- | :--------------------------- | :------------------------------- |474| :-------------- | :--------------------------- | :---------------------------------------------------------- |

321| **Manifest** | `.claude-plugin/plugin.json` | Required metadata file |475| **Manifest** | `.claude-plugin/plugin.json` | Required metadata file |

322| **Commands** | `commands/` | Slash command markdown files |476| **Commands** | `commands/` | Skill Markdown files (legacy; use `skills/` for new skills) |

323| **Agents** | `agents/` | Subagent markdown files |477| **Agents** | `agents/` | Subagent Markdown files |

324| **Skills** | `skills/` | Agent Skills with SKILL.md files |478| **Skills** | `skills/` | Skills with `<name>/SKILL.md` structure |

325| **Hooks** | `hooks/hooks.json` | Hook configuration |479| **Hooks** | `hooks/hooks.json` | Hook configuration |

326| **MCP servers** | `.mcp.json` | MCP server definitions |480| **MCP servers** | `.mcp.json` | MCP server definitions |

481| **LSP servers** | `.lsp.json` | Language server configurations |

482 

483***

484 

485## CLI commands reference

486 

487Claude Code provides CLI commands for non-interactive plugin management, useful for scripting and automation.

488 

489### plugin install

490 

491Install a plugin from available marketplaces.

492 

493```bash theme={null}

494claude plugin install <plugin> [options]

495```

496 

497**Arguments:**

498 

499* `<plugin>`: Plugin name or `plugin-name@marketplace-name` for a specific marketplace

500 

501**Options:**

502 

503| Option | Description | Default |

504| :-------------------- | :------------------------------------------------ | :------ |

505| `-s, --scope <scope>` | Installation scope: `user`, `project`, or `local` | `user` |

506| `-h, --help` | Display help for command | |

507 

508**Examples:**

509 

510```bash theme={null}

511# Install to user scope (default)

512claude plugin install formatter@my-marketplace

513 

514# Install to project scope (shared with team)

515claude plugin install formatter@my-marketplace --scope project

516 

517# Install to local scope (gitignored)

518claude plugin install formatter@my-marketplace --scope local

519```

520 

521### plugin uninstall

522 

523Remove an installed plugin.

524 

525```bash theme={null}

526claude plugin uninstall <plugin> [options]

527```

528 

529**Arguments:**

530 

531* `<plugin>`: Plugin name or `plugin-name@marketplace-name`

532 

533**Options:**

534 

535| Option | Description | Default |

536| :-------------------- | :-------------------------------------------------- | :------ |

537| `-s, --scope <scope>` | Uninstall from scope: `user`, `project`, or `local` | `user` |

538| `-h, --help` | Display help for command | |

539 

540**Aliases:** `remove`, `rm`

541 

542### plugin enable

543 

544Enable a disabled plugin.

545 

546```bash theme={null}

547claude plugin enable <plugin> [options]

548```

549 

550**Arguments:**

551 

552* `<plugin>`: Plugin name or `plugin-name@marketplace-name`

553 

554**Options:**

555 

556| Option | Description | Default |

557| :-------------------- | :--------------------------------------------- | :------ |

558| `-s, --scope <scope>` | Scope to enable: `user`, `project`, or `local` | `user` |

559| `-h, --help` | Display help for command | |

560 

561### plugin disable

562 

563Disable a plugin without uninstalling it.

564 

565```bash theme={null}

566claude plugin disable <plugin> [options]

567```

568 

569**Arguments:**

570 

571* `<plugin>`: Plugin name or `plugin-name@marketplace-name`

572 

573**Options:**

574 

575| Option | Description | Default |

576| :-------------------- | :---------------------------------------------- | :------ |

577| `-s, --scope <scope>` | Scope to disable: `user`, `project`, or `local` | `user` |

578| `-h, --help` | Display help for command | |

579 

580### plugin update

581 

582Update a plugin to the latest version.

583 

584```bash theme={null}

585claude plugin update <plugin> [options]

586```

587 

588**Arguments:**

589 

590* `<plugin>`: Plugin name or `plugin-name@marketplace-name`

591 

592**Options:**

593 

594| Option | Description | Default |

595| :-------------------- | :-------------------------------------------------------- | :------ |

596| `-s, --scope <scope>` | Scope to update: `user`, `project`, `local`, or `managed` | `user` |

597| `-h, --help` | Display help for command | |

327 598 

328***599***

329 600 


347### Common issues618### Common issues

348 619 

349| Issue | Cause | Solution |620| Issue | Cause | Solution |

350| :--------------------- | :------------------------------ | :--------------------------------------------------- |621| :---------------------------------- | :------------------------------ | :-------------------------------------------------------------------------------- |

351| Plugin not loading | Invalid `plugin.json` | Validate JSON syntax |622| Plugin not loading | Invalid `plugin.json` | Validate JSON syntax with `claude plugin validate` or `/plugin validate` |

352| Commands not appearing | Wrong directory structure | Ensure `commands/` at root, not in `.claude-plugin/` |623| Commands not appearing | Wrong directory structure | Ensure `commands/` at root, not in `.claude-plugin/` |

353| Hooks not firing | Script not executable | Run `chmod +x script.sh` |624| Hooks not firing | Script not executable | Run `chmod +x script.sh` |

354| MCP server fails | Missing `${CLAUDE_PLUGIN_ROOT}` | Use variable for all plugin paths |625| MCP server fails | Missing `${CLAUDE_PLUGIN_ROOT}` | Use variable for all plugin paths |

355| Path errors | Absolute paths used | All paths must be relative and start with `./` |626| Path errors | Absolute paths used | All paths must be relative and start with `./` |

627| LSP `Executable not found in $PATH` | Language server not installed | Install the binary (e.g., `npm install -g typescript-language-server typescript`) |

628 

629### Example error messages

630 

631**Manifest validation errors**:

632 

633* `Invalid JSON syntax: Unexpected token } in JSON at position 142`: check for missing commas, extra commas, or unquoted strings

634* `Plugin has an invalid manifest file at .claude-plugin/plugin.json. Validation errors: name: Required`: a required field is missing

635* `Plugin has a corrupt manifest file at .claude-plugin/plugin.json. JSON parse error: ...`: JSON syntax error

636 

637**Plugin loading errors**:

638 

639* `Warning: No commands found in plugin my-plugin custom directory: ./cmds. Expected .md files or SKILL.md in subdirectories.`: command path exists but contains no valid command files

640* `Plugin directory not found at path: ./plugins/my-plugin. Check that the marketplace entry has the correct path.`: the `source` path in marketplace.json points to a non-existent directory

641* `Plugin my-plugin has conflicting manifests: both plugin.json and marketplace entry specify components.`: remove duplicate component definitions or set `strict: true` in marketplace entry

642 

643### Hook troubleshooting

644 

645**Hook script not executing**:

646 

6471. Check the script is executable: `chmod +x ./scripts/your-script.sh`

6482. Verify the shebang line: First line should be `#!/bin/bash` or `#!/usr/bin/env bash`

6493. Check the path uses `${CLAUDE_PLUGIN_ROOT}`: `"command": "${CLAUDE_PLUGIN_ROOT}/scripts/your-script.sh"`

6504. Test the script manually: `./scripts/your-script.sh`

651 

652**Hook not triggering on expected events**:

653 

6541. Verify the event name is correct (case-sensitive): `PostToolUse`, not `postToolUse`

6552. Check the matcher pattern matches your tools: `"matcher": "Write|Edit"` for file operations

6563. Confirm the hook type is valid: `command`, `prompt`, or `agent`

657 

658### MCP server troubleshooting

659 

660**Server not starting**:

661 

6621. Check the command exists and is executable

6632. Verify all paths use `${CLAUDE_PLUGIN_ROOT}` variable

6643. Check the MCP server logs: `claude --debug` shows initialization errors

6654. Test the server manually outside of Claude Code

666 

667**Server tools not appearing**:

668 

6691. Ensure the server is properly configured in `.mcp.json` or `plugin.json`

6702. Verify the server implements the MCP protocol correctly

6713. Check for connection timeouts in debug output

672 

673### Directory structure mistakes

674 

675**Symptoms**: Plugin loads but components (commands, agents, hooks) are missing.

676 

677**Correct structure**: Components must be at the plugin root, not inside `.claude-plugin/`. Only `plugin.json` belongs in `.claude-plugin/`.

678 

679```

680my-plugin/

681├── .claude-plugin/

682│ └── plugin.json ← Only manifest here

683├── commands/ ← At root level

684├── agents/ ← At root level

685└── hooks/ ← At root level

686```

687 

688If your components are inside `.claude-plugin/`, move them to the plugin root.

689 

690**Debug checklist**:

691 

6921. Run `claude --debug` and look for "loading plugin" messages

6932. Check that each component directory is listed in the debug output

6943. Verify file permissions allow reading the plugin files

356 695 

357***696***

358 697 


363Follow semantic versioning for plugin releases:702Follow semantic versioning for plugin releases:

364 703 

365```json theme={null}704```json theme={null}

705{

706 "name": "my-plugin",

707 "version": "2.1.0"

708}

709```

710 

711**Version format**: `MAJOR.MINOR.PATCH`

712 

713* **MAJOR**: Breaking changes (incompatible API changes)

714* **MINOR**: New features (backward-compatible additions)

715* **PATCH**: Bug fixes (backward-compatible fixes)

716 

717**Best practices**:

718 

719* Start at `1.0.0` for your first stable release

720* Update the version in `plugin.json` before distributing changes

721* Document changes in a `CHANGELOG.md` file

722* Use pre-release versions like `2.0.0-beta.1` for testing

723 

724***

366 725 

367## See also726## See also

368 727 

369- [Plugins](/en/plugins) - Tutorials and practical usage728* [Plugins](/en/plugins) - Tutorials and practical usage

370- [Plugin marketplaces](/en/plugin-marketplaces) - Creating and managing marketplaces729* [Plugin marketplaces](/en/plugin-marketplaces) - Creating and managing marketplaces

371- [Slash commands](/en/slash-commands) - Command development details730* [Skills](/en/skills) - Skill development details

372- [Subagents](/en/sub-agents) - Agent configuration and capabilities731* [Subagents](/en/sub-agents) - Agent configuration and capabilities

373- [Agent Skills](/en/skills) - Extend Claude's capabilities732* [Hooks](/en/hooks) - Event handling and automation

374- [Hooks](/en/hooks) - Event handling and automation733* [MCP](/en/mcp) - External tool integration

375- [MCP](/en/mcp) - External tool integration734* [Settings](/en/settings) - Configuration options for plugins

376- [Settings](/en/settings) - Configuration options for plugins

377```

quickstart.md +78 −71

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Quickstart5# Quickstart

2 6 

3> Welcome to Claude Code!7> Welcome to Claude Code!


10 14 

11* A terminal or command prompt open15* A terminal or command prompt open

12* A code project to work with16* A code project to work with

13* A [Claude.ai](https://claude.ai) (recommended) or [Claude Console](https://console.anthropic.com/) account17* A [Claude subscription](https://claude.com/pricing) (Pro, Max, Teams, or Enterprise), [Claude Console](https://console.anthropic.com/) account, or access through a [supported cloud provider](/en/third-party-integrations)

18 

19<Note>

20 This guide covers the terminal CLI. Claude Code is also available on the [web](https://claude.ai/code), as a [desktop app](/en/desktop), in [VS Code](/en/vs-code) and [JetBrains IDEs](/en/jetbrains), in [Slack](/en/slack), and in CI/CD with [GitHub Actions](/en/github-actions) and [GitLab](/en/gitlab-ci-cd). See [all interfaces](/en/overview#use-claude-code-everywhere).

21</Note>

14 22 

15## Step 1: Install Claude Code23## Step 1: Install Claude Code

16 24 


18 26 

19<Tabs>27<Tabs>

20 <Tab title="Native Install (Recommended)">28 <Tab title="Native Install (Recommended)">

21 **Homebrew (macOS, Linux):**

22 

23 ```sh theme={null}

24 brew install --cask claude-code

25 ```

26 

27 **macOS, Linux, WSL:**29 **macOS, Linux, WSL:**

28 30 

29 ```bash theme={null}31 ```bash theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}

30 curl -fsSL https://claude.ai/install.sh | bash32 curl -fsSL https://claude.ai/install.sh | bash

31 ```33 ```

32 34 

33 **Windows PowerShell:**35 **Windows PowerShell:**

34 36 

35 ```powershell theme={null}37 ```powershell theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}

36 irm https://claude.ai/install.ps1 | iex38 irm https://claude.ai/install.ps1 | iex

37 ```39 ```

38 40 

39 **Windows CMD:**41 **Windows CMD:**

40 42 

41 ```batch theme={null}43 ```batch theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}

42 curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd44 curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

43 ```45 ```

46 

47 <Info>

48 Native installations automatically update in the background to keep you on the latest version.

49 </Info>

44 </Tab>50 </Tab>

45 51 

46 <Tab title="NPM">52 <Tab title="Homebrew">

47 If you have [Node.js 18 or newer installed](https://nodejs.org/en/download/):53 ```sh theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}

54 brew install --cask claude-code

55 ```

56 

57 <Info>

58 Homebrew installations do not auto-update. Run `brew upgrade claude-code` periodically to get the latest features and security fixes.

59 </Info>

60 </Tab>

48 61 

49 ```sh theme={null}62 <Tab title="WinGet">

50 npm install -g @anthropic-ai/claude-code63 ```powershell theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null} theme={null}

64 winget install Anthropic.ClaudeCode

51 ```65 ```

66 

67 <Info>

68 WinGet installations do not auto-update. Run `winget upgrade Anthropic.ClaudeCode` periodically to get the latest features and security fixes.

69 </Info>

52 </Tab>70 </Tab>

53</Tabs>71</Tabs>

54 72 


66# Follow the prompts to log in with your account84# Follow the prompts to log in with your account

67```85```

68 86 

69You can log in using either account type:87You can log in using any of these account types:

70 88 

71* [Claude.ai](https://claude.ai) (subscription plans - recommended)89* [Claude Pro, Max, Teams, or Enterprise](https://claude.com/pricing) (recommended)

72* [Claude Console](https://console.anthropic.com/) (API access with pre-paid credits)90* [Claude Console](https://console.anthropic.com/) (API access with pre-paid credits). On first login, a "Claude Code" workspace is automatically created in the Console for centralized cost tracking.

91* [Amazon Bedrock, Google Vertex AI, or Microsoft Foundry](/en/third-party-integrations) (enterprise cloud providers)

73 92 

74Once logged in, your credentials are stored and you won't need to log in again.93Once logged in, your credentials are stored and you won't need to log in again. To switch accounts later, use the `/login` command.

75 

76<Note>

77 When you first authenticate Claude Code with your Claude Console account, a workspace called "Claude Code" is automatically created for you. This workspace provides centralized cost tracking and management for all Claude Code usage in your organization.

78</Note>

79 

80<Note>

81 You can have both account types under the same email address. If you need to log in again or switch accounts, use the `/login` command within Claude Code.

82</Note>

83 94 

84## Step 3: Start your first session95## Step 3: Start your first session

85 96 


101Let's start with understanding your codebase. Try one of these commands:112Let's start with understanding your codebase. Try one of these commands:

102 113 

103```114```

104> what does this project do?115what does this project do?

105```116```

106 117 

107Claude will analyze your files and provide a summary. You can also ask more specific questions:118Claude will analyze your files and provide a summary. You can also ask more specific questions:

108 119 

109```120```

110> what technologies does this project use?121what technologies does this project use?

111```122```

112 123 

113```124```

114> where is the main entry point?125where is the main entry point?

115```126```

116 127 

117```128```

118> explain the folder structure129explain the folder structure

119```130```

120 131 

121You can also ask Claude about its own capabilities:132You can also ask Claude about its own capabilities:

122 133 

123```134```

124> what can Claude Code do?135what can Claude Code do?

125```136```

126 137 

127```138```

128> how do I use slash commands in Claude Code?139how do I create custom skills in Claude Code?

129```140```

130 141 

131```142```

132> can Claude Code work with Docker?143can Claude Code work with Docker?

133```144```

134 145 

135<Note>146<Note>


141Now let's make Claude Code do some actual coding. Try a simple task:152Now let's make Claude Code do some actual coding. Try a simple task:

142 153 

143```154```

144> add a hello world function to the main file155add a hello world function to the main file

145```156```

146 157 

147Claude Code will:158Claude Code will:


160Claude Code makes Git operations conversational:171Claude Code makes Git operations conversational:

161 172 

162```173```

163> what files have I changed?174what files have I changed?

164```175```

165 176 

166```177```

167> commit my changes with a descriptive message178commit my changes with a descriptive message

168```179```

169 180 

170You can also prompt for more complex Git operations:181You can also prompt for more complex Git operations:

171 182 

172```183```

173> create a new branch called feature/quickstart184create a new branch called feature/quickstart

174```185```

175 186 

176```187```

177> show me the last 5 commits188show me the last 5 commits

178```189```

179 190 

180```191```

181> help me resolve merge conflicts192help me resolve merge conflicts

182```193```

183 194 

184## Step 7: Fix a bug or add a feature195## Step 7: Fix a bug or add a feature


188Describe what you want in natural language:199Describe what you want in natural language:

189 200 

190```201```

191> add input validation to the user registration form202add input validation to the user registration form

192```203```

193 204 

194Or fix existing issues:205Or fix existing issues:

195 206 

196```207```

197> there's a bug where users can submit empty forms - fix it208there's a bug where users can submit empty forms - fix it

198```209```

199 210 

200Claude Code will:211Claude Code will:


211**Refactor code**222**Refactor code**

212 223 

213```224```

214> refactor the authentication module to use async/await instead of callbacks225refactor the authentication module to use async/await instead of callbacks

215```226```

216 227 

217**Write tests**228**Write tests**

218 229 

219```230```

220> write unit tests for the calculator functions231write unit tests for the calculator functions

221```232```

222 233 

223**Update documentation**234**Update documentation**

224 235 

225```236```

226> update the README with installation instructions237update the README with installation instructions

227```238```

228 239 

229**Code review**240**Code review**

230 241 

231```242```

232> review my changes and suggest improvements243review my changes and suggest improvements

233```244```

234 245 

235<Tip>246<Tip>


241Here are the most important commands for daily use:252Here are the most important commands for daily use:

242 253 

243| Command | What it does | Example |254| Command | What it does | Example |

244| ------------------- | --------------------------------- | ----------------------------------- |255| ------------------- | ------------------------------------------------------ | ----------------------------------- |

245| `claude` | Start interactive mode | `claude` |256| `claude` | Start interactive mode | `claude` |

246| `claude "task"` | Run a one-time task | `claude "fix the build error"` |257| `claude "task"` | Run a one-time task | `claude "fix the build error"` |

247| `claude -p "query"` | Run one-off query, then exit | `claude -p "explain this function"` |258| `claude -p "query"` | Run one-off query, then exit | `claude -p "explain this function"` |

248| `claude -c` | Continue most recent conversation | `claude -c` |259| `claude -c` | Continue most recent conversation in current directory | `claude -c` |

249| `claude -r` | Resume a previous conversation | `claude -r` |260| `claude -r` | Resume a previous conversation | `claude -r` |

250| `claude commit` | Create a Git commit | `claude commit` |261| `claude commit` | Create a Git commit | `claude commit` |

251| `/clear` | Clear conversation history | `> /clear` |262| `/clear` | Clear conversation history | `/clear` |

252| `/help` | Show available commands | `> /help` |263| `/help` | Show available commands | `/help` |

253| `exit` or Ctrl+C | Exit Claude Code | `> exit` |264| `exit` or Ctrl+C | Exit Claude Code | `exit` |

254 265 

255See the [CLI reference](/en/cli-reference) for a complete list of commands.266See the [CLI reference](/en/cli-reference) for a complete list of commands.

256 267 

257## Pro tips for beginners268## Pro tips for beginners

258 269 

270For more, see [best practices](/en/best-practices) and [common workflows](/en/common-workflows).

271 

259<AccordionGroup>272<AccordionGroup>

260 <Accordion title="Be specific with your requests">273 <Accordion title="Be specific with your requests">

261 Instead of: "fix the bug"274 Instead of: "fix the bug"


267 Break complex tasks into steps:280 Break complex tasks into steps:

268 281 

269 ```282 ```

270 > 1. create a new database table for user profiles283 1. create a new database table for user profiles

271 ```284 2. create an API endpoint to get and update user profiles

272 285 3. build a webpage that allows users to see and edit their information

273 ```

274 > 2. create an API endpoint to get and update user profiles

275 ```

276 

277 ```

278 > 3. build a webpage that allows users to see and edit their information

279 ```286 ```

280 </Accordion>287 </Accordion>

281 288 


283 Before making changes, let Claude understand your code:290 Before making changes, let Claude understand your code:

284 291 

285 ```292 ```

286 > analyze the database schema293 analyze the database schema

287 ```294 ```

288 295 

289 ```296 ```

290 > build a dashboard showing products that are most frequently returned by our UK customers297 build a dashboard showing products that are most frequently returned by our UK customers

291 ```298 ```

292 </Accordion>299 </Accordion>

293 300 


295 * Press `?` to see all available keyboard shortcuts302 * Press `?` to see all available keyboard shortcuts

296 * Use Tab for command completion303 * Use Tab for command completion

297 * Press ↑ for command history304 * Press ↑ for command history

298 * Type `/` to see all slash commands305 * Type `/` to see all commands and skills

299 </Accordion>306 </Accordion>

300</AccordionGroup>307</AccordionGroup>

301 308 


303 310 

304Now that you've learned the basics, explore more advanced features:311Now that you've learned the basics, explore more advanced features:

305 312 

306<CardGroup cols={3}>313<CardGroup cols={2}>

307 <Card title="Common workflows" icon="graduation-cap" href="/en/common-workflows">314 <Card title="How Claude Code works" icon="microchip" href="/en/how-claude-code-works">

308 Step-by-step guides for common tasks315 Understand the agentic loop, built-in tools, and how Claude Code interacts with your project

309 </Card>316 </Card>

310 317 

311 <Card title="CLI reference" icon="terminal" href="/en/cli-reference">318 <Card title="Best practices" icon="star" href="/en/best-practices">

312 Master all commands and options319 Get better results with effective prompting and project setup

313 </Card>320 </Card>

314 321 

315 <Card title="Configuration" icon="gear" href="/en/settings">322 <Card title="Common workflows" icon="graduation-cap" href="/en/common-workflows">

316 Customize Claude Code for your workflow323 Step-by-step guides for common tasks

317 </Card>324 </Card>

318 325 

319 <Card title="Claude Code on the web" icon="cloud" href="/en/claude-code-on-the-web">326 <Card title="Extend Claude Code" icon="puzzle-piece" href="/en/features-overview">

320 Run tasks asynchronously in the cloud327 Customize with CLAUDE.md, skills, hooks, MCP, and more

321 </Card>328 </Card>

322</CardGroup>329</CardGroup>

323 330 

sandboxing.md +47 −6

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Sandboxing5# Sandboxing

2 6 

3> Learn how Claude Code's sandboxed bash tool provides filesystem and network isolation for safer, more autonomous agent execution.7> Learn how Claude Code's sandboxed bash tool provides filesystem and network isolation for safer, more autonomous agent execution.


51 55 

52The sandboxed bash tool leverages operating system security primitives:56The sandboxed bash tool leverages operating system security primitives:

53 57 

54* **Linux**: Uses [bubblewrap](https://github.com/containers/bubblewrap) for isolation

55* **macOS**: Uses Seatbelt for sandbox enforcement58* **macOS**: Uses Seatbelt for sandbox enforcement

59* **Linux**: Uses [bubblewrap](https://github.com/containers/bubblewrap) for isolation

60* **WSL2**: Uses bubblewrap, same as Linux

61 

62WSL1 is not supported because bubblewrap requires kernel features only available in WSL2.

56 63 

57These OS-level restrictions ensure that all child processes spawned by Claude Code's commands inherit the same security boundaries.64These OS-level restrictions ensure that all child processes spawned by Claude Code's commands inherit the same security boundaries.

58 65 

59## Getting started66## Getting started

60 67 

68### Prerequisites

69 

70On **macOS**, sandboxing works out of the box using the built-in Seatbelt framework.

71 

72On **Linux and WSL2**, install the required packages first:

73 

74<Tabs>

75 <Tab title="Ubuntu/Debian">

76 ```bash theme={null}

77 sudo apt-get install bubblewrap socat

78 ```

79 </Tab>

80 

81 <Tab title="Fedora">

82 ```bash theme={null}

83 sudo dnf install bubblewrap socat

84 ```

85 </Tab>

86</Tabs>

87 

61### Enable sandboxing88### Enable sandboxing

62 89 

63You can enable sandboxing by running the `/sandbox` slash command:90You can enable sandboxing by running the `/sandbox` command:

64 91 

65```92```

66> /sandbox93> /sandbox

67```94```

68 95 

69This activates the sandboxed bash tool with default settings, allowing access to your current working directory while blocking access to sensitive system locations.96This opens a menu where you can choose between sandbox modes.

97 

98### Sandbox modes

99 

100Claude Code offers two sandbox modes:

101 

102**Auto-allow mode**: Bash commands will attempt to run inside the sandbox and are automatically allowed without requiring permission. Commands that cannot be sandboxed (such as those needing network access to non-allowed hosts) fall back to the regular permission flow. Explicit ask/deny rules you've configured are always respected.

103 

104**Regular permissions mode**: All bash commands go through the standard permission flow, even when sandboxed. This provides more control but requires more approvals.

105 

106In both modes, the sandbox enforces the same filesystem and network restrictions. The difference is only in whether sandboxed commands are auto-approved or require explicit permission.

107 

108<Info>

109 Auto-allow mode works independently of your permission mode setting. Even if you're not in "accept edits" mode, sandboxed bash commands will run automatically when auto-allow is enabled. This means bash commands that modify files within the sandbox boundaries will execute without prompting, even when file edit tools would normally require approval.

110</Info>

70 111 

71### Configure sandboxing112### Configure sandboxing

72 113 


141 182 

142* Privilege Escalation via Unix Sockets: The `allowUnixSockets` configuration can inadvertently grant access to powerful system services that could lead to sandbox bypasses. For example, if it is used to allow access to `/var/run/docker.sock` this would effectively grant access to the host system through exploiting the docker socket. Users are encouraged to carefully consider any unix sockets that they allow through the sandbox.183* Privilege Escalation via Unix Sockets: The `allowUnixSockets` configuration can inadvertently grant access to powerful system services that could lead to sandbox bypasses. For example, if it is used to allow access to `/var/run/docker.sock` this would effectively grant access to the host system through exploiting the docker socket. Users are encouraged to carefully consider any unix sockets that they allow through the sandbox.

143* Filesystem Permission Escalation: Overly broad filesystem write permissions can enable privilege escalation attacks. Allowing writes to directories containing executables in `$PATH`, system configuration directories, or user shell configuration files (`.bashrc`, `.zshrc`) can lead to code execution in different security contexts when other users or system processes access these files.184* Filesystem Permission Escalation: Overly broad filesystem write permissions can enable privilege escalation attacks. Allowing writes to directories containing executables in `$PATH`, system configuration directories, or user shell configuration files (`.bashrc`, `.zshrc`) can lead to code execution in different security contexts when other users or system processes access these files.

144* Linux Sandbox Strength: The Linux implementation provides strong filesystem and network isolation but includes an `enableWeakerNestedSandbox` mode that enables it to work inside of Docker environments without privileged namespaces. This option considerably weakens security and should only be used incases where additional isolation is otherwise enforced.185* Linux Sandbox Strength: The Linux implementation provides strong filesystem and network isolation but includes an `enableWeakerNestedSandbox` mode that enables it to work inside of Docker environments without privileged namespaces. This option considerably weakens security and should only be used in cases where additional isolation is otherwise enforced.

145 186 

146## Advanced usage187## Advanced usage

147 188 


195 236 

196* **Performance overhead**: Minimal, but some filesystem operations may be slightly slower237* **Performance overhead**: Minimal, but some filesystem operations may be slightly slower

197* **Compatibility**: Some tools that require specific system access patterns may need configuration adjustments, or may even need to be run outside of the sandbox238* **Compatibility**: Some tools that require specific system access patterns may need configuration adjustments, or may even need to be run outside of the sandbox

198* **Platform support**: Currently supports Linux and macOS; Windows support planned239* **Platform support**: Supports macOS, Linux, and WSL2. WSL1 is not supported. Native Windows support is planned.

199 240 

200## See also241## See also

201 242 

202* [Security](/en/security) - Comprehensive security features and best practices243* [Security](/en/security) - Comprehensive security features and best practices

203* [IAM](/en/iam) - Permission configuration and access control244* [IAM](/en/iam) - Permission configuration and access control

204* [Settings](/en/settings) - Complete configuration reference245* [Settings](/en/settings) - Complete configuration reference

205* [CLI reference](/en/cli-reference) - Command-line options including `-sb`246* [CLI reference](/en/cli-reference) - Command-line options

sdk/migration-guide.md +0 −329 deleted

File DeletedView Diff

1# Migrate to Claude Agent SDK

2 

3Guide for migrating the Claude Code TypeScript and Python SDKs to the Claude Agent SDK

4 

5 

6## Overview

7 

8The Claude Code SDK has been renamed to the **Claude Agent SDK** and its documentation has been reorganized. This change reflects the SDK's broader capabilities for building AI agents beyond just coding tasks.

9 

10## What's Changed

11 

12| Aspect | Old | New |

13| :----------------------- | :-------------------------- | :------------------------------- |

14| **Package Name (TS/JS)** | `@anthropic-ai/claude-code` | `@anthropic-ai/claude-agent-sdk` |

15| **Python Package** | `claude-code-sdk` | `claude-agent-sdk` |

16| **Documentation Location** | Claude Code docs | API Guide → Agent SDK section |

17 

18<Note>

19**Documentation Changes:** The Agent SDK documentation has moved from the Claude Code docs to the API Guide under a dedicated [Agent SDK](/docs/en/agent-sdk/overview) section. The Claude Code docs now focus on the CLI tool and automation features.

20</Note>

21 

22## Migration Steps

23 

24### For TypeScript/JavaScript Projects

25 

26**1. Uninstall the old package:**

27 

28```bash

29npm uninstall @anthropic-ai/claude-code

30```

31 

32**2. Install the new package:**

33 

34```bash

35npm install @anthropic-ai/claude-agent-sdk

36```

37 

38**3. Update your imports:**

39 

40Change all imports from `@anthropic-ai/claude-code` to `@anthropic-ai/claude-agent-sdk`:

41 

42```typescript

43// Before

44import { query, tool, createSdkMcpServer } from "@anthropic-ai/claude-code";

45 

46// After

47import {

48 query,

49 tool,

50 createSdkMcpServer,

51} from "@anthropic-ai/claude-agent-sdk";

52```

53 

54**4. Update package.json dependencies:**

55 

56If you have the package listed in your `package.json`, update it:

57 

58```json

59// Before

60{

61 "dependencies": {

62 "@anthropic-ai/claude-code": "^1.0.0"

63 }

64}

65 

66// After

67{

68 "dependencies": {

69 "@anthropic-ai/claude-agent-sdk": "^0.1.0"

70 }

71}

72```

73 

74That's it! No other code changes are required.

75 

76### For Python Projects

77 

78**1. Uninstall the old package:**

79 

80```bash

81pip uninstall claude-code-sdk

82```

83 

84**2. Install the new package:**

85 

86```bash

87pip install claude-agent-sdk

88```

89 

90**3. Update your imports:**

91 

92Change all imports from `claude_code_sdk` to `claude_agent_sdk`:

93 

94```python

95# Before

96from claude_code_sdk import query, ClaudeCodeOptions

97 

98# After

99from claude_agent_sdk import query, ClaudeAgentOptions

100```

101 

102**4. Update type names:**

103 

104Change `ClaudeCodeOptions` to `ClaudeAgentOptions`:

105 

106```python

107# Before

108from claude_agent_sdk import query, ClaudeCodeOptions

109 

110options = ClaudeCodeOptions(

111 model="claude-sonnet-4-5"

112)

113 

114# After

115from claude_agent_sdk import query, ClaudeAgentOptions

116 

117options = ClaudeAgentOptions(

118 model="claude-sonnet-4-5"

119)

120```

121 

122**5. Review [breaking changes](#breaking-changes)**

123 

124Make any code changes needed to complete the migration.

125 

126## Breaking changes

127 

128<Warning>

129To improve isolation and explicit configuration, Claude Agent SDK v0.1.0 introduces breaking changes for users migrating from Claude Code SDK. Review this section carefully before migrating.

130</Warning>

131 

132### Python: ClaudeCodeOptions renamed to ClaudeAgentOptions

133 

134**What changed:** The Python SDK type `ClaudeCodeOptions` has been renamed to `ClaudeAgentOptions`.

135 

136**Migration:**

137 

138```python

139# BEFORE (v0.0.x)

140from claude_agent_sdk import query, ClaudeCodeOptions

141 

142options = ClaudeCodeOptions(

143 model="claude-sonnet-4-5",

144 permission_mode="acceptEdits"

145)

146 

147# AFTER (v0.1.0)

148from claude_agent_sdk import query, ClaudeAgentOptions

149 

150options = ClaudeAgentOptions(

151 model="claude-sonnet-4-5",

152 permission_mode="acceptEdits"

153)

154```

155 

156**Why this changed:** The type name now matches the "Claude Agent SDK" branding and provides consistency across the SDK's naming conventions.

157 

158### System prompt no longer default

159 

160**What changed:** The SDK no longer uses Claude Code's system prompt by default.

161 

162**Migration:**

163 

164<CodeGroup>

165 

166```typescript TypeScript

167// BEFORE (v0.0.x) - Used Claude Code's system prompt by default

168const result = query({ prompt: "Hello" });

169 

170// AFTER (v0.1.0) - Uses empty system prompt by default

171// To get the old behavior, explicitly request Claude Code's preset:

172const result = query({

173 prompt: "Hello",

174 options: {

175 systemPrompt: { type: "preset", preset: "claude_code" }

176 }

177});

178 

179// Or use a custom system prompt:

180const result = query({

181 prompt: "Hello",

182 options: {

183 systemPrompt: "You are a helpful coding assistant"

184 }

185});

186```

187 

188```python Python

189# BEFORE (v0.0.x) - Used Claude Code's system prompt by default

190async for message in query(prompt="Hello"):

191 print(message)

192 

193# AFTER (v0.1.0) - Uses empty system prompt by default

194# To get the old behavior, explicitly request Claude Code's preset:

195from claude_agent_sdk import query, ClaudeAgentOptions

196 

197async for message in query(

198 prompt="Hello",

199 options=ClaudeAgentOptions(

200 system_prompt={"type": "preset", "preset": "claude_code"} # Use the preset

201 )

202):

203 print(message)

204 

205# Or use a custom system prompt:

206async for message in query(

207 prompt="Hello",

208 options=ClaudeAgentOptions(

209 system_prompt="You are a helpful coding assistant"

210 )

211):

212 print(message)

213```

214 

215</CodeGroup>

216 

217**Why this changed:** Provides better control and isolation for SDK applications. You can now build agents with custom behavior without inheriting Claude Code's CLI-focused instructions.

218 

219### Settings Sources No Longer Loaded by Default

220 

221**What changed:** The SDK no longer reads from filesystem settings (CLAUDE.md, settings.json, slash commands, etc.) by default.

222 

223**Migration:**

224 

225<CodeGroup>

226 

227```typescript TypeScript

228// BEFORE (v0.0.x) - Loaded all settings automatically

229const result = query({ prompt: "Hello" });

230// Would read from:

231// - ~/.claude/settings.json (user)

232// - .claude/settings.json (project)

233// - .claude/settings.local.json (local)

234// - CLAUDE.md files

235// - Custom slash commands

236 

237// AFTER (v0.1.0) - No settings loaded by default

238// To get the old behavior:

239const result = query({

240 prompt: "Hello",

241 options: {

242 settingSources: ["user", "project", "local"]

243 }

244});

245 

246// Or load only specific sources:

247const result = query({

248 prompt: "Hello",

249 options: {

250 settingSources: ["project"] // Only project settings

251 }

252});

253```

254 

255```python Python

256# BEFORE (v0.0.x) - Loaded all settings automatically

257async for message in query(prompt="Hello"):

258 print(message)

259# Would read from:

260# - ~/.claude/settings.json (user)

261# - .claude/settings.json (project)

262# - .claude/settings.local.json (local)

263# - CLAUDE.md files

264# - Custom slash commands

265 

266# AFTER (v0.1.0) - No settings loaded by default

267# To get the old behavior:

268from claude_agent_sdk import query, ClaudeAgentOptions

269 

270async for message in query(

271 prompt="Hello",

272 options=ClaudeAgentOptions(

273 setting_sources=["user", "project", "local"]

274 )

275):

276 print(message)

277 

278# Or load only specific sources:

279async for message in query(

280 prompt="Hello",

281 options=ClaudeAgentOptions(

282 setting_sources=["project"] # Only project settings

283 )

284):

285 print(message)

286```

287 

288</CodeGroup>

289 

290**Why this changed:** Ensures SDK applications have predictable behavior independent of local filesystem configurations. This is especially important for:

291- **CI/CD environments** - Consistent behavior without local customizations

292- **Deployed applications** - No dependency on filesystem settings

293- **Testing** - Isolated test environments

294- **Multi-tenant systems** - Prevent settings leakage between users

295 

296<Note>

297**Backward compatibility:** If your application relied on filesystem settings (custom slash commands, CLAUDE.md instructions, etc.), add `settingSources: ['user', 'project', 'local']` to your options.

298</Note>

299 

300## Why the Rename?

301 

302The Claude Code SDK was originally designed for coding tasks, but it has evolved into a powerful framework for building all types of AI agents. The new name "Claude Agent SDK" better reflects its capabilities:

303 

304- Building business agents (legal assistants, finance advisors, customer support)

305- Creating specialized coding agents (SRE bots, security reviewers, code review agents)

306- Developing custom agents for any domain with tool use, MCP integration, and more

307 

308## Getting Help

309 

310If you encounter any issues during migration:

311 

312**For TypeScript/JavaScript:**

313 

3141. Check that all imports are updated to use `@anthropic-ai/claude-agent-sdk`

3152. Verify your package.json has the new package name

3163. Run `npm install` to ensure dependencies are updated

317 

318**For Python:**

319 

3201. Check that all imports are updated to use `claude_agent_sdk`

3212. Verify your requirements.txt or pyproject.toml has the new package name

3223. Run `pip install claude-agent-sdk` to ensure the package is installed

323 

324## Next Steps

325 

326- Explore the [Agent SDK Overview](/docs/en/agent-sdk/overview) to learn about available features

327- Check out the [TypeScript SDK Reference](/docs/en/agent-sdk/typescript) for detailed API documentation

328- Review the [Python SDK Reference](/docs/en/agent-sdk/python) for Python-specific documentation

329- Learn about [Custom Tools](/docs/en/agent-sdk/custom-tools) and [MCP Integration](/docs/en/agent-sdk/mcp)

security.md +6 −2

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Security5# Security

2 6 

3> Learn about Claude Code's security safeguards and best practices for safe usage.7> Learn about Claude Code's security safeguards and best practices for safe usage.


87 91 

88## IDE security92## IDE security

89 93 

90See [here](/en/vs-code#security) for more information on the security of running Claude Code in an IDE.94See [VS Code security and privacy](/en/vs-code#security-and-privacy) for more information on running Claude Code in an IDE.

91 95 

92## Cloud execution security96## Cloud execution security

93 97 


113 117 

114### Team security118### Team security

115 119 

116* Use [enterprise managed policies](/en/iam#enterprise-managed-policy-settings) to enforce organizational standards120* Use [managed settings](/en/iam#managed-settings) to enforce organizational standards

117* Share approved permission configurations through version control121* Share approved permission configurations through version control

118* Train team members on security best practices122* Train team members on security best practices

119* Monitor Claude Code usage through [OpenTelemetry metrics](/en/monitoring-usage)123* Monitor Claude Code usage through [OpenTelemetry metrics](/en/monitoring-usage)

settings.md +642 −72

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Claude Code settings5# Claude Code settings

2 6 

3> Configure Claude Code with global and project-level settings, and environment variables.7> Configure Claude Code with global and project-level settings, and environment variables.

4 8 

5Claude Code offers a variety of settings to configure its behavior to meet your needs. You can configure Claude Code by running the `/config` command when using the interactive REPL, which opens a tabbed Settings interface where you can view status information and modify configuration options.9Claude Code offers a variety of settings to configure its behavior to meet your needs. You can configure Claude Code by running the `/config` command when using the interactive REPL, which opens a tabbed Settings interface where you can view status information and modify configuration options.

6 10 

11## Configuration scopes

12 

13Claude Code uses a **scope system** to determine where configurations apply and who they're shared with. Understanding scopes helps you decide how to configure Claude Code for personal use, team collaboration, or enterprise deployment.

14 

15### Available scopes

16 

17| Scope | Location | Who it affects | Shared with team? |

18| :---------- | :----------------------------------- | :----------------------------------- | :--------------------- |

19| **Managed** | System-level `managed-settings.json` | All users on the machine | Yes (deployed by IT) |

20| **User** | `~/.claude/` directory | You, across all projects | No |

21| **Project** | `.claude/` in repository | All collaborators on this repository | Yes (committed to git) |

22| **Local** | `.claude/*.local.*` files | You, in this repository only | No (gitignored) |

23 

24### When to use each scope

25 

26**Managed scope** is for:

27 

28* Security policies that must be enforced organization-wide

29* Compliance requirements that can't be overridden

30* Standardized configurations deployed by IT/DevOps

31 

32**User scope** is best for:

33 

34* Personal preferences you want everywhere (themes, editor settings)

35* Tools and plugins you use across all projects

36* API keys and authentication (stored securely)

37 

38**Project scope** is best for:

39 

40* Team-shared settings (permissions, hooks, MCP servers)

41* Plugins the whole team should have

42* Standardizing tooling across collaborators

43 

44**Local scope** is best for:

45 

46* Personal overrides for a specific project

47* Testing configurations before sharing with the team

48* Machine-specific settings that won't work for others

49 

50### How scopes interact

51 

52When the same setting is configured in multiple scopes, more specific scopes take precedence:

53 

541. **Managed** (highest) - can't be overridden by anything

552. **Command line arguments** - temporary session overrides

563. **Local** - overrides project and user settings

574. **Project** - overrides user settings

585. **User** (lowest) - applies when nothing else specifies the setting

59 

60For example, if a permission is allowed in user settings but denied in project settings, the project setting takes precedence and the permission is blocked.

61 

62### What uses scopes

63 

64Scopes apply to many Claude Code features:

65 

66| Feature | User location | Project location | Local location |

67| :-------------- | :------------------------ | :--------------------------------- | :----------------------------- |

68| **Settings** | `~/.claude/settings.json` | `.claude/settings.json` | `.claude/settings.local.json` |

69| **Subagents** | `~/.claude/agents/` | `.claude/agents/` | — |

70| **MCP servers** | `~/.claude.json` | `.mcp.json` | `~/.claude.json` (per-project) |

71| **Plugins** | `~/.claude/settings.json` | `.claude/settings.json` | `.claude/settings.local.json` |

72| **CLAUDE.md** | `~/.claude/CLAUDE.md` | `CLAUDE.md` or `.claude/CLAUDE.md` | `CLAUDE.local.md` |

73 

74***

75 

7## Settings files76## Settings files

8 77 

9The `settings.json` file is our official mechanism for configuring Claude78The `settings.json` file is our official mechanism for configuring Claude


14* **Project settings** are saved in your project directory:83* **Project settings** are saved in your project directory:

15 * `.claude/settings.json` for settings that are checked into source control and shared with your team84 * `.claude/settings.json` for settings that are checked into source control and shared with your team

16 * `.claude/settings.local.json` for settings that are not checked in, useful for personal preferences and experimentation. Claude Code will configure git to ignore `.claude/settings.local.json` when it is created.85 * `.claude/settings.local.json` for settings that are not checked in, useful for personal preferences and experimentation. Claude Code will configure git to ignore `.claude/settings.local.json` when it is created.

17* For enterprise deployments of Claude Code, we also support **enterprise86* **Managed settings**: For organizations that need centralized control, Claude Code supports `managed-settings.json` and `managed-mcp.json` files that can be deployed to system directories:

18 managed policy settings**. These take precedence over user and project87 

19 settings. System administrators can deploy policies to:88 * macOS: `/Library/Application Support/ClaudeCode/`

20 * macOS: `/Library/Application Support/ClaudeCode/managed-settings.json`89 * Linux and WSL: `/etc/claude-code/`

21 * Linux and WSL: `/etc/claude-code/managed-settings.json`90 * Windows: `C:\Program Files\ClaudeCode\`

22 * Windows: `C:\ProgramData\ClaudeCode\managed-settings.json`91 

23* Enterprise deployments can also configure **managed MCP servers** that override92 <Note>

24 user-configured servers. See [Enterprise MCP configuration](/en/mcp#enterprise-mcp-configuration):93 These are system-wide paths (not user home directories like `~/Library/...`) that require administrator privileges. They are designed to be deployed by IT administrators.

25 * macOS: `/Library/Application Support/ClaudeCode/managed-mcp.json`94 </Note>

26 * Linux and WSL: `/etc/claude-code/managed-mcp.json`95 

27 * Windows: `C:\ProgramData\ClaudeCode\managed-mcp.json`96 See [Managed settings](/en/iam#managed-settings) and [Managed MCP configuration](/en/mcp#managed-mcp-configuration) for details.

97 

98 <Note>

99 Managed deployments can also restrict **plugin marketplace additions** using

100 `strictKnownMarketplaces`. For more information, see [Managed marketplace restrictions](/en/plugin-marketplaces#managed-marketplace-restrictions).

101 </Note>

102* **Other configuration** is stored in `~/.claude.json`. This file contains your preferences (theme, notification settings, editor mode), OAuth session, [MCP server](/en/mcp) configurations for user and local scopes, per-project state (allowed tools, trust settings), and various caches. Project-scoped MCP servers are stored separately in `.mcp.json`.

28 103 

29```JSON Example settings.json theme={null}104```JSON Example settings.json theme={null}

30{105{


58`settings.json` supports a number of options:133`settings.json` supports a number of options:

59 134 

60| Key | Description | Example |135| Key | Description | Example |

61| :--------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------- |136| :--------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------- |

62| `apiKeyHelper` | Custom script, to be executed in `/bin/sh`, to generate an auth value. This value will be sent as `X-Api-Key` and `Authorization: Bearer` headers for model requests | `/bin/generate_temp_api_key.sh` |137| `apiKeyHelper` | Custom script, to be executed in `/bin/sh`, to generate an auth value. This value will be sent as `X-Api-Key` and `Authorization: Bearer` headers for model requests | `/bin/generate_temp_api_key.sh` |

63| `cleanupPeriodDays` | How long to locally retain chat transcripts based on last activity date (default: 30 days) | `20` |138| `cleanupPeriodDays` | Sessions inactive for longer than this period are deleted at startup. Setting to `0` immediately deletes all sessions. (default: 30 days) | `20` |

64| `companyAnnouncements` | Announcement to display to users at startup. If multiple announcements are provided, they will be cycled through at random. | `["Welcome to Acme Corp! Review our code guidelines at docs.acme.com"]` |139| `companyAnnouncements` | Announcement to display to users at startup. If multiple announcements are provided, they will be cycled through at random. | `["Welcome to Acme Corp! Review our code guidelines at docs.acme.com"]` |

65| `env` | Environment variables that will be applied to every session | `{"FOO": "bar"}` |140| `env` | Environment variables that will be applied to every session | `{"FOO": "bar"}` |

66| `includeCoAuthoredBy` | Whether to include the `co-authored-by Claude` byline in git commits and pull requests (default: `true`) | `false` |141| `attribution` | Customize attribution for git commits and pull requests. See [Attribution settings](#attribution-settings) | `{"commit": "🤖 Generated with Claude Code", "pr": ""}` |

142| `includeCoAuthoredBy` | **Deprecated**: Use `attribution` instead. Whether to include the `co-authored-by Claude` byline in git commits and pull requests (default: `true`) | `false` |

67| `permissions` | See table below for structure of permissions. | |143| `permissions` | See table below for structure of permissions. | |

68| `hooks` | Configure custom commands to run before or after tool executions. See [hooks documentation](/en/hooks) | `{"PreToolUse": {"Bash": "echo 'Running command...'"}}` |144| `hooks` | Configure custom commands to run before or after tool executions. See [hooks documentation](/en/hooks) | `{"PreToolUse": {"Bash": "echo 'Running command...'"}}` |

69| `disableAllHooks` | Disable all [hooks](/en/hooks) | `true` |145| `disableAllHooks` | Disable all [hooks](/en/hooks) | `true` |

146| `allowManagedHooksOnly` | (Managed settings only) Prevent loading of user, project, and plugin hooks. Only allows managed hooks and SDK hooks. See [Hook configuration](#hook-configuration) | `true` |

70| `model` | Override the default model to use for Claude Code | `"claude-sonnet-4-5-20250929"` |147| `model` | Override the default model to use for Claude Code | `"claude-sonnet-4-5-20250929"` |

71| `statusLine` | Configure a custom status line to display context. See [statusLine documentation](/en/statusline) | `{"type": "command", "command": "~/.claude/statusline.sh"}` |148| `otelHeadersHelper` | Script to generate dynamic OpenTelemetry headers. Runs at startup and periodically (see [Dynamic headers](/en/monitoring-usage#dynamic-headers)) | `/bin/generate_otel_headers.sh` |

149| `statusLine` | Configure a custom status line to display context. See [`statusLine` documentation](/en/statusline) | `{"type": "command", "command": "~/.claude/statusline.sh"}` |

150| `fileSuggestion` | Configure a custom script for `@` file autocomplete. See [File suggestion settings](#file-suggestion-settings) | `{"type": "command", "command": "~/.claude/file-suggestion.sh"}` |

151| `respectGitignore` | Control whether the `@` file picker respects `.gitignore` patterns. When `true` (default), files matching `.gitignore` patterns are excluded from suggestions | `false` |

72| `outputStyle` | Configure an output style to adjust the system prompt. See [output styles documentation](/en/output-styles) | `"Explanatory"` |152| `outputStyle` | Configure an output style to adjust the system prompt. See [output styles documentation](/en/output-styles) | `"Explanatory"` |

73| `forceLoginMethod` | Use `claudeai` to restrict login to Claude.ai accounts, `console` to restrict login to Claude Console (API usage billing) accounts | `claudeai` |153| `forceLoginMethod` | Use `claudeai` to restrict login to Claude.ai accounts, `console` to restrict login to Claude Console (API usage billing) accounts | `claudeai` |

74| `forceLoginOrgUUID` | Specify the UUID of an organization to automatically select it during login, bypassing the organization selection step. Requires `forceLoginMethod` to be set | `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"` |154| `forceLoginOrgUUID` | Specify the UUID of an organization to automatically select it during login, bypassing the organization selection step. Requires `forceLoginMethod` to be set | `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"` |

75| `enableAllProjectMcpServers` | Automatically approve all MCP servers defined in project `.mcp.json` files | `true` |155| `enableAllProjectMcpServers` | Automatically approve all MCP servers defined in project `.mcp.json` files | `true` |

76| `enabledMcpjsonServers` | List of specific MCP servers from `.mcp.json` files to approve | `["memory", "github"]` |156| `enabledMcpjsonServers` | List of specific MCP servers from `.mcp.json` files to approve | `["memory", "github"]` |

77| `disabledMcpjsonServers` | List of specific MCP servers from `.mcp.json` files to reject | `["filesystem"]` |157| `disabledMcpjsonServers` | List of specific MCP servers from `.mcp.json` files to reject | `["filesystem"]` |

78| `allowedMcpServers` | When set in managed-settings.json, allowlist of MCP servers users can configure. Undefined = no restrictions, empty array = lockdown. Applies to all scopes. Denylist takes precedence. See [Enterprise MCP configuration](/en/mcp#enterprise-mcp-configuration) | `[{ "serverName": "github" }]` |158| `allowedMcpServers` | When set in managed-settings.json, allowlist of MCP servers users can configure. Undefined = no restrictions, empty array = lockdown. Applies to all scopes. Denylist takes precedence. See [Managed MCP configuration](/en/mcp#managed-mcp-configuration) | `[{ "serverName": "github" }]` |

79| `deniedMcpServers` | When set in managed-settings.json, denylist of MCP servers that are explicitly blocked. Applies to all scopes including enterprise servers. Denylist takes precedence over allowlist. See [Enterprise MCP configuration](/en/mcp#enterprise-mcp-configuration) | `[{ "serverName": "filesystem" }]` |159| `deniedMcpServers` | When set in managed-settings.json, denylist of MCP servers that are explicitly blocked. Applies to all scopes including managed servers. Denylist takes precedence over allowlist. See [Managed MCP configuration](/en/mcp#managed-mcp-configuration) | `[{ "serverName": "filesystem" }]` |

160| `strictKnownMarketplaces` | When set in managed-settings.json, allowlist of plugin marketplaces users can add. Undefined = no restrictions, empty array = lockdown. Applies to marketplace additions only. See [Managed marketplace restrictions](/en/plugin-marketplaces#managed-marketplace-restrictions) | `[{ "source": "github", "repo": "acme-corp/plugins" }]` |

80| `awsAuthRefresh` | Custom script that modifies the `.aws` directory (see [advanced credential configuration](/en/amazon-bedrock#advanced-credential-configuration)) | `aws sso login --profile myprofile` |161| `awsAuthRefresh` | Custom script that modifies the `.aws` directory (see [advanced credential configuration](/en/amazon-bedrock#advanced-credential-configuration)) | `aws sso login --profile myprofile` |

81| `awsCredentialExport` | Custom script that outputs JSON with AWS credentials (see [advanced credential configuration](/en/amazon-bedrock#advanced-credential-configuration)) | `/bin/generate_aws_grant.sh` |162| `awsCredentialExport` | Custom script that outputs JSON with AWS credentials (see [advanced credential configuration](/en/amazon-bedrock#advanced-credential-configuration)) | `/bin/generate_aws_grant.sh` |

163| `alwaysThinkingEnabled` | Enable [extended thinking](/en/common-workflows#use-extended-thinking-thinking-mode) by default for all sessions. Typically configured via the `/config` command rather than editing directly | `true` |

164| `plansDirectory` | Customize where plan files are stored. Path is relative to project root. Default: `~/.claude/plans` | `"./plans"` |

165| `showTurnDuration` | Show turn duration messages after responses (e.g., "Cooked for 1m 6s"). Set to `false` to hide these messages | `true` |

166| `language` | Configure Claude's preferred response language (e.g., `"japanese"`, `"spanish"`, `"french"`). Claude will respond in this language by default | `"japanese"` |

167| `autoUpdatesChannel` | Release channel to follow for updates. Use `"stable"` for a version that is typically about one week old and skips versions with major regressions, or `"latest"` (default) for the most recent release | `"stable"` |

168| `spinnerTipsEnabled` | Show tips in the spinner while Claude is working. Set to `false` to disable tips (default: `true`) | `false` |

169| `terminalProgressBarEnabled` | Enable the terminal progress bar that shows progress in supported terminals like Windows Terminal and iTerm2 (default: `true`) | `false` |

82 170 

83### Permission settings171### Permission settings

84 172 

85| Keys | Description | Example |173| Keys | Description | Example |

86| :----------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------- |174| :----------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------- |

87| `allow` | Array of [permission rules](/en/iam#configuring-permissions) to allow tool use. **Note:** Bash rules use prefix matching, not regex | `[ "Bash(git diff:*)" ]` |175| `allow` | Array of permission rules to allow tool use. See [Permission rule syntax](#permission-rule-syntax) below for pattern matching details | `[ "Bash(git diff:*)" ]` |

88| `ask` | Array of [permission rules](/en/iam#configuring-permissions) to ask for confirmation upon tool use. | `[ "Bash(git push:*)" ]` |176| `ask` | Array of permission rules to ask for confirmation upon tool use. See [Permission rule syntax](#permission-rule-syntax) below | `[ "Bash(git push:*)" ]` |

89| `deny` | Array of [permission rules](/en/iam#configuring-permissions) to deny tool use. Use this to also exclude sensitive files from Claude Code access. **Note:** Bash patterns are prefix matches and can be bypassed (see [Bash permission limitations](/en/iam#tool-specific-permission-rules)) | `[ "WebFetch", "Bash(curl:*)", "Read(./.env)", "Read(./secrets/**)" ]` |177| `deny` | Array of permission rules to deny tool use. Use this to exclude sensitive files from Claude Code access. See [Permission rule syntax](#permission-rule-syntax) and [Bash permission limitations](/en/iam#tool-specific-permission-rules) | `[ "WebFetch", "Bash(curl:*)", "Read(./.env)", "Read(./secrets/**)" ]` |

90| `additionalDirectories` | Additional [working directories](/en/iam#working-directories) that Claude has access to | `[ "../docs/" ]` |178| `additionalDirectories` | Additional [working directories](/en/iam#working-directories) that Claude has access to | `[ "../docs/" ]` |

91| `defaultMode` | Default [permission mode](/en/iam#permission-modes) when opening Claude Code | `"acceptEdits"` |179| `defaultMode` | Default [permission mode](/en/iam#permission-modes) when opening Claude Code | `"acceptEdits"` |

92| `disableBypassPermissionsMode` | Set to `"disable"` to prevent `bypassPermissions` mode from being activated. This disables the `--dangerously-skip-permissions` command-line flag. See [managed policy settings](/en/iam#enterprise-managed-policy-settings) | `"disable"` |180| `disableBypassPermissionsMode` | Set to `"disable"` to prevent `bypassPermissions` mode from being activated. This disables the `--dangerously-skip-permissions` command-line flag. See [managed settings](/en/iam#managed-settings) | `"disable"` |

181 

182### Permission rule syntax

183 

184Permission rules follow the format `Tool` or `Tool(specifier)`. Understanding the syntax helps you write rules that match exactly what you intend.

185 

186#### Rule evaluation order

187 

188When multiple rules could match the same tool use, rules are evaluated in this order:

189 

1901. **Deny** rules are checked first

1912. **Ask** rules are checked second

1923. **Allow** rules are checked last

193 

194The first matching rule determines the behavior. This means deny rules always take precedence over allow rules, even if both match the same command.

195 

196#### Matching all uses of a tool

197 

198To match all uses of a tool, use just the tool name without parentheses:

199 

200| Rule | Effect |

201| :--------- | :--------------------------------- |

202| `Bash` | Matches **all** Bash commands |

203| `WebFetch` | Matches **all** web fetch requests |

204| `Read` | Matches **all** file reads |

205 

206`Bash(*)` is equivalent to `Bash` and matches all Bash commands. Both syntaxes can be used interchangeably.

207 

208#### Using specifiers for fine-grained control

209 

210Add a specifier in parentheses to match specific tool uses:

211 

212| Rule | Effect |

213| :----------------------------- | :------------------------------------------------------- |

214| `Bash(npm run build)` | Matches the exact command `npm run build` |

215| `Read(./.env)` | Matches reading the `.env` file in the current directory |

216| `WebFetch(domain:example.com)` | Matches fetch requests to example.com |

217 

218#### Wildcard patterns

219 

220Two wildcard syntaxes are available for Bash rules:

221 

222| Wildcard | Position | Behavior | Example |

223| :------- | :------------------ | :----------------------------------------------------------------------------------------------- | :------------------------------------------- |

224| `:*` | End of pattern only | **Prefix matching** with word boundary. The prefix must be followed by a space or end-of-string. | `Bash(ls:*)` matches `ls -la` but not `lsof` |

225| `*` | Anywhere in pattern | **Glob matching** with no word boundary. Matches any sequence of characters at that position. | `Bash(ls*)` matches both `ls -la` and `lsof` |

226 

227**Prefix matching with `:*`**

228 

229The `:*` suffix matches any command that starts with the specified prefix. This works with multi-word commands. The following configuration allows npm and git commit commands while blocking git push and rm -rf:

230 

231```json theme={null}

232{

233 "permissions": {

234 "allow": [

235 "Bash(npm run:*)",

236 "Bash(git commit:*)",

237 "Bash(docker compose:*)"

238 ],

239 "deny": [

240 "Bash(git push:*)",

241 "Bash(rm -rf:*)"

242 ]

243 }

244}

245```

246 

247**Glob matching with `*`**

248 

249The `*` wildcard can appear at the beginning, middle, or end of a pattern. The following configuration allows any git command targeting main (like `git checkout main`, `git merge main`) and any version check command (like `node --version`, `npm --version`):

250 

251```json theme={null}

252{

253 "permissions": {

254 "allow": [

255 "Bash(git * main)",

256 "Bash(* --version)"

257 ]

258 }

259}

260```

261 

262<Warning>

263 Bash permission patterns that try to constrain command arguments are fragile. For example, `Bash(curl http://github.com/:*)` intends to restrict curl to GitHub URLs, but won't match `curl -X GET http://github.com/...` (flags before URL), `curl https://github.com/...` (different protocol), or commands using shell variables. Do not rely on argument-constraining patterns as a security boundary. See [Bash permission limitations](/en/iam#tool-specific-permission-rules) for alternatives.

264</Warning>

265 

266For detailed information about tool-specific permission patterns—including Read, Edit, WebFetch, MCP, Task rules, and Bash permission limitations—see [Tool-specific permission rules](/en/iam#tool-specific-permission-rules).

93 267 

94### Sandbox settings268### Sandbox settings

95 269 


99 273 

100| Keys | Description | Example |274| Keys | Description | Example |

101| :-------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------ |275| :-------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------ |

102| `enabled` | Enable bash sandboxing (macOS/Linux only). Default: false | `true` |276| `enabled` | Enable bash sandboxing (macOS, Linux, and WSL2). Default: false | `true` |

103| `autoAllowBashIfSandboxed` | Auto-approve bash commands when sandboxed. Default: true | `true` |277| `autoAllowBashIfSandboxed` | Auto-approve bash commands when sandboxed. Default: true | `true` |

104| `excludedCommands` | Commands that should run outside of the sandbox | `["git", "docker"]` |278| `excludedCommands` | Commands that should run outside of the sandbox | `["git", "docker"]` |

105| `allowUnsandboxedCommands` | Allow commands to run outside the sandbox via the `dangerouslyDisableSandbox` parameter. When set to `false`, the `dangerouslyDisableSandbox` escape hatch is completely disabled and all commands must run sandboxed (or be in `excludedCommands`). Useful for enterprise policies that require strict sandboxing. Default: true | `false` |279| `allowUnsandboxedCommands` | Allow commands to run outside the sandbox via the `dangerouslyDisableSandbox` parameter. When set to `false`, the `dangerouslyDisableSandbox` escape hatch is completely disabled and all commands must run sandboxed (or be in `excludedCommands`). Useful for enterprise policies that require strict sandboxing. Default: true | `false` |

106| `network.allowUnixSockets` | Unix socket paths accessible in sandbox (for SSH agents, etc.) | `["~/.ssh/agent-socket"]` |280| `network.allowUnixSockets` | Unix socket paths accessible in sandbox (for SSH agents, etc.) | `["~/.ssh/agent-socket"]` |

107| `network.allowLocalBinding` | Allow binding to localhost ports (MacOS only). Default: false | `true` |281| `network.allowLocalBinding` | Allow binding to localhost ports (macOS only). Default: false | `true` |

108| `network.httpProxyPort` | HTTP proxy port used if you wish to bring your own proxy. If not specified, Claude will run its own proxy. | `8080` |282| `network.httpProxyPort` | HTTP proxy port used if you wish to bring your own proxy. If not specified, Claude will run its own proxy. | `8080` |

109| `network.socksProxyPort` | SOCKS5 proxy port used if you wish to bring your own proxy. If not specified, Claude will run its own proxy. | `8081` |283| `network.socksProxyPort` | SOCKS5 proxy port used if you wish to bring your own proxy. If not specified, Claude will run its own proxy. | `8081` |

110| `enableWeakerNestedSandbox` | Enable weaker sandbox for unprivileged Docker environments (Linux only). **Reduces security.** Default: false | `true` |284| `enableWeakerNestedSandbox` | Enable weaker sandbox for unprivileged Docker environments (Linux and WSL2 only). **Reduces security.** Default: false | `true` |

111 285 

112**Configuration example:**286**Configuration example:**

113 287 


133}307}

134```308```

135 309 

136**Filesystem access** is controlled via Read/Edit permissions:310**Filesystem and network restrictions** use standard permission rules:

311 

312* Use `Read` deny rules to block Claude from reading specific files or directories

313* Use `Edit` allow rules to let Claude write to directories beyond the current working directory

314* Use `Edit` deny rules to block writes to specific paths

315* Use `WebFetch` allow/deny rules to control which network domains Claude can access

316 

317### Attribution settings

318 

319Claude Code adds attribution to git commits and pull requests. These are configured separately:

320 

321* Commits use [git trailers](https://git-scm.com/docs/git-interpret-trailers) (like `Co-Authored-By`) by default, which can be customized or disabled

322* Pull request descriptions are plain text

323 

324| Keys | Description |

325| :------- | :----------------------------------------------------------------------------------------- |

326| `commit` | Attribution for git commits, including any trailers. Empty string hides commit attribution |

327| `pr` | Attribution for pull request descriptions. Empty string hides pull request attribution |

328 

329**Default commit attribution:**

330 

331```

332🤖 Generated with [Claude Code](https://claude.com/claude-code)

333 

334 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

335```

336 

337**Default pull request attribution:**

338 

339```

340🤖 Generated with [Claude Code](https://claude.com/claude-code)

341```

342 

343**Example:**

344 

345```json theme={null}

346{

347 "attribution": {

348 "commit": "Generated with AI\n\nCo-Authored-By: AI <ai@example.com>",

349 "pr": ""

350 }

351}

352```

353 

354<Note>

355 The `attribution` setting takes precedence over the deprecated `includeCoAuthoredBy` setting. To hide all attribution, set `commit` and `pr` to empty strings.

356</Note>

357 

358### File suggestion settings

359 

360Configure a custom command for `@` file path autocomplete. The built-in file suggestion uses fast filesystem traversal, but large monorepos may benefit from project-specific indexing such as a pre-built file index or custom tooling.

361 

362```json theme={null}

363{

364 "fileSuggestion": {

365 "type": "command",

366 "command": "~/.claude/file-suggestion.sh"

367 }

368}

369```

370 

371The command runs with the same environment variables as [hooks](/en/hooks), including `CLAUDE_PROJECT_DIR`. It receives JSON via stdin with a `query` field:

372 

373```json theme={null}

374{"query": "src/comp"}

375```

376 

377Output newline-separated file paths to stdout (currently limited to 15):

378 

379```

380src/components/Button.tsx

381src/components/Modal.tsx

382src/components/Form.tsx

383```

384 

385**Example:**

386 

387```bash theme={null}

388#!/bin/bash

389query=$(cat | jq -r '.query')

390your-repo-file-index --query "$query" | head -20

391```

392 

393### Hook configuration

394 

395**Managed settings only**: Controls which hooks are allowed to run. This setting can only be configured in [managed settings](#settings-files) and provides administrators with strict control over hook execution.

137 396 

138* Read deny rules block file reads in sandbox397**Behavior when `allowManagedHooksOnly` is `true`:**

139* Edit allow rules permit file writes (in addition to the defaults, e.g. the current working directory)

140* Edit deny rules block writes within allowed paths

141 398 

142**Network access** is controlled via WebFetch permissions:399* Managed hooks and SDK hooks are loaded

400* User hooks, project hooks, and plugin hooks are blocked

143 401 

144* WebFetch allow rules permit network domains402**Configuration:**

145* WebFetch deny rules block network domains403 

404```json theme={null}

405{

406 "allowManagedHooksOnly": true

407}

408```

146 409 

147### Settings precedence410### Settings precedence

148 411 

149Settings are applied in order of precedence (highest to lowest):412Settings apply in order of precedence. From highest to lowest:

150 413 

1511. **Enterprise managed policies** (`managed-settings.json`)4141. **Managed settings** (`managed-settings.json`)

152 * Deployed by IT/DevOps415 * Policies deployed by IT/DevOps to system directories

153 * Cannot be overridden416 * Cannot be overridden by user or project settings

154 417 

1552. **Command line arguments**4182. **Command line arguments**

156 * Temporary overrides for a specific session419 * Temporary overrides for a specific session


1645. **User settings** (`~/.claude/settings.json`)4275. **User settings** (`~/.claude/settings.json`)

165 * Personal global settings428 * Personal global settings

166 429 

167This hierarchy ensures that enterprise security policies are always enforced while still allowing teams and individuals to customize their experience.430This hierarchy ensures that organizational policies are always enforced while still allowing teams and individuals to customize their experience.

431 

432For example, if your user settings allow `Bash(npm run:*)` but a project's shared settings deny it, the project setting takes precedence and the command is blocked.

168 433 

169### Key points about the configuration system434### Key points about the configuration system

170 435 

171* **Memory files (CLAUDE.md)**: Contain instructions and context that Claude loads at startup436* **Memory files (`CLAUDE.md`)**: Contain instructions and context that Claude loads at startup

172* **Settings files (JSON)**: Configure permissions, environment variables, and tool behavior437* **Settings files (JSON)**: Configure permissions, environment variables, and tool behavior

173* **Slash commands**: Custom commands that can be invoked during a session with `/command-name`438* **Skills**: Custom prompts that can be invoked with `/skill-name` or loaded by Claude automatically

174* **MCP servers**: Extend Claude Code with additional tools and integrations439* **MCP servers**: Extend Claude Code with additional tools and integrations

175* **Precedence**: Higher-level configurations (Enterprise) override lower-level ones (User/Project)440* **Precedence**: Higher-level configurations (Managed) override lower-level ones (User/Project)

176* **Inheritance**: Settings are merged, with more specific settings adding to or overriding broader ones441* **Inheritance**: Settings are merged, with more specific settings adding to or overriding broader ones

177 442 

178### System prompt availability443### System prompt

179 444 

180<Note>445Claude Code's internal system prompt is not published. To add custom instructions, use `CLAUDE.md` files or the `--append-system-prompt` flag.

181 Unlike for claude.ai, we do not publish Claude Code's internal system prompt on this website. Use CLAUDE.md files or `--append-system-prompt` to add custom instructions to Claude Code's behavior.

182</Note>

183 446 

184### Excluding sensitive files447### Excluding sensitive files

185 448 

186To prevent Claude Code from accessing files containing sensitive information (e.g., API keys, secrets, environment files), use the `permissions.deny` setting in your `.claude/settings.json` file:449To prevent Claude Code from accessing files containing sensitive information like API keys, secrets, and environment files, use the `permissions.deny` setting in your `.claude/settings.json` file:

187 450 

188```json theme={null}451```json theme={null}

189{452{


199}462}

200```463```

201 464 

202This replaces the deprecated `ignorePatterns` configuration. Files matching these patterns will be completely invisible to Claude Code, preventing any accidental exposure of sensitive data.465This replaces the deprecated `ignorePatterns` configuration. Files matching these patterns are excluded from file discovery and search results, and read operations on these files are denied.

203 466 

204## Subagent configuration467## Subagent configuration

205 468 


212 475 

213## Plugin configuration476## Plugin configuration

214 477 

215Claude Code supports a plugin system that lets you extend functionality with custom commands, agents, hooks, and MCP servers. Plugins are distributed through marketplaces and can be configured at both user and repository levels.478Claude Code supports a plugin system that lets you extend functionality with skills, agents, hooks, and MCP servers. Plugins are distributed through marketplaces and can be configured at both user and repository levels.

216 479 

217### Plugin settings480### Plugin settings

218 481 


221```json theme={null}484```json theme={null}

222{485{

223 "enabledPlugins": {486 "enabledPlugins": {

224 "formatter@company-tools": true,487 "formatter@acme-tools": true,

225 "deployer@company-tools": true,488 "deployer@acme-tools": true,

226 "analyzer@security-plugins": false489 "analyzer@security-plugins": false

227 },490 },

228 "extraKnownMarketplaces": {491 "extraKnownMarketplaces": {

229 "company-tools": {492 "acme-tools": {

230 "source": "github",493 "source": "github",

231 "repo": "company/claude-plugins"494 "repo": "acme-corp/claude-plugins"

232 }495 }

233 }496 }

234}497}


272```json theme={null}535```json theme={null}

273{536{

274 "extraKnownMarketplaces": {537 "extraKnownMarketplaces": {

275 "company-tools": {538 "acme-tools": {

276 "source": {539 "source": {

277 "source": "github",540 "source": "github",

278 "repo": "company-org/claude-plugins"541 "repo": "acme-corp/claude-plugins"

279 }542 }

280 },543 },

281 "security-plugins": {544 "security-plugins": {

282 "source": {545 "source": {

283 "source": "git",546 "source": "git",

284 "url": "https://git.company.com/security/plugins.git"547 "url": "https://git.example.com/security/plugins.git"

285 }548 }

286 }549 }

287 }550 }


293* `github`: GitHub repository (uses `repo`)556* `github`: GitHub repository (uses `repo`)

294* `git`: Any git URL (uses `url`)557* `git`: Any git URL (uses `url`)

295* `directory`: Local filesystem path (uses `path`, for development only)558* `directory`: Local filesystem path (uses `path`, for development only)

559* `hostPattern`: regex pattern to match marketplace hosts (uses `hostPattern`)

560 

561#### `strictKnownMarketplaces`

562 

563**Managed settings only**: Controls which plugin marketplaces users are allowed to add. This setting can only be configured in [`managed-settings.json`](/en/iam#managed-settings) and provides administrators with strict control over marketplace sources.

564 

565**Managed settings file locations**:

566 

567* **macOS**: `/Library/Application Support/ClaudeCode/managed-settings.json`

568* **Linux and WSL**: `/etc/claude-code/managed-settings.json`

569* **Windows**: `C:\Program Files\ClaudeCode\managed-settings.json`

570 

571**Key characteristics**:

572 

573* Only available in managed settings (`managed-settings.json`)

574* Cannot be overridden by user or project settings (highest precedence)

575* Enforced BEFORE network/filesystem operations (blocked sources never execute)

576* Uses exact matching for source specifications (including `ref`, `path` for git sources), except `hostPattern`, which uses regex matching

577 

578**Allowlist behavior**:

579 

580* `undefined` (default): No restrictions - users can add any marketplace

581* Empty array `[]`: Complete lockdown - users cannot add any new marketplaces

582* List of sources: Users can only add marketplaces that match exactly

583 

584**All supported source types**:

585 

586The allowlist supports seven marketplace source types. Most sources use exact matching, while `hostPattern` uses regex matching against the marketplace host.

587 

5881. **GitHub repositories**:

589 

590```json theme={null}

591{ "source": "github", "repo": "acme-corp/approved-plugins" }

592{ "source": "github", "repo": "acme-corp/security-tools", "ref": "v2.0" }

593{ "source": "github", "repo": "acme-corp/plugins", "ref": "main", "path": "marketplace" }

594```

595 

596Fields: `repo` (required), `ref` (optional: branch/tag/SHA), `path` (optional: subdirectory)

597 

5982. **Git repositories**:

599 

600```json theme={null}

601{ "source": "git", "url": "https://gitlab.example.com/tools/plugins.git" }

602{ "source": "git", "url": "https://bitbucket.org/acme-corp/plugins.git", "ref": "production" }

603{ "source": "git", "url": "ssh://git@git.example.com/plugins.git", "ref": "v3.1", "path": "approved" }

604```

605 

606Fields: `url` (required), `ref` (optional: branch/tag/SHA), `path` (optional: subdirectory)

607 

6083. **URL-based marketplaces**:

609 

610```json theme={null}

611{ "source": "url", "url": "https://plugins.example.com/marketplace.json" }

612{ "source": "url", "url": "https://cdn.example.com/marketplace.json", "headers": { "Authorization": "Bearer ${TOKEN}" } }

613```

614 

615Fields: `url` (required), `headers` (optional: HTTP headers for authenticated access)

616 

617<Note>

618 URL-based marketplaces only download the `marketplace.json` file. They do not download plugin files from the server. Plugins in URL-based marketplaces must use external sources (GitHub, npm, or git URLs) rather than relative paths. For plugins with relative paths, use a Git-based marketplace instead. See [Troubleshooting](/en/plugin-marketplaces#plugins-with-relative-paths-fail-in-url-based-marketplaces) for details.

619</Note>

620 

6214. **NPM packages**:

622 

623```json theme={null}

624{ "source": "npm", "package": "@acme-corp/claude-plugins" }

625{ "source": "npm", "package": "@acme-corp/approved-marketplace" }

626```

627 

628Fields: `package` (required, supports scoped packages)

629 

6305. **File paths**:

631 

632```json theme={null}

633{ "source": "file", "path": "/usr/local/share/claude/acme-marketplace.json" }

634{ "source": "file", "path": "/opt/acme-corp/plugins/marketplace.json" }

635```

636 

637Fields: `path` (required: absolute path to marketplace.json file)

638 

6396. **Directory paths**:

640 

641```json theme={null}

642{ "source": "directory", "path": "/usr/local/share/claude/acme-plugins" }

643{ "source": "directory", "path": "/opt/acme-corp/approved-marketplaces" }

644```

645 

646Fields: `path` (required: absolute path to directory containing `.claude-plugin/marketplace.json`)

647 

6487. **Host pattern matching**:

649 

650```json theme={null}

651{ "source": "hostPattern", "hostPattern": "^github\\.example\\.com$" }

652{ "source": "hostPattern", "hostPattern": "^gitlab\\.internal\\.example\\.com$" }

653```

654 

655Fields: `hostPattern` (required: regex pattern to match against the marketplace host)

656 

657Use host pattern matching when you want to allow all marketplaces from a specific host without enumerating each repository individually. This is useful for organizations with internal GitHub Enterprise or GitLab servers where developers create their own marketplaces.

658 

659Host extraction by source type:

660 

661* `github`: always matches against `github.com`

662* `git`: extracts hostname from the URL (supports both HTTPS and SSH formats)

663* `url`: extracts hostname from the URL

664* `npm`, `file`, `directory`: not supported for host pattern matching

665 

666**Configuration examples**:

667 

668Example: allow specific marketplaces only:

669 

670```json theme={null}

671{

672 "strictKnownMarketplaces": [

673 {

674 "source": "github",

675 "repo": "acme-corp/approved-plugins"

676 },

677 {

678 "source": "github",

679 "repo": "acme-corp/security-tools",

680 "ref": "v2.0"

681 },

682 {

683 "source": "url",

684 "url": "https://plugins.example.com/marketplace.json"

685 },

686 {

687 "source": "npm",

688 "package": "@acme-corp/compliance-plugins"

689 }

690 ]

691}

692```

693 

694Example - Disable all marketplace additions:

695 

696```json theme={null}

697{

698 "strictKnownMarketplaces": []

699}

700```

701 

702Example: allow all marketplaces from an internal git server:

703 

704```json theme={null}

705{

706 "strictKnownMarketplaces": [

707 {

708 "source": "hostPattern",

709 "hostPattern": "^github\\.example\\.com$"

710 }

711 ]

712}

713```

714 

715**Exact matching requirements**:

716 

717Marketplace sources must match **exactly** for a user's addition to be allowed. For git-based sources (`github` and `git`), this includes all optional fields:

718 

719* The `repo` or `url` must match exactly

720* The `ref` field must match exactly (or both be undefined)

721* The `path` field must match exactly (or both be undefined)

722 

723Examples of sources that **do NOT match**:

724 

725```json theme={null}

726// These are DIFFERENT sources:

727{ "source": "github", "repo": "acme-corp/plugins" }

728{ "source": "github", "repo": "acme-corp/plugins", "ref": "main" }

729 

730// These are also DIFFERENT:

731{ "source": "github", "repo": "acme-corp/plugins", "path": "marketplace" }

732{ "source": "github", "repo": "acme-corp/plugins" }

733```

734 

735**Comparison with `extraKnownMarketplaces`**:

736 

737| Aspect | `strictKnownMarketplaces` | `extraKnownMarketplaces` |

738| --------------------- | ------------------------------------ | ------------------------------------ |

739| **Purpose** | Organizational policy enforcement | Team convenience |

740| **Settings file** | `managed-settings.json` only | Any settings file |

741| **Behavior** | Blocks non-allowlisted additions | Auto-installs missing marketplaces |

742| **When enforced** | Before network/filesystem operations | After user trust prompt |

743| **Can be overridden** | No (highest precedence) | Yes (by higher precedence settings) |

744| **Source format** | Direct source object | Named marketplace with nested source |

745| **Use case** | Compliance, security restrictions | Onboarding, standardization |

746 

747**Format difference**:

748 

749`strictKnownMarketplaces` uses direct source objects:

750 

751```json theme={null}

752{

753 "strictKnownMarketplaces": [

754 { "source": "github", "repo": "acme-corp/plugins" }

755 ]

756}

757```

758 

759`extraKnownMarketplaces` requires named marketplaces:

760 

761```json theme={null}

762{

763 "extraKnownMarketplaces": {

764 "acme-tools": {

765 "source": { "source": "github", "repo": "acme-corp/plugins" }

766 }

767 }

768}

769```

770 

771**Important notes**:

772 

773* Restrictions are checked BEFORE any network requests or filesystem operations

774* When blocked, users see clear error messages indicating the source is blocked by managed policy

775* The restriction applies only to adding NEW marketplaces; previously installed marketplaces remain accessible

776* Managed settings have the highest precedence and cannot be overridden

777 

778See [Managed marketplace restrictions](/en/plugin-marketplaces#managed-marketplace-restrictions) for user-facing documentation.

296 779 

297### Managing plugins780### Managing plugins

298 781 


315</Note>798</Note>

316 799 

317| Variable | Purpose |800| Variable | Purpose |

318| :----------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |801| :-------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

319| `ANTHROPIC_API_KEY` | API key sent as `X-Api-Key` header, typically for the Claude SDK (for interactive usage, run `/login`) |802| `ANTHROPIC_API_KEY` | API key sent as `X-Api-Key` header, typically for the Claude SDK (for interactive usage, run `/login`) |

320| `ANTHROPIC_AUTH_TOKEN` | Custom value for the `Authorization` header (the value you set here will be prefixed with `Bearer `) |803| `ANTHROPIC_AUTH_TOKEN` | Custom value for the `Authorization` header (the value you set here will be prefixed with `Bearer `) |

321| `ANTHROPIC_CUSTOM_HEADERS` | Custom headers you want to add to the request (in `Name: Value` format) |804| `ANTHROPIC_CUSTOM_HEADERS` | Custom headers you want to add to the request (in `Name: Value` format) |


323| `ANTHROPIC_DEFAULT_OPUS_MODEL` | See [Model configuration](/en/model-config#environment-variables) |806| `ANTHROPIC_DEFAULT_OPUS_MODEL` | See [Model configuration](/en/model-config#environment-variables) |

324| `ANTHROPIC_DEFAULT_SONNET_MODEL` | See [Model configuration](/en/model-config#environment-variables) |807| `ANTHROPIC_DEFAULT_SONNET_MODEL` | See [Model configuration](/en/model-config#environment-variables) |

325| `ANTHROPIC_FOUNDRY_API_KEY` | API key for Microsoft Foundry authentication (see [Microsoft Foundry](/en/microsoft-foundry)) |808| `ANTHROPIC_FOUNDRY_API_KEY` | API key for Microsoft Foundry authentication (see [Microsoft Foundry](/en/microsoft-foundry)) |

809| `ANTHROPIC_FOUNDRY_BASE_URL` | Full base URL for the Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](/en/microsoft-foundry)) |

810| `ANTHROPIC_FOUNDRY_RESOURCE` | Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](/en/microsoft-foundry)) |

326| `ANTHROPIC_MODEL` | Name of the model setting to use (see [Model Configuration](/en/model-config#environment-variables)) |811| `ANTHROPIC_MODEL` | Name of the model setting to use (see [Model Configuration](/en/model-config#environment-variables)) |

327| `ANTHROPIC_SMALL_FAST_MODEL` | \[DEPRECATED] Name of [Haiku-class model for background tasks](/en/costs) |812| `ANTHROPIC_SMALL_FAST_MODEL` | \[DEPRECATED] Name of [Haiku-class model for background tasks](/en/costs) |

328| `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION` | Override AWS region for the Haiku-class model when using Bedrock |813| `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION` | Override AWS region for the Haiku-class model when using Bedrock |


330| `BASH_DEFAULT_TIMEOUT_MS` | Default timeout for long-running bash commands |815| `BASH_DEFAULT_TIMEOUT_MS` | Default timeout for long-running bash commands |

331| `BASH_MAX_OUTPUT_LENGTH` | Maximum number of characters in bash outputs before they are middle-truncated |816| `BASH_MAX_OUTPUT_LENGTH` | Maximum number of characters in bash outputs before they are middle-truncated |

332| `BASH_MAX_TIMEOUT_MS` | Maximum timeout the model can set for long-running bash commands |817| `BASH_MAX_TIMEOUT_MS` | Maximum timeout the model can set for long-running bash commands |

818| `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | Set the percentage of context capacity (1-100) at which auto-compaction triggers. By default, auto-compaction triggers at approximately 95% capacity. Use lower values like `50` to compact earlier. Values above the default threshold have no effect. Applies to both main conversations and subagents. This percentage aligns with the `context_window.used_percentage` field available in [status line](/en/statusline) |

333| `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR` | Return to the original working directory after each Bash command |819| `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR` | Return to the original working directory after each Bash command |

334| `CLAUDE_CODE_API_KEY_HELPER_TTL_MS` | Interval in milliseconds at which credentials should be refreshed (when using `apiKeyHelper`) |820| `CLAUDE_CODE_API_KEY_HELPER_TTL_MS` | Interval in milliseconds at which credentials should be refreshed (when using `apiKeyHelper`) |

335| `CLAUDE_CODE_CLIENT_CERT` | Path to client certificate file for mTLS authentication |821| `CLAUDE_CODE_CLIENT_CERT` | Path to client certificate file for mTLS authentication |

336| `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE` | Passphrase for encrypted CLAUDE\_CODE\_CLIENT\_KEY (optional) |822| `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE` | Passphrase for encrypted CLAUDE\_CODE\_CLIENT\_KEY (optional) |

337| `CLAUDE_CODE_CLIENT_KEY` | Path to client private key file for mTLS authentication |823| `CLAUDE_CODE_CLIENT_KEY` | Path to client private key file for mTLS authentication |

338| `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` | Set to `1` to disable Anthropic API-specific `anthropic-beta` headers. Use this if experiencing issues like "Unexpected value(s) for the `anthropic-beta` header" when using an LLM gateway with third-party providers |824| `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` | Set to `1` to disable Anthropic API-specific `anthropic-beta` headers. Use this if experiencing issues like "Unexpected value(s) for the `anthropic-beta` header" when using an LLM gateway with third-party providers |

825| `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` | Set to `1` to disable all background task functionality, including the `run_in_background` parameter on Bash and subagent tools, auto-backgrounding, and the Ctrl+B shortcut |

826| `CLAUDE_CODE_EXIT_AFTER_STOP_DELAY` | Time in milliseconds to wait after the query loop becomes idle before automatically exiting. Useful for automated workflows and scripts using SDK mode |

827| `CLAUDE_CODE_PROXY_RESOLVES_HOSTS` | Set to `true` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution |

828| `CLAUDE_CODE_TASK_LIST_ID` | Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](/en/interactive-mode#task-list) |

829| `CLAUDE_CODE_TMPDIR` | Override the temp directory used for internal temp files. Claude Code appends `/claude/` to this path. Default: `/tmp` on Unix/macOS, `os.tmpdir()` on Windows |

339| `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_BUG_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` |830| `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_BUG_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` |

340| `CLAUDE_CODE_DISABLE_TERMINAL_TITLE` | Set to `1` to disable automatic terminal title updates based on conversation context |831| `CLAUDE_CODE_DISABLE_TERMINAL_TITLE` | Set to `1` to disable automatic terminal title updates based on conversation context |

832| `CLAUDE_CODE_ENABLE_TASKS` | Set to `false` to temporarily revert to the previous TODO list instead of the task tracking system. Default: `true`. See [Task list](/en/interactive-mode#task-list) |

833| `CLAUDE_CODE_ENABLE_TELEMETRY` | Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](/en/monitoring-usage) |

834| `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS` | Override the default token limit for file reads. Useful when you need to read larger files in full |

835| `CLAUDE_CODE_HIDE_ACCOUNT_INFO` | Set to `1` to hide your email address and organization name from the Claude Code UI. Useful when streaming or recording |

341| `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL` | Skip auto-installation of IDE extensions |836| `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL` | Skip auto-installation of IDE extensions |

342| `CLAUDE_CODE_MAX_OUTPUT_TOKENS` | Set the maximum number of output tokens for most requests |837| `CLAUDE_CODE_MAX_OUTPUT_TOKENS` | Set the maximum number of output tokens for most requests. Default: 32,000. Maximum: 64,000. Increasing this value reduces the effective context window available before [auto-compaction](/en/costs#reduce-token-usage) triggers. |

343| `CLAUDE_CODE_SKIP_BEDROCK_AUTH` | Skip AWS authentication for Bedrock (e.g. when using an LLM gateway) |838| `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS` | Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](/en/monitoring-usage#dynamic-headers) |

344| `CLAUDE_CODE_SKIP_FOUNDRY_AUTH` | Skip Azure authentication for Microsoft Foundry (e.g. when using an LLM gateway) |839| `CLAUDE_CODE_SHELL` | Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) |

345| `CLAUDE_CODE_SKIP_VERTEX_AUTH` | Skip Google authentication for Vertex (e.g. when using an LLM gateway) |840| `CLAUDE_CODE_SHELL_PREFIX` | Command prefix to wrap all bash commands (for example, for logging or auditing). Example: `/path/to/logger.sh` will execute `/path/to/logger.sh <command>` |

841| `CLAUDE_CODE_SKIP_BEDROCK_AUTH` | Skip AWS authentication for Bedrock (for example, when using an LLM gateway) |

842| `CLAUDE_CODE_SKIP_FOUNDRY_AUTH` | Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) |

843| `CLAUDE_CODE_SKIP_VERTEX_AUTH` | Skip Google authentication for Vertex (for example, when using an LLM gateway) |

346| `CLAUDE_CODE_SUBAGENT_MODEL` | See [Model configuration](/en/model-config) |844| `CLAUDE_CODE_SUBAGENT_MODEL` | See [Model configuration](/en/model-config) |

347| `CLAUDE_CODE_USE_BEDROCK` | Use [Bedrock](/en/amazon-bedrock) |845| `CLAUDE_CODE_USE_BEDROCK` | Use [Bedrock](/en/amazon-bedrock) |

348| `CLAUDE_CODE_USE_FOUNDRY` | Use [Microsoft Foundry](/en/microsoft-foundry) |846| `CLAUDE_CODE_USE_FOUNDRY` | Use [Microsoft Foundry](/en/microsoft-foundry) |

349| `CLAUDE_CODE_USE_VERTEX` | Use [Vertex](/en/google-vertex-ai) |847| `CLAUDE_CODE_USE_VERTEX` | Use [Vertex](/en/google-vertex-ai) |

848| `CLAUDE_CONFIG_DIR` | Customize where Claude Code stores its configuration and data files |

350| `DISABLE_AUTOUPDATER` | Set to `1` to disable automatic updates. |849| `DISABLE_AUTOUPDATER` | Set to `1` to disable automatic updates. |

351| `DISABLE_BUG_COMMAND` | Set to `1` to disable the `/bug` command |850| `DISABLE_BUG_COMMAND` | Set to `1` to disable the `/bug` command |

352| `DISABLE_COST_WARNINGS` | Set to `1` to disable cost warning messages |851| `DISABLE_COST_WARNINGS` | Set to `1` to disable cost warning messages |

353| `DISABLE_ERROR_REPORTING` | Set to `1` to opt out of Sentry error reporting |852| `DISABLE_ERROR_REPORTING` | Set to `1` to opt out of Sentry error reporting |

853| `DISABLE_INSTALLATION_CHECKS` | Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations |

354| `DISABLE_NON_ESSENTIAL_MODEL_CALLS` | Set to `1` to disable model calls for non-critical paths like flavor text |854| `DISABLE_NON_ESSENTIAL_MODEL_CALLS` | Set to `1` to disable model calls for non-critical paths like flavor text |

355| `DISABLE_PROMPT_CACHING` | Set to `1` to disable prompt caching for all models (takes precedence over per-model settings) |855| `DISABLE_PROMPT_CACHING` | Set to `1` to disable prompt caching for all models (takes precedence over per-model settings) |

356| `DISABLE_PROMPT_CACHING_HAIKU` | Set to `1` to disable prompt caching for Haiku models |856| `DISABLE_PROMPT_CACHING_HAIKU` | Set to `1` to disable prompt caching for Haiku models |

357| `DISABLE_PROMPT_CACHING_OPUS` | Set to `1` to disable prompt caching for Opus models |857| `DISABLE_PROMPT_CACHING_OPUS` | Set to `1` to disable prompt caching for Opus models |

358| `DISABLE_PROMPT_CACHING_SONNET` | Set to `1` to disable prompt caching for Sonnet models |858| `DISABLE_PROMPT_CACHING_SONNET` | Set to `1` to disable prompt caching for Sonnet models |

359| `DISABLE_TELEMETRY` | Set to `1` to opt out of Statsig telemetry (note that Statsig events do not include user data like code, file paths, or bash commands) |859| `DISABLE_TELEMETRY` | Set to `1` to opt out of Statsig telemetry (note that Statsig events do not include user data like code, file paths, or bash commands) |

860| `ENABLE_TOOL_SEARCH` | Controls [MCP tool search](/en/mcp#scale-with-mcp-tool-search). Values: `auto` (default, enables at 10% context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `true` (always on), `false` (disabled) |

861| `FORCE_AUTOUPDATE_PLUGINS` | Set to `true` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` |

360| `HTTP_PROXY` | Specify HTTP proxy server for network connections |862| `HTTP_PROXY` | Specify HTTP proxy server for network connections |

361| `HTTPS_PROXY` | Specify HTTPS proxy server for network connections |863| `HTTPS_PROXY` | Specify HTTPS proxy server for network connections |

864| `IS_DEMO` | Set to `true` to enable demo mode: hides email and organization from the UI, skips onboarding, and hides internal commands. Useful for streaming or recording sessions |

362| `MAX_MCP_OUTPUT_TOKENS` | Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens (default: 25000) |865| `MAX_MCP_OUTPUT_TOKENS` | Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens (default: 25000) |

363| `MAX_THINKING_TOKENS` | Enable [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) and set the token budget for the thinking process. Extended thinking improves performance on complex reasoning and coding tasks but impacts [prompt caching efficiency](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#caching-with-thinking-blocks). Disabled by default. |866| `MAX_THINKING_TOKENS` | Override the [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) token budget. Thinking is enabled at max budget (31,999 tokens) by default. Use this to limit the budget (for example, `MAX_THINKING_TOKENS=10000`) or disable thinking entirely (`MAX_THINKING_TOKENS=0`). Extended thinking improves performance on complex reasoning and coding tasks but impacts [prompt caching efficiency](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#caching-with-thinking-blocks). |

364| `MCP_TIMEOUT` | Timeout in milliseconds for MCP server startup |867| `MCP_TIMEOUT` | Timeout in milliseconds for MCP server startup |

365| `MCP_TOOL_TIMEOUT` | Timeout in milliseconds for MCP tool execution |868| `MCP_TOOL_TIMEOUT` | Timeout in milliseconds for MCP tool execution |

366| `NO_PROXY` | List of domains and IPs to which requests will be directly issued, bypassing proxy |869| `NO_PROXY` | List of domains and IPs to which requests will be directly issued, bypassing proxy |

367| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Maximum number of characters for slash command metadata shown to [SlashCommand tool](/en/slash-commands#slashcommand-tool) (default: 15000) |870| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Maximum number of characters for skill metadata shown to the [Skill tool](/en/skills#control-who-invokes-a-skill) (default: 15000). Legacy name kept for backwards compatibility. |

368| `USE_BUILTIN_RIPGREP` | Set to `0` to use system-installed `rg` intead of `rg` included with Claude Code |871| `USE_BUILTIN_RIPGREP` | Set to `0` to use system-installed `rg` instead of `rg` included with Claude Code |

369| `VERTEX_REGION_CLAUDE_3_5_HAIKU` | Override region for Claude 3.5 Haiku when using Vertex AI |872| `VERTEX_REGION_CLAUDE_3_5_HAIKU` | Override region for Claude 3.5 Haiku when using Vertex AI |

370| `VERTEX_REGION_CLAUDE_3_7_SONNET` | Override region for Claude 3.7 Sonnet when using Vertex AI |873| `VERTEX_REGION_CLAUDE_3_7_SONNET` | Override region for Claude 3.7 Sonnet when using Vertex AI |

371| `VERTEX_REGION_CLAUDE_4_0_OPUS` | Override region for Claude 4.0 Opus when using Vertex AI |874| `VERTEX_REGION_CLAUDE_4_0_OPUS` | Override region for Claude 4.0 Opus when using Vertex AI |


377Claude Code has access to a set of powerful tools that help it understand and modify your codebase:880Claude Code has access to a set of powerful tools that help it understand and modify your codebase:

378 881 

379| Tool | Description | Permission Required |882| Tool | Description | Permission Required |

380| :------------------ | :--------------------------------------------------------------------------------- | :------------------ |883| :------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------ |

381| **AskUserQuestion** | Asks the user multiple choice questions to gather information or clarify ambiguity | No |884| **AskUserQuestion** | Asks multiple-choice questions to gather requirements or clarify ambiguity | No |

382| **Bash** | Executes shell commands in your environment | Yes |885| **Bash** | Executes shell commands in your environment (see [Bash tool behavior](#bash-tool-behavior) below) | Yes |

383| **BashOutput** | Retrieves output from a background bash shell | No |886| **TaskOutput** | Retrieves output from a background task (bash shell or subagent) | No |

384| **Edit** | Makes targeted edits to specific files | Yes |887| **Edit** | Makes targeted edits to specific files | Yes |

385| **ExitPlanMode** | Prompts the user to exit plan mode and start coding | Yes |888| **ExitPlanMode** | Prompts the user to exit plan mode and start coding | Yes |

386| **Glob** | Finds files based on pattern matching | No |889| **Glob** | Finds files based on pattern matching | No |

387| **Grep** | Searches for patterns in file contents | No |890| **Grep** | Searches for patterns in file contents | No |

388| **KillShell** | Kills a running background bash shell by its ID | No |891| **KillShell** | Kills a running background bash shell by its ID | No |

892| **MCPSearch** | Searches for and loads MCP tools when [tool search](/en/mcp#scale-with-mcp-tool-search) is enabled | No |

389| **NotebookEdit** | Modifies Jupyter notebook cells | Yes |893| **NotebookEdit** | Modifies Jupyter notebook cells | Yes |

390| **Read** | Reads the contents of files | No |894| **Read** | Reads the contents of files | No |

391| **Skill** | Executes a skill within the main conversation | Yes |895| **Skill** | Executes a [skill](/en/skills#control-who-invokes-a-skill) within the main conversation | Yes |

392| **SlashCommand** | Runs a [custom slash command](/en/slash-commands#slashcommand-tool) | Yes |

393| **Task** | Runs a sub-agent to handle complex, multi-step tasks | No |896| **Task** | Runs a sub-agent to handle complex, multi-step tasks | No |

394| **TodoWrite** | Creates and manages structured task lists | No |897| **TaskCreate** | Creates a new task in the task list | No |

898| **TaskGet** | Retrieves full details for a specific task | No |

899| **TaskList** | Lists all tasks with their current status | No |

900| **TaskUpdate** | Updates task status, dependencies, or details | No |

395| **WebFetch** | Fetches content from a specified URL | Yes |901| **WebFetch** | Fetches content from a specified URL | Yes |

396| **WebSearch** | Performs web searches with domain filtering | Yes |902| **WebSearch** | Performs web searches with domain filtering | Yes |

397| **Write** | Creates or overwrites files | Yes |903| **Write** | Creates or overwrites files | Yes |

904| **LSP** | Code intelligence via language servers. Reports type errors and warnings automatically after file edits. Also supports navigation operations: jump to definitions, find references, get type info, list symbols, find implementations, trace call hierarchies. Requires a [code intelligence plugin](/en/discover-plugins#code-intelligence) and its language server binary | No |

398 905 

399Permission rules can be configured using `/allowed-tools` or in [permission settings](/en/settings#available-settings). Also see [Tool-specific permission rules](/en/iam#tool-specific-permission-rules).906Permission rules can be configured using `/allowed-tools` or in [permission settings](/en/settings#available-settings). Also see [Tool-specific permission rules](/en/iam#tool-specific-permission-rules).

400 907 

908### Bash tool behavior

909 

910The Bash tool executes shell commands with the following persistence behavior:

911 

912* **Working directory persists**: When Claude changes the working directory (for example, `cd /path/to/dir`), subsequent Bash commands will execute in that directory. You can use `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=1` to reset to the project directory after each command.

913* **Environment variables do NOT persist**: Environment variables set in one Bash command (for example, `export MY_VAR=value`) are **not** available in subsequent Bash commands. Each Bash command runs in a fresh shell environment.

914 

915To make environment variables available in Bash commands, you have **three options**:

916 

917**Option 1: Activate environment before starting Claude Code** (simplest approach)

918 

919Activate your virtual environment in your terminal before launching Claude Code:

920 

921```bash theme={null}

922conda activate myenv

923# or: source /path/to/venv/bin/activate

924claude

925```

926 

927This works for shell environments but environment variables set within Claude's Bash commands will not persist between commands.

928 

929**Option 2: Set CLAUDE\_ENV\_FILE before starting Claude Code** (persistent environment setup)

930 

931Export the path to a shell script containing your environment setup:

932 

933```bash theme={null}

934export CLAUDE_ENV_FILE=/path/to/env-setup.sh

935claude

936```

937 

938Where `/path/to/env-setup.sh` contains:

939 

940```bash theme={null}

941conda activate myenv

942# or: source /path/to/venv/bin/activate

943# or: export MY_VAR=value

944```

945 

946Claude Code will source this file before each Bash command, making the environment persistent across all commands.

947 

948**Option 3: Use a SessionStart hook** (project-specific configuration)

949 

950Configure in `.claude/settings.json`:

951 

952```json theme={null}

953{

954 "hooks": {

955 "SessionStart": [{

956 "matcher": "startup",

957 "hooks": [{

958 "type": "command",

959 "command": "echo 'conda activate myenv' >> \"$CLAUDE_ENV_FILE\""

960 }]

961 }]

962 }

963}

964```

965 

966The hook writes to `$CLAUDE_ENV_FILE`, which is then sourced before each Bash command. This is ideal for team-shared project configurations.

967 

968See [SessionStart hooks](/en/hooks#persisting-environment-variables) for more details on Option 3.

969 

401### Extending tools with hooks970### Extending tools with hooks

402 971 

403You can run custom commands before or after any tool executes using972You can run custom commands before or after any tool executes using


409 978 

410## See also979## See also

411 980 

412* [Identity and Access Management](/en/iam#configuring-permissions) - Learn about Claude Code's permission system981* [Identity and Access Management](/en/iam#configuring-permissions) - Permission system overview and how allow/ask/deny rules interact

413* [IAM and access control](/en/iam#enterprise-managed-policy-settings) - Enterprise policy management982* [Tool-specific permission rules](/en/iam#tool-specific-permission-rules) - Detailed patterns for Bash, Read, Edit, WebFetch, MCP, and Task tools, including security limitations

414* [Troubleshooting](/en/troubleshooting#auto-updater-issues) - Solutions for common configuration issues983* [Managed settings](/en/iam#managed-settings) - Managed policy configuration for organizations

984* [Troubleshooting](/en/troubleshooting) - Solutions for common configuration issues

setup.md +230 −105

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Set up Claude Code5# Set up Claude Code

2 6 

3> Install, authenticate, and start using Claude Code on your development machine.7> Install, authenticate, and start using Claude Code on your development machine.

4 8 

5## System requirements9## System requirements

6 10 

7* **Operating Systems**: macOS 10.15+, Ubuntu 20.04+/Debian 10+, or Windows 10+ (with WSL 1, WSL 2, or Git for Windows)11* **Operating Systems**: macOS 13.0+, Ubuntu 20.04+/Debian 10+, or Windows 10+ (with WSL 1, WSL 2, or Git for Windows)

8* **Hardware**: 4GB+ RAM12* **Hardware**: 4 GB+ RAM

9* **Software**: [Node.js 18+](https://nodejs.org/en/download) (only required for NPM installation)13* **Network**: Internet connection required (see [network configuration](/en/network-config#network-access-requirements))

10* **Network**: Internet connection required for authentication and AI processing14* **Shell**: Works best in Bash or Zsh

11* **Shell**: Works best in Bash, Zsh or Fish

12* **Location**: [Anthropic supported countries](https://www.anthropic.com/supported-countries)15* **Location**: [Anthropic supported countries](https://www.anthropic.com/supported-countries)

13 16 

14### Additional dependencies17### Additional dependencies

15 18 

16* **ripgrep**: Usually included with Claude Code. If search functionality fails, see [search troubleshooting](/en/troubleshooting#search-and-discovery-issues).19* **ripgrep**: Usually included with Claude Code. If search fails, see [search troubleshooting](/en/troubleshooting#search-and-discovery-issues).

20* **[Node.js 18+](https://nodejs.org/en/download)**: Only required for [deprecated npm installation](#npm-installation-deprecated)

17 21 

18## Standard installation22## Installation

19 23 

20To install Claude Code, use one of the following methods:24To install Claude Code, use one of the following methods:

21 25 

22<Tabs>26<Tabs>

23 <Tab title="Native Install (Recommended)">27 <Tab title="Native Install (Recommended)">

24 **Homebrew (macOS, Linux):**

25 

26 ```sh theme={null}

27 brew install --cask claude-code

28 ```

29 

30 **macOS, Linux, WSL:**28 **macOS, Linux, WSL:**

31 29 

32 ```bash theme={null}30 ```bash theme={null}


44 ```batch theme={null}42 ```batch theme={null}

45 curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd43 curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

46 ```44 ```

47 </Tab>

48 45 

49 <Tab title="NPM">46 <Info>

50 If you have [Node.js 18 or newer installed](https://nodejs.org/en/download/):47 Native installations automatically update in the background to keep you on the latest version.

48 </Info>

49 </Tab>

51 50 

51 <Tab title="Homebrew">

52 ```sh theme={null}52 ```sh theme={null}

53 npm install -g @anthropic-ai/claude-code53 brew install --cask claude-code

54 ```54 ```

55 

56 <Info>

57 Homebrew installations do not auto-update. Run `brew upgrade claude-code` periodically to get the latest features and security fixes.

58 </Info>

55 </Tab>59 </Tab>

56</Tabs>

57 60 

58<Note>61 <Tab title="WinGet">

59 Some users may be automatically migrated to an improved installation method.62 ```powershell theme={null}

60</Note>63 winget install Anthropic.ClaudeCode

64 ```

65 

66 <Info>

67 WinGet installations do not auto-update. Run `winget upgrade Anthropic.ClaudeCode` periodically to get the latest features and security fixes.

68 </Info>

69 </Tab>

70</Tabs>

61 71 

62After the installation process completes, navigate to your project and start Claude Code:72After the installation process completes, navigate to your project and start Claude Code:

63 73 


66claude76claude

67```77```

68 78 

69Claude Code offers the following authentication options:79If you encounter any issues during installation, consult the [troubleshooting guide](/en/troubleshooting).

70 

711. **Claude Console**: The default option. Connect through the Claude Console and complete the OAuth process. Requires active billing at [console.anthropic.com](https://console.anthropic.com). A "Claude Code" workspace will be automatically created for usage tracking and cost management. Note that you cannot create API keys for the Claude Code workspace - it is dedicated exclusively for Claude Code usage.

722. **Claude App (with Pro or Max plan)**: Subscribe to Claude's [Pro or Max plan](https://claude.com/pricing) for a unified subscription that includes both Claude Code and the web interface. Get more value at the same price point while managing your account in one place. Log in with your Claude.ai account. During launch, choose the option that matches your subscription type.

733. **Enterprise platforms**: Configure Claude Code to use [Amazon Bedrock, Google Vertex AI, or Microsoft Foundry](/en/third-party-integrations) for enterprise deployments with your existing cloud infrastructure.

74 

75<Note>

76 Claude Code securely stores your credentials. See [Credential Management](/en/iam#credential-management) for details.

77</Note>

78 

79## Windows setup

80 

81**Option 1: Claude Code within WSL**

82 

83* Both WSL 1 and WSL 2 are supported

84 

85**Option 2: Claude Code on native Windows with Git Bash**

86 

87* Requires [Git for Windows](https://git-scm.com/downloads/win)

88* For portable Git installations, specify the path to your `bash.exe`:

89 ```powershell theme={null}

90 $env:CLAUDE_CODE_GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe"

91 ```

92 

93## Alternative installation methods

94 

95Claude Code offers multiple installation methods to suit different environments.

96 

97If you encounter any issues during installation, consult the [troubleshooting guide](/en/troubleshooting#linux-permission-issues).

98 80 

99<Tip>81<Tip>

100 Run `claude doctor` after installation to check your installation type and version.82 Run `claude doctor` after installation to check your installation type and version.

101</Tip>83</Tip>

102 84 

103### Native installation options85<Note>

86 **Alpine Linux and other musl/uClibc-based distributions**: The native installer requires `libgcc`, `libstdc++`, and `ripgrep`. For Alpine: `apk add libgcc libstdc++ ripgrep`. Set `USE_BUILTIN_RIPGREP=0`.

87</Note>

104 88 

105The native installation is the recommended method and offers several benefits:89### Authentication

106 90 

107* One self-contained executable91#### For individuals

108* No Node.js dependency

109* Improved auto-updater stability

110 92 

111If you have an existing installation of Claude Code, use `claude install` to migrate to the native binary installation.931. **Claude Pro or Max plan** (recommended): Subscribe to Claude's [Pro or Max plan](https://claude.ai/pricing) for a unified subscription that includes both Claude Code and Claude on the web. Manage your account in one place and log in with your Claude.ai account.

942. **Claude Console**: Connect through the [Claude Console](https://console.anthropic.com) and complete the OAuth process. Requires active billing in the Anthropic Console. A "Claude Code" workspace is automatically created for usage tracking and cost management. You can't create API keys for the Claude Code workspace; it's dedicated exclusively for Claude Code usage.

112 95 

113For advanced installation options with the native installer:96#### For teams and organizations

114 97 

115**macOS, Linux, WSL:**981. **Claude for Teams or Enterprise** (recommended): Subscribe to [Claude for Teams](https://claude.com/pricing#team-&-enterprise) or [Claude for Enterprise](https://anthropic.com/contact-sales) for centralized billing, team management, and access to both Claude Code and Claude on the web. Team members log in with their Claude.ai accounts.

992. **Claude Console with team billing**: Set up a shared [Claude Console](https://console.anthropic.com) organization with team billing. Invite team members and assign roles for usage tracking.

1003. **Cloud providers**: Configure Claude Code to use [Amazon Bedrock, Google Vertex AI, or Microsoft Foundry](/en/third-party-integrations) for deployments with your existing cloud infrastructure.

116 101 

117```bash theme={null}102### Install a specific version

118# Install stable version (default)

119curl -fsSL https://claude.ai/install.sh | bash

120 103 

121# Install latest version104The native installer accepts either a specific version number or a release channel (`latest` or `stable`). The channel you choose at install time becomes your default for auto-updates. See [Configure release channel](#configure-release-channel) for more information.

122curl -fsSL https://claude.ai/install.sh | bash -s latest

123 105 

124# Install specific version number106To install the latest version (default):

125curl -fsSL https://claude.ai/install.sh | bash -s 1.0.58

126```

127 107 

128<Note>108<Tabs>

129 **Alpine Linux and other musl/uClibc-based distributions**: The native build requires you to install `libgcc`, `libstdc++`, and `ripgrep`. Install (Alpine: `apk add libgcc libstdc++ ripgrep`) and set `USE_BUILTIN_RIPGREP=0`.109 <Tab title="macOS, Linux, WSL">

130</Note>110 ```bash theme={null}

111 curl -fsSL https://claude.ai/install.sh | bash

112 ```

113 </Tab>

131 114 

132<Note>115 <Tab title="Windows PowerShell">

133 Claude Code installed via Homebrew will auto-update outside of the brew directory unless explicitly disabled with the `DISABLE_AUTOUPDATER` environment variable (see [Auto updates](#auto-updates) section).116 ```powershell theme={null}

134</Note>117 irm https://claude.ai/install.ps1 | iex

118 ```

119 </Tab>

135 120 

136**Windows PowerShell:**121 <Tab title="Windows CMD">

122 ```batch theme={null}

123 curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

124 ```

125 </Tab>

126</Tabs>

137 127 

138```powershell theme={null}128To install the stable version:

139# Install stable version (default)

140irm https://claude.ai/install.ps1 | iex

141 129 

142# Install latest version130<Tabs>

143& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) latest131 <Tab title="macOS, Linux, WSL">

132 ```bash theme={null}

133 curl -fsSL https://claude.ai/install.sh | bash -s stable

134 ```

135 </Tab>

144 136 

145# Install specific version number137 <Tab title="Windows PowerShell">

146& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) 1.0.58138 ```powershell theme={null}

147```139 & ([scriptblock]::Create((irm https://claude.ai/install.ps1))) stable

140 ```

141 </Tab>

148 142 

149**Windows CMD:**143 <Tab title="Windows CMD">

144 ```batch theme={null}

145 curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd stable && del install.cmd

146 ```

147 </Tab>

148</Tabs>

150 149 

151```batch theme={null}150To install a specific version number:

152REM Install stable version (default)

153curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

154 151 

155REM Install latest version152<Tabs>

156curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd latest && del install.cmd153 <Tab title="macOS, Linux, WSL">

154 ```bash theme={null}

155 curl -fsSL https://claude.ai/install.sh | bash -s 1.0.58

156 ```

157 </Tab>

157 158 

158REM Install specific version number159 <Tab title="Windows PowerShell">

159curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd 1.0.58 && del install.cmd160 ```powershell theme={null}

160```161 & ([scriptblock]::Create((irm https://claude.ai/install.ps1))) 1.0.58

162 ```

163 </Tab>

161 164 

162<Tip>165 <Tab title="Windows CMD">

163 Make sure that you remove any outdated aliases or symlinks before installing.166 ```batch theme={null}

164</Tip>167 curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd 1.0.58 && del install.cmd

168 ```

169 </Tab>

170</Tabs>

165 171 

166**Binary integrity and code signing**172### Binary integrity and code signing

167 173 

168* SHA256 checksums for all platforms are published in the release manifests, currently located at `https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{VERSION}/manifest.json` (example: replace `{VERSION}` with `2.0.30`)174* SHA256 checksums for all platforms are published in the release manifests, currently located at `https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{VERSION}/manifest.json` (example: replace `{VERSION}` with `2.0.30`)

169* Signed binaries are distributed for the following platforms:175* Signed binaries are distributed for the following platforms:

170 * macOS: Signed by "Anthropic PBC" and notarized by Apple176 * macOS: Signed by "Anthropic PBC" and notarized by Apple

171 * Windows: Signed by "Anthropic, PBC"177 * Windows: Signed by "Anthropic, PBC"

172 178 

173### NPM installation179## NPM installation (deprecated)

180 

181NPM installation is deprecated. Use the [native installation](#installation) method when possible. To migrate an existing npm installation to native, run `claude install`.

174 182 

175For environments where NPM is preferred or required:183**Global npm installation**

176 184 

177```sh theme={null}185```sh theme={null}

178npm install -g @anthropic-ai/claude-code186npm install -g @anthropic-ai/claude-code


180 188 

181<Warning>189<Warning>

182 Do NOT use `sudo npm install -g` as this can lead to permission issues and security risks.190 Do NOT use `sudo npm install -g` as this can lead to permission issues and security risks.

183 If you encounter permission errors, see [configure Claude Code](/en/troubleshooting#linux-permission-issues) for recommended solutions.191 If you encounter permission errors, see [troubleshooting permission errors](/en/troubleshooting#command-not-found-claude-or-permission-errors) for recommended solutions.

184</Warning>192</Warning>

185 193 

186### Local installation194## Windows setup

187 195 

188* After global install via npm, use `claude migrate-installer` to move to local196**Option 1: Claude Code within WSL**

189* Avoids autoupdater npm permission issues

190* Some users may be automatically migrated to this method

191 197 

192## Running on AWS or GCP198* Both WSL 1 and WSL 2 are supported

199* WSL 2 supports [sandboxing](/en/sandboxing) for enhanced security. WSL 1 does not support sandboxing.

193 200 

194By default, Claude Code uses the Claude API.201**Option 2: Claude Code on native Windows with Git Bash**

195 202 

196For details on running Claude Code on AWS or GCP, see [third-party integrations](/en/third-party-integrations).203* Requires [Git for Windows](https://git-scm.com/downloads/win)

204* For portable Git installations, specify the path to your `bash.exe`:

205 ```powershell theme={null}

206 $env:CLAUDE_CODE_GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe"

207 ```

197 208 

198## Update Claude Code209## Update Claude Code

199 210 


206* **Notifications**: You'll see a notification when updates are installed217* **Notifications**: You'll see a notification when updates are installed

207* **Applying updates**: Updates take effect the next time you start Claude Code218* **Applying updates**: Updates take effect the next time you start Claude Code

208 219 

209**Disable auto-updates:**220<Note>

221 Homebrew and WinGet installations do not auto-update. Use `brew upgrade claude-code` or `winget upgrade Anthropic.ClaudeCode` to update manually.

222 

223 **Known issue:** Claude Code may notify you of updates before the new version is available in these package managers. If an upgrade fails, wait and try again later.

224</Note>

225 

226### Configure release channel

227 

228Configure which release channel Claude Code follows for both auto-updates and `claude update` with the `autoUpdatesChannel` setting:

229 

230* `"latest"` (default): Receive new features as soon as they're released

231* `"stable"`: Use a version that is typically about one week old, skipping releases with major regressions

232 

233Configure this via `/config` → **Auto-update channel**, or add it to your [settings.json file](/en/settings):

234 

235```json theme={null}

236{

237 "autoUpdatesChannel": "stable"

238}

239```

240 

241For enterprise deployments, you can enforce a consistent release channel across your organization using [managed settings](/en/iam#managed-settings).

242 

243### Disable auto-updates

210 244 

211Set the `DISABLE_AUTOUPDATER` environment variable in your shell or [settings.json file](/en/settings):245Set the `DISABLE_AUTOUPDATER` environment variable in your shell or [settings.json file](/en/settings):

212 246 


219```bash theme={null}253```bash theme={null}

220claude update254claude update

221```255```

256 

257## Uninstall Claude Code

258 

259If you need to uninstall Claude Code, follow the instructions for your installation method.

260 

261### Native installation

262 

263Remove the Claude Code binary and version files:

264 

265**macOS, Linux, WSL:**

266 

267```bash theme={null}

268rm -f ~/.local/bin/claude

269rm -rf ~/.local/share/claude

270```

271 

272**Windows PowerShell:**

273 

274```powershell theme={null}

275Remove-Item -Path "$env:USERPROFILE\.local\bin\claude.exe" -Force

276Remove-Item -Path "$env:USERPROFILE\.local\share\claude" -Recurse -Force

277```

278 

279**Windows CMD:**

280 

281```batch theme={null}

282del "%USERPROFILE%\.local\bin\claude.exe"

283rmdir /s /q "%USERPROFILE%\.local\share\claude"

284```

285 

286### Homebrew installation

287 

288```bash theme={null}

289brew uninstall --cask claude-code

290```

291 

292### WinGet installation

293 

294```powershell theme={null}

295winget uninstall Anthropic.ClaudeCode

296```

297 

298### NPM installation

299 

300```bash theme={null}

301npm uninstall -g @anthropic-ai/claude-code

302```

303 

304### Clean up configuration files (optional)

305 

306<Warning>

307 Removing configuration files will delete all your settings, allowed tools, MCP server configurations, and session history.

308</Warning>

309 

310To remove Claude Code settings and cached data:

311 

312**macOS, Linux, WSL:**

313 

314```bash theme={null}

315# Remove user settings and state

316rm -rf ~/.claude

317rm ~/.claude.json

318 

319# Remove project-specific settings (run from your project directory)

320rm -rf .claude

321rm -f .mcp.json

322```

323 

324**Windows PowerShell:**

325 

326```powershell theme={null}

327# Remove user settings and state

328Remove-Item -Path "$env:USERPROFILE\.claude" -Recurse -Force

329Remove-Item -Path "$env:USERPROFILE\.claude.json" -Force

330 

331# Remove project-specific settings (run from your project directory)

332Remove-Item -Path ".claude" -Recurse -Force

333Remove-Item -Path ".mcp.json" -Force

334```

335 

336**Windows CMD:**

337 

338```batch theme={null}

339REM Remove user settings and state

340rmdir /s /q "%USERPROFILE%\.claude"

341del "%USERPROFILE%\.claude.json"

342 

343REM Remove project-specific settings (run from your project directory)

344rmdir /s /q ".claude"

345del ".mcp.json"

346```

skills.md +485 −416

Details

1# Agent Skills1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

2 4 

3> Create, manage, and share Skills to extend Claude's capabilities in Claude Code.5# Extend Claude with skills

4 6 

5This guide shows you how to create, use, and manage Agent Skills in Claude Code. Skills are modular capabilities that extend Claude's functionality through organized folders containing instructions, scripts, and resources.7> Create, manage, and share skills to extend Claude's capabilities in Claude Code. Includes custom slash commands.

6 8 

7## Prerequisites9Skills extend what Claude can do. Create a `SKILL.md` file with instructions, and Claude adds it to its toolkit. Claude uses skills when relevant, or you can invoke one directly with `/skill-name`.

8 

9* Claude Code version 1.0 or later

10* Basic familiarity with [Claude Code](/en/quickstart)

11 

12## What are Agent Skills?

13 

14Agent Skills package expertise into discoverable capabilities. Each Skill consists of a `SKILL.md` file with instructions that Claude reads when relevant, plus optional supporting files like scripts and templates.

15 

16**How Skills are invoked**: Skills are **model-invoked**—Claude autonomously decides when to use them based on your request and the Skill's description. This is different from slash commands, which are **user-invoked** (you explicitly type `/command` to trigger them).

17 

18**Benefits**:

19 

20* Extend Claude's capabilities for your specific workflows

21* Share expertise across your team via git

22* Reduce repetitive prompting

23* Compose multiple Skills for complex tasks

24 

25Learn more in the [Agent Skills overview](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/overview).

26 10 

27<Note>11<Note>

28 For a deep dive into the architecture and real-world applications of Agent Skills, read our engineering blog: [Equipping agents for the real world with Agent Skills](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills).12 For built-in commands like `/help` and `/compact`, see [interactive mode](/en/interactive-mode#built-in-commands).

13 

14 **Custom slash commands have been merged into skills.** A file at `.claude/commands/review.md` and a skill at `.claude/skills/review/SKILL.md` both create `/review` and work the same way. Your existing `.claude/commands/` files keep working. Skills add optional features: a directory for supporting files, frontmatter to [control whether you or Claude invokes them](#control-who-invokes-a-skill), and the ability for Claude to load them automatically when relevant.

29</Note>15</Note>

30 16 

31## Create a Skill17Claude Code skills follow the [Agent Skills](https://agentskills.io) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like [invocation control](#control-who-invokes-a-skill), [subagent execution](#run-skills-in-a-subagent), and [dynamic context injection](#inject-dynamic-context).

32 18 

33Skills are stored as directories containing a `SKILL.md` file.19## Getting started

34 20 

35### Personal Skills21### Create your first skill

36 22 

37Personal Skills are available across all your projects. Store them in `~/.claude/skills/`:23This example creates a skill that teaches Claude to explain code using visual diagrams and analogies. Since it uses default frontmatter, Claude can load it automatically when you ask how something works, or you can invoke it directly with `/explain-code`.

38 24 

39```bash theme={null}25<Steps>

40mkdir -p ~/.claude/skills/my-skill-name26 <Step title="Create the skill directory">

41```27 Create a directory for the skill in your personal skills folder. Personal skills are available across all your projects.

42 28 

43**Use personal Skills for**:29 ```bash theme={null}

30 mkdir -p ~/.claude/skills/explain-code

31 ```

32 </Step>

44 33 

45* Your individual workflows and preferences34 <Step title="Write SKILL.md">

46* Experimental Skills you're developing35 Every skill needs a `SKILL.md` file with two parts: YAML frontmatter (between `---` markers) that tells Claude when to use the skill, and markdown content with instructions Claude follows when the skill is invoked. The `name` field becomes the `/slash-command`, and the `description` helps Claude decide when to load it automatically.

47* Personal productivity tools

48 36 

49### Project Skills37 Create `~/.claude/skills/explain-code/SKILL.md`:

50 38 

51Project Skills are shared with your team. Store them in `.claude/skills/` within your project:39 ```yaml theme={null}

40 ---

41 name: explain-code

42 description: Explains code with visual diagrams and analogies. Use when explaining how code works, teaching about a codebase, or when the user asks "how does this work?"

43 ---

52 44 

53```bash theme={null}45 When explaining code, always include:

54mkdir -p .claude/skills/my-skill-name

55```

56 

57**Use project Skills for**:

58 

59* Team workflows and conventions

60* Project-specific expertise

61* Shared utilities and scripts

62 46 

63Project Skills are checked into git and automatically available to team members.47 1. **Start with an analogy**: Compare the code to something from everyday life

48 2. **Draw a diagram**: Use ASCII art to show the flow, structure, or relationships

49 3. **Walk through the code**: Explain step-by-step what happens

50 4. **Highlight a gotcha**: What's a common mistake or misconception?

64 51 

65### Plugin Skills52 Keep explanations conversational. For complex concepts, use multiple analogies.

53 ```

54 </Step>

66 55 

67Skills can also come from [Claude Code plugins](/en/plugins). Plugins may bundle Skills that are automatically available when the plugin is installed. These Skills work the same way as personal and project Skills.56 <Step title="Test the skill">

57 You can test it two ways:

68 58 

69## Write SKILL.md59 **Let Claude invoke it automatically** by asking something that matches the description:

70 60 

71Create a `SKILL.md` file with YAML frontmatter and Markdown content:61 ```

62 How does this code work?

63 ```

72 64 

73```yaml theme={null}65 **Or invoke it directly** with the skill name:

74name: your-skill-name

75description: Brief description of what this Skill does and when to use it

76 66 

77# Your Skill Name67 ```

68 /explain-code src/auth/login.ts

69 ```

78 70 

79## Instructions71 Either way, Claude should include an analogy and ASCII diagram in its explanation.

80Provide clear, step-by-step guidance for Claude.72 </Step>

73</Steps>

81 74 

82## Examples75### Where skills live

83Show concrete examples of using this Skill.

84```

85 76 

86**Field requirements**:77Where you store a skill determines who can use it:

87 78 

88* `name`: Must use lowercase letters, numbers, and hyphens only (max 64 characters)79| Location | Path | Applies to |

89* `description`: Brief description of what the Skill does and when to use it (max 1024 characters)80| :--------- | :----------------------------------------------- | :----------------------------- |

81| Enterprise | See [managed settings](/en/iam#managed-settings) | All users in your organization |

82| Personal | `~/.claude/skills/<skill-name>/SKILL.md` | All your projects |

83| Project | `.claude/skills/<skill-name>/SKILL.md` | This project only |

84| Plugin | `<plugin>/skills/<skill-name>/SKILL.md` | Where plugin is enabled |

90 85 

91The `description` field is critical for Claude to discover when to use your Skill. It should include both what the Skill does and when Claude should use it.86When skills share the same name across levels, higher-priority locations win: enterprise > personal > project. Plugin skills use a `plugin-name:skill-name` namespace, so they cannot conflict with other levels. If you have files in `.claude/commands/`, those work the same way, but if a skill and a command share the same name, the skill takes precedence.

92 87 

93See the [best practices guide](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/best-practices) for complete authoring guidance including validation rules.88#### Automatic discovery from nested directories

94 89 

95## Add supporting files90When you work with files in subdirectories, Claude Code automatically discovers skills from nested `.claude/skills/` directories. For example, if you're editing a file in `packages/frontend/`, Claude Code also looks for skills in `packages/frontend/.claude/skills/`. This supports monorepo setups where packages have their own skills.

96 91 

97Create additional files alongside SKILL.md:92Each skill is a directory with `SKILL.md` as the entrypoint:

98 93 

99```94```

100my-skill/95my-skill/

101├── SKILL.md (required)96├── SKILL.md # Main instructions (required)

102├── reference.md (optional documentation)97├── template.md # Template for Claude to fill in

103├── examples.md (optional examples)98├── examples/

104── scripts/99│ └── sample.md # Example output showing expected format

105└── helper.py (optional utility)100└── scripts/

106└── templates/101 └── validate.sh # Script Claude can execute

107 └── template.txt (optional template)

108```102```

109 103 

110Reference these files from SKILL.md:104The `SKILL.md` contains the main instructions and is required. Other files are optional and let you build more powerful skills: templates for Claude to fill in, example outputs showing the expected format, scripts Claude can execute, or detailed reference documentation. Reference these files from your `SKILL.md` so Claude knows what they contain and when to load them. See [Add supporting files](#add-supporting-files) for more details.

105 

106<Note>

107 Files in `.claude/commands/` still work and support the same [frontmatter](#frontmatter-reference). Skills are recommended since they support additional features like supporting files.

108</Note>

111 109 

112````markdown theme={null}110## Configure skills

113For advanced usage, see [reference.md](reference.md).

114 111 

115Run the helper script:112Skills are configured through YAML frontmatter at the top of `SKILL.md` and the markdown content that follows.

116```bash

117python scripts/helper.py input.txt

118```

119````

120 113 

121Claude reads these files only when needed, using progressive disclosure to manage context efficiently.114### Types of skill content

122 115 

123## Restrict tool access with allowed-tools116Skill files can contain any instructions, but thinking about how you want to invoke them helps guide what to include:

124 117 

125Use the `allowed-tools` frontmatter field to limit which tools Claude can use when a Skill is active:118**Reference content** adds knowledge Claude applies to your current work. Conventions, patterns, style guides, domain knowledge. This content runs inline so Claude can use it alongside your conversation context.

126 119 

127```yaml theme={null}120```yaml theme={null}

128---121---

129name: safe-file-reader122name: api-conventions

130description: Read files without making changes. Use when you need read-only file access.123description: API design patterns for this codebase

131allowed-tools: Read, Grep, Glob

132---124---

133 125 

134# Safe File Reader126When writing API endpoints:

135 127- Use RESTful naming conventions

136This Skill provides read-only file access.128- Return consistent error formats

137 129- Include request validation

138## Instructions

1391. Use Read to view file contents

1402. Use Grep to search within files

1413. Use Glob to find files by pattern

142```130```

143 131 

144When this Skill is active, Claude can only use the specified tools (Read, Grep, Glob) without needing to ask for permission. This is useful for:132**Task content** gives Claude step-by-step instructions for a specific action, like deployments, commits, or code generation. These are often actions you want to invoke directly with `/skill-name` rather than letting Claude decide when to run them. Add `disable-model-invocation: true` to prevent Claude from triggering it automatically.

145 

146* Read-only Skills that shouldn't modify files

147* Skills with limited scope (e.g., only data analysis, no file writing)

148* Security-sensitive workflows where you want to restrict capabilities

149 

150If `allowed-tools` is not specified, Claude will ask for permission to use tools as normal, following the standard permission model.

151 133 

152<Note>134```yaml theme={null}

153 `allowed-tools` is only supported for Skills in Claude Code.135---

154</Note>136name: deploy

155 137description: Deploy the application to production

156## View available Skills138context: fork

157 139disable-model-invocation: true

158Skills are automatically discovered by Claude from three sources:140---

159 

160* Personal Skills: `~/.claude/skills/`

161* Project Skills: `.claude/skills/`

162* Plugin Skills: bundled with installed plugins

163 

164**To view all available Skills**, ask Claude directly:

165 

166```

167What Skills are available?

168```

169 

170or

171 141 

172```142Deploy the application:

173List all available Skills1431. Run the test suite

1442. Build the application

1453. Push to the deployment target

174```146```

175 147 

176This will show all Skills from all sources, including plugin Skills.148Your `SKILL.md` can contain anything, but thinking through how you want the skill invoked (by you, by Claude, or both) and where you want it to run (inline or in a subagent) helps guide what to include. For complex skills, you can also [add supporting files](#add-supporting-files) to keep the main skill focused.

177 149 

178**To inspect a specific Skill**, you can also check the filesystem:150### Frontmatter reference

179 151 

180```bash theme={null}152Beyond the markdown content, you can configure skill behavior using YAML frontmatter fields between `---` markers at the top of your `SKILL.md` file:

181# List personal Skills

182ls ~/.claude/skills/

183 153 

184# List project Skills (if in a project directory)154```yaml theme={null}

185ls .claude/skills/155---

156name: my-skill

157description: What this skill does

158disable-model-invocation: true

159allowed-tools: Read, Grep

160---

186 161 

187# View a specific Skill's content162Your skill instructions here...

188cat ~/.claude/skills/my-skill/SKILL.md

189```163```

190 164 

191## Test a Skill165All fields are optional. Only `description` is recommended so Claude knows when to use the skill.

192 

193After creating a Skill, test it by asking questions that match your description.

194 

195**Example**: If your description mentions "PDF files":

196 

197```

198Can you help me extract text from this PDF?

199```

200 166 

201Claude autonomously decides to use your Skill if it matches the request—you don't need to explicitly invoke it. The Skill activates automatically based on the context of your question.167| Field | Required | Description |

168| :------------------------- | :---------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- |

169| `name` | No | Display name for the skill. If omitted, uses the directory name. Lowercase letters, numbers, and hyphens only (max 64 characters). |

170| `description` | Recommended | What the skill does and when to use it. Claude uses this to decide when to apply the skill. If omitted, uses the first paragraph of markdown content. |

171| `argument-hint` | No | Hint shown during autocomplete to indicate expected arguments. Example: `[issue-number]` or `[filename] [format]`. |

172| `disable-model-invocation` | No | Set to `true` to prevent Claude from automatically loading this skill. Use for workflows you want to trigger manually with `/name`. Default: `false`. |

173| `user-invocable` | No | Set to `false` to hide from the `/` menu. Use for background knowledge users shouldn't invoke directly. Default: `true`. |

174| `allowed-tools` | No | Tools Claude can use without asking permission when this skill is active. |

175| `model` | No | Model to use when this skill is active. |

176| `context` | No | Set to `fork` to run in a forked subagent context. |

177| `agent` | No | Which subagent type to use when `context: fork` is set. |

178| `hooks` | No | Hooks scoped to this skill's lifecycle. See [Hooks](/en/hooks) for configuration format. |

202 179 

203## Debug a Skill180#### Available string substitutions

204 181 

205If Claude doesn't use your Skill, check these common issues:182Skills support string substitution for dynamic values in the skill content:

206 183 

207### Make description specific184| Variable | Description |

185| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------- |

186| `$ARGUMENTS` | All arguments passed when invoking the skill. If `$ARGUMENTS` is not present in the content, arguments are appended as `ARGUMENTS: <value>`. |

187| `$ARGUMENTS[N]` | Access a specific argument by 0-based index, such as `$ARGUMENTS[0]` for the first argument. |

188| `$N` | Shorthand for `$ARGUMENTS[N]`, such as `$0` for the first argument or `$1` for the second. |

189| `${CLAUDE_SESSION_ID}` | The current session ID. Useful for logging, creating session-specific files, or correlating skill output with sessions. |

208 190 

209**Too vague**:191**Example using substitutions:**

210 192 

211```yaml theme={null}193```yaml theme={null}

212description: Helps with documents194---

213```195name: session-logger

196description: Log activity for this session

197---

214 198 

215**Specific**:199Log the following to logs/${CLAUDE_SESSION_ID}.log:

216 200 

217```yaml theme={null}201$ARGUMENTS

218description: Extract text and tables from PDF files, fill forms, merge documents. Use when working with PDF files or when the user mentions PDFs, forms, or document extraction.

219```202```

220 203 

221Include both what the Skill does and when to use it in the description.204### Add supporting files

222 

223### Verify file path

224 205 

225**Personal Skills**: `~/.claude/skills/skill-name/SKILL.md`206Skills can include multiple files in their directory. This keeps `SKILL.md` focused on the essentials while letting Claude access detailed reference material only when needed. Large reference docs, API specifications, or example collections don't need to load into context every time the skill runs.

226**Project Skills**: `.claude/skills/skill-name/SKILL.md`

227 207 

228Check the file exists:

229 

230```bash theme={null}

231# Personal

232ls ~/.claude/skills/my-skill/SKILL.md

233 

234# Project

235ls .claude/skills/my-skill/SKILL.md

236```208```

237 209my-skill/

238### Check YAML syntax210├── SKILL.md (required - overview and navigation)

239 211├── reference.md (detailed API docs - loaded when needed)

240Invalid YAML prevents the Skill from loading. Verify the frontmatter:212├── examples.md (usage examples - loaded when needed)

241 213└── scripts/

242```bash theme={null}214 └── helper.py (utility script - executed, not loaded)

243cat SKILL.md | head -n 10

244```215```

245 216 

246Ensure:217Reference supporting files from `SKILL.md` so Claude knows what each file contains and when to load it:

247 

248* Opening `---` on line 1

249* Closing `---` before Markdown content

250* Valid YAML syntax (no tabs, correct indentation)

251 218 

252### View errors219```markdown theme={null}

253 220## Additional resources

254Run Claude Code with debug mode to see Skill loading errors:

255 221 

256```bash theme={null}222- For complete API details, see [reference.md](reference.md)

257claude --debug223- For usage examples, see [examples.md](examples.md)

258```224```

259 225 

260## Share Skills with your team226<Tip>Keep `SKILL.md` under 500 lines. Move detailed reference material to separate files.</Tip>

261 

262**Recommended approach**: Distribute Skills through [plugins](/en/plugins).

263 

264To share Skills via plugin:

265 227 

2661. Create a plugin with Skills in the `skills/` directory228### Control who invokes a skill

2672. Add the plugin to a marketplace

2683. Team members install the plugin

269 229 

270For complete instructions, see [Add Skills to your plugin](/en/plugins#add-skills-to-your-plugin).230By default, both you and Claude can invoke any skill. You can type `/skill-name` to invoke it directly, and Claude can load it automatically when relevant to your conversation. Two frontmatter fields let you restrict this:

271 231 

272You can also share Skills directly through project repositories:232* **`disable-model-invocation: true`**: Only you can invoke the skill. Use this for workflows with side effects or that you want to control timing, like `/commit`, `/deploy`, or `/send-slack-message`. You don't want Claude deciding to deploy because your code looks ready.

273 233 

274### Step 1: Add Skill to your project234* **`user-invocable: false`**: Only Claude can invoke the skill. Use this for background knowledge that isn't actionable as a command. A `legacy-system-context` skill explains how an old system works. Claude should know this when relevant, but `/legacy-system-context` isn't a meaningful action for users to take.

275 235 

276Create a project Skill:236This example creates a deploy skill that only you can trigger. The `disable-model-invocation: true` field prevents Claude from running it automatically:

277 237 

278```bash theme={null}238```yaml theme={null}

279mkdir -p .claude/skills/team-skill239---

280# Create SKILL.md240name: deploy

281```241description: Deploy the application to production

242disable-model-invocation: true

243---

282 244 

283### Step 2: Commit to git245Deploy $ARGUMENTS to production:

284 246 

285```bash theme={null}2471. Run the test suite

286git add .claude/skills/2482. Build the application

287git commit -m "Add team Skill for PDF processing"2493. Push to the deployment target

288git push2504. Verify the deployment succeeded

289```251```

290 252 

291### Step 3: Team members get Skills automatically253Here's how the two fields affect invocation and context loading:

292 

293When team members pull the latest changes, Skills are immediately available:

294 

295```bash theme={null}

296git pull

297claude # Skills are now available

298```

299 254 

300## Update a Skill255| Frontmatter | You can invoke | Claude can invoke | When loaded into context |

256| :------------------------------- | :------------- | :---------------- | :----------------------------------------------------------- |

257| (default) | Yes | Yes | Description always in context, full skill loads when invoked |

258| `disable-model-invocation: true` | Yes | No | Description not in context, full skill loads when you invoke |

259| `user-invocable: false` | No | Yes | Description always in context, full skill loads when invoked |

301 260 

302Edit SKILL.md directly:261<Note>

303 262 In a regular session, skill descriptions are loaded into context so Claude knows what's available, but full skill content only loads when invoked. [Subagents with preloaded skills](/en/sub-agents#preload-skills-into-subagents) work differently: the full skill content is injected at startup.

304```bash theme={null}263</Note>

305# Personal Skill

306code ~/.claude/skills/my-skill/SKILL.md

307 

308# Project Skill

309code .claude/skills/my-skill/SKILL.md

310```

311 

312Changes take effect the next time you start Claude Code. If Claude Code is already running, restart it to load the updates.

313 

314## Remove a Skill

315 264 

316Delete the Skill directory:265### Restrict tool access

317 266 

318```bash theme={null}267Use the `allowed-tools` field to limit which tools Claude can use when a skill is active. This skill creates a read-only mode where Claude can explore files but not modify them:

319# Personal

320rm -rf ~/.claude/skills/my-skill

321 268 

322# Project269```yaml theme={null}

323rm -rf .claude/skills/my-skill270---

324git commit -m "Remove unused Skill"271name: safe-reader

272description: Read files without making changes

273allowed-tools: Read, Grep, Glob

274---

325```275```

326 276 

327## Best practices277### Pass arguments to skills

328 

329### Keep Skills focused

330 278 

331One Skill should address one capability:279Both you and Claude can pass arguments when invoking a skill. Arguments are available via the `$ARGUMENTS` placeholder.

332 280 

333**Focused**:281This skill fixes a GitHub issue by number. The `$ARGUMENTS` placeholder gets replaced with whatever follows the skill name:

334 282 

335* "PDF form filling"283```yaml theme={null}

336* "Excel data analysis"284---

337* "Git commit messages"285name: fix-issue

286description: Fix a GitHub issue

287disable-model-invocation: true

288---

338 289 

339**Too broad**:290Fix GitHub issue $ARGUMENTS following our coding standards.

340 291 

341* "Document processing" (split into separate Skills)2921. Read the issue description

342* "Data tools" (split by data type or operation)2932. Understand the requirements

2943. Implement the fix

2954. Write tests

2965. Create a commit

297```

343 298 

344### Write clear descriptions299When you run `/fix-issue 123`, Claude receives "Fix GitHub issue 123 following our coding standards..."

345 300 

346Help Claude discover when to use Skills by including specific triggers in your description:301If you invoke a skill with arguments but the skill doesn't include `$ARGUMENTS`, Claude Code appends `ARGUMENTS: <your input>` to the end of the skill content so Claude still sees what you typed.

347 302 

348**Clear**:303To access individual arguments by position, use `$ARGUMENTS[N]` or the shorter `$N`:

349 304 

350```yaml theme={null}305```yaml theme={null}

351description: Analyze Excel spreadsheets, create pivot tables, and generate charts. Use when working with Excel files, spreadsheets, or analyzing tabular data in .xlsx format.306---

352```307name: migrate-component

353 308description: Migrate a component from one framework to another

354**Vague**:309---

355 310 

356```yaml theme={null}311Migrate the $ARGUMENTS[0] component from $ARGUMENTS[1] to $ARGUMENTS[2].

357description: For files312Preserve all existing behavior and tests.

358```313```

359 314 

360### Test with your team315Running `/migrate-component SearchBar React Vue` replaces `$ARGUMENTS[0]` with `SearchBar`, `$ARGUMENTS[1]` with `React`, and `$ARGUMENTS[2]` with `Vue`. The same skill using the `$N` shorthand:

361 

362Have teammates use Skills and provide feedback:

363 

364* Does the Skill activate when expected?

365* Are the instructions clear?

366* Are there missing examples or edge cases?

367 

368### Document Skill versions

369 316 

370You can document Skill versions in your SKILL.md content to track changes over time. Add a version history section:317```yaml theme={null}

371 318---

372```markdown theme={null}319name: migrate-component

373# My Skill320description: Migrate a component from one framework to another

321---

374 322 

375## Version History323Migrate the $0 component from $1 to $2.

376- v2.0.0 (2025-10-01): Breaking changes to API324Preserve all existing behavior and tests.

377- v1.1.0 (2025-09-15): Added new features

378- v1.0.0 (2025-09-01): Initial release

379```325```

380 326 

381This helps team members understand what changed between versions.327## Advanced patterns

382 328 

383## Troubleshooting329### Inject dynamic context

384 

385### Claude doesn't use my Skill

386 330 

387**Symptom**: You ask a relevant question but Claude doesn't use your Skill.331The `!`command\`\` syntax runs shell commands before the skill content is sent to Claude. The command output replaces the placeholder, so Claude receives actual data, not the command itself.

388 332 

389**Check**: Is the description specific enough?333This skill summarizes a pull request by fetching live PR data with the GitHub CLI. The `!`gh pr diff\`\` and other commands run first, and their output gets inserted into the prompt:

390 334 

391Vague descriptions make discovery difficult. Include both what the Skill does and when to use it, with key terms users would mention.335```yaml theme={null}

336---

337name: pr-summary

338description: Summarize changes in a pull request

339context: fork

340agent: Explore

341allowed-tools: Bash(gh:*)

342---

392 343 

393**Too generic**:344## Pull request context

345- PR diff: !`gh pr diff`

346- PR comments: !`gh pr view --comments`

347- Changed files: !`gh pr diff --name-only`

394 348 

395```yaml theme={null}349## Your task

396description: Helps with data350Summarize this pull request...

397```351```

398 352 

399**Specific**:353When this skill runs:

400 354 

401```yaml theme={null}3551. Each `!`command\`\` executes immediately (before Claude sees anything)

402description: Analyze Excel spreadsheets, generate pivot tables, create charts. Use when working with Excel files, spreadsheets, or .xlsx files.3562. The output replaces the placeholder in the skill content

403```3573. Claude receives the fully-rendered prompt with actual PR data

404 358 

405**Check**: Is the YAML valid?359This is preprocessing, not something Claude executes. Claude only sees the final result.

406 360 

407Run validation to check for syntax errors:361<Tip>

362 To enable [extended thinking](/en/common-workflows#use-extended-thinking-thinking-mode) in a skill, include the word "ultrathink" anywhere in your skill content.

363</Tip>

408 364 

409```bash theme={null}365### Run skills in a subagent

410# View frontmatter

411cat .claude/skills/my-skill/SKILL.md | head -n 15

412 366 

413# Check for common issues367Add `context: fork` to your frontmatter when you want a skill to run in isolation. The skill content becomes the prompt that drives the subagent. It won't have access to your conversation history.

414# - Missing opening or closing ---

415# - Tabs instead of spaces

416# - Unquoted strings with special characters

417```

418 368 

419**Check**: Is the Skill in the correct location?369<Warning>

370 `context: fork` only makes sense for skills with explicit instructions. If your skill contains guidelines like "use these API conventions" without a task, the subagent receives the guidelines but no actionable prompt, and returns without meaningful output.

371</Warning>

420 372 

421```bash theme={null}373Skills and [subagents](/en/sub-agents) work together in two directions:

422# Personal Skills

423ls ~/.claude/skills/*/SKILL.md

424 374 

425# Project Skills375| Approach | System prompt | Task | Also loads |

426ls .claude/skills/*/SKILL.md376| :--------------------------- | :---------------------------------------- | :-------------------------- | :--------------------------- |

427```377| Skill with `context: fork` | From agent type (`Explore`, `Plan`, etc.) | SKILL.md content | CLAUDE.md |

378| Subagent with `skills` field | Subagent's markdown body | Claude's delegation message | Preloaded skills + CLAUDE.md |

428 379 

429### Skill has errors380With `context: fork`, you write the task in your skill and pick an agent type to execute it. For the inverse (defining a custom subagent that uses skills as reference material), see [Subagents](/en/sub-agents#preload-skills-into-subagents).

430 381 

431**Symptom**: The Skill loads but doesn't work correctly.382#### Example: Research skill using Explore agent

432 383 

433**Check**: Are dependencies available?384This skill runs research in a forked Explore agent. The skill content becomes the task, and the agent provides read-only tools optimized for codebase exploration:

434 385 

435Claude will automatically install required dependencies (or ask for permission to install them) when it needs them.386```yaml theme={null}

387---

388name: deep-research

389description: Research a topic thoroughly

390context: fork

391agent: Explore

392---

436 393 

437**Check**: Do scripts have execute permissions?394Research $ARGUMENTS thoroughly:

438 395 

439```bash theme={null}3961. Find relevant files using Glob and Grep

440chmod +x .claude/skills/my-skill/scripts/*.py3972. Read and analyze the code

3983. Summarize findings with specific file references

441```399```

442 400 

443**Check**: Are file paths correct?401When this skill runs:

444 402 

445Use forward slashes (Unix style) in all paths:4031. A new isolated context is created

4042. The subagent receives the skill content as its prompt ("Research \$ARGUMENTS thoroughly...")

4053. The `agent` field determines the execution environment (model, tools, and permissions)

4064. Results are summarized and returned to your main conversation

446 407 

447**Correct**: `scripts/helper.py`408The `agent` field specifies which subagent configuration to use. Options include built-in agents (`Explore`, `Plan`, `general-purpose`) or any custom subagent from `.claude/agents/`. If omitted, uses `general-purpose`.

448**Wrong**: `scripts\helper.py` (Windows style)

449 409 

450### Multiple Skills conflict410### Restrict Claude's skill access

451 411 

452**Symptom**: Claude uses the wrong Skill or seems confused between similar Skills.412By default, Claude can invoke any skill that doesn't have `disable-model-invocation: true` set. Skills that define `allowed-tools` grant Claude access to those tools without per-use approval when the skill is active. Your [permission settings](/en/iam) still govern baseline approval behavior for all other tools. Built-in commands like `/compact` and `/init` are not available through the Skill tool.

453 413 

454**Be specific in descriptions**: Help Claude choose the right Skill by using distinct trigger terms in your descriptions.414Three ways to control which skills Claude can invoke:

455 415 

456Instead of:416**Disable all skills** by denying the Skill tool in `/permissions`:

457 417 

458```yaml theme={null}418```

459# Skill 1419# Add to deny rules:

460description: For data analysis420Skill

461 

462# Skill 2

463description: For analyzing data

464```421```

465 422 

466Use:423**Allow or deny specific skills** using [permission rules](/en/iam):

467 424 

468```yaml theme={null}425```

469# Skill 1426# Allow only specific skills

470description: Analyze sales data in Excel files and CRM exports. Use for sales reports, pipeline analysis, and revenue tracking.427Skill(commit)

428Skill(review-pr:*)

471 429 

472# Skill 2430# Deny specific skills

473description: Analyze log files and system metrics data. Use for performance monitoring, debugging, and system diagnostics.431Skill(deploy:*)

474```432```

475 433 

476## Examples434Permission syntax: `Skill(name)` for exact match, `Skill(name:*)` for prefix match with any arguments.

477 435 

478### Simple Skill (single file)436**Hide individual skills** by adding `disable-model-invocation: true` to their frontmatter. This removes the skill from Claude's context entirely.

479 437 

480```438<Note>

481commit-helper/439 The `user-invocable` field only controls menu visibility, not Skill tool access. Use `disable-model-invocation: true` to block programmatic invocation.

482└── SKILL.md440</Note>

483```

484 441 

485```yaml theme={null}442## Share skills

486name: generating-commit-messages

487description: Generates clear commit messages from git diffs. Use when writing commit messages or reviewing staged changes.

488 443 

489# Generating Commit Messages444Skills can be distributed at different scopes depending on your audience:

490 445 

491## Instructions446* **Project skills**: Commit `.claude/skills/` to version control

447* **Plugins**: Create a `skills/` directory in your [plugin](/en/plugins)

448* **Managed**: Deploy organization-wide through [managed settings](/en/iam#managed-settings)

492 449 

4931. Run `git diff --staged` to see changes450### Generate visual output

4942. I'll suggest a commit message with:

495 - Summary under 50 characters

496 - Detailed description

497 - Affected components

498 451 

499## Best practices452Skills can bundle and run scripts in any language, giving Claude capabilities beyond what's possible in a single prompt. One powerful pattern is generating visual output: interactive HTML files that open in your browser for exploring data, debugging, or creating reports.

500 453 

501- Use present tense454This example creates a codebase explorer: an interactive tree view where you can expand and collapse directories, see file sizes at a glance, and identify file types by color.

502- Explain what and why, not how

503```

504 455 

505### Skill with tool permissions456Create the Skill directory:

506 457 

507```458```bash theme={null}

508code-reviewer/459mkdir -p ~/.claude/skills/codebase-visualizer/scripts

509└── SKILL.md

510```460```

511 461 

512```yaml theme={null}462Create `~/.claude/skills/codebase-visualizer/SKILL.md`. The description tells Claude when to activate this Skill, and the instructions tell Claude to run the bundled script:

463 

464````yaml theme={null}

513---465---

514name: code-reviewer466name: codebase-visualizer

515description: Review code for best practices and potential issues. Use when reviewing code, checking PRs, or analyzing code quality.467description: Generate an interactive collapsible tree visualization of your codebase. Use when exploring a new repo, understanding project structure, or identifying large files.

516allowed-tools: Read, Grep, Glob468allowed-tools: Bash(python:*)

517---469---

518 470 

519# Code Reviewer471# Codebase Visualizer

520 472 

521## Review checklist473Generate an interactive HTML tree view that shows your project's file structure with collapsible directories.

522 474 

5231. Code organization and structure475## Usage

5242. Error handling

5253. Performance considerations

5264. Security concerns

5275. Test coverage

528 476 

529## Instructions477Run the visualization script from your project root:

530 478 

5311. Read the target files using Read tool479```bash

5322. Search for patterns using Grep480python ~/.claude/skills/codebase-visualizer/scripts/visualize.py .

5333. Find related files using Glob

5344. Provide detailed feedback on code quality

535```481```

536 482 

537### Multi-file Skill483This creates `codebase-map.html` in the current directory and opens it in your default browser.

538 484 

539```485## What the visualization shows

540pdf-processing/

541├── SKILL.md

542├── FORMS.md

543├── REFERENCE.md

544└── scripts/

545 ├── fill_form.py

546 └── validate.py

547```

548 486 

549**SKILL.md**:487- **Collapsible directories**: Click folders to expand/collapse

550 488- **File sizes**: Displayed next to each file

551````yaml theme={null}489- **Colors**: Different colors for different file types

552name: pdf-processing490- **Directory totals**: Shows aggregate size of each folder

553description: Extract text, fill forms, merge PDFs. Use when working with PDF files, forms, or document extraction. Requires pypdf and pdfplumber packages.491````

554 492 

555# PDF Processing493Create `~/.claude/skills/codebase-visualizer/scripts/visualize.py`. This script scans a directory tree and generates a self-contained HTML file with:

494 

495* A **summary sidebar** showing file count, directory count, total size, and number of file types

496* A **bar chart** breaking down the codebase by file type (top 8 by size)

497* A **collapsible tree** where you can expand and collapse directories, with color-coded file type indicators

498 

499The script requires Python but uses only built-in libraries, so there are no packages to install:

500 

501```python expandable theme={null}

502#!/usr/bin/env python3

503"""Generate an interactive collapsible tree visualization of a codebase."""

504 

505import json

506import sys

507import webbrowser

508from pathlib import Path

509from collections import Counter

510 

511IGNORE = {'.git', 'node_modules', '__pycache__', '.venv', 'venv', 'dist', 'build'}

512 

513def scan(path: Path, stats: dict) -> dict:

514 result = {"name": path.name, "children": [], "size": 0}

515 try:

516 for item in sorted(path.iterdir()):

517 if item.name in IGNORE or item.name.startswith('.'):

518 continue

519 if item.is_file():

520 size = item.stat().st_size

521 ext = item.suffix.lower() or '(no ext)'

522 result["children"].append({"name": item.name, "size": size, "ext": ext})

523 result["size"] += size

524 stats["files"] += 1

525 stats["extensions"][ext] += 1

526 stats["ext_sizes"][ext] += size

527 elif item.is_dir():

528 stats["dirs"] += 1

529 child = scan(item, stats)

530 if child["children"]:

531 result["children"].append(child)

532 result["size"] += child["size"]

533 except PermissionError:

534 pass

535 return result

536 

537def generate_html(data: dict, stats: dict, output: Path) -> None:

538 ext_sizes = stats["ext_sizes"]

539 total_size = sum(ext_sizes.values()) or 1

540 sorted_exts = sorted(ext_sizes.items(), key=lambda x: -x[1])[:8]

541 colors = {

542 '.js': '#f7df1e', '.ts': '#3178c6', '.py': '#3776ab', '.go': '#00add8',

543 '.rs': '#dea584', '.rb': '#cc342d', '.css': '#264de4', '.html': '#e34c26',

544 '.json': '#6b7280', '.md': '#083fa1', '.yaml': '#cb171e', '.yml': '#cb171e',

545 '.mdx': '#083fa1', '.tsx': '#3178c6', '.jsx': '#61dafb', '.sh': '#4eaa25',

546 }

547 lang_bars = "".join(

548 f'<div class="bar-row"><span class="bar-label">{ext}</span>'

549 f'<div class="bar" style="width:{(size/total_size)*100}%;background:{colors.get(ext,"#6b7280")}"></div>'

550 f'<span class="bar-pct">{(size/total_size)*100:.1f}%</span></div>'

551 for ext, size in sorted_exts

552 )

553 def fmt(b):

554 if b < 1024: return f"{b} B"

555 if b < 1048576: return f"{b/1024:.1f} KB"

556 return f"{b/1048576:.1f} MB"

557 

558 html = f'''<!DOCTYPE html>

559<html><head>

560 <meta charset="utf-8"><title>Codebase Explorer</title>

561 <style>

562 body {{ font: 14px/1.5 system-ui, sans-serif; margin: 0; background: #1a1a2e; color: #eee; }}

563 .container {{ display: flex; height: 100vh; }}

564 .sidebar {{ width: 280px; background: #252542; padding: 20px; border-right: 1px solid #3d3d5c; overflow-y: auto; flex-shrink: 0; }}

565 .main {{ flex: 1; padding: 20px; overflow-y: auto; }}

566 h1 {{ margin: 0 0 10px 0; font-size: 18px; }}

567 h2 {{ margin: 20px 0 10px 0; font-size: 14px; color: #888; text-transform: uppercase; }}

568 .stat {{ display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #3d3d5c; }}

569 .stat-value {{ font-weight: bold; }}

570 .bar-row {{ display: flex; align-items: center; margin: 6px 0; }}

571 .bar-label {{ width: 55px; font-size: 12px; color: #aaa; }}

572 .bar {{ height: 18px; border-radius: 3px; }}

573 .bar-pct {{ margin-left: 8px; font-size: 12px; color: #666; }}

574 .tree {{ list-style: none; padding-left: 20px; }}

575 details {{ cursor: pointer; }}

576 summary {{ padding: 4px 8px; border-radius: 4px; }}

577 summary:hover {{ background: #2d2d44; }}

578 .folder {{ color: #ffd700; }}

579 .file {{ display: flex; align-items: center; padding: 4px 8px; border-radius: 4px; }}

580 .file:hover {{ background: #2d2d44; }}

581 .size {{ color: #888; margin-left: auto; font-size: 12px; }}

582 .dot {{ width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }}

583 </style>

584</head><body>

585 <div class="container">

586 <div class="sidebar">

587 <h1>📊 Summary</h1>

588 <div class="stat"><span>Files</span><span class="stat-value">{stats["files"]:,}</span></div>

589 <div class="stat"><span>Directories</span><span class="stat-value">{stats["dirs"]:,}</span></div>

590 <div class="stat"><span>Total size</span><span class="stat-value">{fmt(data["size"])}</span></div>

591 <div class="stat"><span>File types</span><span class="stat-value">{len(stats["extensions"])}</span></div>

592 <h2>By file type</h2>

593 {lang_bars}

594 </div>

595 <div class="main">

596 <h1>📁 {data["name"]}</h1>

597 <ul class="tree" id="root"></ul>

598 </div>

599 </div>

600 <script>

601 const data = {json.dumps(data)};

602 const colors = {json.dumps(colors)};

603 function fmt(b) {{ if (b < 1024) return b + ' B'; if (b < 1048576) return (b/1024).toFixed(1) + ' KB'; return (b/1048576).toFixed(1) + ' MB'; }}

604 function render(node, parent) {{

605 if (node.children) {{

606 const det = document.createElement('details');

607 det.open = parent === document.getElementById('root');

608 det.innerHTML = `<summary><span class="folder">📁 ${{node.name}}</span><span class="size">${{fmt(node.size)}}</span></summary>`;

609 const ul = document.createElement('ul'); ul.className = 'tree';

610 node.children.sort((a,b) => (b.children?1:0)-(a.children?1:0) || a.name.localeCompare(b.name));

611 node.children.forEach(c => render(c, ul));

612 det.appendChild(ul);

613 const li = document.createElement('li'); li.appendChild(det); parent.appendChild(li);

614 }} else {{

615 const li = document.createElement('li'); li.className = 'file';

616 li.innerHTML = `<span class="dot" style="background:${{colors[node.ext]||'#6b7280'}}"></span>${{node.name}}<span class="size">${{fmt(node.size)}}</span>`;

617 parent.appendChild(li);

618 }}

619 }}

620 data.children.forEach(c => render(c, document.getElementById('root')));

621 </script>

622</body></html>'''

623 output.write_text(html)

624 

625if __name__ == '__main__':

626 target = Path(sys.argv[1] if len(sys.argv) > 1 else '.').resolve()

627 stats = {"files": 0, "dirs": 0, "extensions": Counter(), "ext_sizes": Counter()}

628 data = scan(target, stats)

629 out = Path('codebase-map.html')

630 generate_html(data, stats, out)

631 print(f'Generated {out.absolute()}')

632 webbrowser.open(f'file://{out.absolute()}')

633```

634 

635To test, open Claude Code in any project and ask "Visualize this codebase." Claude runs the script, generates `codebase-map.html`, and opens it in your browser.

636 

637This pattern works for any visual output: dependency graphs, test coverage reports, API documentation, or database schema visualizations. The bundled script does the heavy lifting while Claude handles orchestration.

556 638 

557## Quick start639## Troubleshooting

558 640 

559Extract text:641### Skill not triggering

560```python

561import pdfplumber

562with pdfplumber.open("doc.pdf") as pdf:

563 text = pdf.pages[0].extract_text()

564```

565 642 

566For form filling, see [FORMS.md](FORMS.md).643If Claude doesn't use your skill when expected:

567For detailed API reference, see [REFERENCE.md](REFERENCE.md).

568 644 

569## Requirements6451. Check the description includes keywords users would naturally say

6462. Verify the skill appears in `What skills are available?`

6473. Try rephrasing your request to match the description more closely

6484. Invoke it directly with `/skill-name` if the skill is user-invocable

570 649 

571Packages must be installed in your environment:650### Skill triggers too often

572```bash

573pip install pypdf pdfplumber

574```

575````

576 651 

577<Note>652If Claude uses your skill when you don't want it:

578 List required packages in the description. Packages must be installed in your environment before Claude can use them.

579</Note>

580 653 

581Claude loads additional files only when needed.6541. Make the description more specific

6552. Add `disable-model-invocation: true` if you only want manual invocation

582 656 

583## Next steps657### Claude doesn't see all my skills

584 658 

585<CardGroup cols={2}>659Skill descriptions are loaded into context so Claude knows what's available. If you have many skills, they may exceed the character budget (default 15,000 characters). Run `/context` to check for a warning about excluded skills.

586 <Card title="Authoring best practices" icon="lightbulb" href="https://docs.claude.com/en/docs/agents-and-tools/agent-skills/best-practices">

587 Write Skills that Claude can use effectively

588 </Card>

589 660 

590 <Card title="Agent Skills overview" icon="book" href="https://docs.claude.com/en/docs/agents-and-tools/agent-skills/overview">661To increase the limit, set the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable.

591 Learn how Skills work across Claude products

592 </Card>

593 662 

594 <Card title="Use Skills in the Agent SDK" icon="cube" href="https://docs.claude.com/en/docs/agent-sdk/skills">663## Related resources

595 Use Skills programmatically with TypeScript and Python

596 </Card>

597 664 

598 <Card title="Get started with Agent Skills" icon="rocket" href="https://docs.claude.com/en/docs/agents-and-tools/agent-skills/quickstart">665* **[Subagents](/en/sub-agents)**: delegate tasks to specialized agents

599 Create your first Skill666* **[Plugins](/en/plugins)**: package and distribute skills with other extensions

600 </Card>667* **[Hooks](/en/hooks)**: automate workflows around tool events

601</CardGroup>668* **[Memory](/en/memory)**: manage CLAUDE.md files for persistent context

669* **[Interactive mode](/en/interactive-mode#built-in-commands)**: built-in commands and shortcuts

670* **[Permissions](/en/iam)**: control tool and skill access

slack.md +210 −0 added

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

5# Claude Code in Slack

6 

7> Delegate coding tasks directly from your Slack workspace

8 

9Claude Code in Slack brings the power of Claude Code directly into your Slack workspace. When you mention `@Claude` with a coding task, Claude automatically detects the intent and creates a Claude Code session on the web, allowing you to delegate development work without leaving your team conversations.

10 

11This integration is built on the existing Claude for Slack app but adds intelligent routing to Claude Code on the web for coding-related requests.

12 

13## Use cases

14 

15* **Bug investigation and fixes**: Ask Claude to investigate and fix bugs as soon as they're reported in Slack channels.

16* **Quick code reviews and modifications**: Have Claude implement small features or refactor code based on team feedback.

17* **Collaborative debugging**: When team discussions provide crucial context (e.g., error reproductions or user reports), Claude can use that information to inform its debugging approach.

18* **Parallel task execution**: Kick off coding tasks in Slack while you continue other work, receiving notifications when complete.

19 

20## Prerequisites

21 

22Before using Claude Code in Slack, ensure you have the following:

23 

24| Requirement | Details |

25| :--------------------- | :----------------------------------------------------------------------------- |

26| Claude Plan | Pro, Max, Team, or Enterprise with Claude Code access (premium seats) |

27| Claude Code on the web | Access to [Claude Code on the web](/en/claude-code-on-the-web) must be enabled |

28| GitHub Account | Connected to Claude Code on the web with at least one repository authenticated |

29| Slack Authentication | Your Slack account linked to your Claude account via the Claude app |

30 

31## Setting up Claude Code in Slack

32 

33<Steps>

34 <Step title="Install the Claude App in Slack">

35 A workspace administrator must install the Claude app from the Slack App Marketplace. Visit the [Slack App Marketplace](https://slack.com/marketplace/A08SF47R6P4) and click "Add to Slack" to begin the installation process.

36 </Step>

37 

38 <Step title="Connect your Claude account">

39 After the app is installed, authenticate your individual Claude account:

40 

41 1. Open the Claude app in Slack by clicking on "Claude" in your Apps section

42 2. Navigate to the App Home tab

43 3. Click "Connect" to link your Slack account with your Claude account

44 4. Complete the authentication flow in your browser

45 </Step>

46 

47 <Step title="Configure Claude Code on the web">

48 Ensure your Claude Code on the web is properly configured:

49 

50 * Visit [claude.ai/code](https://claude.ai/code) and sign in with the same account you connected to Slack

51 * Connect your GitHub account if not already connected

52 * Authenticate at least one repository that you want Claude to work with

53 </Step>

54 

55 <Step title="Choose your routing mode">

56 After connecting your accounts, configure how Claude handles your messages in Slack. Navigate to the Claude App Home in Slack to find the **Routing Mode** setting.

57 

58 | Mode | Behavior |

59 | :-------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

60 | **Code only** | Claude routes all @mentions to Claude Code sessions. Best for teams using Claude in Slack exclusively for development tasks. |

61 | **Code + Chat** | Claude analyzes each message and intelligently routes between Claude Code (for coding tasks) and Claude Chat (for writing, analysis, and general questions). Best for teams who want a single @Claude entry point for all types of work. |

62 

63 <Note>

64 In Code + Chat mode, if Claude routes a message to Chat but you wanted a coding session, you can click "Retry as Code" to create a Claude Code session instead. Similarly, if it's routed to Code but you wanted a Chat session, you can choose that option in that thread.

65 </Note>

66 </Step>

67</Steps>

68 

69## How it works

70 

71### Automatic detection

72 

73When you mention @Claude in a Slack channel or thread, Claude automatically analyzes your message to determine if it's a coding task. If Claude detects coding intent, it will route your request to Claude Code on the web instead of responding as a regular chat assistant.

74 

75You can also explicitly tell Claude to handle a request as a coding task, even if it doesn't automatically detect it.

76 

77<Note>

78 Claude Code in Slack only works in channels (public or private). It does not work in direct messages (DMs).

79</Note>

80 

81### Context gathering

82 

83**From threads**: When you @mention Claude in a thread, it gathers context from all messages in that thread to understand the full conversation.

84 

85**From channels**: When mentioned directly in a channel, Claude looks at recent channel messages for relevant context.

86 

87This context helps Claude understand the problem, select the appropriate repository, and inform its approach to the task.

88 

89<Warning>

90 When @Claude is invoked in Slack, Claude is given access to the conversation context to better understand your request. Claude may follow directions from other messages in the context, so users should make sure to only use Claude in trusted Slack conversations.

91</Warning>

92 

93### Session flow

94 

951. **Initiation**: You @mention Claude with a coding request

962. **Detection**: Claude analyzes your message and detects coding intent

973. **Session creation**: A new Claude Code session is created on claude.ai/code

984. **Progress updates**: Claude posts status updates to your Slack thread as work progresses

995. **Completion**: When finished, Claude @mentions you with a summary and action buttons

1006. **Review**: Click "View Session" to see the full transcript, or "Create PR" to open a pull request

101 

102## User interface elements

103 

104### App Home

105 

106The App Home tab shows your connection status and allows you to connect or disconnect your Claude account from Slack.

107 

108### Message actions

109 

110* **View Session**: Opens the full Claude Code session in your browser where you can see all work performed, continue the session, or make additional requests.

111* **Create PR**: Creates a pull request directly from the session's changes.

112* **Retry as Code**: If Claude initially responds as a chat assistant but you wanted a coding session, click this button to retry the request as a Claude Code task.

113* **Change Repo**: Allows you to select a different repository if Claude chose incorrectly.

114 

115### Repository selection

116 

117Claude automatically selects a repository based on context from your Slack conversation. If multiple repositories could apply, Claude may display a dropdown allowing you to choose the correct one.

118 

119## Access and permissions

120 

121### User-level access

122 

123| Access Type | Requirement |

124| :------------------- | :-------------------------------------------------------------- |

125| Claude Code Sessions | Each user runs sessions under their own Claude account |

126| Usage & Rate Limits | Sessions count against the individual user's plan limits |

127| Repository Access | Users can only access repositories they've personally connected |

128| Session History | Sessions appear in your Claude Code history on claude.ai/code |

129 

130### Workspace admin permissions

131 

132Slack workspace administrators control whether the Claude app can be installed in the workspace. Individual users then authenticate with their own Claude accounts to use the integration.

133 

134## What's accessible where

135 

136**In Slack**: You'll see status updates, completion summaries, and action buttons. The full transcript is preserved and always accessible.

137 

138**On the web**: The complete Claude Code session with full conversation history, all code changes, file operations, and the ability to continue the session or create pull requests.

139 

140## Best practices

141 

142### Writing effective requests

143 

144* **Be specific**: Include file names, function names, or error messages when relevant.

145* **Provide context**: Mention the repository or project if it's not clear from the conversation.

146* **Define success**: Explain what "done" looks like—should Claude write tests? Update documentation? Create a PR?

147* **Use threads**: Reply in threads when discussing bugs or features so Claude can gather the full context.

148 

149### When to use Slack vs. web

150 

151**Use Slack when**: Context already exists in a Slack discussion, you want to kick off a task asynchronously, or you're collaborating with teammates who need visibility.

152 

153**Use the web directly when**: You need to upload files, want real-time interaction during development, or are working on longer, more complex tasks.

154 

155## Troubleshooting

156 

157### Sessions not starting

158 

1591. Verify your Claude account is connected in the Claude App Home

1602. Check that you have Claude Code on the web access enabled

1613. Ensure you have at least one GitHub repository connected to Claude Code

162 

163### Repository not showing

164 

1651. Connect the repository in Claude Code on the web at [claude.ai/code](https://claude.ai/code)

1662. Verify your GitHub permissions for that repository

1673. Try disconnecting and reconnecting your GitHub account

168 

169### Wrong repository selected

170 

1711. Click the "Change Repo" button to select a different repository

1722. Include the repository name in your request for more accurate selection

173 

174### Authentication errors

175 

1761. Disconnect and reconnect your Claude account in the App Home

1772. Ensure you're signed into the correct Claude account in your browser

1783. Check that your Claude plan includes Claude Code access

179 

180### Session expiration

181 

1821. Sessions remain accessible in your Claude Code history on the web

1832. You can continue or reference past sessions from [claude.ai/code](https://claude.ai/code)

184 

185## Current limitations

186 

187* **GitHub only**: Currently supports repositories on GitHub.

188* **One PR at a time**: Each session can create one pull request.

189* **Rate limits apply**: Sessions use your individual Claude plan's rate limits.

190* **Web access required**: Users must have Claude Code on the web access; those without it will only get standard Claude chat responses.

191 

192## Related resources

193 

194<CardGroup>

195 <Card title="Claude Code on the web" icon="globe" href="/en/claude-code-on-the-web">

196 Learn more about Claude Code on the web

197 </Card>

198 

199 <Card title="Claude for Slack" icon="slack" href="https://claude.com/claude-and-slack">

200 General Claude for Slack documentation

201 </Card>

202 

203 <Card title="Slack App Marketplace" icon="store" href="https://slack.com/marketplace/A08SF47R6P4">

204 Install the Claude app from the Slack Marketplace

205 </Card>

206 

207 <Card title="Claude Help Center" icon="circle-question" href="https://support.claude.com">

208 Get additional support

209 </Card>

210</CardGroup>

slash-commands.md +0 −497 deleted

File DeletedView Diff

1# Slash commands

2 

3> Control Claude's behavior during an interactive session with slash commands.

4 

5## Built-in slash commands

6 

7| Command | Purpose |

8| :------------------------ | :-------------------------------------------------------------------------------------------------------------------------- |

9| `/add-dir` | Add additional working directories |

10| `/agents` | Manage custom AI subagents for specialized tasks |

11| `/bashes` | List and manage background tasks |

12| `/bug` | Report bugs (sends conversation to Anthropic) |

13| `/clear` | Clear conversation history |

14| `/compact [instructions]` | Compact conversation with optional focus instructions |

15| `/config` | Open the Settings interface (Config tab) |

16| `/context` | Visualize current context usage as a colored grid |

17| `/cost` | Show token usage statistics (see [cost tracking guide](/en/costs#using-the-cost-command) for subscription-specific details) |

18| `/doctor` | Checks the health of your Claude Code installation |

19| `/exit` | Exit the REPL |

20| `/export [filename]` | Export the current conversation to a file or clipboard |

21| `/help` | Get usage help |

22| `/hooks` | Manage hook configurations for tool events |

23| `/ide` | Manage IDE integrations and show status |

24| `/init` | Initialize project with CLAUDE.md guide |

25| `/install-github-app` | Set up Claude GitHub Actions for a repository |

26| `/login` | Switch Anthropic accounts |

27| `/logout` | Sign out from your Anthropic account |

28| `/mcp` | Manage MCP server connections and OAuth authentication |

29| `/memory` | Edit CLAUDE.md memory files |

30| `/model` | Select or change the AI model |

31| `/output-style [style]` | Set the output style directly or from a selection menu |

32| `/permissions` | View or update [permissions](/en/iam#configuring-permissions) |

33| `/plugin` | Manage Claude Code plugins |

34| `/pr-comments` | View pull request comments |

35| `/privacy-settings` | View and update your privacy settings |

36| `/release-notes` | View release notes |

37| `/resume` | Resume a conversation |

38| `/review` | Request code review |

39| `/rewind` | Rewind the conversation and/or code |

40| `/sandbox` | Enable sandboxed bash tool with filesystem and network isolation for safer, more autonomous execution |

41| `/security-review` | Complete a security review of pending changes on the current branch |

42| `/status` | Open the Settings interface (Status tab) showing version, model, account, and connectivity |

43| `/statusline` | Set up Claude Code's status line UI |

44| `/terminal-setup` | Install Shift+Enter key binding for newlines (iTerm2 and VSCode only) |

45| `/todos` | List current todo items |

46| `/usage` | Show plan usage limits and rate limit status (subscription plans only) |

47| `/vim` | Enter vim mode for alternating insert and command modes |

48 

49## Custom slash commands

50 

51Custom slash commands allow you to define frequently-used prompts as Markdown files that Claude Code can execute. Commands are organized by scope (project-specific or personal) and support namespacing through directory structures.

52 

53### Syntax

54 

55```

56/<command-name> [arguments]

57```

58 

59#### Parameters

60 

61| Parameter | Description |

62| :--------------- | :---------------------------------------------------------------- |

63| `<command-name>` | Name derived from the Markdown filename (without `.md` extension) |

64| `[arguments]` | Optional arguments passed to the command |

65 

66### Command types

67 

68#### Project commands

69 

70Commands stored in your repository and shared with your team. When listed in `/help`, these commands show "(project)" after their description.

71 

72**Location**: `.claude/commands/`

73 

74In the following example, we create the `/optimize` command:

75 

76```bash theme={null}

77# Create a project command

78mkdir -p .claude/commands

79echo "Analyze this code for performance issues and suggest optimizations:" > .claude/commands/optimize.md

80```

81 

82#### Personal commands

83 

84Commands available across all your projects. When listed in `/help`, these commands show "(user)" after their description.

85 

86**Location**: `~/.claude/commands/`

87 

88In the following example, we create the `/security-review` command:

89 

90```bash theme={null}

91# Create a personal command

92mkdir -p ~/.claude/commands

93echo "Review this code for security vulnerabilities:" > ~/.claude/commands/security-review.md

94```

95 

96### Features

97 

98#### Namespacing

99 

100Organize commands in subdirectories. The subdirectories are used for organization and appear in the command description, but they do not affect the command name itself. The description will show whether the command comes from the project directory (`.claude/commands`) or the user-level directory (`~/.claude/commands`), along with the subdirectory name.

101 

102Conflicts between user and project level commands are not supported. Otherwise, multiple commands with the same base file name can coexist.

103 

104For example, a file at `.claude/commands/frontend/component.md` creates the command `/component` with description showing "(project:frontend)".

105Meanwhile, a file at `~/.claude/commands/component.md` creates the command `/component` with description showing "(user)".

106 

107#### Arguments

108 

109Pass dynamic values to commands using argument placeholders:

110 

111##### All arguments with `$ARGUMENTS`

112 

113The `$ARGUMENTS` placeholder captures all arguments passed to the command:

114 

115```bash theme={null}

116# Command definition

117echo 'Fix issue #$ARGUMENTS following our coding standards' > .claude/commands/fix-issue.md

118 

119# Usage

120> /fix-issue 123 high-priority

121# $ARGUMENTS becomes: "123 high-priority"

122```

123 

124##### Individual arguments with `$1`, `$2`, etc.

125 

126Access specific arguments individually using positional parameters (similar to shell scripts):

127 

128```bash theme={null}

129# Command definition

130echo 'Review PR #$1 with priority $2 and assign to $3' > .claude/commands/review-pr.md

131 

132# Usage

133> /review-pr 456 high alice

134# $1 becomes "456", $2 becomes "high", $3 becomes "alice"

135```

136 

137Use positional arguments when you need to:

138 

139* Access arguments individually in different parts of your command

140* Provide defaults for missing arguments

141* Build more structured commands with specific parameter roles

142 

143#### Bash command execution

144 

145Execute bash commands before the slash command runs using the `!` prefix. The output is included in the command context. You *must* include `allowed-tools` with the `Bash` tool, but you can choose the specific bash commands to allow.

146 

147For example:

148 

149```markdown theme={null}

150allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)

151description: Create a git commit

152 

153## Context

154 

155- Current git status: !`git status`

156- Current git diff (staged and unstaged changes): !`git diff HEAD`

157- Current branch: !`git branch --show-current`

158- Recent commits: !`git log --oneline -10`

159 

160## Your task

161 

162Based on the above changes, create a single git commit.

163```

164 

165#### File references

166 

167Include file contents in commands using the `@` prefix to [reference files](/en/common-workflows#reference-files-and-directories).

168 

169For example:

170 

171```markdown theme={null}

172# Reference a specific file

173 

174Review the implementation in @src/utils/helpers.js

175 

176# Reference multiple files

177 

178Compare @src/old-version.js with @src/new-version.js

179```

180 

181#### Thinking mode

182 

183Slash commands can trigger extended thinking by including [extended thinking keywords](/en/common-workflows#use-extended-thinking).

184 

185### Frontmatter

186 

187Command files support frontmatter, useful for specifying metadata about the command:

188 

189| Frontmatter | Purpose | Default |

190| :------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------- |

191| `allowed-tools` | List of tools the command can use | Inherits from the conversation |

192| `argument-hint` | The arguments expected for the slash command. Example: `argument-hint: add [tagId] \| remove [tagId] \| list`. This hint is shown to the user when auto-completing the slash command. | None |

193| `description` | Brief description of the command | Uses the first line from the prompt |

194| `model` | Specific model string (see [Models overview](https://docs.claude.com/en/docs/about-claude/models/overview)) | Inherits from the conversation |

195| `disable-model-invocation` | Whether to prevent `SlashCommand` tool from calling this command | false |

196 

197For example:

198 

199```markdown theme={null}

200allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)

201argument-hint: [message]

202description: Create a git commit

203model: claude-3-5-haiku-20241022

204 

205Create a git commit with message: $ARGUMENTS

206```

207 

208Example using positional arguments:

209 

210```markdown theme={null}

211argument-hint: [pr-number] [priority] [assignee]

212description: Review pull request

213 

214Review PR #$1 with priority $2 and assign to $3.

215Focus on security, performance, and code style.

216```

217 

218## Plugin commands

219 

220[Plugins](/en/plugins) can provide custom slash commands that integrate seamlessly with Claude Code. Plugin commands work exactly like user-defined commands but are distributed through [plugin marketplaces](/en/plugin-marketplaces).

221 

222### How plugin commands work

223 

224Plugin commands are:

225 

226* **Namespaced**: Commands can use the format `/plugin-name:command-name` to avoid conflicts (plugin prefix is optional unless there are name collisions)

227* **Automatically available**: Once a plugin is installed and enabled, its commands appear in `/help`

228* **Fully integrated**: Support all command features (arguments, frontmatter, bash execution, file references)

229 

230### Plugin command structure

231 

232**Location**: `commands/` directory in plugin root

233 

234**File format**: Markdown files with frontmatter

235 

236**Basic command structure**:

237 

238```markdown theme={null}

239description: Brief description of what the command does

240 

241# Command Name

242 

243Detailed instructions for Claude on how to execute this command.

244Include specific guidance on parameters, expected outcomes, and any special considerations.

245```

246 

247**Advanced command features**:

248 

249* **Arguments**: Use placeholders like `{arg1}` in command descriptions

250* **Subdirectories**: Organize commands in subdirectories for namespacing

251* **Bash integration**: Commands can execute shell scripts and programs

252* **File references**: Commands can reference and modify project files

253 

254### Invocation patterns

255 

256```shell Direct command (when no conflicts) theme={null}

257/command-name

258```

259 

260```shell Plugin-prefixed (when needed for disambiguation) theme={null}

261/plugin-name:command-name

262```

263 

264```shell With arguments (if command supports them) theme={null}

265/command-name arg1 arg2

266```

267 

268## MCP slash commands

269 

270MCP servers can expose prompts as slash commands that become available in Claude Code. These commands are dynamically discovered from connected MCP servers.

271 

272### Command format

273 

274MCP commands follow the pattern:

275 

276```

277/mcp__<server-name>__<prompt-name> [arguments]

278```

279 

280### Features

281 

282#### Dynamic discovery

283 

284MCP commands are automatically available when:

285 

286* An MCP server is connected and active

287* The server exposes prompts through the MCP protocol

288* The prompts are successfully retrieved during connection

289 

290#### Arguments

291 

292MCP prompts can accept arguments defined by the server:

293 

294```

295# Without arguments

296> /mcp__github__list_prs

297 

298# With arguments

299> /mcp__github__pr_review 456

300> /mcp__jira__create_issue "Bug title" high

301```

302 

303#### Naming conventions

304 

305* Server and prompt names are normalized

306* Spaces and special characters become underscores

307* Names are lowercased for consistency

308 

309### Managing MCP connections

310 

311Use the `/mcp` command to:

312 

313* View all configured MCP servers

314* Check connection status

315* Authenticate with OAuth-enabled servers

316* Clear authentication tokens

317* View available tools and prompts from each server

318 

319### MCP permissions and wildcards

320 

321When configuring [permissions for MCP tools](/en/iam#tool-specific-permission-rules), note that **wildcards are not supported**:

322 

323* ✅ **Correct**: `mcp__github` (approves ALL tools from the github server)

324* ✅ **Correct**: `mcp__github__get_issue` (approves specific tool)

325* ❌ **Incorrect**: `mcp__github__*` (wildcards not supported)

326 

327To approve all tools from an MCP server, use just the server name: `mcp__servername`. To approve specific tools only, list each tool individually.

328 

329## `SlashCommand` tool

330 

331The `SlashCommand` tool allows Claude to execute [custom slash commands](/en/slash-commands#custom-slash-commands) programmatically

332during a conversation. This gives Claude the ability to invoke custom commands

333on your behalf when appropriate.

334 

335To encourage Claude to trigger `SlashCommand` tool, your instructions (prompts,

336CLAUDE.md, etc.) generally need to reference the command by name with its slash.

337 

338Example:

339 

340```

341> Run /write-unit-test when you are about to start writing tests.

342```

343 

344This tool puts each available custom slash command's metadata into context up to the

345character budget limit. You can use `/context` to monitor token usage and follow

346the operations below to manage context.

347 

348### `SlashCommand` tool supported commands

349 

350`SlashCommand` tool only supports custom slash commands that:

351 

352* Are user-defined. Built-in commands like `/compact` and `/init` are *not* supported.

353* Have the `description` frontmatter field populated. We use the `description` in the context.

354 

355For Claude Code versions >= 1.0.124, you can see which custom slash commands

356`SlashCommand` tool can invoke by running `claude --debug` and triggering a query.

357 

358### Disable `SlashCommand` tool

359 

360To prevent Claude from executing any slash commands via the tool:

361 

362```bash theme={null}

363/permissions

364# Add to deny rules: SlashCommand

365```

366 

367This will also remove SlashCommand tool (and the slash command descriptions) from context.

368 

369### Disable specific commands only

370 

371To prevent a specific slash command from becoming available, add

372`disable-model-invocation: true` to the slash command's frontmatter.

373 

374This will also remove the command's metadata from context.

375 

376### `SlashCommand` permission rules

377 

378The permission rules support:

379 

380* **Exact match**: `SlashCommand:/commit` (allows only `/commit` with no arguments)

381* **Prefix match**: `SlashCommand:/review-pr:*` (allows `/review-pr` with any arguments)

382 

383### Character budget limit

384 

385The `SlashCommand` tool includes a character budget to limit the size of command

386descriptions shown to Claude. This prevents token overflow when many commands

387are available.

388 

389The budget includes each custom slash command's name, args, and description.

390 

391* **Default limit**: 15,000 characters

392* **Custom limit**: Set via `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable

393 

394When the character budget is exceeded, Claude will see only a subset of the

395available commands. In `/context`, a warning will show with "M of N commands".

396 

397## Skills vs slash commands

398 

399**Slash commands** and **Agent Skills** serve different purposes in Claude Code:

400 

401### Use slash commands for

402 

403**Quick, frequently-used prompts**:

404 

405* Simple prompt snippets you use often

406* Quick reminders or templates

407* Frequently-used instructions that fit in one file

408 

409**Examples**:

410 

411* `/review` → "Review this code for bugs and suggest improvements"

412* `/explain` → "Explain this code in simple terms"

413* `/optimize` → "Analyze this code for performance issues"

414 

415### Use Skills for

416 

417**Comprehensive capabilities with structure**:

418 

419* Complex workflows with multiple steps

420* Capabilities requiring scripts or utilities

421* Knowledge organized across multiple files

422* Team workflows you want to standardize

423 

424**Examples**:

425 

426* PDF processing Skill with form-filling scripts and validation

427* Data analysis Skill with reference docs for different data types

428* Documentation Skill with style guides and templates

429 

430### Key differences

431 

432| Aspect | Slash Commands | Agent Skills |

433| -------------- | -------------------------------- | ----------------------------------- |

434| **Complexity** | Simple prompts | Complex capabilities |

435| **Structure** | Single .md file | Directory with SKILL.md + resources |

436| **Discovery** | Explicit invocation (`/command`) | Automatic (based on context) |

437| **Files** | One file only | Multiple files, scripts, templates |

438| **Scope** | Project or personal | Project or personal |

439| **Sharing** | Via git | Via git |

440 

441### Example comparison

442 

443**As a slash command**:

444 

445```markdown theme={null}

446# .claude/commands/review.md

447Review this code for:

448- Security vulnerabilities

449- Performance issues

450- Code style violations

451```

452 

453Usage: `/review` (manual invocation)

454 

455**As a Skill**:

456 

457```

458.claude/skills/code-review/

459├── SKILL.md (overview and workflows)

460├── SECURITY.md (security checklist)

461├── PERFORMANCE.md (performance patterns)

462├── STYLE.md (style guide reference)

463└── scripts/

464 └── run-linters.sh

465```

466 

467Usage: "Can you review this code?" (automatic discovery)

468 

469The Skill provides richer context, validation scripts, and organized reference material.

470 

471### When to use each

472 

473**Use slash commands**:

474 

475* You invoke the same prompt repeatedly

476* The prompt fits in a single file

477* You want explicit control over when it runs

478 

479**Use Skills**:

480 

481* Claude should discover the capability automatically

482* Multiple files or scripts are needed

483* Complex workflows with validation steps

484* Team needs standardized, detailed guidance

485 

486Both slash commands and Skills can coexist. Use the approach that fits your needs.

487 

488Learn more about [Agent Skills](/en/skills).

489 

490## See also

491 

492* [Plugins](/en/plugins) - Extend Claude Code with custom commands through plugins

493* [Identity and Access Management](/en/iam) - Complete guide to permissions, including MCP tool permissions

494* [Interactive mode](/en/interactive-mode) - Shortcuts, input modes, and interactive features

495* [CLI reference](/en/cli-reference) - Command-line flags and options

496* [Settings](/en/settings) - Configuration options

497* [Memory management](/en/memory) - Managing Claude's memory across sessions

statusline.md +68 −1

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Status line configuration5# Status line configuration

2 6 

3> Create a custom status line for Claude Code to display contextual information7> Create a custom status line for Claude Code to display contextual information


25## How it Works29## How it Works

26 30 

27* The status line is updated when the conversation messages update31* The status line is updated when the conversation messages update

28* Updates run at most every 300ms32* Updates run at most every 300 ms

29* The first line of stdout from your command becomes the status line text33* The first line of stdout from your command becomes the status line text

30* ANSI color codes are supported for styling your status line34* ANSI color codes are supported for styling your status line

31* Claude Code passes contextual information about the current session (model, directories, etc.) as JSON to your script via stdin35* Claude Code passes contextual information about the current session (model, directories, etc.) as JSON to your script via stdin


58 "total_api_duration_ms": 2300,62 "total_api_duration_ms": 2300,

59 "total_lines_added": 156,63 "total_lines_added": 156,

60 "total_lines_removed": 2364 "total_lines_removed": 23

65 },

66 "context_window": {

67 "total_input_tokens": 15234,

68 "total_output_tokens": 4521,

69 "context_window_size": 200000,

70 "used_percentage": 42.5,

71 "remaining_percentage": 57.5,

72 "current_usage": {

73 "input_tokens": 8500,

74 "output_tokens": 1200,

75 "cache_creation_input_tokens": 5000,

76 "cache_read_input_tokens": 2000

77 }

61 }78 }

62}79}

63```80```


181get_duration() { echo "$input" | jq -r '.cost.total_duration_ms'; }198get_duration() { echo "$input" | jq -r '.cost.total_duration_ms'; }

182get_lines_added() { echo "$input" | jq -r '.cost.total_lines_added'; }199get_lines_added() { echo "$input" | jq -r '.cost.total_lines_added'; }

183get_lines_removed() { echo "$input" | jq -r '.cost.total_lines_removed'; }200get_lines_removed() { echo "$input" | jq -r '.cost.total_lines_removed'; }

201get_input_tokens() { echo "$input" | jq -r '.context_window.total_input_tokens'; }

202get_output_tokens() { echo "$input" | jq -r '.context_window.total_output_tokens'; }

203get_context_window_size() { echo "$input" | jq -r '.context_window.context_window_size'; }

184 204 

185# Use the helpers205# Use the helpers

186MODEL=$(get_model_name)206MODEL=$(get_model_name)


188echo "[$MODEL] 📁 ${DIR##*/}"208echo "[$MODEL] 📁 ${DIR##*/}"

189```209```

190 210 

211### Context Window Usage

212 

213Display the percentage of context window consumed. The `context_window` object contains:

214 

215* `total_input_tokens` / `total_output_tokens`: Cumulative totals across the entire session

216* `used_percentage`: Pre-calculated percentage of context window used (0-100)

217* `remaining_percentage`: Pre-calculated percentage of context window remaining (0-100)

218* `current_usage`: Current context window usage from the last API call (may be `null` if no messages yet)

219 * `input_tokens`: Input tokens in current context

220 * `output_tokens`: Output tokens generated

221 * `cache_creation_input_tokens`: Tokens written to cache

222 * `cache_read_input_tokens`: Tokens read from cache

223 

224You can use the pre-calculated `used_percentage` and `remaining_percentage` fields directly, or calculate from `current_usage` for more control.

225 

226**Simple approach using pre-calculated percentages:**

227 

228```bash theme={null}

229#!/bin/bash

230input=$(cat)

231 

232MODEL=$(echo "$input" | jq -r '.model.display_name')

233PERCENT_USED=$(echo "$input" | jq -r '.context_window.used_percentage // 0')

234 

235echo "[$MODEL] Context: ${PERCENT_USED}%"

236```

237 

238**Advanced approach with manual calculation:**

239 

240```bash theme={null}

241#!/bin/bash

242input=$(cat)

243 

244MODEL=$(echo "$input" | jq -r '.model.display_name')

245CONTEXT_SIZE=$(echo "$input" | jq -r '.context_window.context_window_size')

246USAGE=$(echo "$input" | jq '.context_window.current_usage')

247 

248if [ "$USAGE" != "null" ]; then

249 # Calculate current context from current_usage fields

250 CURRENT_TOKENS=$(echo "$USAGE" | jq '.input_tokens + .cache_creation_input_tokens + .cache_read_input_tokens')

251 PERCENT_USED=$((CURRENT_TOKENS * 100 / CONTEXT_SIZE))

252 echo "[$MODEL] Context: ${PERCENT_USED}%"

253else

254 echo "[$MODEL] Context: 0%"

255fi

256```

257 

191## Tips258## Tips

192 259 

193* Keep your status line concise - it should fit on one line260* Keep your status line concise - it should fit on one line

sub-agents.md +459 −284

Details

1# Subagents1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

5# Create custom subagents

2 6 

3> Create and use specialized AI subagents in Claude Code for task-specific workflows and improved context management.7> Create and use specialized AI subagents in Claude Code for task-specific workflows and improved context management.

4 8 

5Custom subagents in Claude Code are specialized AI assistants that can be invoked to handle specific types of tasks. They enable more efficient problem-solving by providing task-specific configurations with customized system prompts, tools and a separate context window.9Subagents are specialized AI assistants that handle specific types of tasks. Each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions. When Claude encounters a task that matches a subagent's description, it delegates to that subagent, which works independently and returns results.

10 

11Subagents help you:

12 

13* **Preserve context** by keeping exploration and implementation out of your main conversation

14* **Enforce constraints** by limiting which tools a subagent can use

15* **Reuse configurations** across projects with user-level subagents

16* **Specialize behavior** with focused system prompts for specific domains

17* **Control costs** by routing tasks to faster, cheaper models like Haiku

18 

19Claude uses each subagent's description to decide when to delegate tasks. When you create a subagent, write a clear description so Claude knows when to use it.

20 

21Claude Code includes several built-in subagents like **Explore**, **Plan**, and **general-purpose**. You can also create custom subagents to handle specific tasks. This page covers the [built-in subagents](#built-in-subagents), [how to create your own](#quickstart-create-your-first-subagent), [full configuration options](#configure-subagents), [patterns for working with subagents](#work-with-subagents), and [example subagents](#example-subagents).

22 

23## Built-in subagents

24 

25Claude Code includes built-in subagents that Claude automatically uses when appropriate. Each inherits the parent conversation's permissions with additional tool restrictions.

26 

27<Tabs>

28 <Tab title="Explore">

29 A fast, read-only agent optimized for searching and analyzing codebases.

30 

31 * **Model**: Haiku (fast, low-latency)

32 * **Tools**: Read-only tools (denied access to Write and Edit tools)

33 * **Purpose**: File discovery, code search, codebase exploration

6 34 

7## What are subagents?35 Claude delegates to Explore when it needs to search or understand a codebase without making changes. This keeps exploration results out of your main conversation context.

8 36 

9Subagents are pre-configured AI personalities that Claude Code can delegate tasks to. Each subagent:37 When invoking Explore, Claude specifies a thoroughness level: **quick** for targeted lookups, **medium** for balanced exploration, or **very thorough** for comprehensive analysis.

38 </Tab>

10 39 

11* Has a specific purpose and expertise area40 <Tab title="Plan">

12* Uses its own context window separate from the main conversation41 A research agent used during [plan mode](/en/common-workflows#use-plan-mode-for-safe-code-analysis) to gather context before presenting a plan.

13* Can be configured with specific tools it's allowed to use

14* Includes a custom system prompt that guides its behavior

15 42 

16When Claude Code encounters a task that matches a subagent's expertise, it can delegate that task to the specialized subagent, which works independently and returns results.43 * **Model**: Inherits from main conversation

44 * **Tools**: Read-only tools (denied access to Write and Edit tools)

45 * **Purpose**: Codebase research for planning

17 46 

18## Key benefits47 When you're in plan mode and Claude needs to understand your codebase, it delegates research to the Plan subagent. This prevents infinite nesting (subagents cannot spawn other subagents) while still gathering necessary context.

48 </Tab>

19 49 

20<CardGroup cols={2}>50 <Tab title="General-purpose">

21 <Card title="Context preservation" icon="layer-group">51 A capable agent for complex, multi-step tasks that require both exploration and action.

22 Each subagent operates in its own context, preventing pollution of the main conversation and keeping it focused on high-level objectives.

23 </Card>

24 52 

25 <Card title="Specialized expertise" icon="brain">53 * **Model**: Inherits from main conversation

26 Subagents can be fine-tuned with detailed instructions for specific domains, leading to higher success rates on designated tasks.54 * **Tools**: All tools

27 </Card>55 * **Purpose**: Complex research, multi-step operations, code modifications

28 56 

29 <Card title="Reusability" icon="rotate">57 Claude delegates to general-purpose when the task requires both exploration and modification, complex reasoning to interpret results, or multiple dependent steps.

30 Once created, subagents can be used across different projects and shared with your team for consistent workflows.58 </Tab>

31 </Card>

32 59 

33 <Card title="Flexible permissions" icon="shield-check">60 <Tab title="Other">

34 Each subagent can have different tool access levels, allowing you to limit powerful tools to specific subagent types.61 Claude Code includes additional helper agents for specific tasks. These are typically invoked automatically, so you don't need to use them directly.

35 </Card>

36</CardGroup>

37 62 

38## Quick start63 | Agent | Model | When Claude uses it |

64 | :---------------- | :------- | :------------------------------------------------------- |

65 | Bash | Inherits | Running terminal commands in a separate context |

66 | statusline-setup | Sonnet | When you run `/statusline` to configure your status line |

67 | Claude Code Guide | Haiku | When you ask questions about Claude Code features |

68 </Tab>

69</Tabs>

39 70 

40To create your first subagent:71Beyond these built-in subagents, you can create your own with custom prompts, tool restrictions, permission modes, hooks, and skills. The following sections show how to get started and customize subagents.

72 

73## Quickstart: create your first subagent

74 

75Subagents are defined in Markdown files with YAML frontmatter. You can [create them manually](#write-subagent-files) or use the `/agents` command.

76 

77This walkthrough guides you through creating a user-level subagent with the `/agent` command. The subagent reviews code and suggests improvements for the codebase.

41 78 

42<Steps>79<Steps>

43 <Step title="Open the subagents interface">80 <Step title="Open the subagents interface">

44 Run the following command:81 In Claude Code, run:

45 82 

46 ```83 ```

47 /agents84 /agents

48 ```85 ```

49 </Step>86 </Step>

50 87 

51 <Step title="Select 'Create New Agent'">88 <Step title="Create a new user-level agent">

52 Choose whether to create a project-level or user-level subagent89 Select **Create new agent**, then choose **User-level**. This saves the subagent to `~/.claude/agents/` so it's available in all your projects.

90 </Step>

91 

92 <Step title="Generate with Claude">

93 Select **Generate with Claude**. When prompted, describe the subagent:

94 

95 ```

96 A code improvement agent that scans files and suggests improvements

97 for readability, performance, and best practices. It should explain

98 each issue, show the current code, and provide an improved version.

99 ```

100 

101 Claude generates the system prompt and configuration. Press `e` to open it in your editor if you want to customize it.

102 </Step>

103 

104 <Step title="Select tools">

105 For a read-only reviewer, deselect everything except **Read-only tools**. If you keep all tools selected, the subagent inherits all tools available to the main conversation.

53 </Step>106 </Step>

54 107 

55 <Step title="Define the subagent">108 <Step title="Select model">

56 * **Recommended**: Generate with Claude first, then customize to make it yours109 Choose which model the subagent uses. For this example agent, select **Sonnet**, which balances capability and speed for analyzing code patterns.

57 * Describe your subagent in detail and when it should be used

58 * Select the tools you want to grant access to (or leave blank to inherit all tools)

59 * The interface shows all available tools, making selection easy

60 * If you're generating with Claude, you can also edit the system prompt in your own editor by pressing `e`

61 </Step>110 </Step>

62 111 

63 <Step title="Save and use">112 <Step title="Choose a color">

64 Your subagent is now available! Claude will use it automatically when appropriate, or you can invoke it explicitly:113 Pick a background color for the subagent. This helps you identify which subagent is running in the UI.

114 </Step>

115 

116 <Step title="Save and try it out">

117 Save the subagent. It's available immediately (no restart needed). Try it:

65 118 

66 ```119 ```

67 > Use the code-reviewer subagent to check my recent changes120 Use the code-improver agent to suggest improvements in this project

68 ```121 ```

122 

123 Claude delegates to your new subagent, which scans the codebase and returns improvement suggestions.

69 </Step>124 </Step>

70</Steps>125</Steps>

71 126 

72## Subagent configuration127You now have a subagent you can use in any project on your machine to analyze codebases and suggest improvements.

73 128 

74### File locations129You can also create subagents manually as Markdown files, define them via CLI flags, or distribute them through plugins. The following sections cover all configuration options.

75 130 

76Subagents are stored as Markdown files with YAML frontmatter in two possible locations:131## Configure subagents

77 132 

78| Type | Location | Scope | Priority |133### Use the /agents command

79| :-------------------- | :------------------ | :---------------------------- | :------- |

80| **Project subagents** | `.claude/agents/` | Available in current project | Highest |

81| **User subagents** | `~/.claude/agents/` | Available across all projects | Lower |

82 134 

83When subagent names conflict, project-level subagents take precedence over user-level subagents.135The `/agents` command provides an interactive interface for managing subagents. Run `/agents` to:

84 136 

85### Plugin agents137* View all available subagents (built-in, user, project, and plugin)

138* Create new subagents with guided setup or Claude generation

139* Edit existing subagent configuration and tool access

140* Delete custom subagents

141* See which subagents are active when duplicates exist

86 142 

87[Plugins](/en/plugins) can provide custom subagents that integrate seamlessly with Claude Code. Plugin agents work identically to user-defined agents and appear in the `/agents` interface.143This is the recommended way to create and manage subagents. For manual creation or automation, you can also add subagent files directly.

88 144 

89**Plugin agent locations**: Plugins include agents in their `agents/` directory (or custom paths specified in the plugin manifest).145### Choose the subagent scope

90 146 

91**Using plugin agents**:147Subagents are Markdown files with YAML frontmatter. Store them in different locations depending on scope. When multiple subagents share the same name, the higher-priority location wins.

92 148 

93* Plugin agents appear in `/agents` alongside your custom agents149| Location | Scope | Priority | How to create |

94* Can be invoked explicitly: "Use the code-reviewer agent from the security-plugin"150| :--------------------------- | :---------------------- | :---------- | :------------------------------------ |

95* Can be invoked automatically by Claude when appropriate151| `--agents` CLI flag | Current session | 1 (highest) | Pass JSON when launching Claude Code |

96* Can be managed (viewed, inspected) through `/agents` interface152| `.claude/agents/` | Current project | 2 | Interactive or manual |

153| `~/.claude/agents/` | All your projects | 3 | Interactive or manual |

154| Plugin's `agents/` directory | Where plugin is enabled | 4 (lowest) | Installed with [plugins](/en/plugins) |

97 155 

98See the [plugin components reference](/en/plugins-reference#agents) for details on creating plugin agents.156**Project subagents** (`.claude/agents/`) are ideal for subagents specific to a codebase. Check them into version control so your team can use and improve them collaboratively.

99 157 

100### CLI-based configuration158**User subagents** (`~/.claude/agents/`) are personal subagents available in all your projects.

101 159 

102You can also define subagents dynamically using the `--agents` CLI flag, which accepts a JSON object:160**CLI-defined subagents** are passed as JSON when launching Claude Code. They exist only for that session and aren't saved to disk, making them useful for quick testing or automation scripts:

103 161 

104```bash theme={null}162```bash theme={null}

105claude --agents '{163claude --agents '{


112}'170}'

113```171```

114 172 

115**Priority**: CLI-defined subagents have lower priority than project-level subagents but higher priority than user-level subagents.173The `--agents` flag accepts JSON with the same fields as [frontmatter](#supported-frontmatter-fields). Use `prompt` for the system prompt (equivalent to the markdown body in file-based subagents). See the [CLI reference](/en/cli-reference#agents-flag-format) for the full JSON format.

116 

117**Use case**: This approach is useful for:

118 174 

119* Quick testing of subagent configurations175**Plugin subagents** come from [plugins](/en/plugins) you've installed. They appear in `/agents` alongside your custom subagents. See the [plugin components reference](/en/plugins-reference#agents) for details on creating plugin subagents.

120* Session-specific subagents that don't need to be saved

121* Automation scripts that need custom subagents

122* Sharing subagent definitions in documentation or scripts

123 176 

124For detailed information about the JSON format and all available options, see the [CLI reference documentation](/en/cli-reference#agents-flag-format).177### Write subagent files

125 178 

126### File format179Subagent files use YAML frontmatter for configuration, followed by the system prompt in Markdown:

127 180 

128Each subagent is defined in a Markdown file with this structure:181<Note>

182 Subagents are loaded at session start. If you create a subagent by manually adding a file, restart your session or use `/agents` to load it immediately.

183</Note>

129 184 

130```markdown theme={null}185```markdown theme={null}

131---186---

132name: your-sub-agent-name187name: code-reviewer

133description: Description of when this subagent should be invoked188description: Reviews code for quality and best practices

134tools: tool1, tool2, tool3 # Optional - inherits all tools if omitted189tools: Read, Glob, Grep

135model: sonnet # Optional - specify model alias or 'inherit'190model: sonnet

136permissionMode: default # Optional - permission mode for the subagent

137skills: skill1, skill2 # Optional - skills to auto-load

138---191---

139 192 

140Your subagent's system prompt goes here. This can be multiple paragraphs193You are a code reviewer. When invoked, analyze the code and provide

141and should clearly define the subagent's role, capabilities, and approach194specific, actionable feedback on quality, security, and best practices.

142to solving problems.

143 

144Include specific instructions, best practices, and any constraints

145the subagent should follow.

146```195```

147 196 

148#### Configuration fields197The frontmatter defines the subagent's metadata and configuration. The body becomes the system prompt that guides the subagent's behavior. Subagents receive only this system prompt (plus basic environment details like working directory), not the full Claude Code system prompt.

198 

199#### Supported frontmatter fields

200 

201The following fields can be used in the YAML frontmatter. Only `name` and `description` are required.

149 202 

150| Field | Required | Description |203| Field | Required | Description |

151| :--------------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |204| :---------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

152| `name` | Yes | Unique identifier using lowercase letters and hyphens |205| `name` | Yes | Unique identifier using lowercase letters and hyphens |

153| `description` | Yes | Natural language description of the subagent's purpose |206| `description` | Yes | When Claude should delegate to this subagent |

154| `tools` | No | Comma-separated list of specific tools. If omitted, inherits all tools from the main thread |207| `tools` | No | [Tools](#available-tools) the subagent can use. Inherits all tools if omitted |

155| `model` | No | Model to use for this subagent. Can be a model alias (`sonnet`, `opus`, `haiku`) or `'inherit'` to use the main conversation's model. If omitted, defaults to the [configured subagent model](/en/model-config) |208| `disallowedTools` | No | Tools to deny, removed from inherited or specified list |

156| `permissionMode` | No | Permission mode for the subagent. Valid values: `default`, `acceptEdits`, `bypassPermissions`, `plan`, `ignore`. Controls how the subagent handles permission requests |209| `model` | No | [Model](#choose-a-model) to use: `sonnet`, `opus`, `haiku`, or `inherit`. Defaults to `inherit` |

157| `skills` | No | Comma-separated list of skill names to auto-load when the subagent starts. Skills are loaded into the subagent's context automatically |210| `permissionMode` | No | [Permission mode](#permission-modes): `default`, `acceptEdits`, `dontAsk`, `bypassPermissions`, or `plan` |

211| `skills` | No | [Skills](/en/skills) to load into the subagent's context at startup. The full skill content is injected, not just made available for invocation. Subagents don't inherit skills from the parent conversation |

212| `hooks` | No | [Lifecycle hooks](#define-hooks-for-subagents) scoped to this subagent |

158 213 

159### Model selection214### Choose a model

160 215 

161The `model` field allows you to control which [AI model](/en/model-config) the subagent uses:216The `model` field controls which [AI model](/en/model-config) the subagent uses:

162 217 

163* **Model alias**: Use one of the available aliases: `sonnet`, `opus`, or `haiku`218* **Model alias**: Use one of the available aliases: `sonnet`, `opus`, or `haiku`

164* **`'inherit'`**: Use the same model as the main conversation (useful for consistency)219* **inherit**: Use the same model as the main conversation

165* **Omitted**: If not specified, uses the default model configured for subagents (`sonnet`)220* **Omitted**: If not specified, defaults to `inherit` (uses the same model as the main conversation)

221 

222### Control subagent capabilities

223 

224You can control what subagents can do through tool access, permission modes, and conditional rules.

225 

226#### Available tools

227 

228Subagents can use any of Claude Code's [internal tools](/en/settings#tools-available-to-claude). By default, subagents inherit all tools from the main conversation, including MCP tools.

229 

230To restrict tools, use the `tools` field (allowlist) or `disallowedTools` field (denylist):

231 

232```yaml theme={null}

233---

234name: safe-researcher

235description: Research agent with restricted capabilities

236tools: Read, Grep, Glob, Bash

237disallowedTools: Write, Edit

238---

239```

240 

241#### Permission modes

242 

243The `permissionMode` field controls how the subagent handles permission prompts. Subagents inherit the permission context from the main conversation but can override the mode.

244 

245| Mode | Behavior |

246| :------------------ | :----------------------------------------------------------------- |

247| `default` | Standard permission checking with prompts |

248| `acceptEdits` | Auto-accept file edits |

249| `dontAsk` | Auto-deny permission prompts (explicitly allowed tools still work) |

250| `bypassPermissions` | Skip all permission checks |

251| `plan` | Plan mode (read-only exploration) |

252 

253<Warning>

254 Use `bypassPermissions` with caution. It skips all permission checks, allowing the subagent to execute any operation without approval.

255</Warning>

256 

257If the parent uses `bypassPermissions`, this takes precedence and cannot be overridden.

258 

259#### Preload skills into subagents

260 

261Use the `skills` field to inject skill content into a subagent's context at startup. This gives the subagent domain knowledge without requiring it to discover and load skills during execution.

262 

263```yaml theme={null}

264---

265name: api-developer

266description: Implement API endpoints following team conventions

267skills:

268 - api-conventions

269 - error-handling-patterns

270---

271 

272Implement API endpoints. Follow the conventions and patterns from the preloaded skills.

273```

274 

275The full content of each skill is injected into the subagent's context, not just made available for invocation. Subagents don't inherit skills from the parent conversation; you must list them explicitly.

166 276 

167<Note>277<Note>

168 Using `'inherit'` is particularly useful when you want your subagents to adapt to the model choice of the main conversation, ensuring consistent capabilities and response style throughout your session.278 This is the inverse of [running a skill in a subagent](/en/skills#run-skills-in-a-subagent). With `skills` in a subagent, the subagent controls the system prompt and loads skill content. With `context: fork` in a skill, the skill content is injected into the agent you specify. Both use the same underlying system.

169</Note>279</Note>

170 280 

171### Available tools281#### Conditional rules with hooks

172 282 

173Subagents can be granted access to any of Claude Code's internal tools. See the [tools documentation](/en/settings#tools-available-to-claude) for a complete list of available tools.283For more dynamic control over tool usage, use `PreToolUse` hooks to validate operations before they execute. This is useful when you need to allow some operations of a tool while blocking others.

174 284 

175<Tip>285This example creates a subagent that only allows read-only database queries. The `PreToolUse` hook runs the script specified in `command` before each Bash command executes:

176 **Recommended:** Use the `/agents` command to modify tool access - it provides an interactive interface that lists all available tools, including any connected MCP server tools, making it easier to select the ones you need.286 

177</Tip>287```yaml theme={null}

288---

289name: db-reader

290description: Execute read-only database queries

291tools: Bash

292hooks:

293 PreToolUse:

294 - matcher: "Bash"

295 hooks:

296 - type: command

297 command: "./scripts/validate-readonly-query.sh"

298---

299```

300 

301Claude Code [passes hook input as JSON](/en/hooks#pretooluse-input) via stdin to hook commands. The validation script reads this JSON, extracts the Bash command, and [exits with code 2](/en/hooks#exit-code-2-behavior) to block write operations:

178 302 

179You have two options for configuring tools:303```bash theme={null}

304#!/bin/bash

305# ./scripts/validate-readonly-query.sh

180 306 

181* **Omit the `tools` field** to inherit all tools from the main thread (default), including MCP tools307INPUT=$(cat)

182* **Specify individual tools** as a comma-separated list for more granular control (can be edited manually or via `/agents`)308COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')

183 309 

184**MCP Tools**: Subagents can access MCP tools from configured MCP servers. When the `tools` field is omitted, subagents inherit all MCP tools available to the main thread.310# Block SQL write operations (case-insensitive)

311if echo "$COMMAND" | grep -iE '\b(INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|TRUNCATE)\b' > /dev/null; then

312 echo "Blocked: Only SELECT queries are allowed" >&2

313 exit 2

314fi

315 

316exit 0

317```

185 318 

186## Managing subagents319See [Hook input](/en/hooks#pretooluse-input) for the complete input schema and [exit codes](/en/hooks#simple-exit-code) for how exit codes affect behavior.

187 320 

188### Using the /agents command (Recommended)321#### Disable specific subagents

189 322 

190The `/agents` command provides a comprehensive interface for subagent management:323You can prevent Claude from using specific subagents by adding them to the `deny` array in your [settings](/en/settings#permission-settings). Use the format `Task(subagent-name)` where `subagent-name` matches the subagent's name field.

191 324 

325```json theme={null}

326{

327 "permissions": {

328 "deny": ["Task(Explore)", "Task(my-custom-agent)"]

329 }

330}

192```331```

193/agents332 

333This works for both built-in and custom subagents. You can also use the `--disallowedTools` CLI flag:

334 

335```bash theme={null}

336claude --disallowedTools "Task(Explore)"

194```337```

195 338 

196This opens an interactive menu where you can:339See [IAM documentation](/en/iam#tool-specific-permission-rules) for more details on permission rules.

197 340 

198* View all available subagents (built-in, user, and project)341### Define hooks for subagents

199* Create new subagents with guided setup

200* Edit existing custom subagents, including their tool access

201* Delete custom subagents

202* See which subagents are active when duplicates exist

203* **Easily manage tool permissions** with a complete list of available tools

204 342 

205### Direct file management343Subagents can define [hooks](/en/hooks) that run during the subagent's lifecycle. There are two ways to configure hooks:

206 344 

207You can also manage subagents by working directly with their files:3451. **In the subagent's frontmatter**: Define hooks that run only while that subagent is active

3462. **In `settings.json`**: Define hooks that run in the main session when subagents start or stop

208 347 

209```bash theme={null}348#### Hooks in subagent frontmatter

210# Create a project subagent349 

211mkdir -p .claude/agents350Define hooks directly in the subagent's markdown file. These hooks only run while that specific subagent is active and are cleaned up when it finishes.

212echo '---351 

213name: test-runner352| Event | Matcher input | When it fires |

214description: Use proactively to run tests and fix failures353| :------------ | :------------ | :------------------------------ |

354| `PreToolUse` | Tool name | Before the subagent uses a tool |

355| `PostToolUse` | Tool name | After the subagent uses a tool |

356| `Stop` | (none) | When the subagent finishes |

215 357 

216You are a test automation expert. When you see code changes, proactively run the appropriate tests. If tests fail, analyze the failures and fix them while preserving the original test intent.' > .claude/agents/test-runner.md358This example validates Bash commands with the `PreToolUse` hook and runs a linter after file edits with `PostToolUse`:

217 359 

218# Create a user subagent360```yaml theme={null}

219mkdir -p ~/.claude/agents361---

220# ... create subagent file362name: code-reviewer

363description: Review code changes with automatic linting

364hooks:

365 PreToolUse:

366 - matcher: "Bash"

367 hooks:

368 - type: command

369 command: "./scripts/validate-command.sh $TOOL_INPUT"

370 PostToolUse:

371 - matcher: "Edit|Write"

372 hooks:

373 - type: command

374 command: "./scripts/run-linter.sh"

375---

221```376```

222 377 

223## Using subagents effectively378`Stop` hooks in frontmatter are automatically converted to `SubagentStop` events.

224 379 

225### Automatic delegation380#### Project-level hooks for subagent events

226 381 

227Claude Code proactively delegates tasks based on:382Configure hooks in `settings.json` that respond to subagent lifecycle events in the main session. Use the `matcher` field to target specific agent types by name.

228 383 

229* The task description in your request384| Event | Matcher input | When it fires |

230* The `description` field in subagent configurations385| :-------------- | :-------------- | :------------------------------- |

231* Current context and available tools386| `SubagentStart` | Agent type name | When a subagent begins execution |

387| `SubagentStop` | Agent type name | When a subagent completes |

232 388 

233<Tip>389This example runs setup and cleanup scripts only when the `db-agent` subagent starts and stops:

234 To encourage more proactive subagent use, include phrases like "use PROACTIVELY" or "MUST BE USED" in your `description` field.

235</Tip>

236 390 

237### Explicit invocation391```json theme={null}

392{

393 "hooks": {

394 "SubagentStart": [

395 {

396 "matcher": "db-agent",

397 "hooks": [

398 { "type": "command", "command": "./scripts/setup-db-connection.sh" }

399 ]

400 }

401 ],

402 "SubagentStop": [

403 {

404 "matcher": "db-agent",

405 "hooks": [

406 { "type": "command", "command": "./scripts/cleanup-db-connection.sh" }

407 ]

408 }

409 ]

410 }

411}

412```

413 

414See [Hooks](/en/hooks) for the complete hook configuration format.

238 415 

239Request a specific subagent by mentioning it in your command:416## Work with subagents

417 

418### Understand automatic delegation

419 

420Claude automatically delegates tasks based on the task description in your request, the `description` field in subagent configurations, and current context. To encourage proactive delegation, include phrases like "use proactively" in your subagent's description field.

421 

422You can also request a specific subagent explicitly:

240 423 

241```424```

242> Use the test-runner subagent to fix failing tests425Use the test-runner subagent to fix failing tests

243> Have the code-reviewer subagent look at my recent changes426Have the code-reviewer subagent look at my recent changes

244> Ask the debugger subagent to investigate this error

245```427```

246 428 

247## Built-in subagents429### Run subagents in foreground or background

248 430 

249Claude Code includes built-in subagents that are available out of the box:431Subagents can run in the foreground (blocking) or background (concurrent):

250 432 

251### General-purpose subagent433* **Foreground subagents** block the main conversation until complete. Permission prompts and clarifying questions (like [`AskUserQuestion`](/en/settings#tools-available-to-claude)) are passed through to you.

434* **Background subagents** run concurrently while you continue working. They inherit the parent's permissions and auto-deny anything not pre-approved. If a background subagent needs a permission it doesn't have or needs to ask clarifying questions, that tool call fails but the subagent continues. MCP tools are not available in background subagents.

252 435 

253The general-purpose subagent is a capable agent for complex, multi-step tasks that require both exploration and action. Unlike the Explore subagent, it can modify files and execute a wider range of operations.436If a background subagent fails due to missing permissions, you can [resume it](#resume-subagents) in the foreground to retry with interactive prompts.

254 437 

255**Key characteristics:**438Claude decides whether to run subagents in the foreground or background based on the task. You can also:

256 439 

257* **Model**: Uses Sonnet for more capable reasoning440* Ask Claude to "run this in the background"

258* **Tools**: Has access to all tools441* Press **Ctrl+B** to background a running task

259* **Mode**: Can read and write files, execute commands, make changes

260* **Purpose**: Complex research tasks, multi-step operations, code modifications

261 442 

262**When Claude uses it:**443To disable all background task functionality, set the `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` environment variable to `1`. See [Environment variables](/en/settings#environment-variables).

263 444 

264Claude delegates to the general-purpose subagent when:445### Common patterns

265 446 

266* The task requires both exploration and modification447#### Isolate high-volume operations

267* Complex reasoning is needed to interpret search results

268* Multiple strategies may be needed if initial searches fail

269* The task has multiple steps that depend on each other

270 448 

271**Example scenario:**449One of the most effective uses for subagents is isolating operations that produce large amounts of output. Running tests, fetching documentation, or processing log files can consume significant context. By delegating these to a subagent, the verbose output stays in the subagent's context while only the relevant summary returns to your main conversation.

272 450 

273```451```

274User: Find all the places where we handle authentication and update them to use the new token format452Use a subagent to run the test suite and report only the failing tests with their error messages

275 

276Claude: [Invokes general-purpose subagent]

277[Agent searches for auth-related code across codebase]

278[Agent reads and analyzes multiple files]

279[Agent makes necessary edits]

280[Returns detailed writeup of changes made]

281```453```

282 454 

283### Plan subagent455#### Run parallel research

284 456 

285The Plan subagent is a specialized built-in agent designed for use during plan mode. When Claude is operating in plan mode (non-execution mode), it uses the Plan subagent to conduct research and gather information about your codebase before presenting a plan.457For independent investigations, spawn multiple subagents to work simultaneously:

286 458 

287**Key characteristics:**459```

460Research the authentication, database, and API modules in parallel using separate subagents

461```

288 462 

289* **Model**: Uses Sonnet for more capable analysis463Each subagent explores its area independently, then Claude synthesizes the findings. This works best when the research paths don't depend on each other.

290* **Tools**: Has access to Read, Glob, Grep, and Bash tools for codebase exploration

291* **Purpose**: Searches files, analyzes code structure, and gathers context

292* **Automatic invocation**: Claude automatically uses this agent when in plan mode and needs to research the codebase

293 464 

294**How it works:**465<Warning>

295When you're in plan mode and Claude needs to understand your codebase to create a plan, it delegates research tasks to the Plan subagent. This prevents infinite nesting of agents (subagents cannot spawn other subagents) while still allowing Claude to gather the necessary context.466 When subagents complete, their results return to your main conversation. Running many subagents that each return detailed results can consume significant context.

467</Warning>

296 468 

297**Example scenario:**469#### Chain subagents

298 470 

299```471For multi-step workflows, ask Claude to use subagents in sequence. Each subagent completes its task and returns results to Claude, which then passes relevant context to the next subagent.

300User: [In plan mode] Help me refactor the authentication module

301 472 

302Claude: Let me research your authentication implementation first...473```

303[Internally invokes Plan subagent to explore auth-related files]474Use the code-reviewer subagent to find performance issues, then use the optimizer subagent to fix them

304[Plan subagent searches codebase and returns findings]

305Claude: Based on my research, here's my proposed plan...

306```475```

307 476 

308<Tip>477### Choose between subagents and main conversation

309 The Plan subagent is only used in plan mode. In normal execution mode, Claude uses the general-purpose agent or other custom subagents you've created.

310</Tip>

311 478 

312### Explore subagent479Use the **main conversation** when:

313 480 

314The Explore subagent is a fast, lightweight agent optimized for searching and analyzing codebases. It operates in strict read-only mode and is designed for rapid file discovery and code exploration.481* The task needs frequent back-and-forth or iterative refinement

482* Multiple phases share significant context (planning → implementation → testing)

483* You're making a quick, targeted change

484* Latency matters. Subagents start fresh and may need time to gather context

315 485 

316**Key characteristics:**486Use **subagents** when:

317 487 

318* **Model**: Uses Haiku for fast, low-latency searches488* The task produces verbose output you don't need in your main context

319* **Mode**: Strictly read-only - cannot create, modify, or delete files489* You want to enforce specific tool restrictions or permissions

320* **Tools available**:490* The work is self-contained and can return a summary

321 * Glob - File pattern matching

322 * Grep - Content searching with regex

323 * Read - Reading file contents

324 * Bash - Read-only commands only (ls, git status, git log, git diff, find, cat, head, tail)

325 491 

326**When Claude uses it:**492Consider [Skills](/en/skills) instead when you want reusable prompts or workflows that run in the main conversation context rather than isolated subagent context.

327 493 

328Claude will delegate to the Explore subagent when it needs to search or understand a codebase but doesn't need to make changes. This is more efficient than the main agent running multiple search commands directly, as content found during the exploration process doesn't bloat the main conversation.494<Note>

495 Subagents cannot spawn other subagents. If your workflow requires nested delegation, use [Skills](/en/skills) or [chain subagents](#chain-subagents) from the main conversation.

496</Note>

329 497 

330**Thoroughness levels:**498### Manage subagent context

331 499 

332When invoking the Explore subagent, Claude specifies a thoroughness level:500#### Resume subagents

333 501 

334* **Quick** - Basic searches, fastest results. Good for simple lookups.502Each subagent invocation creates a new instance with fresh context. To continue an existing subagent's work instead of starting over, ask Claude to resume it.

335* **Medium** - Moderate exploration. Balances speed and thoroughness.

336* **Very thorough** - Comprehensive analysis across multiple locations and naming conventions. Used when the target might be in unexpected places.

337 503 

338**Example scenarios:**504Resumed subagents retain their full conversation history, including all previous tool calls, results, and reasoning. The subagent picks up exactly where it stopped rather than starting fresh.

339 505 

340```506When a subagent completes, Claude receives its agent ID. To resume a subagent, ask Claude to continue the previous work:

341User: Where are errors from the client handled?

342 507 

343Claude: [Invokes Explore subagent with "medium" thoroughness]

344[Explore uses Grep to search for error handling patterns]

345[Explore uses Read to examine promising files]

346[Returns findings with absolute file paths]

347Claude: Client errors are handled in src/services/process.ts:712...

348```508```

509Use the code-reviewer subagent to review the authentication module

510[Agent completes]

349 511 

512Continue that code review and now analyze the authorization logic

513[Claude resumes the subagent with full context from previous conversation]

350```514```

351User: What's the codebase structure?

352 515 

353Claude: [Invokes Explore subagent with "quick" thoroughness]516You can also ask Claude for the agent ID if you want to reference it explicitly, or find IDs in the transcript files at `~/.claude/projects/{project}/{sessionId}/subagents/`. Each transcript is stored as `agent-{agentId}.jsonl`.

354[Explore uses Glob and ls to map directory structure]517 

355[Returns overview of key directories and their purposes]518Subagent transcripts persist independently of the main conversation:

519 

520* **Main conversation compaction**: When the main conversation compacts, subagent transcripts are unaffected. They're stored in separate files.

521* **Session persistence**: Subagent transcripts persist within their session. You can [resume a subagent](#resume-subagents) after restarting Claude Code by resuming the same session.

522* **Automatic cleanup**: Transcripts are cleaned up based on the `cleanupPeriodDays` setting (default: 30 days).

523 

524#### Auto-compaction

525 

526Subagents support automatic compaction using the same logic as the main conversation. By default, auto-compaction triggers at approximately 95% capacity. To trigger compaction earlier, set `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` to a lower percentage (for example, `50`). See [environment variables](/en/settings#environment-variables) for details.

527 

528Compaction events are logged in subagent transcript files:

529 

530```json theme={null}

531{

532 "type": "system",

533 "subtype": "compact_boundary",

534 "compactMetadata": {

535 "trigger": "auto",

536 "preTokens": 167189

537 }

538}

356```539```

357 540 

541The `preTokens` value shows how many tokens were used before compaction occurred.

542 

358## Example subagents543## Example subagents

359 544 

545These examples demonstrate effective patterns for building subagents. Use them as starting points, or generate a customized version with Claude.

546 

547<Tip>

548 **Best practices:**

549 

550 * **Design focused subagents:** each subagent should excel at one specific task

551 * **Write detailed descriptions:** Claude uses the description to decide when to delegate

552 * **Limit tool access:** grant only necessary permissions for security and focus

553 * **Check into version control:** share project subagents with your team

554</Tip>

555 

360### Code reviewer556### Code reviewer

361 557 

558A read-only subagent that reviews code without modifying it. This example shows how to design a focused subagent with limited tool access (no Edit or Write) and a detailed prompt that specifies exactly what to look for and how to format output.

559 

362```markdown theme={null}560```markdown theme={null}

363---561---

364name: code-reviewer562name: code-reviewer


3763. Begin review immediately5733. Begin review immediately

377 574 

378Review checklist:575Review checklist:

379- Code is simple and readable576- Code is clear and readable

380- Functions and variables are well-named577- Functions and variables are well-named

381- No duplicated code578- No duplicated code

382- Proper error handling579- Proper error handling


395 592 

396### Debugger593### Debugger

397 594 

595A subagent that can both analyze and fix issues. Unlike the code reviewer, this one includes Edit because fixing bugs requires modifying code. The prompt provides a clear workflow from diagnosis to verification.

596 

398```markdown theme={null}597```markdown theme={null}

399---598---

400name: debugger599name: debugger


425- Testing approach624- Testing approach

426- Prevention recommendations625- Prevention recommendations

427 626 

428Focus on fixing the underlying issue, not just symptoms.627Focus on fixing the underlying issue, not the symptoms.

429```628```

430 629 

431### Data scientist630### Data scientist

432 631 

632A domain-specific subagent for data analysis work. This example shows how to create subagents for specialized workflows outside of typical coding tasks. It explicitly sets `model: sonnet` for more capable analysis.

633 

433```markdown theme={null}634```markdown theme={null}

434---635---

435name: data-scientist636name: data-scientist


463Always ensure queries are efficient and cost-effective.664Always ensure queries are efficient and cost-effective.

464```665```

465 666 

466## Best practices667### Database query validator

467 

468* **Start with Claude-generated agents**: We highly recommend generating your initial subagent with Claude and then iterating on it to make it personally yours. This approach gives you the best results - a solid foundation that you can customize to your specific needs.

469 668 

470* **Design focused subagents**: Create subagents with single, clear responsibilities rather than trying to make one subagent do everything. This improves performance and makes subagents more predictable.669A subagent that allows Bash access but validates commands to permit only read-only SQL queries. This example shows how to use `PreToolUse` hooks for conditional validation when you need finer control than the `tools` field provides.

471 670 

472* **Write detailed prompts**: Include specific instructions, examples, and constraints in your system prompts. The more guidance you provide, the better the subagent will perform.671```markdown theme={null}

473 672---

474* **Limit tool access**: Only grant tools that are necessary for the subagent's purpose. This improves security and helps the subagent focus on relevant actions.673name: db-reader

475 674description: Execute read-only database queries. Use when analyzing data or generating reports.

476* **Version control**: Check project subagents into version control so your team can benefit from and improve them collaboratively.675tools: Bash

477 676hooks:

478## Advanced usage677 PreToolUse:

678 - matcher: "Bash"

679 hooks:

680 - type: command

681 command: "./scripts/validate-readonly-query.sh"

682---

479 683 

480### Chaining subagents684You are a database analyst with read-only access. Execute SELECT queries to answer questions about the data.

481 685 

482For complex workflows, you can chain multiple subagents:686When asked to analyze data:

6871. Identify which tables contain the relevant data

6882. Write efficient SELECT queries with appropriate filters

6893. Present results clearly with context

483 690 

691You cannot modify data. If asked to INSERT, UPDATE, DELETE, or modify schema, explain that you only have read access.

484```692```

485> First use the code-analyzer subagent to find performance issues, then use the optimizer subagent to fix them

486```

487 

488### Dynamic subagent selection

489 

490Claude Code intelligently selects subagents based on context. Make your `description` fields specific and action-oriented for best results.

491 693 

492### Resumable subagents694Claude Code [passes hook input as JSON](/en/hooks#pretooluse-input) via stdin to hook commands. The validation script reads this JSON, extracts the command being executed, and checks it against a list of SQL write operations. If a write operation is detected, the script [exits with code 2](/en/hooks#exit-code-2-behavior) to block execution and returns an error message to Claude via stderr.

493 695 

494Subagents can be resumed to continue previous conversations, which is particularly useful for long-running research or analysis tasks that need to be continued across multiple invocations.696Create the validation script anywhere in your project. The path must match the `command` field in your hook configuration:

495 697 

496**How it works:**698```bash theme={null}

497 699#!/bin/bash

498* Each subagent execution is assigned a unique `agentId`700# Blocks SQL write operations, allows SELECT queries

499* The agent's conversation is stored in a separate transcript file: `agent-{agentId}.jsonl`

500* You can resume a previous agent by providing its `agentId` via the `resume` parameter

501* When resumed, the agent continues with full context from its previous conversation

502 701 

503**Example workflow:**702# Read JSON input from stdin

703INPUT=$(cat)

504 704 

505Initial invocation:705# Extract the command field from tool_input using jq

706COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')

506 707 

507```708if [ -z "$COMMAND" ]; then

508> Use the code-analyzer agent to start reviewing the authentication module709 exit 0

509 710fi

510[Agent completes initial analysis and returns agentId: "abc123"]

511```

512 711 

513Resume the agent:712# Block write operations (case-insensitive)

713if echo "$COMMAND" | grep -iE '\b(INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|TRUNCATE|REPLACE|MERGE)\b' > /dev/null; then

714 echo "Blocked: Write operations not allowed. Use SELECT queries only." >&2

715 exit 2

716fi

514 717 

718exit 0

515```719```

516> Resume agent abc123 and now analyze the authorization logic as well

517 

518[Agent continues with full context from previous conversation]

519```

520 

521**Use cases:**

522 

523* **Long-running research**: Break down large codebase analysis into multiple sessions

524* **Iterative refinement**: Continue refining a subagent's work without losing context

525* **Multi-step workflows**: Have a subagent work on related tasks sequentially while maintaining context

526 720 

527**Technical details:**721Make the script executable:

528 722 

529* Agent transcripts are stored in your project directory723```bash theme={null}

530* Recording is disabled during resume to avoid duplicating messages724chmod +x ./scripts/validate-readonly-query.sh

531* Both synchronous and asynchronous agents can be resumed

532* The `resume` parameter accepts the agent ID from a previous execution

533 

534**Programmatic usage:**

535 

536If you're using the Agent SDK or interacting with the AgentTool directly, you can pass the `resume` parameter:

537 

538```typescript theme={null}

539{

540 "description": "Continue analysis",

541 "prompt": "Now examine the error handling patterns",

542 "subagent_type": "code-analyzer",

543 "resume": "abc123" // Agent ID from previous execution

544}

545```725```

546 726 

547<Tip>727The hook receives JSON via stdin with the Bash command in `tool_input.command`. Exit code 2 blocks the operation and feeds the error message back to Claude. See [Hooks](/en/hooks#simple-exit-code) for details on exit codes and [Hook input](/en/hooks#pretooluse-input) for the complete input schema.

548 Keep track of agent IDs for tasks you may want to resume later. Claude Code displays the agent ID when a subagent completes its work.

549</Tip>

550 

551## Performance considerations

552 728 

553* **Context efficiency**: Agents help preserve main context, enabling longer overall sessions729## Next steps

554* **Latency**: Subagents start off with a clean slate each time they are invoked and may add latency as they gather context that they require to do their job effectively.

555 730 

556## Related documentation731Now that you understand subagents, explore these related features:

557 732 

558* [Plugins](/en/plugins) - Extend Claude Code with custom agents through plugins733* [Distribute subagents with plugins](/en/plugins) to share subagents across teams or projects

559* [Slash commands](/en/slash-commands) - Learn about other built-in commands734* [Run Claude Code programmatically](/en/headless) with the Agent SDK for CI/CD and automation

560* [Settings](/en/settings) - Configure Claude Code behavior735* [Use MCP servers](/en/mcp) to give subagents access to external tools and data

561* [Hooks](/en/hooks) - Automate workflows with event handlers

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Optimize your terminal setup5# Optimize your terminal setup

2 6 

3> Claude Code works best when your terminal is properly configured. Follow these guidelines to optimize your experience.7> Claude Code works best when your terminal is properly configured. Follow these guidelines to optimize your experience.


10 14 

11### Line breaks15### Line breaks

12 16 

13You have several options for entering linebreaks into Claude Code:17You have several options for entering line breaks into Claude Code:

14 18 

15* **Quick escape**: Type `\` followed by Enter to create a newline19* **Quick escape**: Type `\` followed by Enter to create a newline

16* **Keyboard shortcut**: Set up a keybinding to insert a newline20* **Shift+Enter**: Works out of the box in iTerm2, WezTerm, Ghostty, and Kitty

21* **Keyboard shortcut**: Set up a keybinding to insert a newline in other terminals

22 

23**Set up Shift+Enter for other terminals**

17 24 

18#### Set up Shift+Enter (VS Code or iTerm2):25Run `/terminal-setup` within Claude Code to automatically configure Shift+Enter for VS Code, Alacritty, Zed, and Warp.

19 26 

20Run `/terminal-setup` within Claude Code to automatically configure Shift+Enter.27<Note>

28 The `/terminal-setup` command is only visible in terminals that require manual configuration. If you're using iTerm2, WezTerm, Ghostty, or Kitty, you won't see this command because Shift+Enter already works natively.

29</Note>

21 30 

22#### Set up Option+Enter (VS Code, iTerm2 or macOS Terminal.app):31**Set up Option+Enter (VS Code, iTerm2 or macOS Terminal.app)**

23 32 

24**For Mac Terminal.app:**33**For Mac Terminal.app:**

25 34 


65The supported subset includes:74The supported subset includes:

66 75 

67* Mode switching: `Esc` (to NORMAL), `i`/`I`, `a`/`A`, `o`/`O` (to INSERT)76* Mode switching: `Esc` (to NORMAL), `i`/`I`, `a`/`A`, `o`/`O` (to INSERT)

68* Navigation: `h`/`j`/`k`/`l`, `w`/`e`/`b`, `0`/`$`/`^`, `gg`/`G`77* Navigation: `h`/`j`/`k`/`l`, `w`/`e`/`b`, `0`/`$`/`^`, `gg`/`G`, `f`/`F`/`t`/`T` with `;`/`,` repeat

69* Editing: `x`, `dw`/`de`/`db`/`dd`/`D`, `cw`/`ce`/`cb`/`cc`/`C`, `.` (repeat)78* Editing: `x`, `dw`/`de`/`db`/`dd`/`D`, `cw`/`ce`/`cb`/`cc`/`C`, `.` (repeat)

79* Yank/paste: `yy`/`Y`, `yw`/`ye`/`yb`, `p`/`P`

80* Text objects: `iw`/`aw`, `iW`/`aW`, `i"`/`a"`, `i'`/`a'`, `i(`/`a(`, `i[`/`a[`, `i{`/`a{`

81* Indentation: `>>`/`<<`

82* Line operations: `J` (join lines)

83 

84See [Interactive mode](/en/interactive-mode#vim-editor-mode) for the complete reference.

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Enterprise deployment overview5# Enterprise deployment overview

2 6 

3> Learn how Claude Code can integrate with various third-party services and infrastructure to meet enterprise deployment requirements.7> Learn how Claude Code can integrate with various third-party services and infrastructure to meet enterprise deployment requirements.

4 8 

5This page provides an overview of available deployment options and helps you choose the right configuration for your organization.9Organizations can deploy Claude Code through Anthropic directly or through a cloud provider. This page helps you choose the right configuration.

10 

11## Compare deployment options

12 

13For most organizations, Claude for Teams or Claude for Enterprise provides the best experience. Team members get access to both Claude Code and Claude on the web with a single subscription, centralized billing, and no infrastructure setup required.

14 

15**Claude for Teams** is self-service and includes collaboration features, admin tools, and billing management. Best for smaller teams that need to get started quickly.

16 

17**Claude for Enterprise** adds SSO and domain capture, role-based permissions, compliance API access, and managed policy settings for deploying organization-wide Claude Code configurations. Best for larger organizations with security and compliance requirements.

18 

19Learn more about [Team plans](https://support.claude.com/en/articles/9266767-what-is-the-team-plan) and [Enterprise plans](https://support.claude.com/en/articles/9797531-what-is-the-enterprise-plan).

6 20 

7## Provider comparison21If your organization has specific infrastructure requirements, compare the options below:

8 22 

9<table>23<table>

10 <thead>24 <thead>

11 <tr>25 <tr>

12 <th>Feature</th>26 <th>Feature</th>

13 <th>Anthropic</th>27 <th>Claude for Teams/Enterprise</th>

28 <th>Anthropic Console</th>

14 <th>Amazon Bedrock</th>29 <th>Amazon Bedrock</th>

15 <th>Google Vertex AI</th>30 <th>Google Vertex AI</th>

16 <th>Microsoft Foundry</th>31 <th>Microsoft Foundry</th>


18 </thead>33 </thead>

19 34 

20 <tbody>35 <tbody>

36 <tr>

37 <td>Best for</td>

38 <td>Most organizations (recommended)</td>

39 <td>Individual developers</td>

40 <td>AWS-native deployments</td>

41 <td>GCP-native deployments</td>

42 <td>Azure-native deployments</td>

43 </tr>

44 

45 <tr>

46 <td>Billing</td>

47 <td><strong>Teams:</strong> \$150/seat (Premium) with PAYG available<br /><strong>Enterprise:</strong> <a href="https://claude.com/contact-sales">Contact Sales</a></td>

48 <td>PAYG</td>

49 <td>PAYG through AWS</td>

50 <td>PAYG through GCP</td>

51 <td>PAYG through Azure</td>

52 </tr>

53 

21 <tr>54 <tr>

22 <td>Regions</td>55 <td>Regions</td>

23 <td>Supported [countries](https://www.anthropic.com/supported-countries)</td>56 <td>Supported [countries](https://www.anthropic.com/supported-countries)</td>

57 <td>Supported [countries](https://www.anthropic.com/supported-countries)</td>

24 <td>Multiple AWS [regions](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html)</td>58 <td>Multiple AWS [regions](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html)</td>

25 <td>Multiple GCP [regions](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations)</td>59 <td>Multiple GCP [regions](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations)</td>

26 <td>Multiple Azure [regions](https://azure.microsoft.com/en-us/explore/global-infrastructure/products-by-region/)</td>60 <td>Multiple Azure [regions](https://azure.microsoft.com/en-us/explore/global-infrastructure/products-by-region/)</td>


32 <td>Enabled by default</td>66 <td>Enabled by default</td>

33 <td>Enabled by default</td>67 <td>Enabled by default</td>

34 <td>Enabled by default</td>68 <td>Enabled by default</td>

69 <td>Enabled by default</td>

35 </tr>70 </tr>

36 71 

37 <tr>72 <tr>

38 <td>Authentication</td>73 <td>Authentication</td>

74 <td>Claude.ai SSO or email</td>

39 <td>API key</td>75 <td>API key</td>

40 <td>API key or AWS credentials</td>76 <td>API key or AWS credentials</td>

41 <td>GCP credentials</td>77 <td>GCP credentials</td>


44 80 

45 <tr>81 <tr>

46 <td>Cost tracking</td>82 <td>Cost tracking</td>

47 <td>Dashboard</td>83 <td>Usage dashboard</td>

84 <td>Usage dashboard</td>

48 <td>AWS Cost Explorer</td>85 <td>AWS Cost Explorer</td>

49 <td>GCP Billing</td>86 <td>GCP Billing</td>

50 <td>Azure Cost Management</td>87 <td>Azure Cost Management</td>

51 </tr>88 </tr>

52 89 

90 <tr>

91 <td>Includes Claude on web</td>

92 <td>Yes</td>

93 <td>No</td>

94 <td>No</td>

95 <td>No</td>

96 <td>No</td>

97 </tr>

98 

53 <tr>99 <tr>

54 <td>Enterprise features</td>100 <td>Enterprise features</td>

55 <td>Teams, usage monitoring</td>101 <td>Team management, SSO, usage monitoring</td>

102 <td>None</td>

56 <td>IAM policies, CloudTrail</td>103 <td>IAM policies, CloudTrail</td>

57 <td>IAM roles, Cloud Audit Logs</td>104 <td>IAM roles, Cloud Audit Logs</td>

58 <td>RBAC policies, Azure Monitor</td>105 <td>RBAC policies, Azure Monitor</td>


60 </tbody>107 </tbody>

61</table>108</table>

62 109 

63## Cloud providers110Select a deployment option to view setup instructions:

64 

65<CardGroup cols={3}>

66 <Card title="Amazon Bedrock" icon="aws" href="/en/amazon-bedrock">

67 Use Claude models through AWS infrastructure with API key or IAM-based authentication and AWS-native monitoring

68 </Card>

69 

70 <Card title="Google Vertex AI" icon="google" href="/en/google-vertex-ai">

71 Access Claude models via Google Cloud Platform with enterprise-grade security and compliance

72 </Card>

73 

74 <Card title="Microsoft Foundry" icon="microsoft" href="/en/microsoft-foundry">

75 Access Claude through Azure with API key or Microsoft Entra ID authentication and Azure billing

76 </Card>

77</CardGroup>

78 

79## Corporate infrastructure

80 111 

81<CardGroup cols={2}>112* [Claude for Teams or Enterprise](/en/iam#claude-for-teams-or-enterprise-recommended)

82 <Card title="Enterprise Network" icon="shield" href="/en/network-config">113* [Anthropic Console](/en/iam#claude-console-authentication)

83 Configure Claude Code to work with your organization's proxy servers and SSL/TLS requirements114* [Amazon Bedrock](/en/amazon-bedrock)

84 </Card>115* [Google Vertex AI](/en/google-vertex-ai)

116* [Microsoft Foundry](/en/microsoft-foundry)

85 117 

86 <Card title="LLM Gateway" icon="server" href="/en/llm-gateway">118## Configure proxies and gateways

87 Deploy centralized model access with usage tracking, budgeting, and audit logging

88 </Card>

89</CardGroup>

90 119 

91## Configuration overview120Most organizations can use a cloud provider directly without additional configuration. However, you may need to configure a corporate proxy or LLM gateway if your organization has specific network or management requirements. These are different configurations that can be used together:

92 121 

93Claude Code supports flexible configuration options that allow you to combine different providers and infrastructure:122* **Corporate proxy**: Routes traffic through an HTTP/HTTPS proxy. Use this if your organization requires all outbound traffic to pass through a proxy server for security monitoring, compliance, or network policy enforcement. Configure with the `HTTPS_PROXY` or `HTTP_PROXY` environment variables. Learn more in [Enterprise network configuration](/en/network-config).

123* **LLM Gateway**: A service that sits between Claude Code and the cloud provider to handle authentication and routing. Use this if you need centralized usage tracking across teams, custom rate limiting or budgets, or centralized authentication management. Configure with the `ANTHROPIC_BASE_URL`, `ANTHROPIC_BEDROCK_BASE_URL`, or `ANTHROPIC_VERTEX_BASE_URL` environment variables. Learn more in [LLM gateway configuration](/en/llm-gateway).

94 124 

95<Note>125The following examples show the environment variables to set in your shell or shell profile (`.bashrc`, `.zshrc`). See [Settings](/en/settings) for other configuration methods.

96 Understand the difference between:

97 126 

98 * **Corporate proxy**: An HTTP/HTTPS proxy for routing traffic (set via `HTTPS_PROXY` or `HTTP_PROXY`)127### Amazon Bedrock

99 * **LLM Gateway**: A service that handles authentication and provides provider-compatible endpoints (set via `ANTHROPIC_BASE_URL`, `ANTHROPIC_BEDROCK_BASE_URL`, or `ANTHROPIC_VERTEX_BASE_URL`)

100 128 

101 Both configurations can be used in tandem.129<Tabs>

102</Note>130 <Tab title="Corporate proxy">

131 Route Bedrock traffic through your corporate proxy by setting the following [environment variables](/en/settings#environment-variables):

103 132 

104### Using Bedrock with corporate proxy133 ```bash theme={null}

134 # Enable Bedrock

135 export CLAUDE_CODE_USE_BEDROCK=1

136 export AWS_REGION=us-east-1

105 137 

106Route Bedrock traffic through a corporate HTTP/HTTPS proxy:138 # Configure corporate proxy

139 export HTTPS_PROXY='https://proxy.example.com:8080'

140 ```

141 </Tab>

107 142 

108```bash theme={null}143 <Tab title="LLM Gateway">

109# Enable Bedrock144 Route Bedrock traffic through your LLM gateway by setting the following [environment variables](/en/settings#environment-variables):

110export CLAUDE_CODE_USE_BEDROCK=1

111export AWS_REGION=us-east-1

112 145 

113# Configure corporate proxy146 ```bash theme={null}

114export HTTPS_PROXY='https://proxy.example.com:8080'147 # Enable Bedrock

115```148 export CLAUDE_CODE_USE_BEDROCK=1

116 149 

117### Using Bedrock with LLM Gateway150 # Configure LLM gateway

151 export ANTHROPIC_BEDROCK_BASE_URL='https://your-llm-gateway.com/bedrock'

152 export CLAUDE_CODE_SKIP_BEDROCK_AUTH=1 # If gateway handles AWS auth

153 ```

154 </Tab>

155</Tabs>

118 156 

119Use a gateway service that provides Bedrock-compatible endpoints:157### Microsoft Foundry

120 158 

121```bash theme={null}159<Tabs>

122# Enable Bedrock160 <Tab title="Corporate proxy">

123export CLAUDE_CODE_USE_BEDROCK=1161 Route Foundry traffic through your corporate proxy by setting the following [environment variables](/en/settings#environment-variables):

124 162 

125# Configure LLM gateway163 ```bash theme={null}

126export ANTHROPIC_BEDROCK_BASE_URL='https://your-llm-gateway.com/bedrock'164 # Enable Microsoft Foundry

127export CLAUDE_CODE_SKIP_BEDROCK_AUTH=1 # If gateway handles AWS auth165 export CLAUDE_CODE_USE_FOUNDRY=1

128```166 export ANTHROPIC_FOUNDRY_RESOURCE=your-resource

167 export ANTHROPIC_FOUNDRY_API_KEY=your-api-key # Or omit for Entra ID auth

129 168 

130### Using Foundry with corporate proxy169 # Configure corporate proxy

170 export HTTPS_PROXY='https://proxy.example.com:8080'

171 ```

172 </Tab>

131 173 

132Route Azure traffic through a corporate HTTP/HTTPS proxy:174 <Tab title="LLM Gateway">

175 Route Foundry traffic through your LLM gateway by setting the following [environment variables](/en/settings#environment-variables):

133 176 

134```bash theme={null}177 ```bash theme={null}

135# Enable Microsoft Foundry178 # Enable Microsoft Foundry

136export CLAUDE_CODE_USE_FOUNDRY=1179 export CLAUDE_CODE_USE_FOUNDRY=1

137export ANTHROPIC_FOUNDRY_RESOURCE=your-resource

138export ANTHROPIC_FOUNDRY_API_KEY=your-api-key # Or omit for Entra ID auth

139 180 

140# Configure corporate proxy181 # Configure LLM gateway

141export HTTPS_PROXY='https://proxy.example.com:8080'182 export ANTHROPIC_FOUNDRY_BASE_URL='https://your-llm-gateway.com'

142```183 export CLAUDE_CODE_SKIP_FOUNDRY_AUTH=1 # If gateway handles Azure auth

184 ```

185 </Tab>

186</Tabs>

143 187 

144### Using Foundry with LLM Gateway188### Google Vertex AI

145 189 

146Use a gateway service that provides Azure-compatible endpoints:190<Tabs>

191 <Tab title="Corporate proxy">

192 Route Vertex AI traffic through your corporate proxy by setting the following [environment variables](/en/settings#environment-variables):

147 193 

148```bash theme={null}194 ```bash theme={null}

149# Enable Microsoft Foundry195 # Enable Vertex

150export CLAUDE_CODE_USE_FOUNDRY=1196 export CLAUDE_CODE_USE_VERTEX=1

197 export CLOUD_ML_REGION=us-east5

198 export ANTHROPIC_VERTEX_PROJECT_ID=your-project-id

151 199 

152# Configure LLM gateway200 # Configure corporate proxy

153export ANTHROPIC_FOUNDRY_BASE_URL='https://your-llm-gateway.com'201 export HTTPS_PROXY='https://proxy.example.com:8080'

154export CLAUDE_CODE_SKIP_FOUNDRY_AUTH=1 # If gateway handles Azure auth202 ```

155```203 </Tab>

156 204 

157### Using Vertex AI with corporate proxy205 <Tab title="LLM Gateway">

206 Route Vertex AI traffic through your LLM gateway by setting the following [environment variables](/en/settings#environment-variables):

158 207 

159Route Vertex AI traffic through a corporate HTTP/HTTPS proxy:208 ```bash theme={null}

209 # Enable Vertex

210 export CLAUDE_CODE_USE_VERTEX=1

160 211 

161```bash theme={null}212 # Configure LLM gateway

162# Enable Vertex213 export ANTHROPIC_VERTEX_BASE_URL='https://your-llm-gateway.com/vertex'

163export CLAUDE_CODE_USE_VERTEX=1214 export CLAUDE_CODE_SKIP_VERTEX_AUTH=1 # If gateway handles GCP auth

164export CLOUD_ML_REGION=us-east5215 ```

165export ANTHROPIC_VERTEX_PROJECT_ID=your-project-id216 </Tab>

217</Tabs>

166 218 

167# Configure corporate proxy219<Tip>

168export HTTPS_PROXY='https://proxy.example.com:8080'220 Use `/status` in Claude Code to verify your proxy and gateway configuration is applied correctly.

169```221</Tip>

170 

171### Using Vertex AI with LLM Gateway

172 

173Combine Google Vertex AI models with an LLM gateway for centralized management:

174 

175```bash theme={null}

176# Enable Vertex

177export CLAUDE_CODE_USE_VERTEX=1

178 

179# Configure LLM gateway

180export ANTHROPIC_VERTEX_BASE_URL='https://your-llm-gateway.com/vertex'

181export CLAUDE_CODE_SKIP_VERTEX_AUTH=1 # If gateway handles GCP auth

182```

183 

184### Authentication configuration

185 

186Claude Code uses the `ANTHROPIC_AUTH_TOKEN` for the `Authorization` header when needed. The `SKIP_AUTH` flags (`CLAUDE_CODE_SKIP_BEDROCK_AUTH`, `CLAUDE_CODE_SKIP_VERTEX_AUTH`) are used in LLM gateway scenarios where the gateway handles provider authentication.

187 

188## Choosing the right deployment configuration

189 

190Consider these factors when selecting your deployment approach:

191 

192### Direct provider access

193 

194Best for organizations that:

195 

196* Want the simplest setup

197* Have existing AWS or GCP infrastructure

198* Need provider-native monitoring and compliance

199 

200### Corporate proxy

201 

202Best for organizations that:

203 

204* Have existing corporate proxy requirements

205* Need traffic monitoring and compliance

206* Must route all traffic through specific network paths

207 

208### LLM Gateway

209 

210Best for organizations that:

211 

212* Need usage tracking across teams

213* Want to dynamically switch between models

214* Require custom rate limiting or budgets

215* Need centralized authentication management

216 

217## Debugging

218 

219When debugging your deployment:

220 

221* Use the `claude /status` [slash command](/en/slash-commands). This command provides observability into any applied authentication, proxy, and URL settings.

222* Set environment variable `export ANTHROPIC_LOG=debug` to log requests.

223 222 

224## Best practices for organizations223## Best practices for organizations

225 224 

226### 1. Invest in documentation and memory225### Invest in documentation and memory

227 226 

228We strongly recommend investing in documentation so that Claude Code understands your codebase. Organizations can deploy CLAUDE.md files at multiple levels:227We strongly recommend investing in documentation so that Claude Code understands your codebase. Organizations can deploy CLAUDE.md files at multiple levels:

229 228 

230* **Organization-wide**: Deploy to system directories like `/Library/Application Support/ClaudeCode/CLAUDE.md` (macOS) for company-wide standards229* **Organization-wide**: Deploy to system directories like `/Library/Application Support/ClaudeCode/CLAUDE.md` (macOS) for company-wide standards

231* **Repository-level**: Create `CLAUDE.md` files in repository roots containing project architecture, build commands, and contribution guidelines. Check these into source control so all users benefit230* **Repository-level**: Create `CLAUDE.md` files in repository roots containing project architecture, build commands, and contribution guidelines. Check these into source control so all users benefit

232 231 

233 [Learn more](/en/memory).232Learn more in [Memory and CLAUDE.md files](/en/memory).

234 233 

235### 2. Simplify deployment234### Simplify deployment

236 235 

237If you have a custom development environment, we find that creating a "one click" way to install Claude Code is key to growing adoption across an organization.236If you have a custom development environment, we find that creating a "one click" way to install Claude Code is key to growing adoption across an organization.

238 237 

239### 3. Start with guided usage238### Start with guided usage

240 239 

241Encourage new users to try Claude Code for codebase Q\&A, or on smaller bug fixes or feature requests. Ask Claude Code to make a plan. Check Claude's suggestions and give feedback if it's off-track. Over time, as users understand this new paradigm better, then they'll be more effective at letting Claude Code run more agentically.240Encourage new users to try Claude Code for codebase Q\&A, or on smaller bug fixes or feature requests. Ask Claude Code to make a plan. Check Claude's suggestions and give feedback if it's off-track. Over time, as users understand this new paradigm better, then they'll be more effective at letting Claude Code run more agentically.

242 241 

243### 4. Configure security policies242### Configure security policies

244 243 

245Security teams can configure managed permissions for what Claude Code is and is not allowed to do, which cannot be overwritten by local configuration. [Learn more](/en/security).244Security teams can configure managed permissions for what Claude Code is and is not allowed to do, which cannot be overwritten by local configuration. [Learn more](/en/security).

246 245 

247### 5. Leverage MCP for integrations246### Leverage MCP for integrations

248 247 

249MCP is a great way to give Claude Code more information, such as connecting to ticket management systems or error logs. We recommend that one central team configures MCP servers and checks a `.mcp.json` configuration into the codebase so that all users benefit. [Learn more](/en/mcp).248MCP is a great way to give Claude Code more information, such as connecting to ticket management systems or error logs. We recommend that one central team configures MCP servers and checks a `.mcp.json` configuration into the codebase so that all users benefit. [Learn more](/en/mcp).

250 249 

251At Anthropic, we trust Claude Code to power development across every Anthropic codebase. We hope you enjoy using Claude Code as much as we do!250At Anthropic, we trust Claude Code to power development across every Anthropic codebase. We hope you enjoy using Claude Code as much as we do.

252 251 

253## Next steps252## Next steps

254 253 

255* [Set up Amazon Bedrock](/en/amazon-bedrock) for AWS-native deployment254Once you've chosen a deployment option and configured access for your team:

256* [Configure Google Vertex AI](/en/google-vertex-ai) for GCP deployment255 

257* [Set up Microsoft Foundry](/en/microsoft-foundry) for Azure deployment2561. **Roll out to your team**: Share installation instructions and have team members [install Claude Code](/en/setup) and authenticate with their credentials.

258* [Configure Enterprise Network](/en/network-config) for network requirements2572. **Set up shared configuration**: Create a [CLAUDE.md file](/en/memory) in your repositories to help Claude Code understand your codebase and coding standards.

259* [Deploy LLM Gateway](/en/llm-gateway) for enterprise management2583. **Configure permissions**: Review [security settings](/en/security) to define what Claude Code can and cannot do in your environment.

260* [Settings](/en/settings) for configuration options and environment variables

troubleshooting.md +119 −31

Details

1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

4 

1# Troubleshooting5# Troubleshooting

2 6 

3> Discover solutions to common issues with Claude Code installation and usage.7> Discover solutions to common issues with Claude Code installation and usage.


50```54```

51 55 

52<Warning>56<Warning>

53 Avoid disabling Windows PATH importing (`appendWindowsPath = false`) as this breaks the ability to easily call Windows executables from WSL. Similarly, avoid uninstalling Node.js from Windows if you use it for Windows development.57 Avoid disabling Windows PATH importing (`appendWindowsPath = false`) as this breaks the ability to call Windows executables from WSL. Similarly, avoid uninstalling Node.js from Windows if you use it for Windows development.

54</Warning>58</Warning>

55 59 

60### WSL2 sandbox setup

61 

62[Sandboxing](/en/sandboxing) is supported on WSL2 but requires installing additional packages. If you see an error like "Sandbox requires socat and bubblewrap" when running `/sandbox`, install the dependencies:

63 

64<Tabs>

65 <Tab title="Ubuntu/Debian">

66 ```bash theme={null}

67 sudo apt-get install bubblewrap socat

68 ```

69 </Tab>

70 

71 <Tab title="Fedora">

72 ```bash theme={null}

73 sudo dnf install bubblewrap socat

74 ```

75 </Tab>

76</Tabs>

77 

78WSL1 does not support sandboxing. If you see "Sandboxing requires WSL2", you need to upgrade to WSL2 or run Claude Code without sandboxing.

79 

56### Linux and Mac installation issues: permission or command not found errors80### Linux and Mac installation issues: permission or command not found errors

57 81 

58When installing Claude Code with npm, `PATH` problems may prevent access to `claude`.82When installing Claude Code with npm, `PATH` problems may prevent access to `claude`.

59You may also encounter permission errors if your npm global prefix is not user writable (eg. `/usr`, or `/usr/local`).83You may also encounter permission errors if your npm global prefix is not user writable (for example, `/usr`, or `/usr/local`).

60 84 

61#### Recommended solution: Native Claude Code installation85#### Recommended solution: Native Claude Code installation

62 86 

63Claude Code has a native installation that doesn't depend on npm or Node.js.87Claude Code has a native installation that doesn't depend on npm or Node.js.

64 88 

65<Note>

66 The native Claude Code installer is currently in beta.

67</Note>

68 

69Use the following command to run the native installer.89Use the following command to run the native installer.

70 90 

71**macOS, Linux, WSL:**91**macOS, Linux, WSL:**


95 115 

96```116```

97 117 

98This command installs the appropriate build of Claude Code for your operating system and architecture and adds a symlink to the installation at `~/.local/bin/claude`.118This command installs the appropriate build of Claude Code for your operating system and architecture and adds a symlink to the installation at `~/.local/bin/claude` (or `%USERPROFILE%\.local\bin\claude.exe` on Windows).

99 119 

100<Tip>120<Tip>

101 Make sure that you have the installation directory in your system PATH.121 Make sure that you have the installation directory in your system PATH.

102</Tip>122</Tip>

103 123 

104#### Alternative solution: Migrate to local installation124### Windows: "Claude Code on Windows requires git-bash"

105 125 

106Alternatively, if Claude Code will run, you can migrate to a local installation:126Claude Code on native Windows requires [Git for Windows](https://git-scm.com/downloads/win) which includes Git Bash. If Git is installed but not detected:

107 127 

108```bash theme={null}1281. Set the path explicitly in PowerShell before running Claude:

109claude migrate-installer129 ```powershell theme={null}

110```130 $env:CLAUDE_CODE_GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe"

131 ```

111 132 

112This moves Claude Code to `~/.claude/local/` and sets up an alias in your shell configuration. No `sudo` is required for future updates.1332. Or add it to your system environment variables permanently through System Properties Environment Variables.

113 134 

114After migration, restart your shell, and then verify your installation:135If Git is installed in a non-standard location, adjust the path accordingly.

115 136 

116On macOS/Linux/WSL:137### Windows: "installMethod is native, but claude command not found"

117 138 

118```bash theme={null}139If you see this error after installation, the `claude` command isn't in your PATH. Add it manually:

119which claude # Should show an alias to ~/.claude/local/claude

120```

121 140 

122On Windows:141<Steps>

142 <Step title="Open Environment Variables">

143 Press `Win + R`, type `sysdm.cpl`, and press Enter. Click **Advanced** → **Environment Variables**.

144 </Step>

123 145 

124```powershell theme={null}146 <Step title="Edit User PATH">

125where claude # Should show path to claude executable147 Under "User variables", select **Path** and click **Edit**. Click **New** and add:

126```148 

149 ```

150 %USERPROFILE%\.local\bin

151 ```

152 </Step>

153 

154 <Step title="Restart your terminal">

155 Close and reopen PowerShell or CMD for changes to take effect.

156 </Step>

157</Steps>

127 158 

128Verify installation:159Verify installation:

129 160 


1462. Close Claude Code1772. Close Claude Code

1473. Restart with `claude` and complete the authentication process again1783. Restart with `claude` and complete the authentication process again

148 179 

180If the browser doesn't open automatically during login, press `c` to copy the OAuth URL to your clipboard, then paste it into your browser manually.

181 

149If problems persist, try:182If problems persist, try:

150 183 

151```bash theme={null}184```bash theme={null}


155 188 

156This removes your stored authentication information and forces a clean login.189This removes your stored authentication information and forces a clean login.

157 190 

191## Configuration file locations

192 

193Claude Code stores configuration in several locations:

194 

195| File | Purpose |

196| :---------------------------- | :------------------------------------------------------- |

197| `~/.claude/settings.json` | User settings (permissions, hooks, model overrides) |

198| `.claude/settings.json` | Project settings (checked into source control) |

199| `.claude/settings.local.json` | Local project settings (not committed) |

200| `~/.claude.json` | Global state (theme, OAuth, MCP servers) |

201| `.mcp.json` | Project MCP servers (checked into source control) |

202| `managed-settings.json` | [Managed settings](/en/settings#settings-files) |

203| `managed-mcp.json` | [Managed MCP servers](/en/mcp#managed-mcp-configuration) |

204 

205On Windows, `~` refers to your user home directory, such as `C:\Users\YourName`.

206 

207**Managed file locations:**

208 

209* macOS: `/Library/Application Support/ClaudeCode/`

210* Linux/WSL: `/etc/claude-code/`

211* Windows: `C:\Program Files\ClaudeCode\`

212 

213For details on configuring these files, see [Settings](/en/settings) and [MCP](/en/mcp).

214 

215### Resetting configuration

216 

217To reset Claude Code to default settings, you can remove the configuration files:

218 

219```bash theme={null}

220# Reset all user settings and state

221rm ~/.claude.json

222rm -rf ~/.claude/

223 

224# Reset project-specific settings

225rm -rf .claude/

226rm .mcp.json

227```

228 

229<Warning>

230 This will remove all your settings, MCP server configurations, and session history.

231</Warning>

232 

158## Performance and stability233## Performance and stability

159 234 

160### High CPU or memory usage235### High CPU or memory usage


174 249 

175### Search and discovery issues250### Search and discovery issues

176 251 

177If Search tool, `@file` mentions, custom agents, and custom slash commands aren't working, install system `ripgrep`:252If Search tool, `@file` mentions, custom agents, and custom skills aren't working, install system `ripgrep`:

178 253 

179```bash theme={null}254```bash theme={null}

180# macOS (Homebrew) 255# macOS (Homebrew)


252 These networking issues only affect WSL2. WSL1 uses the host's network directly and doesn't require these configurations.327 These networking issues only affect WSL2. WSL1 uses the host's network directly and doesn't require these configurations.

253</Note>328</Note>

254 329 

255For additional JetBrains configuration tips, see our [IDE integration guide](/en/vs-code#jetbrains-plugin-settings).330For additional JetBrains configuration tips, see our [JetBrains IDE guide](/en/jetbrains#plugin-settings).

256 331 

257### Reporting Windows IDE integration issues (both native and WSL)332### Reporting Windows IDE integration issues (both native and WSL)

258 333 

259If you're experiencing IDE integration problems on Windows, please [create an issue](https://github.com/anthropics/claude-code/issues) with the following information: whether you are native (git bash), or WSL1/WSL2, WSL networking mode (NAT or mirrored), IDE name/version, Claude Code extension/plugin version, and shell type (bash/zsh/etc)334If you're experiencing IDE integration problems on Windows, [create an issue](https://github.com/anthropics/claude-code/issues) with the following information:

335 

336* Environment type: native Windows (Git Bash) or WSL1/WSL2

337* WSL networking mode (if applicable): NAT or mirrored

338* IDE name and version

339* Claude Code extension/plugin version

340* Shell type: Bash, Zsh, PowerShell, etc.

260 341 

261### ESC key not working in JetBrains (IntelliJ, PyCharm, etc.) terminals342### Escape key not working in JetBrains (IntelliJ, PyCharm, etc.) terminals

262 343 

263If you're using Claude Code in JetBrains terminals and the ESC key doesn't interrupt the agent as expected, this is likely due to a keybinding clash with JetBrains' default shortcuts.344If you're using Claude Code in JetBrains terminals and the `Esc` key doesn't interrupt the agent as expected, this is likely due to a keybinding clash with JetBrains' default shortcuts.

264 345 

265To fix this issue:346To fix this issue:

266 347 


270 * Click "Configure terminal keybindings" and delete the "Switch focus to Editor" shortcut351 * Click "Configure terminal keybindings" and delete the "Switch focus to Editor" shortcut

2713. Apply the changes3523. Apply the changes

272 353 

273This allows the ESC key to properly interrupt Claude Code operations.354This allows the `Esc` key to properly interrupt Claude Code operations.

274 355 

275## Markdown formatting issues356## Markdown formatting issues

276 357 


300 381 

301**Solutions:**382**Solutions:**

302 383 

3031. **Ask Claude to add language tags**: Simply request "Please add appropriate language tags to all code blocks in this markdown file."3841. **Ask Claude to add language tags**: Request "Add appropriate language tags to all code blocks in this markdown file."

304 385 

3052. **Use post-processing hooks**: Set up automatic formatting hooks to detect and add missing language tags. See the [markdown formatting hook example](/en/hooks-guide#markdown-formatting-hook) for implementation details.3862. **Use post-processing hooks**: Set up automatic formatting hooks to detect and add missing language tags. See the [markdown formatting hook example](/en/hooks-guide#markdown-formatting-hook) for implementation details.

306 387 


323To minimize formatting issues:404To minimize formatting issues:

324 405 

325* **Be explicit in requests**: Ask for "properly formatted markdown with language-tagged code blocks"406* **Be explicit in requests**: Ask for "properly formatted markdown with language-tagged code blocks"

326* **Use project conventions**: Document your preferred markdown style in [CLAUDE.md](/en/memory)407* **Use project conventions**: Document your preferred markdown style in [`CLAUDE.md`](/en/memory)

327* **Set up validation hooks**: Use post-processing hooks to automatically verify and fix common formatting issues408* **Set up validation hooks**: Use post-processing hooks to automatically verify and fix common formatting issues

328 409 

329## Getting more help410## Getting more help


332 413 

3331. Use the `/bug` command within Claude Code to report problems directly to Anthropic4141. Use the `/bug` command within Claude Code to report problems directly to Anthropic

3342. Check the [GitHub repository](https://github.com/anthropics/claude-code) for known issues4152. Check the [GitHub repository](https://github.com/anthropics/claude-code) for known issues

3353. Run `/doctor` to check the health of your Claude Code installation4163. Run `/doctor` to diagnose issues. It checks:

417 * Installation type, version, and search functionality

418 * Auto-update status and available versions

419 * Invalid settings files (malformed JSON, incorrect types)

420 * MCP server configuration errors

421 * Keybinding configuration problems

422 * Context usage warnings (large CLAUDE.md files, high MCP token usage, unreachable permission rules)

423 * Plugin and agent loading errors

3364. Ask Claude directly about its capabilities and features - Claude has built-in access to its documentation4244. Ask Claude directly about its capabilities and features - Claude has built-in access to its documentation

vs-code.md +363 −91

Details

1# Visual Studio Code1> ## Documentation Index

2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt

3> Use this file to discover all available pages before exploring further.

2 4 

3> Use Claude Code with Visual Studio Code through our native extension or CLI integration5# Use Claude Code in VS Code

4 6 

5<img src="https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=300652d5678c63905e6b0ea9e50835f8" alt="Claude Code VS Code Extension Interface" data-og-width="2500" width="2500" data-og-height="1155" height="1155" data-path="images/vs-code-extension-interface.jpg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=280&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=87630c671517a3d52e9aee627041696e 280w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=560&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=716b093879204beec8d952649ef75292 560w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=840&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=c1525d1a01513acd9d83d8b5a8fe2fc8 840w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=1100&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=1d90021d58bbb51f871efec13af955c3 1100w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=1650&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=7babdd25440099886f193cfa99af88ae 1650w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=2500&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=08c92eedfb56fe61a61e480fb63784b6 2500w" />7> Install and configure the Claude Code extension for VS Code. Get AI coding assistance with inline diffs, @-mentions, plan review, and keyboard shortcuts.

6 8 

7## VS Code Extension (Beta)9<img src="https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=300652d5678c63905e6b0ea9e50835f8" alt="VS Code editor with the Claude Code extension panel open on the right side, showing a conversation with Claude" data-og-width="2500" width="2500" data-og-height="1155" height="1155" data-path="images/vs-code-extension-interface.jpg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=280&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=87630c671517a3d52e9aee627041696e 280w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=560&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=716b093879204beec8d952649ef75292 560w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=840&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=c1525d1a01513acd9d83d8b5a8fe2fc8 840w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=1100&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=1d90021d58bbb51f871efec13af955c3 1100w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=1650&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=7babdd25440099886f193cfa99af88ae 1650w, https://mintcdn.com/claude-code/-YhHHmtSxwr7W8gy/images/vs-code-extension-interface.jpg?w=2500&fit=max&auto=format&n=-YhHHmtSxwr7W8gy&q=85&s=08c92eedfb56fe61a61e480fb63784b6 2500w" />

8 10 

9The VS Code extension, available in beta, lets you see Claude's changes in real-time through a native graphical interface integrated directly into your IDE. The VS Code extension makes it easier to access and interact with Claude Code for users who prefer a visual interface over the terminal.11The VS Code extension provides a native graphical interface for Claude Code, integrated directly into your IDE. This is the recommended way to use Claude Code in VS Code.

10 12 

11### Features13With the extension, you can review and edit Claude's plans before accepting them, auto-accept edits as they're made, @-mention files with specific line ranges from your selection, access conversation history, and open multiple conversations in separate tabs or windows.

12 14 

13The VS Code extension provides:15## Prerequisites

14 16 

15* **Native IDE experience**: Dedicated Claude Code sidebar panel accessed via the Spark icon17* VS Code 1.98.0 or higher

16* **Plan mode with editing**: Review and edit Claude's plans before accepting them18* An Anthropic account (you'll sign in when you first open the extension). If you're using a third-party provider like Amazon Bedrock or Google Vertex AI, see [Use third-party providers](#use-third-party-providers) instead.

17* **Auto-accept edits mode**: Automatically apply Claude's changes as they're made

18* **Extended thinking**: Toggle extended thinking on/off using the Extended Thinking button in the bottom-right corner of the prompt input

19* **File management**: @-mention files or attach files and images using the system file picker

20* **MCP server usage**: Use Model Context Protocol servers configured through the CLI

21* **Conversation history**: Easy access to past conversations

22* **Multiple sessions**: Run multiple Claude Code sessions simultaneously

23* **Keyboard shortcuts**: Support for most shortcuts from the CLI

24* **Slash commands**: Access most CLI slash commands directly in the extension

25 19 

26### Requirements20<Tip>

21 The extension includes the CLI (command-line interface), which you can access from VS Code's integrated terminal for advanced features. See [VS Code extension vs. Claude Code CLI](#vs-code-extension-vs-claude-code-cli) for details.

22</Tip>

27 23 

28* VS Code 1.98.0 or higher24## Install the extension

25 

26Click the link for your IDE to install directly:

27 

28* [Install for VS Code](vscode:extension/anthropic.claude-code)

29* [Install for Cursor](cursor:extension/anthropic.claude-code)

29 30 

30### Installation31Or in VS Code, press `Cmd+Shift+X` (Mac) or `Ctrl+Shift+X` (Windows/Linux) to open the Extensions view, search for "Claude Code", and click **Install**.

31 32 

32Download and install the extension from the [Visual Studio Code Extension Marketplace](https://marketplace.visualstudio.com/items?itemName=anthropic.claude-code).33<Note>If the extension doesn't appear after installation, restart VS Code or run "Developer: Reload Window" from the Command Palette.</Note>

33 34 

34### How It Works35## Get started

35 36 

36Once installed, you can start using Claude Code through the VS Code interface:37Once installed, you can start using Claude Code through the VS Code interface:

37 38 

381. Click the Spark icon in your editor's sidebar to open the Claude Code panel39<Steps>

392. Prompt Claude Code in the same way you would in the terminal40 <Step title="Open the Claude Code panel">

403. Watch as Claude analyzes your code and suggests changes41 Throughout VS Code, the Spark icon indicates Claude Code: <img src="https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-spark-icon.svg?fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=a734d84e785140016672f08e0abb236c" alt="Spark icon" style={{display: "inline", height: "0.85em", verticalAlign: "middle"}} data-og-width="16" width="16" data-og-height="16" height="16" data-path="images/vs-code-spark-icon.svg" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-spark-icon.svg?w=280&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=9a45aad9a84b9fa1701ac99a1f9aa4e9 280w, https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-spark-icon.svg?w=560&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=3f4cb9254c4d4e93989c4b6bf9292f4b 560w, https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-spark-icon.svg?w=840&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=e75ccc9faa3e572db8f291ceb65bb264 840w, https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-spark-icon.svg?w=1100&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=f147bd81a381a62539a4ce361fac41c7 1100w, https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-spark-icon.svg?w=1650&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=78fe68efaee5d6e844bbacab1b442ed5 1650w, https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-spark-icon.svg?w=2500&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=efb8dbe1dfa722d094edc6ad2ad4bedb 2500w" />

414. Review and accept edits directly in the interface42 

42 * **Tip**: Drag the sidebar wider to see inline diffs, then click on them to expand for full details43 The quickest way to open Claude is to click the Spark icon in the **Editor Toolbar** (top-right corner of the editor). The icon only appears when you have a file open.

44 

45 <img src="https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-editor-icon.png?fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=eb4540325d94664c51776dbbfec4cf02" alt="VS Code editor showing the Spark icon in the Editor Toolbar" data-og-width="2796" width="2796" data-og-height="734" height="734" data-path="images/vs-code-editor-icon.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-editor-icon.png?w=280&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=56f218d5464359d6480cfe23f70a923e 280w, https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-editor-icon.png?w=560&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=344a8db024b196c795a80dc85cacb8d1 560w, https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-editor-icon.png?w=840&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=f30bf834ee0625b2a4a635d552d87163 840w, https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-editor-icon.png?w=1100&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=81fdf984840e43a9f08ae42729d1484d 1100w, https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-editor-icon.png?w=1650&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=8b60fb32de54717093d512afaa99785c 1650w, https://mintcdn.com/claude-code/mfM-EyoZGnQv8JTc/images/vs-code-editor-icon.png?w=2500&fit=max&auto=format&n=mfM-EyoZGnQv8JTc&q=85&s=893e6bda8f2e9d42c8a294d394f0b736 2500w" />

46 

47 Other ways to open Claude Code:

48 

49 * **Command Palette**: `Cmd+Shift+P` (Mac) or `Ctrl+Shift+P` (Windows/Linux), type "Claude Code", and select an option like "Open in New Tab"

50 * **Status Bar**: Click **✱ Claude Code** in the bottom-right corner of the window. This works even when no file is open.

51 

52 You can drag the Claude panel to reposition it anywhere in VS Code. See [Customize your workflow](#customize-your-workflow) for details.

53 </Step>

54 

55 <Step title="Send a prompt">

56 Ask Claude to help with your code or files, whether that's explaining how something works, debugging an issue, or making changes.

57 

58 <Tip>Claude automatically sees your selected text. Press `Option+K` (Mac) / `Alt+K` (Windows/Linux) to also insert an @-mention reference (like `@file.ts#5-10`) into your prompt.</Tip>

59 

60 Here's an example of asking about a particular line in a file:

61 

62 <img src="https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-send-prompt.png?fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=ede3ed8d8d5f940e01c5de636d009cfd" alt="VS Code editor with lines 2-3 selected in a Python file, and the Claude Code panel showing a question about those lines with an @-mention reference" data-og-width="3288" width="3288" data-og-height="1876" height="1876" data-path="images/vs-code-send-prompt.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-send-prompt.png?w=280&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=f40bde7b2c245fe8f0f5b784e8106492 280w, https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-send-prompt.png?w=560&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=fad66a27a9a6faa23b05370aa4f398b2 560w, https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-send-prompt.png?w=840&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=4539c8a3823ca80a5c8771f6c088ce9e 840w, https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-send-prompt.png?w=1100&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=fae8ebf300c7853409a562ffa46d9c71 1100w, https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-send-prompt.png?w=1650&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=22e4462bb8cf0c0ca20f8102bc4c971a 1650w, https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-send-prompt.png?w=2500&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=739bfd045f70fe7be1a109a53494590e 2500w" />

63 </Step>

64 

65 <Step title="Review changes">

66 When Claude wants to edit a file, it shows a side-by-side comparison of the original and proposed changes, then asks for permission. You can accept, reject, or tell Claude what to do instead.

67 

68 <img src="https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-edits.png?fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=e005f9b41c541c5c7c59c082f7c4841c" alt="VS Code showing a diff of Claude's proposed changes with a permission prompt asking whether to make the edit" data-og-width="3292" width="3292" data-og-height="1876" height="1876" data-path="images/vs-code-edits.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-edits.png?w=280&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=cb5d41b81087f79b842a56b5a3304660 280w, https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-edits.png?w=560&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=90bb691960decdc06393c3c21cd62c75 560w, https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-edits.png?w=840&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=9a11bf878ba619e850380904ff4f38e8 840w, https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-edits.png?w=1100&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=6dddbf596b4f69ec6245bdc5eb6dd487 1100w, https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-edits.png?w=1650&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=ef2713b8cbfd2cee97af817d813d64c7 1650w, https://mintcdn.com/claude-code/FVYz38sRY-VuoGHA/images/vs-code-edits.png?w=2500&fit=max&auto=format&n=FVYz38sRY-VuoGHA&q=85&s=1f7e1c52919cdfddf295f32a2ec7ae59 2500w" />

69 </Step>

70</Steps>

71 

72For more ideas on what you can do with Claude Code, see [Common workflows](/en/common-workflows).

73 

74<Tip>

75 The extension includes two built-in tutorials:

76 

77 * **VS Code walkthrough**: Run "Claude Code: Open Walkthrough" from the Command Palette for a guided tour of the basics.

78 * **Interactive checklist**: Click the graduation cap icon in the Claude panel header to work through features like writing code, using Plan mode, and setting up rules.

79</Tip>

80 

81## Use the prompt box

82 

83The prompt box supports several features:

84 

85* **Permission modes**: Click the mode indicator at the bottom of the prompt box to switch modes. In normal mode, Claude asks permission before each action. In Plan mode, Claude describes what it will do and waits for approval before making changes. In auto-accept mode, Claude makes edits without asking. Set the default in VS Code settings under `claudeCode.initialPermissionMode`.

86* **Command menu**: Click `/` or type `/` to open the command menu. Options include attaching files, switching models, toggling extended thinking, and viewing plan usage (`/usage`). The Customize section provides access to MCP servers, hooks, memory, permissions, and plugins. Items with a terminal icon open in the integrated terminal.

87* **Context indicator**: The prompt box shows how much of Claude's context window you're using. Claude automatically compacts when needed, or you can run `/compact` manually.

88* **Extended thinking**: Lets Claude spend more time reasoning through complex problems. Toggle it on via the command menu (`/`). See [Extended thinking](/en/common-workflows#use-extended-thinking-thinking-mode) for details.

89* **Multi-line input**: Press `Shift+Enter` to add a new line without sending.

90 

91### Reference files and folders

92 

93Use @-mentions to give Claude context about specific files or folders. When you type `@` followed by a file or folder name, Claude reads that content and can answer questions about it or make changes to it. Claude Code supports fuzzy matching, so you can type partial names to find what you need:

94 

95```

96> Explain the logic in @auth (fuzzy matches auth.js, AuthService.ts, etc.)

97> What's in @src/components/ (include a trailing slash for folders)

98```

99 

100When you select text in the editor, Claude can see your highlighted code automatically. The prompt box footer shows how many lines are selected. Press `Option+K` (Mac) / `Alt+K` (Windows/Linux) to insert an @-mention with the file path and line numbers (e.g., `@app.ts#5-10`). Click the selection indicator to toggle whether Claude can see your highlighted text - the eye-slash icon means the selection is hidden from Claude.

101 

102You can also hold `Shift` while dragging files into the prompt box to add them as attachments. Click the X on any attachment to remove it from context.

103 

104### Resume past conversations

105 

106Click the dropdown at the top of the Claude Code panel to access your conversation history. You can search by keyword or browse by time (Today, Yesterday, Last 7 days, etc.). Click any conversation to resume it with the full message history. For more on resuming sessions, see [Common workflows](/en/common-workflows#resume-previous-conversations).

107 

108### Resume remote sessions from Claude.ai

109 

110If you use [Claude Code on the web](/en/claude-code-on-the-web), you can resume those remote sessions directly in VS Code. This requires signing in with **Claude.ai Subscription**, not Anthropic Console.

111 

112<Steps>

113 <Step title="Open Past Conversations">

114 Click the **Past Conversations** dropdown at the top of the Claude Code panel.

115 </Step>

116 

117 <Step title="Select the Remote tab">

118 The dialog shows two tabs: Local and Remote. Click **Remote** to see sessions from claude.ai.

119 </Step>

120 

121 <Step title="Select a session to resume">

122 Browse or search your remote sessions. Click any session to download it and continue the conversation locally.

123 </Step>

124</Steps>

125 

126<Note>

127 Only web sessions started with a GitHub repository appear in the Remote tab. Resuming loads the conversation history locally; changes are not synced back to claude.ai.

128</Note>

129 

130## Customize your workflow

131 

132Once you're up and running, you can reposition the Claude panel, run multiple sessions, or switch to terminal mode.

133 

134### Choose where Claude lives

135 

136You can drag the Claude panel to reposition it anywhere in VS Code. Grab the panel's tab or title bar and drag it to:

137 

138* **Secondary sidebar**: The right side of the window. Keeps Claude visible while you code.

139* **Primary sidebar**: The left sidebar with icons for Explorer, Search, etc.

140* **Editor area**: Opens Claude as a tab alongside your files. Useful for side tasks.

141 

142<Tip>

143 Use the sidebar for your main Claude session and open additional tabs for side tasks. Claude remembers your preferred location. Note that the Spark icon only appears in the Activity Bar when the Claude panel is docked to the left. Since Claude defaults to the right side, use the Editor Toolbar icon to open Claude.

144</Tip>

145 

146### Run multiple conversations

147 

148Use **Open in New Tab** or **Open in New Window** from the Command Palette to start additional conversations. Each conversation maintains its own history and context, allowing you to work on different tasks in parallel.

149 

150When using tabs, a small colored dot on the spark icon indicates status: blue means a permission request is pending, orange means Claude finished while the tab was hidden.

151 

152### Switch to terminal mode

153 

154By default, the extension opens a graphical chat panel. If you prefer the CLI-style interface, open the [Use Terminal setting](vscode://settings/claudeCode.useTerminal) and check the box.

155 

156You can also open VS Code settings (`Cmd+,` on Mac or `Ctrl+,` on Windows/Linux), go to Extensions → Claude Code, and check **Use Terminal**.

157 

158## Manage plugins

159 

160The VS Code extension includes a graphical interface for installing and managing [plugins](/en/plugins). Type `/plugins` in the prompt box to open the **Manage plugins** interface.

161 

162### Install plugins

163 

164The plugin dialog shows two tabs: **Plugins** and **Marketplaces**.

165 

166In the Plugins tab:

167 

168* **Installed plugins** appear at the top with toggle switches to enable or disable them

169* **Available plugins** from your configured marketplaces appear below

170* Search to filter plugins by name or description

171* Click **Install** on any available plugin

172 

173When you install a plugin, choose the installation scope:

43 174 

44### Using Third-Party Providers175* **Install for you**: Available in all your projects (user scope)

176* **Install for this project**: Shared with project collaborators (project scope)

177* **Install locally**: Only for you, only in this repository (local scope)

45 178 

46The VS Code extension supports using Claude Code with third-party providers like Amazon Bedrock, Microsoft Foundry, and Google Vertex AI. When configured with these providers, the extension will not prompt for login. To use third-party providers, configure environment variables in the VS Code extension settings:179### Manage marketplaces

47 180 

481. Open VS Code settings181Switch to the **Marketplaces** tab to add or remove plugin sources:

492. Search for "Claude Code: Environment Variables"

503. Add the required environment variables

51 182 

52#### Environment Variables183* Enter a GitHub repo, URL, or local path to add a new marketplace

184* Click the refresh icon to update a marketplace's plugin list

185* Click the trash icon to remove a marketplace

53 186 

54| Variable | Description | Required | Example |187After making changes, a banner prompts you to restart Claude Code to apply the updates.

55| :---------------------------- | :------------------------------------- | :----------------------------- | :----------------------------------------------- |

56| `CLAUDE_CODE_USE_BEDROCK` | Enable Amazon Bedrock integration | Required for Bedrock | `"1"` or `"true"` |

57| `CLAUDE_CODE_USE_FOUNDRY` | Enable Microsoft Foundry integration | Required for Foundry | `"1"` or `"true"` |

58| `CLAUDE_CODE_USE_VERTEX` | Enable Google Vertex AI integration | Required for Vertex AI | `"1"` or `"true"` |

59| `AWS_REGION` | AWS region for Bedrock | | `"us-east-2"` |

60| `AWS_PROFILE` | AWS profile for Bedrock authentication | | `"your-profile"` |

61| `CLOUD_ML_REGION` | Region for Vertex AI | | `"global"` or `"us-east5"` |

62| `ANTHROPIC_VERTEX_PROJECT_ID` | GCP project ID for Vertex AI | | `"your-project-id"` |

63| `ANTHROPIC_FOUNDRY_RESOURCE` | Azure resource name for Foundry | Required for Microsoft Foundry | `"your-resource"` |

64| `ANTHROPIC_FOUNDRY_API_KEY` | API key for Microsoft Foundry | Optional for Microsoft Foundry | `"your-api-key"` |

65| `ANTHROPIC_MODEL` | Override primary model | Override model ID | `"us.anthropic.claude-sonnet-4-5-20250929-v1:0"` |

66| `ANTHROPIC_SMALL_FAST_MODEL` | Override small/fast model | Optional | `"us.anthropic.claude-3-5-haiku-20241022-v1:0"` |

67| `CLAUDE_CODE_SKIP_AUTH_LOGIN` | Disable all prompts to login | Optional | `"1"` or `"true"` |

68 188 

69For detailed setup instructions and additional configuration options, see:189<Note>

190 Plugin management in VS Code uses the same CLI commands under the hood. Plugins and marketplaces you configure in the extension are also available in the CLI, and vice versa.

191</Note>

70 192 

71* [Claude Code on Amazon Bedrock](/en/amazon-bedrock)193For more about the plugin system, see [Plugins](/en/plugins) and [Plugin marketplaces](/en/plugin-marketplaces).

72* [Claude Code on Microsoft Foundry](/en/microsoft-foundry)

73* [Claude Code on Google Vertex AI](/en/google-vertex-ai)

74 194 

75### Not Yet Implemented195## VS Code commands and shortcuts

76 196 

77The following features are not yet available in the VS Code extension:197Open the Command Palette (`Cmd+Shift+P` on Mac or `Ctrl+Shift+P` on Windows/Linux) and type "Claude Code" to see all available VS Code commands for the Claude Code extension.

78 198 

79* **MCP server and Plugin configuration UI**: Type `/mcp` to open the terminal-based MCP server configuration, or `/plugin` for Plugin configuration. Once configured, MCP servers and Plugins will work in the extension. You can also [configure MCP servers through the CLI](/en/mcp) first, then the extension will use them.199Some shortcuts depend on which panel is "focused" (receiving keyboard input). When your cursor is in a code file, the editor is focused. When your cursor is in Claude's prompt box, Claude is focused. Use `Cmd+Esc` / `Ctrl+Esc` to toggle between them.

80* **Subagents configuration**: Configure [subagents through the CLI](/en/sub-agents) to use them in VS Code

81* **Checkpoints**: Save and restore conversation state at specific points

82* **Conversation rewinding**: The `/rewind` command is coming soon

83* **Advanced shortcuts**:

84 * `#` shortcut to add to memory (not supported)

85 * `!` shortcut to run bash commands directly (not supported)

86* **Tab completion**: File path completion with tab key

87* **Model selection UI for older models**: To use older model versions like `claude-sonnet-4-20250514`, open VS Code settings for Claude Code (the `/General Config` command) and insert the model string directly into the 'Selected Model' field

88 200 

89We are working on adding these features in future updates.201<Note>

202 These are VS Code commands for controlling the extension. Not all built-in Claude Code commands are available in the extension. See [VS Code extension vs. Claude Code CLI](#vs-code-extension-vs-claude-code-cli) for details.

203</Note>

90 204 

91## Security Considerations205| Command | Shortcut | Description |

206| -------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------ |

207| Focus Input | `Cmd+Esc` (Mac) / `Ctrl+Esc` (Windows/Linux) | Toggle focus between editor and Claude |

208| Open in Side Bar | - | Open Claude in the left sidebar |

209| Open in Terminal | - | Open Claude in terminal mode |

210| Open in New Tab | `Cmd+Shift+Esc` (Mac) / `Ctrl+Shift+Esc` (Windows/Linux) | Open a new conversation as an editor tab |

211| Open in New Window | - | Open a new conversation in a separate window |

212| New Conversation | `Cmd+N` (Mac) / `Ctrl+N` (Windows/Linux) | Start a new conversation (requires Claude to be focused) |

213| Insert @-Mention Reference | `Option+K` (Mac) / `Alt+K` (Windows/Linux) | Insert a reference to the current file and selection (requires editor to be focused) |

214| Show Logs | - | View extension debug logs |

215| Logout | - | Sign out of your Anthropic account |

92 216 

93When Claude Code runs in VS Code with auto-edit permissions enabled, it may be able to modify IDE configuration files that can be automatically executed by your IDE. This may increase the risk of running Claude Code in auto-edit mode and allow bypassing Claude Code's permission prompts for bash execution.217## Configure settings

94 218 

95When running in VS Code, consider:219The extension has two types of settings:

96 220 

97* Enabling [VS Code Restricted Mode](https://code.visualstudio.com/docs/editor/workspace-trust#_restricted-mode) for untrusted workspaces221* **Extension settings** in VS Code: Control the extension's behavior within VS Code. Open with `Cmd+,` (Mac) or `Ctrl+,` (Windows/Linux), then go to Extensions → Claude Code. You can also type `/` and select **General Config** to open settings.

98* Using manual approval mode for edits222* **Claude Code settings** in `~/.claude/settings.json`: Shared between the extension and CLI. Use for allowed commands, environment variables, hooks, and MCP servers. See [Settings](/en/settings) for details.

99* Taking extra care to ensure Claude is only used with trusted prompts

100 223 

101## Legacy CLI Integration224### Extension settings

102 225 

103The first VS Code integration that we released allows Claude Code running in the terminal to interact with your IDE. It provides selection context sharing (current selection/tab is automatically shared with Claude Code), diff viewing in the IDE instead of terminal, file reference shortcuts (`Cmd+Option+K` on Mac or `Alt+Ctrl+K` on Windows/Linux to insert file references like @File#L1-99), and automatic diagnostic sharing (lint and syntax errors).226| Setting | Default | Description |

227| --------------------------------- | --------- | ----------------------------------------------------------------------------------------------------- |

228| `selectedModel` | `default` | Model for new conversations. Change per-session with `/model`. |

229| `useTerminal` | `false` | Launch Claude in terminal mode instead of graphical panel |

230| `initialPermissionMode` | `default` | Controls approval prompts: `default` (ask each time), `plan`, `acceptEdits`, or `bypassPermissions` |

231| `preferredLocation` | `panel` | Where Claude opens: `sidebar` (right) or `panel` (new tab) |

232| `autosave` | `true` | Auto-save files before Claude reads or writes them |

233| `useCtrlEnterToSend` | `false` | Use Ctrl/Cmd+Enter instead of Enter to send prompts |

234| `enableNewConversationShortcut` | `true` | Enable Cmd/Ctrl+N to start a new conversation |

235| `hideOnboarding` | `false` | Hide the onboarding checklist (graduation cap icon) |

236| `respectGitIgnore` | `true` | Exclude .gitignore patterns from file searches |

237| `environmentVariables` | `[]` | Set environment variables for the Claude process. Use Claude Code settings instead for shared config. |

238| `disableLoginPrompt` | `false` | Skip authentication prompts (for third-party provider setups) |

239| `allowDangerouslySkipPermissions` | `false` | Bypass all permission prompts. **Use with extreme caution.** |

240| `claudeProcessWrapper` | - | Executable path used to launch the Claude process |

104 241 

105The legacy integration auto-installs when you run `claude` from VS Code's integrated terminal. Simply run `claude` from the terminal and all features activate. For external terminals, use the `/ide` command to connect Claude Code to your VS Code instance. To configure, run `claude`, enter `/config`, and set the diff tool to `auto` for automatic IDE detection.242## VS Code extension vs. Claude Code CLI

106 243 

107Both the extension and CLI integration work with Visual Studio Code, Cursor, Windsurf, and VSCodium.244Claude Code is available as both a VS Code extension (graphical panel) and a CLI (command-line interface in the terminal). Some features are only available in the CLI. If you need a CLI-only feature, run `claude` in VS Code's integrated terminal.

108 245 

109## Troubleshooting246| Feature | CLI | VS Code Extension |

247| ------------------- | --------------------------------------------- | ---------------------------------------- |

248| Commands and skills | [All](/en/interactive-mode#built-in-commands) | Subset (type `/` to see available) |

249| MCP server config | Yes | No (configure via CLI, use in extension) |

250| Checkpoints | Yes | Yes |

251| `!` bash shortcut | Yes | No |

252| Tab completion | Yes | No |

110 253 

111### Extension Not Installing254### Rewind with checkpoints

112 255 

113* Ensure you have a compatible version of VS Code (1.85.0 or later)256The VS Code extension supports checkpoints, which track Claude's file edits and let you rewind to a previous state. Hover over any message to reveal the rewind button, then choose from three options:

257 

258* **Fork conversation from here**: start a new conversation branch from this message while keeping all code changes intact

259* **Rewind code to here**: revert file changes back to this point in the conversation while keeping the full conversation history

260* **Fork conversation and rewind code**: start a new conversation branch and revert file changes to this point

261 

262For full details on how checkpoints work and their limitations, see [Checkpointing](/en/checkpointing).

263 

264### Run CLI in VS Code

265 

266To use the CLI while staying in VS Code, open the integrated terminal (`` Ctrl+` `` on Windows/Linux or `` Cmd+` `` on Mac) and run `claude`. The CLI automatically integrates with your IDE for features like diff viewing and diagnostic sharing.

267 

268If using an external terminal, run `/ide` inside Claude Code to connect it to VS Code.

269 

270### Switch between extension and CLI

271 

272The extension and CLI share the same conversation history. To continue an extension conversation in the CLI, run `claude --resume` in the terminal. This opens an interactive picker where you can search for and select your conversation.

273 

274### Include terminal output in prompts

275 

276Reference terminal output in your prompts using `@terminal:name` where `name` is the terminal's title. This lets Claude see command output, error messages, or logs without copy-pasting.

277 

278### Monitor background processes

279 

280When Claude runs long-running commands, the extension shows progress in the status bar. However, visibility for background tasks is limited compared to the CLI. For better visibility, have Claude output the command so you can run it in VS Code's integrated terminal.

281 

282### Connect to external tools with MCP

283 

284MCP (Model Context Protocol) servers give Claude access to external tools, databases, and APIs. Configure them via CLI, then use them in both extension and CLI.

285 

286To add an MCP server, open the integrated terminal (`` Ctrl+` `` or `` Cmd+` ``) and run:

287 

288```bash theme={null}

289claude mcp add --transport http github https://api.githubcopilot.com/mcp/

290```

291 

292Once configured, ask Claude to use the tools (e.g., "Review PR #456"). Some servers require authentication: run `claude` in the terminal, then type `/mcp` to authenticate. See the [MCP documentation](/en/mcp) for available servers.

293 

294## Work with git

295 

296Claude Code integrates with git to help with version control workflows directly in VS Code. Ask Claude to commit changes, create pull requests, or work across branches.

297 

298### Create commits and pull requests

299 

300Claude can stage changes, write commit messages, and create pull requests based on your work:

301 

302```

303> commit my changes with a descriptive message

304> create a pr for this feature

305> summarize the changes I've made to the auth module

306```

307 

308When creating pull requests, Claude generates descriptions based on the actual code changes and can add context about testing or implementation decisions.

309 

310### Use git worktrees for parallel tasks

311 

312Git worktrees allow multiple Claude Code sessions to work on separate branches simultaneously, each with isolated files:

313 

314```bash theme={null}

315# Create a worktree for a new feature

316git worktree add ../project-feature-a -b feature-a

317 

318# Run Claude Code in each worktree

319cd ../project-feature-a && claude

320```

321 

322Each worktree maintains independent file state while sharing git history. This prevents Claude instances from interfering with each other when working on different tasks.

323 

324For detailed git workflows including PR reviews and branch management, see [Common workflows](/en/common-workflows#create-pull-requests).

325 

326## Use third-party providers

327 

328By default, Claude Code connects directly to Anthropic's API. If your organization uses Amazon Bedrock, Google Vertex AI, or Microsoft Foundry to access Claude, configure the extension to use your provider instead:

329 

330<Steps>

331 <Step title="Disable login prompt">

332 Open the [Disable Login Prompt setting](vscode://settings/claudeCode.disableLoginPrompt) and check the box.

333 

334 You can also open VS Code settings (`Cmd+,` on Mac or `Ctrl+,` on Windows/Linux), search for "Claude Code login", and check **Disable Login Prompt**.

335 </Step>

336 

337 <Step title="Configure your provider">

338 Follow the setup guide for your provider:

339 

340 * [Claude Code on Amazon Bedrock](/en/amazon-bedrock)

341 * [Claude Code on Google Vertex AI](/en/google-vertex-ai)

342 * [Claude Code on Microsoft Foundry](/en/microsoft-foundry)

343 

344 These guides cover configuring your provider in `~/.claude/settings.json`, which ensures your settings are shared between the VS Code extension and the CLI.

345 </Step>

346</Steps>

347 

348## Security and privacy

349 

350Your code stays private. Claude Code processes your code to provide assistance but does not use it to train models. For details on data handling and how to opt out of logging, see [Data and privacy](/en/data-usage).

351 

352With auto-edit permissions enabled, Claude Code can modify VS Code configuration files (like `settings.json` or `tasks.json`) that VS Code may execute automatically. To reduce risk when working with untrusted code:

353 

354* Enable [VS Code Restricted Mode](https://code.visualstudio.com/docs/editor/workspace-trust#_restricted-mode) for untrusted workspaces

355* Use manual approval mode instead of auto-accept for edits

356* Review changes carefully before accepting them

357 

358## Fix common issues

359 

360### Extension won't install

361 

362* Ensure you have a compatible version of VS Code (1.98.0 or later)

114* Check that VS Code has permission to install extensions363* Check that VS Code has permission to install extensions

115* Try installing directly from the Marketplace website364* Try installing directly from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=anthropic.claude-code)

365 

366### Spark icon not visible

367 

368The Spark icon appears in the **Editor Toolbar** (top-right of editor) when you have a file open. If you don't see it:

116 369 

117### Claude Code Never Responds3701. **Open a file**: The icon requires a file to be open. Having just a folder open isn't enough.

3712. **Check VS Code version**: Requires 1.98.0 or higher (Help → About)

3723. **Restart VS Code**: Run "Developer: Reload Window" from the Command Palette

3734. **Disable conflicting extensions**: Temporarily disable other AI extensions (Cline, Continue, etc.)

3745. **Check workspace trust**: The extension doesn't work in Restricted Mode

118 375 

119If Claude Code is not responding to your prompts:376Alternatively, click "✱ Claude Code" in the **Status Bar** (bottom-right corner). This works even without a file open. You can also use the **Command Palette** (`Cmd+Shift+P` / `Ctrl+Shift+P`) and type "Claude Code".

377 

378### Claude Code never responds

379 

380If Claude Code isn't responding to your prompts:

120 381 

1211. **Check your internet connection**: Ensure you have a stable internet connection3821. **Check your internet connection**: Ensure you have a stable internet connection

1222. **Start a new conversation**: Try starting a fresh conversation to see if the issue persists3832. **Start a new conversation**: Try starting a fresh conversation to see if the issue persists

1233. **Try the CLI**: Run `claude` from the terminal to see if you get more detailed error messages3843. **Try the CLI**: Run `claude` from the terminal to see if you get more detailed error messages

1244. **File a bug report**: If the problem continues, [file an issue on GitHub](https://github.com/anthropics/claude-code/issues) with details about the error

125 385 

126### Legacy Integration Not Working386If problems persist, [file an issue on GitHub](https://github.com/anthropics/claude-code/issues) with details about the error.

387 

388## Uninstall the extension

389 

390To uninstall the Claude Code extension:

391 

3921. Open the Extensions view (`Cmd+Shift+X` on Mac or `Ctrl+Shift+X` on Windows/Linux)

3932. Search for "Claude Code"

3943. Click **Uninstall**

395 

396To also remove extension data and reset all settings:

397 

398```bash theme={null}

399rm -rf ~/.vscode/globalStorage/anthropic.claude-code

400```

401 

402For additional help, see the [troubleshooting guide](/en/troubleshooting).

403 

404## Next steps

127 405 

128* Ensure you're running Claude Code from VS Code's integrated terminal406Now that you have Claude Code set up in VS Code:

129* Ensure the CLI for your IDE variant is installed:

130 * VS Code: `code` command should be available

131 * Cursor: `cursor` command should be available

132 * Windsurf: `windsurf` command should be available

133 * VSCodium: `codium` command should be available

134* If the command isn't installed:

135 1. Open command palette with `Cmd+Shift+P` (Mac) or `Ctrl+Shift+P` (Windows/Linux)

136 2. Search for "Shell Command: Install 'code' command in PATH" (or equivalent for your IDE)

137 407 

138For additional help, see our [troubleshooting guide](/en/troubleshooting).408* [Explore common workflows](/en/common-workflows) to get the most out of Claude Code

409* [Set up MCP servers](/en/mcp) to extend Claude's capabilities with external tools. Configure servers using the CLI, then use them in the extension.

410* [Configure Claude Code settings](/en/settings) to customize allowed commands, hooks, and more. These settings are shared between the extension and CLI.