agentleFS
LukaGiorgadzeLukaGiorgadze/opencto/skills/codex-noninteractive/SKILL.md

codex-noninteractive

Skill1 starsChanged 5 months agoMITView on GitHub

Use this skill when a user asks for non-trivial code changes — such as implementing a new feature, fixing a bug, refactoring, or any task that requires meaningful edits across one or more files. Skip it for minor changes that can be done in a few lines directly.

  • Reads credentials

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 6 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this skill when designing, reviewing, or generating commands and workflows around codex exec.

    line 12
  2. Distinctive:

    When generating a workflow that writes changes, separate read-only Codex generation from write-permission PR creation.

    line 37
  3. Distinctive:

    Avoid persisted rollout files:

    line 53
  4. Distinctive:

    Write only the final message to a file:

    line 71
  5. Very specific:

    Avoid danger-full-access unless the runner is isolated.

    line 98
  6. Very specific:

    If an enabled MCP server has required = true and cannot initialize, expect codex exec to exit with an error.

    line 100
  7. Very specific:

    Use prompt-plus-stdin when command output is context and the instruction is known.

    line 122
  8. Very specific:

    Use --json when downstream tooling needs progress/events.

    line 126
  9. Very specific:

    Use --output-schema when downstream tooling needs a stable final JSON shape:

    line 128
  10. Very specific:

    Keep schemas strict: require needed fields and set additionalProperties: false.

    line 134
  11. Very specific:

    Do not set OPENAI_API_KEY or CODEX_API_KEY as a job-level environment variable in workflows that check out or run repository-controlled …

    line 142
  12. Very specific:

    Treat ~/.codex/auth.json like a password.

    line 152
  13. Distinctive:

    When asked to auto-fix CI failures in GitHub Actions, use this security pattern:

    line 156
  14. Very specific:

    Check out the failing commit with contents: read.

    line 159
  15. Distinctive:

    Run setup and tests before exposing OpenAI credentials.

    line 160
  16. Very specific:

    Read references/github-actions-autofix.md when a full workflow is needed.

    line 165
  17. Distinctive:

    Before returning a command or workflow, verify:

    line 181

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Codex Non-Interactive Mode

Use this skill for

Use this skill when designing, reviewing, or generating commands and workflows around codex exec.

Good matches include CI jobs, release-note generation, repo triage, automated fixes, log summarization, structured JSON output, stdin piping, schema-constrained output, sandbox configuration, API-key handling, and non-interactive session resume.

Core model

codex exec runs Codex without opening the interactive TUI. It is meant for scripts, pipelines, scheduled jobs, and automation.

Default behavior:

  • Progress streams to stderr.
  • The final assistant message prints to stdout.
  • Piped stdin can be used as task context.
  • codex exec - makes stdin the full prompt.
  • The default sandbox is read-only.
  • Runs normally require a Git repository unless --skip-git-repo-check is used.
  • codex e is the short alias for codex exec.

Standard procedure

  1. Identify the automation shape: one-off shell command, CI step, JSONL event stream, schema output, or resumed multi-stage run.
  2. Choose the safest permission level that can complete the task.
  3. Choose the input pattern: prompt only, prompt plus stdin context, or stdin-as-prompt with -.
  4. Choose output handling: final stdout, --output-last-message, JSONL with --json, or --output-schema.
  5. For CI, keep credentials out of untrusted setup/build/test steps.
  6. When generating a workflow that writes changes, separate read-only Codex generation from write-permission PR creation.

Common commands

Prompt only:

codex exec "summarize the repository structure and list the top 5 risky areas"

Redirect final output:

codex exec "generate release notes for the last 10 commits" | tee release-notes.md

Avoid persisted rollout files:

codex exec --ephemeral "triage this repository and suggest next steps"

Allow workspace edits:

codex exec --sandbox workspace-write "fix the failing tests"

Emit JSONL events:

codex exec --json "summarize the repo structure" | jq

Write only the final message to a file:

codex exec "summarize the repo structure" -o summary.md

Resume the last non-interactive session:

codex exec "review the change for race conditions"
codex exec resume --last "fix the race conditions you found"

Permissions and safety

Use least privilege.

NeedCommand pattern
Inspect onlycodex exec "<task>"
Modify workspace filescodex exec --sandbox workspace-write "<task>"
Broader system accesscodex exec --sandbox danger-full-access "<task>"
No saved rollout filescodex exec --ephemeral "<task>"
Ignore local user configcodex exec --ignore-user-config "<task>"
Ignore execpolicy rulescodex exec --ignore-rules "<task>"
Outside Git repositorycodex exec --skip-git-repo-check "<task>"

Avoid danger-full-access unless the runner is isolated. Treat --full-auto as deprecated compatibility behavior; prefer explicit --sandbox workspace-write.

If an enabled MCP server has required = true and cannot initialize, expect codex exec to exit with an error.

Input patterns

Prompt plus stdin context:

npm test 2>&1   | codex exec "summarize the failing tests and propose the smallest likely fix"   | tee test-summary.md

Stdin as the full prompt:

cat prompt.txt | codex exec -

Dynamic generated prompt:

generate_prompt.sh | codex exec - --json > result.jsonl

Use prompt-plus-stdin when command output is context and the instruction is known. Use codex exec - when another script or file generates the full instruction.

Structured and machine-readable output

Use --json when downstream tooling needs progress/events. JSONL event types include thread.started, turn.started, turn.completed, turn.failed, item.*, and error.

Use --output-schema when downstream tooling needs a stable final JSON shape:

codex exec "Extract project metadata"   --output-schema ./schema.json   -o ./project-metadata.json

Keep schemas strict: require needed fields and set additionalProperties: false.

Authentication in automation

codex exec reuses saved CLI authentication by default.

For GitHub Actions, prefer openai/codex-action over installing the CLI and exposing an API key to a shell step.

Do not set OPENAI_API_KEY or CODEX_API_KEY as a job-level environment variable in workflows that check out or run repository-controlled code.

For non-GitHub automation, scope CODEX_API_KEY to the single codex exec invocation:

CODEX_API_KEY=<api-key> codex exec --json "triage open bug reports"

CODEX_API_KEY is supported only by codex exec.

Treat ~/.codex/auth.json like a password. Do not use ChatGPT-managed auth files in public or open-source repository runners.

GitHub Actions autofix pattern

When asked to auto-fix CI failures in GitHub Actions, use this security pattern:

  1. Trigger a follow-up workflow from failed CI.
  2. Check out the failing commit with contents: read.
  3. Run setup and tests before exposing OpenAI credentials.
  4. Run openai/codex-action.
  5. Save Codex changes as a patch artifact.
  6. In a separate job with write permissions, apply the patch and open a PR.

Read references/github-actions-autofix.md when a full workflow is needed.

Resources

Load these only when the task needs the extra detail:

  • references/codex-exec-flags.md: full codex exec and codex exec resume flag table.
  • references/structured-output.md: JSONL events and schema-constrained output patterns.
  • references/stdin-piping.md: prompt-plus-stdin and stdin-as-prompt examples.
  • references/auth-and-ci-security.md: API-key handling and CI auth guidance.
  • references/github-actions-autofix.md: full secure GitHub Actions auto-fix workflow.
  • references/full-non-interactive-reference.md: complete cleaned source reference.
  • references/agentskills-practices-used.md: Agent Skills design choices used in this package.

Response checklist

Before returning a command or workflow, verify:

  • The command uses codex exec or codex exec resume, not the interactive TUI.
  • The sandbox is the least-permissive viable option.
  • Secrets are scoped only to the Codex invocation or protected action.
  • Untrusted repository code does not run with API keys in its environment.
  • Output mode matches the caller's downstream consumer.
  • Stdin mode matches whether stdin is context or the full prompt.
  • The Git repository requirement is handled explicitly.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.