RESOURCES / GUIDESJAVASCRIPT / TYPESCRIPT

StemCode for JavaScript and TypeScript Developers: AI Coding with Node.js, React, and Next.js.

Use StemCode with JavaScript, TypeScript, Node.js, React, Next.js, package managers, type checking, tests, linting, refactoring, and code review.

PUBLISHED 2026-10-01STEMCODE DEVELOPER GUIDELOCAL-FIRST AI CODING
PROJECT INSTRUCTIONS / AGENTS.MD

Give StemCode durable repository instructions before asking it to edit.

Add an AGENTS.md file at the repository root for persistent project instructions. StemCode loads AGENTS.md or .agent/AGENTS.md from the workspace into the model context, so this is the right place for architecture boundaries, generated-file rules, coding conventions, validation expectations, and manual setup notes that should apply across sessions.

Keep AGENTS.md practical and repository-specific

Prefer concrete rules the agent can act on: where important source lives, what it must not edit, which patterns it should preserve, and which checks it should run after a change.

# JavaScript / TypeScript Project Instructions

This is a JavaScript / TypeScript project.

Important source and configuration paths:
- package.json
- lockfiles
- src/
- app/
- pages/
- packages/
- tests/
- tsconfig*.json

Generated or disposable paths — do not modify:
- node_modules/
- .next/
- dist/
- build/
- coverage/
- .turbo/
- .cache/

Follow these rules:
- Use the package manager selected by the repository lockfile.
- Do not edit node_modules or framework build output.
- Respect TypeScript strictness and existing lint rules.
- Preserve server/client and package boundaries.
- Do not introduce a new state, validation, or HTTP library when the project already has one.
- Run focused type, lint, test, and build checks before finishing.

Validation:
- npm run typecheck
- npm run lint
- npm test
- npm run build

Commit the file with the project so the same instructions are reviewable and shared by everyone using StemCode in the repository.

01 / WHY STEMCODE

Use repository-aware AI without replacing the tools your stack already needs.

StemCode works best when it can understand the repository around a task, inspect related files, use code intelligence where available, run the project's normal validation commands, and review the final diff before you accept a change.

GOOD FIT FOR JAVASCRIPT / TYPESCRIPT WORK

JavaScript and TypeScript repositories using Node.js, React, Next.js, Express, NestJS, package workspaces, REST or GraphQL APIs, frontend tests, backend tests, linting, type checking, and normal Git workflows.

02 / SETUP

Install StemCode and open the project root.

Start StemCode from the package or monorepo root so package manifests, lockfiles, workspace configuration, source, tests, generated-code rules, and Git history are all available as repository context.

npmnpm install -g stemcode
pnpmpnpm add -g stemcode
cd your-project
stemcode
/init

Keep StemCode at the repository root so project instructions, source, configuration, tests, and Git history are visible from one workspace.

03 / PROJECT CONTEXT

Give the agent package boundaries, source, tests, and configuration—not dependency output.

Modern JavaScript repositories often combine applications, packages, generated output, caches, and framework build artifacts. Keep source and configuration visible while excluding dependencies and disposable build products.

INSPECT

Keep source-of-truth files visible.

package.json
lockfiles
src/
app/
pages/
packages/
tests/
tsconfig*.json
IGNORE

Skip generated or disposable output.

node_modules/
.next/
dist/
build/
coverage/
.turbo/
.cache/

Add generated paths to Git ignore rules or .stemcode/.stemcodeignore so repository search stays focused.

FIRST PROMPT

Understand the project before changing it.

Analyze this JavaScript/TypeScript repository. Map package boundaries, runtime entry points, React or framework routing, server/API layers, shared packages, data access, tests, scripts, and build tooling. Do not modify files yet.

04 / CODE INTELLIGENCE

Use TypeScript language intelligence and keep framework conventions in context.

The TypeScript language service provides strong definitions, references, diagnostics, and type information across JavaScript and TypeScript projects. Repository search is still needed for framework routing, configuration, environment variables, and generated conventions.

TYPESCRIPTEnsure TypeScript and your editor language service are available for the workspace
/lsp refresh
/lsp
Use both semantic navigation and repository search

When tracing a feature, include tsconfig boundaries, package exports, server/client boundaries, framework route conventions, environment configuration, and generated types. Type-correct code can still violate React rendering rules or Next.js server/client constraints.

05 / DEVELOPMENT WORKFLOW

Trace data flow across UI, server, packages, and configuration before editing.

Ask for end-to-end feature understanding first, then make small changes that preserve package boundaries, framework conventions, and the repository’s existing dependency choices.

NEXT.JS

Trace a route end to end

Trace this Next.js feature from route entry through server/client components, data loading, validation, API calls, caching, and tests. Identify server-only and client-only boundaries before editing.

REACT

Review component state

Review this React flow for unnecessary effects, stale state, rendering loops, unstable dependencies, accessibility regressions, and duplicated server state.

NODE.JS

Follow the backend path

Trace this request from the Node.js endpoint through validation, authorization, service logic, persistence, errors, and tests. Reuse existing middleware and error conventions.

MONOREPO

Protect package boundaries

Find every consumer of this shared package API and propose a migration that keeps packages buildable between steps before changing the exported type.

06 / BUILD AND TEST

Run the repository’s actual scripts for types, lint, tests, and builds.

Package.json scripts are usually the best source of truth. Prefer the project’s chosen package manager and existing scripts instead of substituting new tooling.

TYPECHECKnpm run typecheck
LINTnpm run lint
TESTnpm test
BUILDnpm run build

If the repository uses pnpm, Yarn, Bun, Nx, Turborepo, or another workspace runner, use its checked-in commands. Start with the affected package or test file, then widen validation after the focused checks pass.

Run the smallest relevant validation first. If it passes, run the broader project checks and review the final diff.
07 / PROJECT MEMORY

Keep longer-lived architecture context alongside your project instructions.

Use AGENTS.md for concise rules the agent should follow on every task. Keep longer architecture notes, domain context, and workflow references in repository-level StemCode memory so both stay reviewable and versionable.

Use the package manager selected by the repository lockfile.
Do not edit node_modules or framework build output.
Respect TypeScript strictness and existing lint rules.
Preserve server/client and package boundaries.
Do not introduce a new state, validation, or HTTP library when the project already has one.
Run focused type, lint, test, and build checks before finishing.
08 / REVIEW

Review the change in terms of your stack, not only the generated code.

Ask StemCode to inspect its own diff and check the integration points that are easiest to miss in a repository-wide change.

- TypeScript errors and unsafe widening
- server/client boundary mistakes
- React rendering and effect behavior
- API authorization and validation
- package export compatibility
- environment variable usage
- bundle or dependency growth
- tests, lint, and build results
09 / FAQ

Common setup questions.

Does this cover React and Next.js?

Yes. The guide treats them as framework layers on top of JavaScript/TypeScript and emphasizes route, rendering, server/client, data-flow, and build conventions.

Should StemCode install missing packages automatically?

Prefer existing dependencies first. Ask for a new package only when the task genuinely needs it, and review lockfile and bundle impact as part of the change.

What about monorepos?

Start at the workspace root, keep package manifests and workspace configuration visible, and validate the smallest affected package before running broader workspace checks.

NEXT STEP

Put StemCode to work in a real repository.

Install StemCode, open the project you already work in, and begin with a repository-understanding task before asking the agent to change code. That gives the model better context and keeps the workflow reviewable.

INSTALL

Start with the CLI.

npm install -g stemcode
cd your-project
stemcode
LEARN

Go deeper.

Read the full StemCode documentation for providers, permissions, LSP integrations, memory, MCP, CI review, and advanced workspace configuration.

READ THE DOCS →