diff --git a/src/features/opencode-skill-loader/skill-content.test.ts b/src/features/opencode-skill-loader/skill-content.test.ts
index 1c21e14a..4ea84671 100644
--- a/src/features/opencode-skill-loader/skill-content.test.ts
+++ b/src/features/opencode-skill-loader/skill-content.test.ts
@@ -1,6 +1,34 @@
-import { describe, it, expect } from "bun:test"
+///
+
+import { describe, it, expect, beforeEach, afterEach } from "bun:test"
+import { join } from "node:path"
+import { tmpdir } from "node:os"
import { resolveSkillContent, resolveMultipleSkills, resolveSkillContentAsync, resolveMultipleSkillsAsync } from "./skill-content"
+let originalEnv: Record
+let testConfigDir: string
+
+beforeEach(() => {
+ originalEnv = {
+ CLAUDE_CONFIG_DIR: process.env.CLAUDE_CONFIG_DIR,
+ OPENCODE_CONFIG_DIR: process.env.OPENCODE_CONFIG_DIR,
+ }
+ const unique = `skill-content-test-${Date.now()}-${Math.random().toString(16).slice(2)}`
+ testConfigDir = join(tmpdir(), unique)
+ process.env.CLAUDE_CONFIG_DIR = testConfigDir
+ process.env.OPENCODE_CONFIG_DIR = testConfigDir
+})
+
+afterEach(() => {
+ for (const [key, value] of Object.entries(originalEnv)) {
+ if (value !== undefined) {
+ process.env[key] = value
+ } else {
+ delete process.env[key]
+ }
+ }
+})
+
describe("resolveSkillContent", () => {
it("should return template for existing skill", () => {
// given: builtin skills with 'frontend-ui-ux' skill