openapi-to-cli / rules
Cursor rule263 starsChanged 3 months agoMITView on GitHub
Workflow for openapi-to-cli
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/architecture.mdcCursor rule
- .cursor/rules/code-style.mdcCursor rule
- .cursor/rules/implementation-order.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- ocli-apiSkill
The file
We split this workflow.mdc into the rules it gives an agent
11 rules. About 0 are common, 5 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
When the user asks for a new feature (words like "feature", "add", "implement", "фича", "добавить"), follow this order.
- Very specific: line 17
Failing test first: add or extend a test in tests/<module>.test.ts.
- Very specific: line 18
Confirm red: run only that test: npx jest tests/<module>.test.ts -t "<title>".
- Very specific: line 19
Implement: write the minimum code in src/ that makes the test pass.
- Distinctive: line 28
When the user reports a bug (words like "bug", "fix", "ошибка", "баг", "исправить"):
- Very specific: line 31
Reproduction test: add a test in tests/<module>.test.ts that reproduces the bug.
- Distinctive: line 32
Confirm red: run only that test and confirm it fails.
- Distinctive: line 37
Docs: update README.md if the bug affected documented behavior.
- Distinctive: line 61
When propagating, translate the frontmatter:
- Very specific: line 72
If a rule file was added, renamed, or removed, refresh the table in .codex/rules.md and the rule list in AGENTS.md.
- Very specific: line 73
If AGENTS.md changed, confirm CLAUDE.md still resolves to it (ls -la CLAUDE.md).
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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.
Files
--- description: Workflow for openapi-to-cli alwaysApply: true --- # Workflow (TDD, layered, docs-aware) This file is `alwaysApply: true`, so it loads in every Cursor session (same priority as the top-level project rules). `openapi-to-cli` (`ocli`) is a TypeScript CLI that turns OpenAPI/Swagger specs into runtime commands. The user-facing surface is the `ocli` binary, `.ocli/` config dir, and `profiles.ini`. Tests live next to source in `tests/` and run with Jest. Behavior is specified by tests; the README documents the public CLI contract. ## New features (TDD) When the user asks for a new feature (words like "feature", "add", "implement", "фича", "добавить"), follow this order. Do not skip steps. 1. **Plan**: outline the steps for the change (modules to touch, tests to add). Use a task list if it spans more than 2-3 steps. 2. **Failing test first**: add or extend a test in `tests/<module>.test.ts`. The test must describe the new behavior in `describe`/`it` and **fail** for the right reason. 3. **Confirm red**: run only that test: `npx jest tests/<module>.test.ts -t "<title>"`. Confirm it fails as expected. 4. **Implement**: write the minimum code in `src/` that makes the test pass. Follow @architecture.mdc and @code-style.mdc. When adding new classes, follow @implementation-order.mdc - lower layer first. 5. **Confirm green**: re-run the same test; it must pass. 6. **Full suite**: `npm test`. All tests must be green. Fix regressions before moving on. 7. **Build check**: `npm run build` to confirm `tsc` is clean (no type errors). 8. **Docs**: update `README.md` whenever any of the following change: CLI flags, command names, profile fields, `.ocli/` layout, BM25 search behavior, supported OpenAPI/Swagger features, authentication and header handling (which requests carry profile credentials and custom headers, and to which hosts), spec loading and caching (accepted sources, `$ref` resolution, when the cache is refreshed), or the benchmark numbers. A change counts even when it adds no flag: if a user can observe the difference (a spec behind auth now loads, credentials reach a host they did not reach before), document it. If you changed observable CLI output (`--help`, error messages, exit codes), update the relevant section of the README. The `examples/skill-ocli-api.md` and `skills/ocli-api/SKILL.md` must stay aligned with the documented agent workflow. 9. **Report**: brief summary of files touched, tests added, suite result. ## Bug fixes (TDD) When the user reports a bug (words like "bug", "fix", "ошибка", "баг", "исправить"): 1. **Plan** the fix. 2. **Reproduction test**: add a test in `tests/<module>.test.ts` that reproduces the bug. It must **fail** on the broken code for the right reason. 3. **Confirm red**: run only that test and confirm it fails. 4. **Fix**: minimal code change in `src/` to make the test pass; respect existing module boundaries. 5. **Confirm green**: re-run the regression test. 6. **Full suite**: `npm test`. All tests green. 7. **Build check**: `npm run build`. 8. **Docs**: update `README.md` if the bug affected documented behavior. 9. **Report**: what was broken, what changed, suite result. ## Before the final answer - `npm test` is green - **always**. - `npm run build` is clean. - `README.md` reflects any user-visible change. - Report what changed, which tests were added, and the suite result. ## Rules sync (Cursor <-> Claude <-> Codex) `.claude/rules/*.md` and `.cursor/rules/*.mdc` cover the same topics and must stay aligned. **Any change to a rule in one location must be mirrored to the other in the same change**, no exceptions. Codex reads the Cursor side through the hook bridge in `.codex/` (`hooks.json`, `hooks/attach_rules.py`), so there is no third copy of the rule bodies; what must be kept in step for Codex is the index `.codex/rules.md` and the top-level brief `AGENTS.md`, to which `CLAUDE.md` is a symlink. Mapping: | Topic | Claude | Cursor | |-------|--------|--------| | Workflow | `.claude/rules/workflow.md` | `.cursor/rules/workflow.mdc` | | Architecture | `.claude/rules/architecture.md` | `.cursor/rules/architecture.mdc` | | Code style | `.claude/rules/code-style.md` | `.cursor/rules/code-style.mdc` | | Testing | `.claude/rules/testing.md` | `.cursor/rules/testing.mdc` | | Implementation order | `.claude/rules/implementation-order.md` | `.cursor/rules/implementation-order.mdc` (create if absent) | When propagating, translate the frontmatter: - Claude `paths: ["src/**/*.ts"]` -> Cursor `globs: src/**/*.ts` + `alwaysApply: true` (or `false` for optional topics like `implementation-order`). Keep `globs` unquoted: the Codex bridge parser reads the value literally, and a quoted glob never matches. - Claude rule without frontmatter (loaded every session, e.g. `workflow.md`) -> Cursor `alwaysApply: true` with no `globs`. - Replace cross-rule links: Claude `[architecture.md](architecture.md)` -> Cursor `@architecture.mdc`. Body content stays identical. If the change is Cursor-only or Claude-only (very rare - e.g. tool-specific quirk), state that explicitly in the file as "Tool-specific:" and skip mirroring for that section only. Checklist for every rule change: 1. Edit the Claude file and its Cursor mirror in the same commit. 2. If a rule file was added, renamed, or removed, refresh the table in `.codex/rules.md` and the rule list in `AGENTS.md`. 3. If `AGENTS.md` changed, confirm `CLAUDE.md` still resolves to it (`ls -la CLAUDE.md`). 4. A rule reaches Codex only if its Cursor frontmatter carries `globs` or `alwaysApply: true`. The hook script and `hooks.json` are never edited per project; after any edit to them, Codex users must re-run `/hooks` to trust the new hash. ## Relationship to other rules - @architecture.mdc is loaded under `src/**` - use it when picking modules and dependency direction. - @implementation-order.mdc is loaded under `src/**` - use it to decide layer order when adding new classes. - @code-style.mdc is loaded for all `.ts` files - applies to both `src/` and `tests/`. - @testing.mdc is loaded under `tests/` - applies when writing or editing tests.
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
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.

