codex-arsenal 0.1.0 → 0.2.0

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.
package/CODEX.md CHANGED
@@ -1,121 +1,121 @@
1
- # CODEX.md
2
-
3
- > Behavioral guidelines to reduce common LLM coding mistakes.
4
- > Merge with project-specific instructions as needed.
5
- > **Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
6
-
7
- ---
8
-
9
- ## 1. Think Before Coding
10
-
11
- **Don't assume. Don't hide confusion. Surface tradeoffs.**
12
-
13
- Before implementing:
14
-
15
- - State your assumptions explicitly. If uncertain, ask.
16
- - If multiple interpretations exist, present them — don't pick silently.
17
- - If a simpler approach exists, say so. Push back when warranted.
18
- - If something is unclear, **stop**. Name what's confusing. Ask.
19
-
20
- ---
21
-
22
- ## 2. Simplicity First
23
-
24
- **Minimum code that solves the problem. Nothing speculative.**
25
-
26
- - No features beyond what was asked.
27
- - No abstractions for single-use code.
28
- - No "flexibility" or "configurability" that wasn't requested.
29
- - No error handling for impossible scenarios.
30
- - If you write 200 lines and it could be 50, rewrite it.
31
-
32
- > Ask yourself: *"Would a senior engineer say this is overcomplicated?"*
33
- > If yes — simplify.
34
-
35
- ---
36
-
37
- ## 3. Surgical Changes
38
-
39
- **Touch only what you must. Clean up only your own mess.**
40
-
41
- When editing existing code:
42
-
43
- - Don't "improve" adjacent code, comments, or formatting.
44
- - Don't refactor things that aren't broken.
45
- - Match existing style, even if you'd do it differently.
46
- - If you notice unrelated dead code, **mention it — don't delete it**.
47
-
48
- When your changes create orphans:
49
-
50
- - Remove imports / variables / functions that **YOUR changes** made unused.
51
- - Don't remove pre-existing dead code unless asked.
52
-
53
- > **The test:** Every changed line should trace directly to the user's request.
54
-
55
- ---
56
-
57
- ## 4. Goal-Driven Execution
58
-
59
- **Define success criteria. Loop until verified.**
60
-
61
- Transform tasks into verifiable goals:
62
-
63
- | Vague | Verifiable |
64
- |-------|------------|
65
- | "Add validation" | "Write tests for invalid inputs, then make them pass" |
66
- | "Fix the bug" | "Write a test that reproduces it, then make it pass" |
67
- | "Refactor X" | "Ensure tests pass before and after" |
68
-
69
- For multi-step tasks, state a brief plan:
70
-
71
- ```
72
- 1. [Step] → verify: [check]
73
- 2. [Step] → verify: [check]
74
- 3. [Step] → verify: [check]
75
- ```
76
-
77
- Strong success criteria let you loop independently.
78
- Weak criteria ("make it work") require constant clarification.
79
-
80
- ---
81
-
82
- ## 5. Agentic Execution (Codex-specific)
83
-
84
- **Codex runs with more autonomy — so guardrails matter more.**
85
-
86
- - **Sandbox first:** Never run destructive commands (`rm -rf`, DB migrations, deploys) without explicit confirmation.
87
- - **Read before write:** Understand the existing codebase structure before modifying it. Use `find`, `grep`, `cat` to build context.
88
- - **One action at a time:** In agentic loops, complete and verify each step before proceeding to the next.
89
- - **Fail loudly:** If a step fails, surface the error immediately. Don't try to work around it silently.
90
- - **Scope your shell:** Prefer relative paths over absolute. Never assume a working directory without confirming it.
91
-
92
- ---
93
-
94
- ## 6. Context Awareness
95
-
96
- **Codex has a limited context window — use it wisely.**
97
-
98
- - Don't re-read files you've already loaded. Reference prior output instead.
99
- - When summarizing large codebases, compress systematically: directory tree → key files → function signatures.
100
- - If context is filling up, state it: *"I'm approaching context limits. Summarizing and continuing."*
101
- - Prefer targeted grep/search over reading entire files when looking for a specific symbol.
102
-
103
- ---
104
-
105
- ## 7. Tool Use Discipline
106
-
107
- **Every tool call has a cost. Make them count.**
108
-
109
- - Batch related reads into a single operation where possible.
110
- - Don't run the same command twice to "verify" — if you need to verify, define the assertion first.
111
- - Avoid speculative exploration ("let me just check...") — know what you're looking for before you look.
112
- - If a tool fails, diagnose before retrying. Don't brute-force.
113
-
114
- ---
115
-
116
- ## ✅ These guidelines are working if:
117
-
118
- - Diffs contain fewer unnecessary changes
119
- - Fewer rewrites due to overcomplication
120
- - Clarifying questions come **before** implementation, not after mistakes
1
+ # CODEX.md
2
+
3
+ > Behavioral guidelines to reduce common LLM coding mistakes.
4
+ > Merge with project-specific instructions as needed.
5
+ > **Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
6
+
7
+ ---
8
+
9
+ ## 1. Think Before Coding
10
+
11
+ **Don't assume. Don't hide confusion. Surface tradeoffs.**
12
+
13
+ Before implementing:
14
+
15
+ - State your assumptions explicitly. If uncertain, ask.
16
+ - If multiple interpretations exist, present them — don't pick silently.
17
+ - If a simpler approach exists, say so. Push back when warranted.
18
+ - If something is unclear, **stop**. Name what's confusing. Ask.
19
+
20
+ ---
21
+
22
+ ## 2. Simplicity First
23
+
24
+ **Minimum code that solves the problem. Nothing speculative.**
25
+
26
+ - No features beyond what was asked.
27
+ - No abstractions for single-use code.
28
+ - No "flexibility" or "configurability" that wasn't requested.
29
+ - No error handling for impossible scenarios.
30
+ - If you write 200 lines and it could be 50, rewrite it.
31
+
32
+ > Ask yourself: *"Would a senior engineer say this is overcomplicated?"*
33
+ > If yes — simplify.
34
+
35
+ ---
36
+
37
+ ## 3. Surgical Changes
38
+
39
+ **Touch only what you must. Clean up only your own mess.**
40
+
41
+ When editing existing code:
42
+
43
+ - Don't "improve" adjacent code, comments, or formatting.
44
+ - Don't refactor things that aren't broken.
45
+ - Match existing style, even if you'd do it differently.
46
+ - If you notice unrelated dead code, **mention it — don't delete it**.
47
+
48
+ When your changes create orphans:
49
+
50
+ - Remove imports / variables / functions that **YOUR changes** made unused.
51
+ - Don't remove pre-existing dead code unless asked.
52
+
53
+ > **The test:** Every changed line should trace directly to the user's request.
54
+
55
+ ---
56
+
57
+ ## 4. Goal-Driven Execution
58
+
59
+ **Define success criteria. Loop until verified.**
60
+
61
+ Transform tasks into verifiable goals:
62
+
63
+ | Vague | Verifiable |
64
+ |-------|------------|
65
+ | "Add validation" | "Write tests for invalid inputs, then make them pass" |
66
+ | "Fix the bug" | "Write a test that reproduces it, then make it pass" |
67
+ | "Refactor X" | "Ensure tests pass before and after" |
68
+
69
+ For multi-step tasks, state a brief plan:
70
+
71
+ ```
72
+ 1. [Step] → verify: [check]
73
+ 2. [Step] → verify: [check]
74
+ 3. [Step] → verify: [check]
75
+ ```
76
+
77
+ Strong success criteria let you loop independently.
78
+ Weak criteria ("make it work") require constant clarification.
79
+
80
+ ---
81
+
82
+ ## 5. Agentic Execution (Codex-specific)
83
+
84
+ **Codex runs with more autonomy — so guardrails matter more.**
85
+
86
+ - **Sandbox first:** Never run destructive commands (`rm -rf`, DB migrations, deploys) without explicit confirmation.
87
+ - **Read before write:** Understand the existing codebase structure before modifying it. Use `find`, `grep`, `cat` to build context.
88
+ - **One action at a time:** In agentic loops, complete and verify each step before proceeding to the next.
89
+ - **Fail loudly:** If a step fails, surface the error immediately. Don't try to work around it silently.
90
+ - **Scope your shell:** Prefer relative paths over absolute. Never assume a working directory without confirming it.
91
+
92
+ ---
93
+
94
+ ## 6. Context Awareness
95
+
96
+ **Codex has a limited context window — use it wisely.**
97
+
98
+ - Don't re-read files you've already loaded. Reference prior output instead.
99
+ - When summarizing large codebases, compress systematically: directory tree → key files → function signatures.
100
+ - If context is filling up, state it: *"I'm approaching context limits. Summarizing and continuing."*
101
+ - Prefer targeted grep/search over reading entire files when looking for a specific symbol.
102
+
103
+ ---
104
+
105
+ ## 7. Tool Use Discipline
106
+
107
+ **Every tool call has a cost. Make them count.**
108
+
109
+ - Batch related reads into a single operation where possible.
110
+ - Don't run the same command twice to "verify" — if you need to verify, define the assertion first.
111
+ - Avoid speculative exploration ("let me just check...") — know what you're looking for before you look.
112
+ - If a tool fails, diagnose before retrying. Don't brute-force.
113
+
114
+ ---
115
+
116
+ ## ✅ These guidelines are working if:
117
+
118
+ - Diffs contain fewer unnecessary changes
119
+ - Fewer rewrites due to overcomplication
120
+ - Clarifying questions come **before** implementation, not after mistakes
121
121
  - Agentic runs complete tasks end-to-end without silent failures or scope creep
package/lib/manifest.js CHANGED
@@ -60,6 +60,15 @@ export const MANIFEST = [
60
60
  { src: "skills/test-gen/prompt.md", dest: "skills/test-gen/prompt.md" }
61
61
  ]
62
62
  },
63
+ {
64
+ id: "skill-publishing-npm-packages",
65
+ category: "Skills",
66
+ label: "publishing-npm-packages",
67
+ description: "A Codex skill for preparing, troubleshooting, and automating npm package releases.",
68
+ files: [
69
+ { src: "skills/publishing-npm-packages/SKILL.md", dest: "skills/publishing-npm-packages/SKILL.md" }
70
+ ]
71
+ },
63
72
  {
64
73
  id: "plugin-context-window-compressor",
65
74
  category: "Plugins",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-arsenal",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A practical arsenal of Codex and Claude Code plugins, skills, prompts, workflows, and configs.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: publishing-npm-packages
3
+ description: Use when preparing, troubleshooting, or automating npm package releases, especially GitHub Actions Trusted Publishing, provenance, 2FA publish errors, version tags, npm pack checks, or npx CLI packages.
4
+ ---
5
+
6
+ # Publishing npm Packages
7
+
8
+ ## Overview
9
+
10
+ Publish npm packages through a verified release path. Prefer GitHub Actions Trusted Publishing with OIDC over long-lived `NPM_TOKEN` secrets.
11
+
12
+ ## Release Decision
13
+
14
+ Use this order:
15
+
16
+ 1. Existing package with Trusted Publishing configured: release by version tag.
17
+ 2. First publish for a new package: create the package with npm 2FA or a short-lived/granular manual path, then configure Trusted Publishing.
18
+ 3. CI provider unsupported or private dependency constraints: use a granular npm token with the narrowest publish scope.
19
+
20
+ ## Preflight
21
+
22
+ Before changing release config, inspect:
23
+
24
+ - `package.json`: `name`, `version`, `bin`, `files`, `repository.url`, `publishConfig.access`
25
+ - `package-lock.json`: present when workflow uses `npm ci`
26
+ - `.github/workflows/*.yml`: CI and publish workflow
27
+ - npm package state: `npm info <package-name>` when npm is available
28
+
29
+ For GitHub Actions Trusted Publishing, require:
30
+
31
+ ```yaml
32
+ permissions:
33
+ contents: read
34
+ id-token: write
35
+ ```
36
+
37
+ Use GitHub-hosted runners, Node 22.14+ or 24, npm 11.5.1+, and `actions/setup-node` with `registry-url: "https://registry.npmjs.org"`.
38
+
39
+ ## Package Metadata
40
+
41
+ Keep npm metadata boring and exact:
42
+
43
+ ```json
44
+ {
45
+ "type": "module",
46
+ "bin": {
47
+ "package-name": "bin/cli.js"
48
+ },
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/OWNER/REPO.git"
52
+ },
53
+ "publishConfig": {
54
+ "access": "public"
55
+ }
56
+ }
57
+ ```
58
+
59
+ Do not use `./` in `bin` paths if npm reports that it auto-corrected the script name or path. Run `npm pkg fix` when available, or apply the equivalent minimal metadata fix.
60
+
61
+ ## Trusted Publishing Setup
62
+
63
+ Configure on npmjs.com after the package exists:
64
+
65
+ ```text
66
+ Packages -> PACKAGE -> Settings -> Trusted publishing
67
+ Provider: GitHub Actions
68
+ Owner: GitHub owner
69
+ Repository: GitHub repository
70
+ Workflow filename: publish.yml
71
+ Environment: npm, if the workflow uses environment: npm
72
+ ```
73
+
74
+ The workflow filename is only `publish.yml`, not `.github/workflows/publish.yml`.
75
+
76
+ If the workflow uses `environment: npm`, ensure GitHub has an environment named `npm`.
77
+
78
+ ## Recommended Workflows
79
+
80
+ Use separate CI and publish workflows.
81
+
82
+ CI:
83
+
84
+ ```yaml
85
+ name: CI
86
+ on:
87
+ pull_request:
88
+ push:
89
+ branches: [main]
90
+ permissions:
91
+ contents: read
92
+ jobs:
93
+ test:
94
+ runs-on: ubuntu-latest
95
+ steps:
96
+ - uses: actions/checkout@v6
97
+ - uses: actions/setup-node@v6
98
+ with:
99
+ node-version: "24"
100
+ package-manager-cache: false
101
+ - run: npm ci
102
+ - run: npm test
103
+ - run: npm pack --dry-run
104
+ ```
105
+
106
+ Publish:
107
+
108
+ ```yaml
109
+ name: Publish to npm
110
+ on:
111
+ push:
112
+ tags: ["v*"]
113
+ permissions:
114
+ contents: read
115
+ id-token: write
116
+ jobs:
117
+ publish:
118
+ runs-on: ubuntu-latest
119
+ environment: npm
120
+ steps:
121
+ - uses: actions/checkout@v6
122
+ - uses: actions/setup-node@v6
123
+ with:
124
+ node-version: "24"
125
+ registry-url: "https://registry.npmjs.org"
126
+ package-manager-cache: false
127
+ - run: npm ci
128
+ - run: npm test
129
+ - run: npm pack --dry-run
130
+ - run: npm publish
131
+ ```
132
+
133
+ ## Release Procedure
134
+
135
+ 1. Verify clean state: `git status --short`.
136
+ 2. Run tests: `npm test`.
137
+ 3. Inspect package contents: `npm pack --dry-run`.
138
+ 4. Bump version: `npm version patch`, `minor`, or `major`.
139
+ 5. Push commit and tag: `git push --follow-tags`.
140
+ 6. Check GitHub Actions publish job.
141
+ 7. Smoke test after publish: `npx <package-name> --help` or `npx <package-name> list`.
142
+
143
+ ## Failure Handling
144
+
145
+ | Symptom | Root Cause | Response |
146
+ | --- | --- | --- |
147
+ | `E403 Two-factor authentication... required` | Manual publish without required 2FA or publish token | Enable npm 2FA and retry manual first publish, or use Trusted Publishing after package exists |
148
+ | `ENEEDAUTH` in GitHub Actions | Trusted Publisher mismatch or missing OIDC permission | Check owner, repo, workflow filename, environment name, and `id-token: write` |
149
+ | npm auto-corrects `package.json` | Metadata is publishable but not canonical | Run `npm pkg fix` or make the exact minimal metadata change |
150
+ | `npm ci` fails in CI | Missing or stale lockfile | Generate/update `package-lock.json` with the intended npm version |
151
+ | Package name unavailable | Name already exists or scope mismatch | Rename to a scoped package such as `@owner/name` and set public access |
152
+
153
+ ## Guardrails
154
+
155
+ - Never publish without reading the `npm pack --dry-run` file list.
156
+ - Never add `NPM_TOKEN` when Trusted Publishing works for the project.
157
+ - Never reuse a version after a failed or partial publish; check `npm info <name> versions`.
158
+ - Never claim a package is published until npm or `npx` confirms the released version.