AgentMD - AI Agent Rules Library icon AgentMD - AI Agent Rules Library

Create better AI coding workflows with curated rule templates, framework-specific presets, and reusable standards for secure, testable, maintainable code.

Get access

OpenCode · JavaScript / TypeScript · Next.js · Popular baseline

Status: Published · Visibility: Public

Author

agent_rules_bot

Agent

OpenCode OpenCode

Language

JavaScript / TypeScript JavaScript / TypeScript

Framework

Next.js Next.js

Testing rules Security rules Prefer minimal diffs Code style rules Architecture rules Token saving rules
# OpenCode · JavaScript / TypeScript + Next.js  
Generated February 10, 2026  
Agent: OpenCode  
Language: JavaScript / TypeScript  
Framework: Next.js

## Global rules
- Start by reading existing project instructions and architecture docs before changing behavior.

- Prefer minimal diffs and preserve existing code style and naming conventions.

- State assumptions and call out risks before making breaking or cross-module changes.

- When behavior changes, add or update tests in the closest existing test layer.

- Never commit secrets, tokens, credentials, or generated private keys.

Start by reading existing project instructions and architecture docs before changing behavior.

Prefer minimal diffs and preserve existing code style and naming conventions.

State assumptions and call out risks before making breaking or cross-module changes.

When behavior changes, add or update tests in the closest existing test layer.

Never commit secrets, tokens, credentials, or generated private keys.

## Agent-specific
- Prioritize terminal-native workflows and reproducible command sequences.

- Explain intent before applying multi-file changes.

- Keep patches minimal and verify with focused checks.

## Language-specific
- Prefer TypeScript types/interfaces for public contracts.

- Keep functions pure when possible and isolate side effects.

- Avoid implicit any and unstable object shapes.

## Framework-specific
- Use App Router conventions and colocate route logic with pages.

- Keep server/client component boundaries explicit.

- Cache data fetches intentionally and invalidate with clear triggers.

## Options

### Token saving rules
- Reuse shared instruction snippets instead of restating long guidance.

- Avoid duplicating context already available in repository docs.

### Testing rules
- Require tests for changed behavior or document why tests were not added.

- Run the smallest relevant test subset first, then broaden if needed.

### Code style rules
- Follow existing formatter/linter configuration.

- Avoid style-only churn in unrelated files.

### Architecture rules
- Preserve module boundaries and avoid leaking internal abstractions.

- Prefer incremental refactors over large rewrites.

### Security rules
- Validate and sanitize all user-controlled input.

- Apply least-privilege defaults for data access and actions.

### Prefer minimal diffs
- Limit changes to the smallest set of files and lines needed.

- Defer unrelated cleanup to separate follow-up changes.
Back to public rule sets