diff --git a/debug_bar.module b/debug_bar.module
index a6d9f18..8160a3e 100644
--- a/debug_bar.module
+++ b/debug_bar.module
@@ -1,12 +1,17 @@
 <?php
 
+/**
+ * @file
+ */
+
 declare(strict_types=1);
 
 /**
  * @file
  * Primary module hooks for debug_bar module.
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\debug_bar\Hook\DebugBarHooks;
 use Drupal\debug_bar\Data\DebugBarItem;
 
 /**
@@ -14,10 +19,9 @@ use Drupal\debug_bar\Data\DebugBarItem;
  *
  * @phpstan-param array{'#attached': array{'#attached': array{'library': list<non-empty-string>}}} &$page
  */
+#[LegacyHook]
 function debug_bar_page_attachments(array &$page): void {
-  if (\Drupal::currentUser()->hasPermission('view debug bar')) {
-    $page['#attached']['library'][] = 'debug_bar/debug_bar';
-  }
+  \Drupal::service(DebugBarHooks::class)->pageAttachments($page);
 }
 
 /**
@@ -25,15 +29,9 @@ function debug_bar_page_attachments(array &$page): void {
  *
  * @phpstan-ignore-next-line
  */
+#[LegacyHook]
 function debug_bar_theme(): array {
-  return [
-    'debug_bar' => [
-      'variables' => [
-        'items' => [],
-        'attributes' => [],
-      ],
-    ],
-  ];
+  return \Drupal::service(DebugBarHooks::class)->theme();
 }
 
 /**
diff --git a/debug_bar.services.yml b/debug_bar.services.yml
index 84aa1fe..c992823 100644
--- a/debug_bar.services.yml
+++ b/debug_bar.services.yml
@@ -25,3 +25,7 @@ services:
       - '@renderer'
       - '@datetime.time'
       - '@extension.list.module'
+
+  Drupal\debug_bar\Hook\DebugBarHooks:
+    class: Drupal\debug_bar\Hook\DebugBarHooks
+    autowire: true
diff --git a/src/Hook/DebugBarHooks.php b/src/Hook/DebugBarHooks.php
new file mode 100644
index 0000000..bc05f62
--- /dev/null
+++ b/src/Hook/DebugBarHooks.php
@@ -0,0 +1,41 @@
+<?php
+
+namespace Drupal\debug_bar\Hook;
+
+use Drupal\Core\Hook\Attribute\Hook;
+
+/**
+ * Hook implementations for debug_bar.
+ */
+class DebugBarHooks {
+
+  /**
+   * Implements hook_attachments().
+   *
+   * @phpstan-param array{'#attached': array{'#attached': array{'library': list<non-empty-string>}}} &$page
+   */
+  #[Hook('attachments', module: 'debug_bar_page')]
+  public function pageAttachments(array &$page): void {
+    if (\Drupal::currentUser()->hasPermission('view debug bar')) {
+      $page['#attached']['library'][] = 'debug_bar/debug_bar';
+    }
+  }
+
+  /**
+   * Implements hook_theme().
+   *
+   * @phpstan-ignore-next-line
+   */
+  #[Hook('theme')]
+  public function theme(): array {
+    return [
+      'debug_bar' => [
+        'variables' => [
+          'items' => [],
+          'attributes' => [],
+        ],
+      ],
+    ];
+  }
+
+}
diff --git a/tests/src/Functional/ActionsTest.php b/tests/src/Functional/ActionsTest.php
index 8010acd..de6f218 100644
--- a/tests/src/Functional/ActionsTest.php
+++ b/tests/src/Functional/ActionsTest.php
@@ -4,6 +4,8 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\debug_bar\Functional;
 
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\BrowserTestBase;
 
@@ -12,6 +14,8 @@ use Drupal\Tests\BrowserTestBase;
  *
  * @group debug_bar
  */
+#[Group('debug_bar')]
+#[RunTestsInSeparateProcesses]
 final class ActionsTest extends BrowserTestBase {
 
   /**
diff --git a/tests/src/Functional/DebugBarTest.php b/tests/src/Functional/DebugBarTest.php
index d13cd95..5ad1f7c 100644
--- a/tests/src/Functional/DebugBarTest.php
+++ b/tests/src/Functional/DebugBarTest.php
@@ -4,6 +4,8 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\debug_bar\Functional;
 
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
 use Behat\Mink\Element\NodeElement;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\BrowserTestBase;
@@ -13,6 +15,8 @@ use Drupal\Tests\BrowserTestBase;
  *
  * @group debug_bar
  */
+#[Group('debug_bar')]
+#[RunTestsInSeparateProcesses]
 final class DebugBarTest extends BrowserTestBase {
 
   /**
diff --git a/tests/src/Functional/SettingsFormTest.php b/tests/src/Functional/SettingsFormTest.php
index 0f1b49e..44bb841 100644
--- a/tests/src/Functional/SettingsFormTest.php
+++ b/tests/src/Functional/SettingsFormTest.php
@@ -4,6 +4,8 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\debug_bar\Functional;
 
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Tests\BrowserTestBase;
 
@@ -12,6 +14,8 @@ use Drupal\Tests\BrowserTestBase;
  *
  * @group debug_bar
  */
+#[Group('debug_bar')]
+#[RunTestsInSeparateProcesses]
 final class SettingsFormTest extends BrowserTestBase {
 
   /**
diff --git a/tests/src/FunctionalJavascript/DebugBarTest.php b/tests/src/FunctionalJavascript/DebugBarTest.php
index a85a66a..6065d53 100644
--- a/tests/src/FunctionalJavascript/DebugBarTest.php
+++ b/tests/src/FunctionalJavascript/DebugBarTest.php
@@ -4,11 +4,16 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\debug_bar\FunctionalJavascript;
 
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
+
 /**
  * Tests the JavaScript functionality of the Debug Bar module.
  *
  * @group debug_bar
  */
+#[Group('debug_bar')]
+#[RunTestsInSeparateProcesses]
 final class DebugBarTest extends DebugBarTestBase {
 
   /**
diff --git a/tests/src/FunctionalJavascript/DebugBarTestBase.php b/tests/src/FunctionalJavascript/DebugBarTestBase.php
index 2f59a06..bae2fac 100644
--- a/tests/src/FunctionalJavascript/DebugBarTestBase.php
+++ b/tests/src/FunctionalJavascript/DebugBarTestBase.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\debug_bar\FunctionalJavascript;
 
+use PHPUnit\Framework\Attributes\Group;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
 
@@ -12,6 +13,7 @@ use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
  *
  * @group debug_bar
  */
+#[Group('debug_bar')]
 abstract class DebugBarTestBase extends WebDriverTestBase {
 
   /**
