@pigcloud/skills 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +4 -4
  2. package/README.en.md +74 -83
  3. package/README.md +74 -85
  4. package/bin/cli.js +114 -89
  5. package/bin/postinstall.js +1 -1
  6. package/package.json +1 -1
  7. package/rules/skill-profile-map.json +5 -5
  8. package/rules/skill-profile-map.md +2 -2
  9. package/scripts/validate-skill-shapes.js +2 -1
  10. package/scripts/validate-skills.ps1 +6 -6
  11. package/scripts/validate-skills.sh +5 -5
  12. package/skills/api-docs/SKILL.md +2 -2
  13. package/skills/domain-modeling/SKILL.md +4 -4
  14. package/skills/extract-business-facts/SKILL.md +336 -0
  15. package/skills/extract-business-facts/scripts/write-knowledge-base.js +227 -0
  16. package/skills/knowledge-capture/SKILL.md +16 -7
  17. package/skills/project-bootstrap/SKILL.md +2 -2
  18. package/skills/references/business-fact-extraction.md +414 -0
  19. package/skills/references/golden-prompt-suite.js +64 -14
  20. package/skills/references/rule-loading-map.md +18 -18
  21. package/skills/references/skill-authoring-standard.md +2 -2
  22. package/skills/references/skill-boundary-template.md +56 -23
  23. package/skills/references/skill-enhanced-template.md +80 -30
  24. package/skills/references/skill-reference-matrix.md +21 -20
  25. package/skills/{spec-refinement → spec}/SKILL.md +19 -14
  26. package/skills/technical-design/SKILL.md +4 -4
  27. package/pig-cloud-skills-commands/.codex-plugin/plugin.json +0 -35
  28. package/pig-cloud-skills-commands/README.md +0 -24
  29. package/pig-cloud-skills-commands/commands/analyze.md +0 -21
  30. package/pig-cloud-skills-commands/commands/build.md +0 -21
  31. package/pig-cloud-skills-commands/commands/design.md +0 -21
  32. package/pig-cloud-skills-commands/commands/distill.md +0 -21
  33. package/pig-cloud-skills-commands/commands/doc.md +0 -21
  34. package/pig-cloud-skills-commands/commands/infra.md +0 -21
  35. package/pig-cloud-skills-commands/commands/init.md +0 -20
  36. package/pig-cloud-skills-commands/commands/kb.md +0 -20
  37. package/pig-cloud-skills-commands/commands/perf.md +0 -20
  38. package/pig-cloud-skills-commands/commands/prd.md +0 -21
  39. package/pig-cloud-skills-commands/commands/review.md +0 -21
  40. package/pig-cloud-skills-commands/commands/security.md +0 -21
  41. package/pig-cloud-skills-commands/commands/test.md +0 -21
  42. package/pig-cloud-skills-commands/commands/workflow.md +0 -20
  43. package/skills/product-intake/SKILL.md +0 -98
  44. package/skills/references/agent-personas.md +0 -34
  45. package/skills/references/flow-test-cases.md +0 -62
  46. package/skills/references/full-chain-replay-scenarios.md +0 -79
  47. package/skills/references/hooks.md +0 -67
  48. package/skills/references/negative-replay-scenarios.md +0 -49
  49. package/skills/references/prompt-replay-checklist.md +0 -128
  50. package/skills/references/requirements-separation-map.md +0 -71
  51. package/skills/references/slash-commands.md +0 -34
  52. package/skills/spec-refinement/references/ears-syntax.md +0 -127
  53. package/skills/spec-refinement/references/requirement-checklist.md +0 -139
  54. package/skills/spec-refinement/references/spec-workbook.md +0 -75
package/CHANGELOG.md CHANGED
@@ -8,9 +8,9 @@
8
8
 
9
9
  ### Changed
10
10
  - Made postinstall client-aware so it can auto-install into the detected client(s) from `INIT_CWD`.
11
- - Kept Codex as the only client with a real command pack so `/prd`, `/analyze`, and friends remain executable entries instead of fake aliases.
11
+ - Kept Codex as the only client with a real command pack so `/spec` remains the executable entry instead of a fake alias.
12
12
  - Extended `pig-skills auto` to install the matching client folders for Codex, Claude Code, Trae, Cursor, Copilot, and Windsurf.
13
- - Clarified in the README and usage docs that only Codex gets `/prd`-style command files, while other clients receive skills and rules.
13
+ - Clarified in the README and usage docs that only Codex gets `/spec`-style command files, while other clients receive skills and rules.
14
14
  - Unified the usage guides around the same client-detection and knowledge-capture model.
15
15
 
16
16
  ## [1.1.0] - 2026-06-18
@@ -19,7 +19,7 @@
19
19
  - 重构 skill 体系说明,按当前 13 个 skill 重新梳理 README 和使用方式
20
20
  - 补充统一校验入口 `validate-skills.js`,并增加 Windows / macOS / Linux 壳
21
21
  - 将便携 Python 纳入仓库内,避免依赖系统环境
22
- - 统一 `spec-refinement`、`knowledge-capture`、`workflow-router` 等高频 skill 的识别与门禁表达
22
+ - 统一 `spec`、`knowledge-capture`、`workflow-router` 等高频 skill 的识别与门禁表达
23
23
  - 收缩 skill frontmatter,按官方 validator 规范保留最小字段
24
24
  - 将 `handover` 合并进 `knowledge-capture`,删除独立交接 skill
25
25
 
@@ -41,7 +41,7 @@
41
41
 
42
42
  ### Skills
43
43
  - **Core**: workflow-router, technical-design, feature-build, code-review
44
- - **Analysis**: spec-refinement, domain-modeling
44
+ - **Analysis**: spec, domain-modeling
45
45
  - **Integration**: api-docs, test-design
46
46
  - **Collaboration**: knowledge-capture
47
47
  - **Infrastructure**: project-bootstrap, environment-deploy
package/README.en.md CHANGED
@@ -1,83 +1,74 @@
1
- # @pigcloud/skills
2
-
3
- > An AI skills pack for product, engineering, and QA collaboration. `@pigcloud/skills` is the npm package name; `skills/` carries reusable capabilities, `rules/` carries constraints and validation, `workflow-router` handles stage routing, and `CI / Test / Evidence` completes the delivery loop.
4
-
5
- ## What this system does
6
-
7
- - Route first, then execute
8
- - Constrain first, then generate
9
- - Reuse first, then rewrite
10
- - Verify first, then conclude
11
-
12
- ## Core Layers
13
-
14
- 1. `workflow-router`: identifies the task type and chooses the next stage
15
- 2. `skills/`: reusable capability modules
16
- 3. `rules/`: project constraints, boundaries, and hard checks
17
- 4. `CI / Test / Evidence`: verifiable delivery gates
18
-
19
- ## Common Entry Points
20
-
21
- - Product intake: `product-intake`
22
- - Requirement refinement: `spec-refinement`
23
- - Stage routing: `workflow-router`
24
- - Design and implementation: `technical-design` / `feature-build`
25
- - Review and validation: `code-review` / `security-review` / `performance-check`
26
- - Knowledge capture: `knowledge-capture`
27
-
28
- ## Install
29
-
30
- ```bash
31
- npm install -g @pigcloud/skills
32
- ```
33
-
34
- ## Migration Note
35
-
36
- - `@pig-cloud/skills` is the historical package name
37
- - `@pig/skills` was the intermediate migration name
38
- - New installs should use `@pigcloud/skills`
39
- - `Pig Cloud` is only the repository-specific rules/scaffold context, not the npm package name
40
-
41
- ## Client Setup
42
-
43
- - Codex: see [docs/CODEX-APP-GUIDE.md](docs/CODEX-APP-GUIDE.md)
44
- - Trae: see [docs/TRAE-GUIDE.md](docs/TRAE-GUIDE.md)
45
- - Cloud Code / Claude Code: see [docs/CLAUDE-CODE-GUIDE.md](docs/CLAUDE-CODE-GUIDE.md)
46
- - Unified installation guide: see [docs/client-installation-guide.md](docs/client-installation-guide.md)
47
-
48
- ## Governance Overview
49
-
50
- - System overview: [docs/agent-governance-overview.md](docs/agent-governance-overview.md)
51
- - Skills extension guide: [docs/skills-extension-guide.md](docs/skills-extension-guide.md)
52
- - Package migration note: [docs/package-name-migration.md](docs/package-name-migration.md)
53
-
54
- ## Validation
55
-
56
- ```bash
57
- node validate-skills.js
58
- node scripts/validate-skill-shapes.js
59
- node scripts/validate-rules.js
60
- node scripts/validate-skill-stop-rules.js
61
- node scripts/validate-skill-replay-signals.js
62
- node self-test-skills.js
63
- ```
64
-
65
- ## Directory Map
66
-
67
- - `skills/`: skill bodies
68
- - `skills/references/`: authoring standard, reference matrix, loading map
69
- - `rules/`: rule entry point and bundles
70
- - `docs/`: install, governance, migration, and workflow notes
71
- - `bin/`: CLI, auto-install, postinstall
72
-
73
- ## Entry Docs
74
-
75
- - [AGENTS.md](AGENTS.md)
76
- - [docs/README.md](docs/README.md)
77
- - [docs/client-installation-guide.md](docs/client-installation-guide.md)
78
- - [docs/agent-governance-overview.md](docs/agent-governance-overview.md)
79
- - [docs/skills-extension-guide.md](docs/skills-extension-guide.md)
80
- - [docs/package-name-migration.md](docs/package-name-migration.md)
81
- - [skills/references/skill-authoring-standard.md](skills/references/skill-authoring-standard.md)
82
- - [skills/references/skill-reference-matrix.md](skills/references/skill-reference-matrix.md)
83
- - [skills/references/rule-loading-map.md](skills/references/rule-loading-map.md)
1
+ # @pigcloud/skills
2
+
3
+ > An AI skills pack for product, engineering, and QA collaboration. `skills/` carries reusable capabilities, `rules/` carries constraints and validation, `workflow-router` handles stage routing, and `CI / Test / Evidence` completes the delivery loop.
4
+
5
+ ## What this system does
6
+
7
+ - Route first, then execute
8
+ - Constrain first, then generate
9
+ - Reuse first, then rewrite
10
+ - Verify first, then conclude
11
+
12
+ ## Core Layers
13
+
14
+ 1. `workflow-router`: identifies the task type and chooses the next stage
15
+ 2. `skills/`: reusable capability modules
16
+ 3. `rules/`: project constraints, boundaries, and hard checks
17
+ 4. `CI / Test / Evidence`: verifiable delivery gates
18
+
19
+ ## Common Entry Points
20
+
21
+ - Spec: `spec`
22
+ - Stage routing: `workflow-router`
23
+ - Design and implementation: `technical-design` / `feature-build`
24
+ - Review and validation: `code-review` / `security-review` / `performance-check`
25
+ - Fact extraction: `extract-business-facts`
26
+ - Knowledge capture: `knowledge-capture`
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ npm install -g @pigcloud/skills
32
+ ```
33
+
34
+ ## Client Setup
35
+
36
+ - Codex: see [docs/CODEX-APP-GUIDE.md](docs/CODEX-APP-GUIDE.md)
37
+ - Trae: see [docs/TRAE-GUIDE.md](docs/TRAE-GUIDE.md)
38
+ - Claude Code: see [docs/CLAUDE-CODE-GUIDE.md](docs/CLAUDE-CODE-GUIDE.md)
39
+ - Unified installation guide: see [docs/client-installation-guide.md](docs/client-installation-guide.md)
40
+
41
+ ## Governance Overview
42
+
43
+ - System overview: [docs/agent-governance-overview.md](docs/agent-governance-overview.md)
44
+ - Skills extension guide: [docs/skills-extension-guide.md](docs/skills-extension-guide.md)
45
+
46
+ ## Validation
47
+
48
+ ```bash
49
+ node validate-skills.js
50
+ node scripts/validate-skill-shapes.js
51
+ node scripts/validate-rules.js
52
+ node scripts/validate-skill-stop-rules.js
53
+ node scripts/validate-skill-replay-signals.js
54
+ node self-test-skills.js
55
+ ```
56
+
57
+ ## Directory Map
58
+
59
+ - `skills/`: skill bodies
60
+ - `skills/references/`: authoring standard, reference matrix, loading map
61
+ - `rules/`: rule entry point and bundles
62
+ - `docs/`: install, governance, and workflow notes
63
+ - `bin/`: CLI, auto-install, postinstall
64
+
65
+ ## Entry Docs
66
+
67
+ - [AGENTS.md](AGENTS.md)
68
+ - [docs/README.md](docs/README.md)
69
+ - [docs/client-installation-guide.md](docs/client-installation-guide.md)
70
+ - [docs/agent-governance-overview.md](docs/agent-governance-overview.md)
71
+ - [docs/skills-extension-guide.md](docs/skills-extension-guide.md)
72
+ - [skills/references/skill-authoring-standard.md](skills/references/skill-authoring-standard.md)
73
+ - [skills/references/skill-reference-matrix.md](skills/references/skill-reference-matrix.md)
74
+ - [skills/references/rule-loading-map.md](skills/references/rule-loading-map.md)
package/README.md CHANGED
@@ -1,85 +1,74 @@
1
- # @pigcloud/skills
2
-
3
- > 一个面向产品、研发、测试协作的 AI skills pack。`@pigcloud/skills` 是 npm 包名;`skills/` 负责能力执行,`rules/` 负责约束与校验,`workflow-router` 负责阶段编排,`CI / Test / Evidence` 负责交付闭环。
4
-
5
- ## 这套体系做什么
6
-
7
- - 先路由,再执行
8
- - 先约束,再生成
9
- - 先复用,再重写
10
- - 先验证,再结论
11
-
12
- ## 核心分层
13
-
14
- 1. `workflow-router`:识别任务类型并决定下一阶段
15
- 2. `skills/`:承载可复用能力模块
16
- 3. `rules/`:承载项目规范、边界和强约束
17
- 4. `CI / Test / Evidence`:承载可验证交付
18
-
19
- ## 常见入口
20
-
21
- - 产品收口:`product-intake`
22
- - 需求细化:`spec-refinement`
23
- - 阶段路由:`workflow-router`
24
- - 设计与实现:`technical-design` / `feature-build`
25
- - 审核与验证:`code-review` / `security-review` / `performance-check`
26
- - 知识沉淀:`knowledge-capture`
27
-
28
- ## 安装
29
-
30
- ### 全局安装
31
-
32
- ```bash
33
- npm install -g @pigcloud/skills
34
- ```
35
-
36
- ### 迁移说明
37
-
38
- - `@pig-cloud/skills` 是历史包名
39
- - `@pig/skills` 是迁移中间名
40
- - 现在请使用 `@pigcloud/skills`
41
- - `Pig Cloud` 仅表示仓库里的专属规则/脚手架语境,不再表示 npm 包名
42
-
43
- ## 客户端接入
44
-
45
- - Codex:见 [docs/CODEX-APP-GUIDE.md](docs/CODEX-APP-GUIDE.md)
46
- - Trae:见 [docs/TRAE-GUIDE.md](docs/TRAE-GUIDE.md)
47
- - Cloud Code / Claude Code:见 [docs/CLAUDE-CODE-GUIDE.md](docs/CLAUDE-CODE-GUIDE.md)
48
- - 统一安装说明:见 [docs/client-installation-guide.md](docs/client-installation-guide.md)
49
-
50
- ## 治理总览
51
-
52
- - 体系总览:见 [docs/agent-governance-overview.md](docs/agent-governance-overview.md)
53
- - 技能扩展:见 [docs/skills-extension-guide.md](docs/skills-extension-guide.md)
54
- - 包名迁移:见 [docs/package-name-migration.md](docs/package-name-migration.md)
55
-
56
- ## 验证
57
-
58
- ```bash
59
- node validate-skills.js
60
- node scripts/validate-skill-shapes.js
61
- node scripts/validate-rules.js
62
- node scripts/validate-skill-stop-rules.js
63
- node scripts/validate-skill-replay-signals.js
64
- node self-test-skills.js
65
- ```
66
-
67
- ## 目录
68
-
69
- - `skills/`:技能主体
70
- - `skills/references/`:作者规范、参考矩阵、规则加载地图
71
- - `rules/`:规则入口和 bundle
72
- - `docs/`:安装、治理、迁移、工作流说明
73
- - `bin/`:CLI、自动安装、postinstall
74
-
75
- ## 入口文档
76
-
77
- - [AGENTS.md](AGENTS.md)
78
- - [docs/README.md](docs/README.md)
79
- - [docs/client-installation-guide.md](docs/client-installation-guide.md)
80
- - [docs/agent-governance-overview.md](docs/agent-governance-overview.md)
81
- - [docs/skills-extension-guide.md](docs/skills-extension-guide.md)
82
- - [docs/package-name-migration.md](docs/package-name-migration.md)
83
- - [skills/references/skill-authoring-standard.md](skills/references/skill-authoring-standard.md)
84
- - [skills/references/skill-reference-matrix.md](skills/references/skill-reference-matrix.md)
85
- - [skills/references/rule-loading-map.md](skills/references/rule-loading-map.md)
1
+ # @pigcloud/skills
2
+
3
+ > 一个面向产品、研发、测试协作的 AI 技能包。`skills/` 负责任务边界与交接,`rules/` 负责规则约束与校验,`workflow-router` 负责阶段路由,`CI / Test / Evidence` 负责交付闭环。
4
+
5
+ ## 这套系统做什么
6
+
7
+ - 先路由,再执行
8
+ - 先约束,再生成
9
+ - 先复用,再改写
10
+ - 先验证,再结论
11
+
12
+ ## 核心层
13
+
14
+ 1. `workflow-router`:识别任务类型并选择下一阶段
15
+ 2. `skills/`:可复用的能力模块
16
+ 3. `rules/`:项目约束、边界和硬校验
17
+ 4. `CI / Test / Evidence`:可验证的交付门禁
18
+
19
+ ## 常用入口
20
+
21
+ - 规格澄清:`spec`
22
+ - 阶段路由:`workflow-router`
23
+ - 设计与实现:`technical-design` / `feature-build`
24
+ - 审查与验证:`code-review` / `security-review` / `performance-check`
25
+ - 事实抽取:`extract-business-facts`
26
+ - 知识沉淀:`knowledge-capture`
27
+
28
+ ## 安装
29
+
30
+ ```bash
31
+ npm install -g @pigcloud/skills
32
+ ```
33
+
34
+ ## 客户端接入
35
+
36
+ - Codex:见 [docs/CODEX-APP-GUIDE.md](docs/CODEX-APP-GUIDE.md)
37
+ - Trae:见 [docs/TRAE-GUIDE.md](docs/TRAE-GUIDE.md)
38
+ - Claude Code:见 [docs/CLAUDE-CODE-GUIDE.md](docs/CLAUDE-CODE-GUIDE.md)
39
+ - 统一安装指南:见 [docs/client-installation-guide.md](docs/client-installation-guide.md)
40
+
41
+ ## 治理概览
42
+
43
+ - 系统总览:见 [docs/agent-governance-overview.md](docs/agent-governance-overview.md)
44
+ - 技能扩展指南:见 [docs/skills-extension-guide.md](docs/skills-extension-guide.md)
45
+
46
+ ## 校验
47
+
48
+ ```bash
49
+ node validate-skills.js
50
+ node scripts/validate-skill-shapes.js
51
+ node scripts/validate-rules.js
52
+ node scripts/validate-skill-stop-rules.js
53
+ node scripts/validate-skill-replay-signals.js
54
+ node self-test-skills.js
55
+ ```
56
+
57
+ ## 目录说明
58
+
59
+ - `skills/`:技能正文
60
+ - `skills/references/`:编写标准、参考矩阵、加载映射
61
+ - `rules/`:规则入口与规则包
62
+ - `docs/`:安装、治理和工作流说明
63
+ - `bin/`:CLI、自动安装、postinstall
64
+
65
+ ## 入口文档
66
+
67
+ - [AGENTS.md](AGENTS.md)
68
+ - [docs/README.md](docs/README.md)
69
+ - [docs/client-installation-guide.md](docs/client-installation-guide.md)
70
+ - [docs/agent-governance-overview.md](docs/agent-governance-overview.md)
71
+ - [docs/skills-extension-guide.md](docs/skills-extension-guide.md)
72
+ - [skills/references/skill-authoring-standard.md](skills/references/skill-authoring-standard.md)
73
+ - [skills/references/skill-reference-matrix.md](skills/references/skill-reference-matrix.md)
74
+ - [skills/references/rule-loading-map.md](skills/references/rule-loading-map.md)
package/bin/cli.js CHANGED
@@ -7,16 +7,17 @@ const os = require('os');
7
7
  const { detectRulesBundle } = require('./rules-loader');
8
8
  const { ensureNpmRuntime } = require('./runtime-bootstrap');
9
9
 
10
- const PACKAGE_ROOT = path.join(__dirname, '..');
11
- const SKILLS_DIR = path.join(PACKAGE_ROOT, 'skills');
12
- const VERSION = require('../package.json').version;
13
- const CODEX_HOME = process.env.CODEX_HOME || path.join(os.homedir(), '.codex');
14
- const AGENTS_HOME = path.join(os.homedir(), '.agents');
15
- const COMMAND_PACK_NAME = 'pig-cloud-skills-commands';
16
- const COMMAND_PACK_SOURCE = path.join(PACKAGE_ROOT, COMMAND_PACK_NAME);
17
- const CODEX_HOME_SKILLS_DIR = path.join(CODEX_HOME, 'skills');
18
- const AGENTS_PLUGINS_DIR = path.join(AGENTS_HOME, 'plugins');
19
- const AGENTS_MARKETPLACE_FILE = path.join(AGENTS_PLUGINS_DIR, 'marketplace.json');
10
+ const PACKAGE_ROOT = path.join(__dirname, '..');
11
+ const SKILLS_DIR = path.join(PACKAGE_ROOT, 'skills');
12
+ const VERSION = require('../package.json').version;
13
+ const CODEX_HOME = process.env.CODEX_HOME || path.join(os.homedir(), '.codex');
14
+ const COMMAND_PACK_NAME = 'codex-commands';
15
+ const COMMAND_PACK_SOURCE = path.join(PACKAGE_ROOT, COMMAND_PACK_NAME);
16
+ const CODEX_HOME_SKILLS_DIR = path.join(CODEX_HOME, 'skills');
17
+ const CODEX_HOME_SKILLS_NAMESPACE = 'pigcloud';
18
+ const CODEX_HOME_SKILLS_NAMESPACE_DIR = path.join(CODEX_HOME_SKILLS_DIR, CODEX_HOME_SKILLS_NAMESPACE);
19
+ const CODEX_PLUGINS_DIR = path.join(CODEX_HOME, 'plugins');
20
+ const CODEX_MARKETPLACE_FILE = path.join(CODEX_PLUGINS_DIR, 'marketplace.json');
20
21
  const INSTALL_ROOT = path.resolve(process.env.INIT_CWD || process.cwd());
21
22
  const SUPPORTED_TOOLS = ['codex', 'claude', 'trae', 'cursor', 'copilot', 'windsurf'];
22
23
  const TOOL_ALIASES = {
@@ -43,12 +44,12 @@ const chalk = {
43
44
 
44
45
  const SKILLS = [
45
46
  { name: 'workflow-router', category: 'core', description: 'route workflow stages' },
47
+ { name: 'spec', category: 'analysis', description: 'turn product input into an executable spec' },
46
48
  { name: 'technical-design', category: 'core', description: 'shape implementation design' },
47
49
  { name: 'feature-build', category: 'core', description: 'implement features safely' },
48
50
  { name: 'code-review', category: 'core', description: 'review code changes' },
49
- { name: 'product-intake', category: 'analysis', description: 'capture product intent' },
50
- { name: 'spec-refinement', category: 'analysis', description: 'turn demand into specs' },
51
51
  { name: 'domain-modeling', category: 'analysis', description: 'extract domain knowledge' },
52
+ { name: 'extract-business-facts', category: 'analysis', description: 'extract business facts from code' },
52
53
  { name: 'api-docs', category: 'integration', description: 'document API contracts' },
53
54
  { name: 'test-design', category: 'integration', description: 'design test coverage' },
54
55
  { name: 'security-review', category: 'review', description: 'review security risks' },
@@ -58,11 +59,11 @@ const SKILLS = [
58
59
  { name: 'environment-deploy', category: 'infrastructure', description: 'deploy supporting environments' }
59
60
  ];
60
61
 
61
- const TOOL_CONFIGS = {
62
- codex: { dir: '.agents/skills', rootFile: '.agents/AGENTS.md', markers: ['.agents/AGENTS.md', '.agents'] },
63
- opencode: { dir: '.agents/skills', rootFile: '.agents/AGENTS.md', markers: ['.agents/AGENTS.md', '.agents'] },
64
- claude: { dir: '.claude/skills', rootFile: '.claude/CLAUDE.md', markers: ['.claude/CLAUDE.md', '.claude'] },
65
- claude_code: { dir: '.claude/skills', rootFile: '.claude/CLAUDE.md', markers: ['.claude/CLAUDE.md', '.claude'] },
62
+ const TOOL_CONFIGS = {
63
+ codex: { dir: '.codex/skills/pigcloud', rootFile: '.codex/AGENTS.md', markers: ['.codex/AGENTS.md', '.codex'] },
64
+ opencode: { dir: '.codex/skills/pigcloud', rootFile: '.codex/AGENTS.md', markers: ['.codex/AGENTS.md', '.codex'] },
65
+ claude: { dir: '.claude/skills', rootFile: '.claude/CLAUDE.md', markers: ['.claude/CLAUDE.md', '.claude'] },
66
+ claude_code: { dir: '.claude/skills', rootFile: '.claude/CLAUDE.md', markers: ['.claude/CLAUDE.md', '.claude'] },
66
67
  trae: { dir: '.trae/skills', rootFile: '.trae/AGENTS.md', markers: ['.trae/AGENTS.md', '.trae'] },
67
68
  cursor: { dir: '.cursor/rules', rootFile: '.cursor/rules/project-rules.mdc', markers: ['.cursor/rules/project-rules.mdc', '.cursor/rules'] },
68
69
  copilot: { dir: '.github', rootFile: '.github/copilot-instructions.md', markers: ['.github/copilot-instructions.md'] },
@@ -253,17 +254,29 @@ async function writeRootFile(tool, cwd = process.cwd()) {
253
254
  }
254
255
  }
255
256
 
256
- async function copySkillToCodexHome(skillName) {
257
- const skill = normalizeSkillName(skillName);
258
- if (!getSkillInfo(skill)) {
259
- throw new Error(`Unknown skill: ${skillName}`);
260
- }
261
-
262
- const sourceDir = path.join(SKILLS_DIR, skill);
263
- const destDir = path.join(CODEX_HOME_SKILLS_DIR, skill);
264
- await ensureDir(CODEX_HOME_SKILLS_DIR);
265
- await copyDirectory(sourceDir, destDir);
266
- }
257
+ async function copySkillToCodexHome(skillName) {
258
+ const skill = normalizeSkillName(skillName);
259
+ if (!getSkillInfo(skill)) {
260
+ throw new Error(`Unknown skill: ${skillName}`);
261
+ }
262
+
263
+ const sourceDir = path.join(SKILLS_DIR, skill);
264
+ const destDir = path.join(CODEX_HOME_SKILLS_NAMESPACE_DIR, skill);
265
+ await removePath(path.join(CODEX_HOME_SKILLS_DIR, skill));
266
+ await removePath(destDir);
267
+ await ensureDir(CODEX_HOME_SKILLS_NAMESPACE_DIR);
268
+ await copyDirectory(sourceDir, destDir);
269
+ }
270
+
271
+ async function clearCodexPersonalSkillsNamespace() {
272
+ await removePath(CODEX_HOME_SKILLS_NAMESPACE_DIR);
273
+ }
274
+
275
+ async function clearCodexLegacyFlatSkills(skillNames) {
276
+ for (const skillName of skillNames) {
277
+ await removePath(path.join(CODEX_HOME_SKILLS_DIR, normalizeSkillName(skillName)));
278
+ }
279
+ }
267
280
 
268
281
  function buildMarketplaceEntry(pluginName) {
269
282
  return {
@@ -280,11 +293,11 @@ function buildMarketplaceEntry(pluginName) {
280
293
  };
281
294
  }
282
295
 
283
- async function writeCodexMarketplaceEntry(pluginName) {
284
- await ensureDir(AGENTS_PLUGINS_DIR);
285
- const existing = (await pathExists(AGENTS_MARKETPLACE_FILE))
286
- ? await readJson(AGENTS_MARKETPLACE_FILE)
287
- : { name: 'personal', interface: { displayName: 'Personal' }, plugins: [] };
296
+ async function writeCodexMarketplaceEntry(pluginName) {
297
+ await ensureDir(CODEX_PLUGINS_DIR);
298
+ const existing = (await pathExists(CODEX_MARKETPLACE_FILE))
299
+ ? await readJson(CODEX_MARKETPLACE_FILE)
300
+ : { name: 'personal', interface: { displayName: 'Personal' }, plugins: [] };
288
301
 
289
302
  if (!existing.name) existing.name = 'personal';
290
303
  if (!existing.interface) existing.interface = { displayName: 'Personal' };
@@ -298,19 +311,19 @@ async function writeCodexMarketplaceEntry(pluginName) {
298
311
  existing.plugins.push(entry);
299
312
  }
300
313
 
301
- await writeJson(AGENTS_MARKETPLACE_FILE, existing);
302
- }
303
-
304
- async function installCodexCommandPack() {
305
- if (!(await pathExists(COMMAND_PACK_SOURCE))) {
306
- throw new Error(`Codex command pack not found: ${COMMAND_PACK_SOURCE}`);
307
- }
308
-
309
- const destDir = path.join(AGENTS_PLUGINS_DIR, COMMAND_PACK_NAME);
310
- await ensureDir(AGENTS_PLUGINS_DIR);
311
- await copyDirectory(COMMAND_PACK_SOURCE, destDir);
312
- await writeCodexMarketplaceEntry(COMMAND_PACK_NAME);
313
- }
314
+ await writeJson(CODEX_MARKETPLACE_FILE, existing);
315
+ }
316
+
317
+ async function installCodexCommandPack() {
318
+ if (!(await pathExists(COMMAND_PACK_SOURCE))) {
319
+ throw new Error(`Codex command pack not found: ${COMMAND_PACK_SOURCE}`);
320
+ }
321
+
322
+ const destDir = path.join(CODEX_PLUGINS_DIR, COMMAND_PACK_NAME);
323
+ await ensureDir(CODEX_PLUGINS_DIR);
324
+ await copyDirectory(COMMAND_PACK_SOURCE, destDir);
325
+ await writeCodexMarketplaceEntry(COMMAND_PACK_NAME);
326
+ }
314
327
 
315
328
  async function installSharedWorkspaceAssets(cwd = getInstallRoot()) {
316
329
  const sharedAssets = [
@@ -325,13 +338,18 @@ async function installSharedWorkspaceAssets(cwd = getInstallRoot()) {
325
338
  }
326
339
  }
327
340
 
328
- async function installSkills(skills, tool, cwd = getInstallRoot()) {
329
- await installSharedWorkspaceAssets(cwd);
330
- for (const skill of skills) {
331
- await copySkill(skill, tool, cwd);
332
- }
333
- await writeRootFile(tool, cwd);
334
- if (tool === 'codex') {
341
+ async function installSkills(skills, tool, cwd = getInstallRoot(), options = {}) {
342
+ const { resetCodexNamespace = false } = options;
343
+ await installSharedWorkspaceAssets(cwd);
344
+ if (tool === 'codex' && resetCodexNamespace) {
345
+ await clearCodexPersonalSkillsNamespace();
346
+ await clearCodexLegacyFlatSkills(skills);
347
+ }
348
+ for (const skill of skills) {
349
+ await copySkill(skill, tool, cwd);
350
+ }
351
+ await writeRootFile(tool, cwd);
352
+ if (tool === 'codex') {
335
353
  for (const skill of skills) {
336
354
  await copySkillToCodexHome(skill);
337
355
  }
@@ -339,16 +357,16 @@ async function installSkills(skills, tool, cwd = getInstallRoot()) {
339
357
  }
340
358
  }
341
359
 
342
- async function installSkillsForTools(skills, tools, cwd = getInstallRoot()) {
343
- const uniqueTools = [...new Set(tools.filter(Boolean))];
344
- if (uniqueTools.length === 0) {
345
- throw new Error('Unable to resolve any install targets.');
346
- }
347
-
348
- for (const tool of uniqueTools) {
349
- await installSkills(skills, tool, cwd);
350
- }
351
- }
360
+ async function installSkillsForTools(skills, tools, cwd = getInstallRoot(), options = {}) {
361
+ const uniqueTools = [...new Set(tools.filter(Boolean))];
362
+ if (uniqueTools.length === 0) {
363
+ throw new Error('Unable to resolve any install targets.');
364
+ }
365
+
366
+ for (const tool of uniqueTools) {
367
+ await installSkills(skills, tool, cwd, options);
368
+ }
369
+ }
352
370
 
353
371
  function parseArgs(argv) {
354
372
  const positionals = [];
@@ -465,10 +483,10 @@ async function run() {
465
483
  if (command === 'init') {
466
484
  const skills = getSelectedSkills(options.skills, options.all || !options.skills);
467
485
  try {
468
- await ensureRuntimeForInstall();
469
- const tools = resolveRequestedTools(options.tool);
470
- await installSkillsForTools(skills, tools);
471
- console.log(chalk.green(`Installed ${skills.length} skills for ${tools.join(', ')}`));
486
+ await ensureRuntimeForInstall();
487
+ const tools = resolveRequestedTools(options.tool);
488
+ await installSkillsForTools(skills, tools, getInstallRoot(), { resetCodexNamespace: true });
489
+ console.log(chalk.green(`Installed ${skills.length} skills for ${tools.join(', ')}`));
472
490
  } catch (error) {
473
491
  console.error(chalk.red(error.message));
474
492
  process.exitCode = 1;
@@ -479,10 +497,10 @@ async function run() {
479
497
  if (command === 'auto') {
480
498
  const skills = getSelectedSkills(options.skills, options.all || !options.skills);
481
499
  try {
482
- await ensureRuntimeForInstall();
483
- const tools = resolveRequestedTools('auto');
484
- await installSkillsForTools(skills, tools);
485
- console.log(chalk.green(`Auto-installed ${skills.length} skills for ${tools.join(', ')}`));
500
+ await ensureRuntimeForInstall();
501
+ const tools = resolveRequestedTools('auto');
502
+ await installSkillsForTools(skills, tools, getInstallRoot(), { resetCodexNamespace: true });
503
+ console.log(chalk.green(`Auto-installed ${skills.length} skills for ${tools.join(', ')}`));
486
504
  } catch (error) {
487
505
  console.error(chalk.red(error.message));
488
506
  process.exitCode = 1;
@@ -493,9 +511,9 @@ async function run() {
493
511
  if (command === 'codex') {
494
512
  const skills = getSelectedSkills(options.skills, options.all || !options.skills);
495
513
  try {
496
- await ensureRuntimeForInstall();
497
- await installSkills(skills, 'codex');
498
- console.log(chalk.green(`Synced ${skills.length} skills into Codex`));
514
+ await ensureRuntimeForInstall();
515
+ await installSkills(skills, 'codex', getInstallRoot(), { resetCodexNamespace: true });
516
+ console.log(chalk.green(`Synced ${skills.length} skills into Codex`));
499
517
  console.log(chalk.green(`Installed Codex command pack: ${COMMAND_PACK_NAME}`));
500
518
  } catch (error) {
501
519
  console.error(chalk.red(error.message));
@@ -570,11 +588,11 @@ async function run() {
570
588
  await installSharedWorkspaceAssets();
571
589
  for (const tool of tools) {
572
590
  await copySkill(skillName, tool);
573
- await writeRootFile(tool);
574
- if (tool === 'codex') {
575
- await copySkillToCodexHome(skillName);
576
- await installCodexCommandPack();
577
- }
591
+ await writeRootFile(tool);
592
+ if (tool === 'codex') {
593
+ await copySkillToCodexHome(skillName);
594
+ await installCodexCommandPack();
595
+ }
578
596
  }
579
597
  console.log(chalk.green(`Installed: ${normalizeSkillName(skillName)} -> ${tools.join(', ')}`));
580
598
  } catch (error) {
@@ -599,12 +617,19 @@ async function run() {
599
617
  for (const tool of tools) {
600
618
  const targetSkillDir = getTargetSkillDir(tool);
601
619
  if (!targetSkillDir) continue;
602
- const skillDir = path.join(targetSkillDir, normalizedSkill);
603
- if (await pathExists(skillDir)) {
604
- await removePath(skillDir);
605
- removedAny = true;
606
- }
607
- }
620
+ const skillDir = path.join(targetSkillDir, normalizedSkill);
621
+ if (await pathExists(skillDir)) {
622
+ await removePath(skillDir);
623
+ removedAny = true;
624
+ }
625
+ if (tool === 'codex') {
626
+ const legacySkillDir = path.join(CODEX_HOME_SKILLS_DIR, normalizedSkill);
627
+ if (await pathExists(legacySkillDir)) {
628
+ await removePath(legacySkillDir);
629
+ removedAny = true;
630
+ }
631
+ }
632
+ }
608
633
  console.log(removedAny
609
634
  ? chalk.green(`Removed: ${normalizedSkill}`)
610
635
  : chalk.yellow(`Skill not found: ${normalizedSkill}`));
@@ -640,10 +665,10 @@ async function run() {
640
665
 
641
666
  if (command === 'update') {
642
667
  try {
643
- await ensureRuntimeForInstall();
644
- const tools = resolveRequestedTools(options.tool);
645
- await installSkillsForTools(SKILLS.map(skill => skill.name), tools);
646
- console.log(chalk.green(`Updated ${SKILLS.length} skills for ${tools.join(', ')}`));
668
+ await ensureRuntimeForInstall();
669
+ const tools = resolveRequestedTools(options.tool);
670
+ await installSkillsForTools(SKILLS.map(skill => skill.name), tools, getInstallRoot(), { resetCodexNamespace: true });
671
+ console.log(chalk.green(`Updated ${SKILLS.length} skills for ${tools.join(', ')}`));
647
672
  } catch (error) {
648
673
  console.error(chalk.red(error.message));
649
674
  process.exitCode = 1;