opencode-codeops 1.4.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/LICENSE +21 -0
  3. package/README.md +171 -0
  4. package/_shared/auto-design.md +129 -0
  5. package/_shared/layout-convention.md +198 -0
  6. package/_shared/quality-profile.md +134 -0
  7. package/_shared/recommendation-hardening.md +166 -0
  8. package/_shared/scope-expansion-control.md +176 -0
  9. package/_shared/spec-first-ordering.md +79 -0
  10. package/_shared/zero-ambiguity-gate.md +311 -0
  11. package/agent-templates/codebase-scout.md +17 -0
  12. package/agent-templates/concurrency-auditor.md +5 -0
  13. package/agent-templates/design-challenger.md +26 -0
  14. package/agent-templates/financial-integrity-auditor.md +5 -0
  15. package/agent-templates/perf-auditor.md +23 -0
  16. package/agent-templates/phase-reviewer.md +54 -0
  17. package/agent-templates/plan-task-executor-opus.md +46 -0
  18. package/agent-templates/plan-task-executor.md +43 -0
  19. package/agent-templates/preflight-auditor.md +45 -0
  20. package/agent-templates/security-auditor.md +42 -0
  21. package/agent-templates/semantics-reviewer.md +5 -0
  22. package/agent-templates/spec-test-author.md +29 -0
  23. package/agents/concurrency-auditor.md +15 -0
  24. package/agents/correctness-reviewer.md +66 -0
  25. package/agents/demanding-executor.md +58 -0
  26. package/agents/design-challenger.md +38 -0
  27. package/agents/executor.md +55 -0
  28. package/agents/explorer.md +29 -0
  29. package/agents/financial-integrity-auditor.md +15 -0
  30. package/agents/performance-auditor.md +35 -0
  31. package/agents/preflight-auditor.md +57 -0
  32. package/agents/security-auditor.md +54 -0
  33. package/agents/semantics-reviewer.md +15 -0
  34. package/agents/spec-test-author.md +41 -0
  35. package/bin/codeops-worktree +244 -0
  36. package/bin/index.mjs +106 -0
  37. package/bin/install-agents.mjs +453 -0
  38. package/bin/install-skills.mjs +466 -0
  39. package/bin/lib/opencode-install.mjs +185 -0
  40. package/install.sh +55 -0
  41. package/package.json +73 -0
  42. package/plugin/index.ts +181 -0
  43. package/references/domains/compiler-and-language.md +28 -0
  44. package/references/domains/data-and-migration.md +22 -0
  45. package/references/domains/distributed-and-concurrent.md +26 -0
  46. package/references/domains/financial-system.md +28 -0
  47. package/references/domains/selection.md +19 -0
  48. package/references/domains/web-application.md +23 -0
  49. package/schemas/codeops-config.schema.json +56 -0
  50. package/scripts/check-version.mjs +163 -0
  51. package/scripts/codeops-migrate.sh +355 -0
  52. package/scripts/codeops-roadmap-compact.sh +232 -0
  53. package/scripts/codeops-roadmap-sync.sh +275 -0
  54. package/scripts/codeops_outcomes.py +155 -0
  55. package/scripts/codeops_plan.py +239 -0
  56. package/scripts/codeops_plan_migrate.py +318 -0
  57. package/scripts/codeops_worktree_snapshot.py +99 -0
  58. package/scripts/install_agents.py +288 -0
  59. package/scripts/release.mjs +533 -0
  60. package/skills/analyze-project/SKILL.md +28 -0
  61. package/skills/clean-comments/SKILL.md +22 -0
  62. package/skills/exec-plan/SKILL.md +267 -0
  63. package/skills/exec-plan/commit-modes.md +113 -0
  64. package/skills/exec-plan/execution-protocol.md +471 -0
  65. package/skills/git-commit/SKILL.md +35 -0
  66. package/skills/github-issues/SKILL.md +38 -0
  67. package/skills/grill-me/SKILL.md +342 -0
  68. package/skills/make-plan/SKILL.md +282 -0
  69. package/skills/make-plan/quality-checklist.md +96 -0
  70. package/skills/make-plan/templates.md +535 -0
  71. package/skills/make-plan/zero-ambiguity-gate.md +19 -0
  72. package/skills/make-requirements/SKILL.md +268 -0
  73. package/skills/make-requirements/discovery-phases.md +255 -0
  74. package/skills/make-requirements/review-and-add.md +73 -0
  75. package/skills/make-requirements/templates.md +296 -0
  76. package/skills/make-requirements/zero-ambiguity-gate.md +18 -0
  77. package/skills/outcome-review/SKILL.md +34 -0
  78. package/skills/preflight/SKILL.md +310 -0
  79. package/skills/preflight/dimensions.md +181 -0
  80. package/skills/preflight/report-format.md +300 -0
  81. package/skills/retro-requirements/SKILL.md +218 -0
  82. package/skills/retro-requirements/confidence-classification.md +45 -0
  83. package/skills/retro-requirements/phases.md +609 -0
  84. package/skills/retro-requirements/triage-gate.md +135 -0
  85. package/skills/roadmap/SKILL.md +381 -0
  86. package/skills/roadmap/stage-hooks.md +80 -0
  87. package/skills/roadmap/template.md +200 -0
  88. package/skills/setup-codeops/SKILL.md +94 -0
  89. package/skills/setup-codeops/migration.md +106 -0
  90. package/skills/setup-codeops/scaffold.md +99 -0
  91. package/skills/setup-routing/SKILL.md +102 -0
  92. package/skills/setup-routing/routing.md +44 -0
  93. package/skills/techdocs/SKILL.md +199 -0
  94. package/skills/techdocs/authoring-and-update.md +178 -0
  95. package/skills/techdocs/templates.md +655 -0
  96. package/skills/techdocs/vitepress-setup.md +143 -0
  97. package/skills/upgrade-plan/SKILL.md +75 -0
  98. package/skills/upgrade-plan/content-quality-gate.md +35 -0
  99. package/skills/upgrade-plan/upgrade-checklists.md +107 -0
  100. package/standards/coding-standards-full.md +124 -0
  101. package/standards/coding-standards.md +64 -0
  102. package/standards/output-style.md +17 -0
@@ -0,0 +1,143 @@
1
+ # techdocs — VitePress Setup (Phase 3)
2
+
3
+ > **CodeOps Artifact Schema**: 1
4
+
5
+ Scaffold VitePress for the `docs/` set: install it, generate the config, add npm scripts, and
6
+ ignore build output. Read this when first scaffolding the docs site, and whenever new pages are
7
+ added (the sidebar must stay in sync).
8
+
9
+ ## 1. Install VitePress
10
+
11
+ Install VitePress as a dev dependency using the project's package manager:
12
+
13
+ ```bash
14
+ # npm
15
+ npm install -D vitepress vitepress-plugin-mermaid mermaid
16
+
17
+ # yarn
18
+ yarn add -D vitepress vitepress-plugin-mermaid mermaid
19
+
20
+ # pnpm
21
+ pnpm add -D vitepress vitepress-plugin-mermaid mermaid
22
+ ```
23
+
24
+ > `vitepress-plugin-mermaid` is required for the architecture diagrams — vanilla VitePress does
25
+ > NOT render ```` ```mermaid ```` blocks. The config below must wrap `defineConfig` with
26
+ > `withMermaid` accordingly:
27
+ >
28
+ > ```typescript
29
+ > import { withMermaid } from 'vitepress-plugin-mermaid'
30
+ > export default withMermaid(defineConfig({ /* … */ }))
31
+ > ```
32
+
33
+ ## 2. Generate `.vitepress/config.ts`
34
+
35
+ Generate `docs/.vitepress/config.ts` based on the **actual** documentation structure.
36
+
37
+ ```typescript
38
+ import { defineConfig } from 'vitepress'
39
+
40
+ export default defineConfig({
41
+ title: '[Project Name] — Technical Documentation',
42
+ description: 'Architecture documentation for [Project Name]',
43
+
44
+ themeConfig: {
45
+ nav: [
46
+ { text: 'Architecture', link: '/architecture/system-overview' },
47
+ { text: 'Decisions', link: '/decisions/' },
48
+ { text: 'Guides', link: '/guides/getting-started' },
49
+ { text: 'Reference', link: '/reference/configuration' },
50
+ ],
51
+
52
+ sidebar: [
53
+ {
54
+ text: 'Overview',
55
+ items: [
56
+ { text: 'Introduction', link: '/' },
57
+ ],
58
+ },
59
+ {
60
+ text: 'Architecture',
61
+ items: [
62
+ { text: 'System Overview', link: '/architecture/system-overview' },
63
+ { text: 'Data Model', link: '/architecture/data-model' },
64
+ { text: 'API Design', link: '/architecture/api-design' },
65
+ { text: 'Infrastructure', link: '/architecture/infrastructure' },
66
+ { text: 'Security', link: '/architecture/security' },
67
+ ],
68
+ },
69
+ {
70
+ text: 'Decisions',
71
+ items: [
72
+ { text: 'Decision Log', link: '/decisions/' },
73
+ // Individual ADRs are listed here as they are created
74
+ ],
75
+ },
76
+ {
77
+ text: 'Developer Guides',
78
+ items: [
79
+ { text: 'Getting Started', link: '/guides/getting-started' },
80
+ { text: 'Development Workflow', link: '/guides/development' },
81
+ { text: 'Deployment', link: '/guides/deployment' },
82
+ ],
83
+ },
84
+ {
85
+ text: 'Reference',
86
+ items: [
87
+ { text: 'Configuration', link: '/reference/configuration' },
88
+ { text: 'Integrations', link: '/reference/integrations' },
89
+ ],
90
+ },
91
+ ],
92
+
93
+ socialLinks: [
94
+ // { icon: 'github', link: 'https://github.com/...' },
95
+ ],
96
+ },
97
+ })
98
+ ```
99
+
100
+ > **Rule:** The sidebar MUST only include sections that actually exist. Remove entries for any
101
+ > section skipped per the project-type adaptation table in SKILL.md.
102
+
103
+ ## 3. Add npm scripts
104
+
105
+ Add documentation scripts to the project's `package.json`:
106
+
107
+ ```json
108
+ {
109
+ "scripts": {
110
+ "docs:dev": "vitepress dev docs",
111
+ "docs:build": "vitepress build docs",
112
+ "docs:preview": "vitepress preview docs"
113
+ }
114
+ }
115
+ ```
116
+
117
+ ## 4. Update `.gitignore`
118
+
119
+ Add the VitePress build output to `.gitignore`:
120
+
121
+ ```
122
+ docs/.vitepress/dist
123
+ docs/.vitepress/cache
124
+ ```
125
+
126
+ ## Sidebar auto-update when pages are added
127
+
128
+ When new documentation pages are added (new ADRs, new architecture sections), update
129
+ `.vitepress/config.ts` so the new pages appear in the sidebar.
130
+
131
+ When a new ADR is created, add it under the Decisions section:
132
+
133
+ ```typescript
134
+ {
135
+ text: 'Decisions',
136
+ items: [
137
+ { text: 'Decision Log', link: '/decisions/' },
138
+ { text: 'ADR-001: [Title]', link: '/decisions/ADR-001-short-name' },
139
+ { text: 'ADR-002: [Title]', link: '/decisions/ADR-002-short-name' },
140
+ // New ADR added here
141
+ ],
142
+ }
143
+ ```
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: upgrade-plan
3
+ description: Upgrade an existing CodeOps requirements set, specification, plan, or project from a legacy artifact format to the current schema and quality standards. Use for upgrade my plan, upgrade requirements, migrate CodeOps artifacts, or bring project artifacts up to date. Assesses and previews changes, closes content ambiguities before structural migration, preserves user-authored semantics and progress, and verifies the result without advancing the roadmap.
4
+ ---
5
+
6
+ # Upgrade CodeOps artifacts
7
+
8
+ The current CodeOps artifact schema is `1`. Historical Claude CodeOps `3.x` stamps describe the producing skill release, not this schema. Treat them as legacy input requiring assessment, not as numeric predecessors of schema 1.
9
+
10
+ ## Scope
11
+
12
+ Upgrade content and structure in place. Layout moves belong to `setup-codeops`. Never combine a layout migration and semantic/schema upgrade into one irreversible operation.
13
+
14
+ Targets may be a requirements set, one feature plan, one feature, or the whole CodeOps project. Resolve flat/nested paths via [../../_shared/layout-convention.md](../../_shared/layout-convention.md).
15
+
16
+ ## Phase 1 — Read-only assessment
17
+
18
+ 1. Read every target artifact and its links.
19
+ 2. Detect `CodeOps Artifact Schema: 1`, legacy `CodeOps Skills Version`, partial migrations,
20
+ obsolete `traceability.json` files, missing RD-to-plan declarations, and contradictory stamps.
21
+ 3. Run current requirement, specification, plan, domain-lens, and content-quality checks.
22
+ 4. Inventory user-owned semantics, completed/in-progress task marks, custom notes, identifiers, and links that must survive byte-for-byte or meaning-for-meaning.
23
+ 5. Produce an upgrade report listing additions, structural changes, semantic gaps, preserved content, risks, and rollback/recovery method.
24
+
25
+ If current semantic gates pass, every plan declares its implemented RDs, and every execution plan
26
+ uses the four checklist markers, report no upgrade needed. Treat obsolete traceability files as
27
+ deletion candidates after confirming no external consumer depends on them; do not migrate their
28
+ graph state into a replacement platform.
29
+
30
+ For a whole nested `codeops/` project, preview the deterministic structural portion with:
31
+
32
+ ```bash
33
+ python3 "${CODEOPS_PLUGIN_ROOT}/scripts/codeops_plan_migrate.py" ./codeops
34
+ ```
35
+
36
+ If the preview has no `BLOCKED` entries and the user approves it, rerun with `--apply`. The
37
+ migrator never resolves content ambiguities: return blocked mappings or legacy blocker semantics
38
+ to this skill before applying.
39
+
40
+ ## Phase 2 — Approval and content-quality gate
41
+
42
+ Present the report before writing. The user may approve all, request details, narrow scope, or decline.
43
+
44
+ After approval, run [content-quality-gate.md](content-quality-gate.md). Structural modernization must not hide vague or contradictory content. Record every material gap as an ambiguity, resolve it explicitly, and update its authoritative owner before migration.
45
+
46
+ ## Phase 3 — Structural migration
47
+
48
+ Follow [upgrade-checklists.md](upgrade-checklists.md):
49
+
50
+ - add `> **CodeOps Artifact Schema**: 1` where artifact stamps belong;
51
+ - add or update each plan's single `> **Implements**:` declaration;
52
+ - preserve completed `[x]` and implemented `[~]` task states;
53
+ - convert a blocked legacy task to `[!]` with a short visible reason;
54
+ - preserve technical decisions, requirements, criteria, rationale, and notes;
55
+ - update renamed skill/project-guidance references;
56
+ - add missing ambiguity, domain, security, verification, and project-tracking sections; and
57
+ - never silently renumber identifiers that external artifacts reference.
58
+
59
+ Use small recoverable edits. Git history is the rollback and recovery mechanism.
60
+
61
+ ## Phase 4 — Verification
62
+
63
+ Run the plan parser and the project's verification commands:
64
+
65
+ ```bash
66
+ python3 "${CODEOPS_PLUGIN_ROOT}/scripts/codeops_plan.py" --root . --json
67
+ ```
68
+
69
+ Then verify document/task/requirement counts and user semantics are preserved; material
70
+ ambiguities are resolved or explicitly approved deferrals; tests precede implementation; no task
71
+ is marked `[x]` without passing verification; roadmap lifecycle state is unchanged except for
72
+ approved drift repair; and the Git diff contains only the approved migration.
73
+
74
+ Report old formats, new schema, files changed, ambiguities resolved, RD-to-plan coverage, preserved
75
+ progress, and residual risk. Do not auto-advance lifecycle stages.
@@ -0,0 +1,35 @@
1
+ # Phase 2B — Content Quality Gate (caller preamble, upgrade-plan)
2
+
3
+ > **CodeOps Artifact Schema**: 1
4
+
5
+ The Content Quality Gate IS the shared Zero-Ambiguity Gate, scoped to **existing documents**: the
6
+ gate itself is defined ONCE in **[../../_shared/zero-ambiguity-gate.md](../../_shared/zero-ambiguity-gate.md)**
7
+ — read it before running Phase 2B. This preamble binds it to upgrade-plan and adds the
8
+ upgrade-only scanning rules:
9
+
10
+ - **Phase**: 2B — Phase 3 (structural upgrades) is BLOCKED until it passes. While blocked:
11
+ no structural upgrades, no version-stamp updates, no document edits.
12
+ - **Scope**: scan ALL existing documents of the artifact being upgraded across the shared gate's
13
+ 12 categories, looking for content that predates the gate (vague decisions, unstated
14
+ assumptions, AI-guessed specifications). Upgrading format without fixing content produces a
15
+ polished but hollow artifact.
16
+ - **Register handling**: append to the artifact's existing register (continue numbering) or
17
+ create a fresh one if none exists; tag every upgrade-found entry `(upgrade)` in the Category
18
+ column. Record `Upgrade From:` / `Upgrade To:` in the register header.
19
+
20
+ ## Vague-language patterns to flag
21
+
22
+ ```
23
+ "TBD", "to be determined", "something like", "we could", "probably", "might", "maybe",
24
+ "a reasonable approach", "as needed", "if applicable", "similar to", "standard approach",
25
+ "best practices", "etc.", "and so on"
26
+ ```
27
+
28
+ **Materiality clause:** flag an instance only where the vagueness **hides a decision** — wording
29
+ whose resolution would change what gets built, tested, or secured. Non-normative prose (context,
30
+ examples, illustrative asides) is exempt. When unsure whether it hides a decision, flag it.
31
+
32
+ ## After the gate passes
33
+
34
+ Phase 3 applies structural upgrades AND writes every resolved content gap into the appropriate
35
+ document with an `AR #` back-reference, so document content and register stay linked.
@@ -0,0 +1,107 @@
1
+ # Phase 3 — Per-Document Re-evaluation Checklists (Reference)
2
+
3
+ The upgrade-plan skill links here. Use these checklists in Phase 3, after the Content Quality Gate
4
+ ([content-quality-gate.md](content-quality-gate.md)) has passed. Apply the **plan checklists** when
5
+ upgrading `plans/[feature-name]/`, and the **requirements checklists** when upgrading
6
+ `requirements/`.
7
+
8
+ For every document: re-evaluate against current standards (the make-plan skill's current standards
9
+ for plans; the make-requirements skill's current standards for requirements), add the version stamp
10
+ `> **CodeOps Artifact Schema**: 1` where stamps belong, and write in any content fixes resolved
11
+ during Phase 2B with an `AR #` back-reference. Always honor the Content Preservation Rules in
12
+ SKILL.md — never destroy user work.
13
+
14
+ ---
15
+
16
+ ## Plan upgrade — re-evaluation checklists
17
+
18
+ For a whole nested project, use `codeops_plan_migrate.py <codeops-dir>` to preview the mechanical
19
+ RD mapping and obsolete-graph deletion after these content checks pass. Apply only from a clean
20
+ Git tree and only when the preview has no blocked plan.
21
+
22
+ Re-evaluate each plan document against the make-plan skill's current standards.
23
+
24
+ ### `00-index.md`
25
+ - [ ] Version stamp present? → Add `> **CodeOps Artifact Schema**: 1` if missing.
26
+ - [ ] Follows the current index template structure?
27
+ - [ ] Navigation links to all plan documents?
28
+ - [ ] Document count and overview accurate?
29
+
30
+ ### `00-ambiguity-register.md`
31
+ - [ ] Exists? → If not, it was created during Phase 2B.
32
+ - [ ] All entries resolved with explicit user decisions?
33
+ - [ ] Upgrade entries tagged with `(upgrade)` in the Category column?
34
+ - [ ] `AR #` back-references added to all plan documents for resolved content gaps?
35
+
36
+ ### `01-requirements.md`
37
+ - [ ] Security requirements section present? (per your project's coding standards — AGENTS.md)
38
+ - [ ] Acceptance criteria for each requirement?
39
+ - [ ] Requirements numbered and categorized?
40
+ - [ ] All scope decisions have `AR #` back-references?
41
+ - [ ] No vague language remaining?
42
+
43
+ ### `02-current-state.md` (if it exists)
44
+ - [ ] Gap-analysis format follows the current template?
45
+
46
+ ### `03-XX` technical specification documents
47
+ - [ ] **Preserve user-authored technical decisions verbatim.**
48
+ - [ ] Add missing structural sections (e.g. error-handling table, testing requirements).
49
+ - [ ] Insert `AR #` back-references for content gaps resolved during Phase 2B.
50
+ - [ ] No vague language remaining?
51
+
52
+ ### `07-testing-strategy.md` (if it exists)
53
+ - [ ] Follows current testing standards — your project's testing standards (AGENTS.md)?
54
+ - [ ] Coverage-goals table present?
55
+ - [ ] Test categories clearly defined?
56
+
57
+ ### `99-execution-plan.md`
58
+ - [ ] Version stamp present? → Add `> **CodeOps Artifact Schema**: 1` if missing.
59
+ - [ ] Commit-mode flags documented? (`--ask-commit`, `--no-commit`, `--auto-commit`)
60
+ - [ ] Session protocol section present and current?
61
+ - [ ] Success criteria includes a post-completion re-analysis step?
62
+ - [ ] Success criteria includes a security-hardening check?
63
+ - [ ] Success criteria includes a dead-code check?
64
+ - [ ] Success criteria includes zero-ambiguity verification?
65
+ - [ ] Techdocs-update step present in success criteria (via the techdocs skill)?
66
+ - [ ] Dependencies section present?
67
+
68
+ ### Cross-references (all plan documents)
69
+ - [ ] References point to current skill/command names (make-plan skill, make-requirements skill,
70
+ techdocs skill, the `git-commit` skill commands, the project's AGENTS.md)?
71
+ - [ ] No references to deprecated or renamed rules / MCP calls?
72
+
73
+ ---
74
+
75
+ ## Requirements upgrade — re-evaluation checklists
76
+
77
+ Re-evaluate each requirements document against the make-requirements skill's current standards.
78
+
79
+ ### `00-ambiguity-register.md`
80
+ - [ ] Exists? → If not, it was created during Phase 2B.
81
+ - [ ] All entries resolved with explicit user decisions?
82
+ - [ ] Upgrade entries tagged with `(upgrade)` in the Category column?
83
+ - [ ] `AR #` back-references added to all RD documents for resolved content gaps?
84
+
85
+ ### `README.md`
86
+ - [ ] Version stamp present? → Add `> **CodeOps Artifact Schema**: 1` if missing.
87
+ - [ ] Follows the current README template?
88
+ - [ ] Dependency graph present and accurate?
89
+ - [ ] Domain glossary present and complete?
90
+ - [ ] Document index lists all RD documents?
91
+ - [ ] Ambiguity Register listed in the document index?
92
+
93
+ ### Individual RD documents (`RD-XXX-*.md`)
94
+ - [ ] Version stamp present? → Add `> **CodeOps Artifact Schema**: 1` if missing.
95
+ - [ ] Security considerations section present and complete? (per your project's coding standards — AGENTS.md)
96
+ - [ ] Acceptance criteria defined for each requirement?
97
+ - [ ] Dependencies on other RDs documented?
98
+ - [ ] Scope decisions have `AR #` back-references?
99
+ - [ ] Integration points section present?
100
+ - [ ] No vague language remaining?
101
+ - [ ] Priority and status fields present?
102
+ - [ ] Techdocs-update section present (via the techdocs skill)?
103
+
104
+ ### Cross-references (all requirements documents)
105
+ - [ ] References point to current skill/command names (make-requirements skill, make-plan skill,
106
+ techdocs skill, the `git-commit` skill commands, the project's AGENTS.md)?
107
+ - [ ] No references to deprecated or renamed rules / MCP calls?
@@ -0,0 +1,124 @@
1
+ # Coding standards (CodeOps) — FULL reference
2
+
3
+ > This is the complete standards text. The `SessionStart` hook injects only the compact core
4
+ > (`standards/coding-standards.md`); read THIS file before writing substantial code or tests,
5
+ > and whenever a core one-liner needs its full definition.
6
+
7
+ # Coding standards (CodeOps)
8
+
9
+ These apply to all code I write unless this project's `AGENTS.md` overrides a specific point.
10
+
11
+ ## Quality & structure
12
+ - **DRY.** Extract repeated logic, constants, and patterns; if similar code appears in more than one place, refactor it.
13
+ - **Clarity over cleverness.** Every line should be readable by a junior developer. Prefer explicit logic over "smart" one-liners.
14
+ - **Single responsibility** per function/class/module.
15
+ - **No dead code.** Remove unused imports, variables, parameters, functions, unreachable code, and commented-out blocks (use version control instead). For intentionally-unused required parameters, use the language's convention (e.g. `_param`). Lean on the language's unused-detection tooling.
16
+ - **Consistency is non-negotiable.** Follow the existing patterns, naming, and architecture of the file/codebase; don't introduce new styles without a strong reason.
17
+ - **If in doubt, be explicit** — more readable code and clearer structure beat fewer lines.
18
+
19
+ ## Documentation
20
+ - **NON-NEGOTIABLE — write for a junior developer.** Comment **why**, not just what — explain
21
+ complex logic, invariants, edge cases, and non-obvious decisions in a calm, teaching tone.
22
+ Anything above a junior developer's reading level gets a comment that walks through what is
23
+ happening without merely narrating the syntax.
24
+ - **NON-NEGOTIABLE — document the code's entities.** Every public, exported, or external-facing
25
+ class, interface, method, function, property, type, and constant gets a language-appropriate doc
26
+ comment (JSDoc, docstring, `///`, etc.). Document every non-trivial internal entity too. State
27
+ purpose, parameters, return value, thrown errors, side effects, and important invariants where
28
+ they apply. Genuinely self-evident private properties and trivial one-line helpers may be skipped;
29
+ blanket comments that only restate a name or type are noise, not clarity.
30
+ - Add **`@example`** (or the language equivalent) to public and external-facing API wherever practical — worked examples are the fastest way for both a developer and an AI tool to learn correct usage.
31
+ - **NON-NEGOTIABLE — never reference CodeOps planning artifacts in code.** No code comment or doc comment may point at `codeops/`, `plans/`, `requirements/`, an execution plan, or a plan / requirement / task / RD / AR identifier. Those files are ephemeral — regenerated by the planning skills, migrated between layouts, or deleted once a feature ships — so a reference into them is a dangling pointer and pure noise to a reviewer who never had that folder. **The code must be fully self-explanatory on its own.** When a comment needs the rationale a plan recorded, restate that rationale in plain language in the code; do not cite the plan. (This is about shipped source — commit / PR messages may still reference the plan, as that lives in durable git history, not the code a reviewer reads.)
32
+ - Doc comments carry **no change history, bug-fix notes, or "fixed in vX" annotations** — that belongs in the commit / PR body, where the developer and reviewer see it. A doc comment describes what the entity *is and does now*, not how it got there.
33
+
34
+ ## Architecture & boundaries
35
+ - **Split files before ~700 lines** or when they hold multiple concerns; aim for 200–500 lines per file (700 is the ceiling, not the goal). Use foundation-first layering with a single public entry point (`index`/`mod`/`__init__`).
36
+ - **Respect module/package boundaries** — import from public APIs, never reach into another module's internals.
37
+ - Keep imports at the top; separate type-only imports from value imports where supported; avoid deprecated import styles.
38
+ - Separate runtime dependencies from dev/build dependencies; keep the dependency surface minimal.
39
+
40
+ ## Type safety (statically-typed languages)
41
+ - Proper top-of-file imports for types — no inline `import(...)` type expressions.
42
+ - Use type guards / narrowing; **no unsafe casts** (`as any`, `as unknown`) to bypass the type system in production code.
43
+ - Provide all required fields when constructing typed objects; use enums/constants for discriminators, not bare string literals.
44
+
45
+ ## OOP (when the project uses classes)
46
+ - Prefer `public`/`protected` over `private` (unless `private` is idiomatic for the language and the project opts in). Treat `protected` as internal and document it.
47
+
48
+ ## Security — non-negotiable, from the first line of code
49
+ - **Validate and sanitize all input server-side** with allowlists; check types, ranges, lengths, formats at every entry point.
50
+ - **Prevent injection:** parameterized queries (never string-concatenate SQL/NoSQL), escape output / use framework auto-escaping (XSS), never pass unsanitized input to shells/`eval` (command injection), canonicalize and reject `..`/absolute paths (path traversal), anti-CSRF tokens + `SameSite` cookies, rate-limit auth endpoints.
51
+ - **Protect data:** TLS in transit; encrypt sensitive data at rest; hash passwords with `bcrypt`/`argon2`/`scrypt`; never hardcode secrets (use env vars / secret managers); never log secrets or PII; return minimal errors in production; restrictive CORS; request-size limits; audit dependencies; run containers as non-root from minimal images.
52
+
53
+ # Testing standards
54
+
55
+ - **Run the project's verify command (build + test) before completing any task or committing.** No code is "done" while any test fails.
56
+ - **Targeted vs. full:** iterate with targeted tests, but run the **full** verify before declaring completion.
57
+ - **Maximum, granular coverage:** happy path, edge/boundary cases, error/invalid inputs, and integration — each test focused on one thing with a clear failure message.
58
+ - **End-to-end tests** for complete workflows wherever feasible.
59
+ - **Prefer real objects over mocks.** Only mock true externals (DB, HTTP, filesystem) or not-yet-built implementations.
60
+ - **Split test files by concern** (~200–300 lines max): `[feature].[concern].test.[ext]`.
61
+ - **Specification vs. implementation tests (non-negotiable).** Keep them in separate files:
62
+ - *Specification tests* (`[feature].spec.test.[ext]`) derive expectations from requirements/acceptance criteria/API contracts — **never** from reading the implementation. They are immutable oracles: if a spec test fails after implementation, the **implementation** is wrong. Don't weaken or "fix" a spec test to match broken code without explicit approval. Each carries a traceability comment that states, in plain language, the behavior or acceptance criterion it verifies (e.g. `// password must be at least 8 characters`) — the requirement's *substance*, never a path or ID into `requirements/` (per the Documentation ban), so the oracle stays self-contained if the planning folder is ever removed.
63
+ - *Implementation tests* (`[feature].impl.test.[ext]`) cover internals, edge cases, and error paths.
64
+ - When planning with the CodeOps skills, this is enforced as: write spec tests → confirm they fail (red) → implement → make them pass (green) → add implementation tests → verify.
65
+ - **Security tests are mandatory** for input validation, authz, injection, and rate limiting.
66
+
67
+ # Working style
68
+ - **Ask before assuming.** When a request is ambiguous, ask clarifying questions and suggest improvements rather than guessing. (For deep, structured disambiguation, the `grill-me` skill exists.)
69
+ - **Minimum-sufficient design — do not overengineer.** Use the simplest implementation that fully
70
+ satisfies the authorized requirements and existing project conventions. Do not introduce new
71
+ abstractions, layers, dependencies, services, generalized frameworks, infrastructure, or
72
+ future-proofing unless authorized requirements, existing project conventions, or demonstrated
73
+ risks require them. Prefer modifying and reusing existing patterns. When multiple solutions are
74
+ correct, choose the smaller one. A proposed material support surface triggers the explicit
75
+ user-approval stop in `_shared/zero-ambiguity-gate.md`; `--auto-design` cannot approve it.
76
+ - **Verify previous work** before building on it; confirm a task actually meets its acceptance criteria before calling it done.
77
+ - **Grounded options & recommendations (NON-NEGOTIABLE).** Whenever you present options, choices, or recommendations — from analysis, defect/bug findings, a direction to fix a bug, requirements choices, plan-making, or plan execution:
78
+ 1. **Filter** — present only genuinely viable options; drop weakly-grounded options that realistically won't be chosen and never pad with strawmen. Present ≥2 options only when ≥2 are genuinely viable; when one path clearly dominates, present it alone, say it is the only viable one, and name what you rejected and why.
79
+ 2. **Second-guess** — critique and stress-test each surviving option *before* presenting it, not after.
80
+ 3. **Ground in the code** — for any option that involves modifying existing code, verify it against the actual current code (read the real files) before presenting and cite the evidence as `file:line`; if you could not verify, say so explicitly.
81
+ 4. **Recommend** — lead with your recommended option and a concrete, grounded reason. You recommend; the user decides — never decide for them.
82
+ - **Proportionality** — match the ceremony to the stakes. Trivial, easily-reversible, or obvious choices get a one-line recommendation; the full four-step treatment is for consequential or code-modifying decisions. Drowning the user in analysis wastes their time as surely as strawman options do.
83
+ - **Presentation** (consequential decisions) — lead with the recommendation, then each surviving option with its viability, terse pros/cons, and (for code-touching options) a `file:line` evidence cite; close with a one-line "considered and dropped: …" when you filtered options out.
84
+ - **Harden before presenting** (consequential decisions) — institutionalize the "are these your best?" challenge so it runs *before* you present and *converges* (never reflexive change under pressure): run the reframing prompts + the definition-of-done rubric, and close with a `Confidence:` / `Hardening:` disclosure. For **high-stakes** decisions (preflight CRITICAL/MAJOR findings, or complex/sensitive gate decisions) spawn one independent challenger and reconcile. Full protocol: `_shared/recommendation-hardening.md`.
85
+ - ✅ *"Recommend **A** — cache in the existing `UserRepo.find` (`repo/user.ts:42`), no new layer. **B** (new cache service) adds infra we don't need here. Dropped: client-side cache — can't share across requests."*
86
+ ❌ *"There are a few ways: A, B, or C — let me know which you prefer."* (no recommendation, no code grounding, options unfiltered)
87
+
88
+ # Validation for non-code artifacts
89
+
90
+ "Verify" is not only build+test. When a change touches non-code artifacts, run the matching
91
+ validation before calling it done:
92
+
93
+ | Artifact | Validation command |
94
+ | -------- | ------------------ |
95
+ | Dockerfile / Compose | `docker build .` / `docker compose config` |
96
+ | Shell scripts | `shellcheck <script>` (and `bash -n`) |
97
+ | Terraform | `terraform validate` (and `terraform plan` where safe) |
98
+ | Kubernetes manifests | `kubectl apply --dry-run=client -f <file>` |
99
+ | CI workflows | the CI linter (`actionlint`, `gitlab-ci-lint`, …) |
100
+ | JSON / YAML / TOML | a parser pass (`python3 -m json.tool`, `yq`, `taplo`) |
101
+ | SQL migrations | apply against a scratch database / the migration tool's dry-run |
102
+ | Nginx / infra configs | the tool's own check (`nginx -t`, etc.) |
103
+
104
+ # Coverage targets & test naming
105
+
106
+ | Code type | Coverage target |
107
+ | --------- | --------------- |
108
+ | Core business logic | 90% |
109
+ | Supporting modules / services | 80% |
110
+ | UI / glue / configuration | 60% |
111
+
112
+ Test names state behavior: `should [expected behavior] when [condition]`. Targets are defaults —
113
+ a project may adjust them explicitly in its requirements (an AR-referenced decision), never
114
+ silently.
115
+
116
+ # Security-test organization
117
+
118
+ Security tests live in their own tree, split by concern, so their absence is visible:
119
+
120
+ ```
121
+ tests/security/security.[concern].test.[ext]
122
+ e.g. security.input-validation.test.ts, security.authz.test.ts,
123
+ security.injection.test.ts, security.rate-limit.test.ts
124
+ ```
@@ -0,0 +1,64 @@
1
+ # Coding standards (CodeOps) — core
2
+
3
+ These apply to all code I write unless this project's `AGENTS.md` overrides a specific point.
4
+ This is the compact, always-injected core; the complete text lives in
5
+ `standards/coding-standards-full.md` — **read it before writing substantial code or tests.**
6
+ Do not duplicate these standards in `~/.config/opencode/AGENTS.md` — the plugin injects them.
7
+
8
+ ## Quality & structure
9
+ - **DRY**; **clarity over cleverness** (junior-readable); **single responsibility**; **no dead
10
+ code**; **consistency with the existing codebase is non-negotiable**; be explicit when in doubt.
11
+ - Split files before ~700 lines (aim for 200–500); respect module boundaries (import public APIs only); imports at
12
+ the top; keep the dependency surface minimal.
13
+ - **NON-NEGOTIABLE documentation:** write for a junior developer; explain complex logic,
14
+ invariants, edge cases, and non-obvious decisions in a calm teaching tone. Document every
15
+ public/exported class, interface, method, function, property, type, and constant, plus every
16
+ non-trivial internal entity, using the language's doc-comment format; add `@example` to public
17
+ APIs where practical. Do not pad trivial private code with comments that merely restate it.
18
+ Never reference `codeops/`/`plans/`/`requirements/`, an execution plan, or a plan/RD/AR/task ID
19
+ in code or doc comments; restate durable rationale in plain language. Full rules:
20
+ `coding-standards-full.md`.
21
+ - Statically-typed code: no unsafe casts (`as any`/`as unknown`); use type guards; enums/constants
22
+ for discriminators.
23
+
24
+ ## Security — non-negotiable, from the first line
25
+ - Validate and sanitize ALL input server-side (allowlists). Prevent injection: parameterized
26
+ queries, escaped output, no unsanitized shell/`eval`, canonicalized paths (reject `..`),
27
+ anti-CSRF + `SameSite`, rate-limited auth.
28
+ - Protect data: TLS in transit, encryption at rest, `bcrypt`/`argon2`/`scrypt` for passwords, no
29
+ hardcoded secrets, never log secrets/PII, minimal prod errors, restrictive CORS, non-root
30
+ containers.
31
+
32
+ # Testing standards
33
+ - **Run the project's verify command before completing any task or committing**; full verify
34
+ before declaring done. No code is "done" while any test fails.
35
+ - Granular coverage (happy path, edges, errors, integration); E2E where feasible; real objects
36
+ over mocks (mock only true externals); test files split by concern.
37
+ - **Specification vs. implementation tests (non-negotiable):** `[feature].spec.test.[ext]`
38
+ derives from requirements only — an immutable oracle (a failing spec test means the
39
+ implementation is wrong, never the test); `[feature].impl.test.[ext]` covers internals.
40
+ Order: spec tests → red → implement → green → impl tests → verify.
41
+ - Security tests are mandatory (input validation, authz, injection, rate limiting). Non-code
42
+ artifacts get validation too — see the full standards' validation-command table.
43
+
44
+ # Working style
45
+ - **Ask before assuming**; **verify previous work** before building on it.
46
+ - **Do not overengineer:** use the simplest implementation that fully satisfies the authorized
47
+ requirements and existing project conventions. Do not add abstractions, layers, dependencies,
48
+ services, generalized frameworks, infrastructure, or future-proofing unless authorized
49
+ requirements, existing project conventions, or demonstrated risks require them. Prefer modifying
50
+ and reusing existing patterns; when multiple solutions are correct, choose the smaller one. A
51
+ proposed material support surface triggers the explicit user-approval stop in
52
+ `_shared/zero-ambiguity-gate.md`; `--auto-design` cannot approve it.
53
+ - **Grounded options & recommendations (NON-NEGOTIABLE):** Filter (only genuinely viable options,
54
+ no strawmen; ≥2 only when ≥2 are viable) → Second-guess each → Ground in the code (cite
55
+ `file:line`; say so if unverified) → Recommend (lead with it and a concrete reason; you
56
+ recommend, the user decides). Proportionality: ceremony matches stakes. Harden consequential
57
+ recommendations per `_shared/recommendation-hardening.md` (high-stakes decisions get one
58
+ independent challenger; disclose `Confidence:`/`Hardening:` where that protocol requires).
59
+
60
+ > Project-specific commands, structure, and conventions live in this project's `AGENTS.md`
61
+ > (generate/refresh it with the `analyze-project` skill). Multi-step CodeOps workflows are available as
62
+ > skills: `make-plan`, `exec-plan`, `make-requirements`, `retro-requirements`, `grill-me`,
63
+ > `preflight`, `techdocs`, `roadmap`, `upgrade-plan`, `setup-codeops`, and `setup-routing`.
64
+ > Guarded commits, GitHub issues, comment cleanup, and outcome reviews are skills as well.
@@ -0,0 +1,17 @@
1
+ # Output style (CodeOps) — how to report back
2
+
3
+ - **Be short and prefer tabular form.** Findings, comparisons, status and file lists go in a table;
4
+ use prose only for reasoning a table can't carry. Never narrate work already visible in the
5
+ transcript, and never restate a result twice in different words.
6
+ - **Use plain international English in user-facing text.** Prefer short sentences and common words.
7
+ Put one main idea in each sentence. Define uncommon technical terms on first use. Avoid idioms,
8
+ dense clauses, cryptic grammar, and unclear pronouns. Preserve exact identifiers, commands, and
9
+ technical terms when precision requires them.
10
+ - **Match reasoning effort to stakes.** Use deeper reasoning for semantic, financial, security,
11
+ concurrency, migration, or architecture decisions; avoid interrupting the user merely to
12
+ narrate an internal effort choice.
13
+ - **Advise `/compact` at clean boundaries**, not mid-task: after a phase verifies, before
14
+ `preflight` or `make-plan`, and on a project switch. Say why now.
15
+ - **End with "Next steps"** wherever there is a next action — a small table of what to do and who
16
+ owns it. When the repo has a roadmap, precede it with a one-line progress count (done / total)
17
+ and a table of the remaining items, so the distance left to travel is always visible.