engineering-conventions

Enforces engineering invariants for plugin initialization, subprocesses, and test isolation in opencode-swarm.

Updated May 31, 2026
One-click install
npx skills add https://github.com/AlexanderNarbaev/agi --skill engineering-conventions-alexandernarbaev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: engineering-conventions
Source: https://github.com/AlexanderNarbaev/agi/tree/main/.opencode/skills/engineering-conventions
Command: npx skills add https://github.com/AlexanderNarbaev/agi --skill engineering-conventions-alexandernarbaev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Prevents recurring production regressions in the opencode-swarm repository by loading non-negotiable engineering invariants before modifying high-risk areas like plugin initialization, subprocess spawning, tool registration, and test mocking. ## Core Features & Use Cases - Invariant Enforcement: Summarizes the 12 invariants from AGENTS.md, highlighting the four that caused recent regressions (bounded fail-open plugin init, bounded killable subprocesses, Node-ESM runtime portability, and test mock isolation). - Init-Path Import Safety: Details how transitive import chains (e.g., the src/lang barrel loading web-tree-sitter WASM) violate init latency budgets, with a verification checklist including repro-704 timing and purity tests. - Tool Version Parity: Requires invoking pinned tool versions (e.g., bunx @biomejs/biome@<version>) so local validation matches CI gates. - Skill Mirror Contract: Explains identical/divergent/opencode-only mirror contracts between .opencode and .claude skill trees, verified with bun run drift:check. - Use Case: Before editing src/index.ts or src/hooks/*, load this skill to learn that every awaited init operation must be wrapped in withTimeout and degrade non-fatally, avoiding the silent plugin-drop failure from issue #704. ## Quick Start Load the engineering-conventions skill before modifying plugin initialization, subprocess, or test code and follow its invariant checklist.

Frequently Asked Questions about engineering-conventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I modify opencode-swarm plugin initialization safely?

Wrap every awaited operation on the plugin-init path in withTimeout and degrade non-fatally on timeout. The OpenCode plugin host silently drops a plugin whose entry never resolves, so unbounded awaits cause the 'no agents in TUI' failure from issue #704.

How should subprocesses be spawned in Bun plugin code?

Every bunSpawn call must pass cwd, stdin: 'ignore', a timeout in milliseconds, bounded stdio, and call proc.kill() in a finally block. An outer withTimeout alone lets the awaiter proceed but does not abort the child process.

Why does importing from src/lang break plugin startup?

The src/lang/index.ts barrel re-exports from ./runtime, which statically imports web-tree-sitter and loads heavy WASM at module-eval time. Import from src/lang/profiles instead, or use dynamic import() with the --external web-tree-sitter build flag.

How do I avoid mock.module leaks in Bun tests?

mock.module leaks across files in Bun's shared test-runner process. Prefer _test_exports for pure function testing, then _internals dependency-injection seams for within-module mocking, and use mock.module only when unavoidable with restoration in afterEach.

Why does biome pass locally but fail in CI?

Unversioned bunx biome resolves to whatever the registry returns at run time, which may differ from the pinned version in package.json. Invoke the pinned version explicitly, e.g. bunx @biomejs/biome@<version> ci ., to match the CI gate.

When should I not use the test_runner tool for repo validation?

The test_runner tool is for targeted validation with explicit files lists; MAX_SAFE_TEST_FILES is 50 and broader scopes can stall or kill OpenCode. For full repo validation, run the shell commands in contributing.md or TESTING.md directly.