Loading...
Loading...
Write effective AGENTS.md files that give coding agents the context they need to work in a repository. Use when creating a new AGENTS.md, improving an existing one, setting up a repo for AI coding agents, or onboarding agents to a codebase. Triggers on: "write AGENTS.md", "create AGENTS.md", "agent instructions", "set up repo for agents", "configure coding agent", "onboard agent to codebase", "agent context file".
npx skill4agent add caidanw/skills agents-md## Commands
- Install: `npm install`
- Dev server: `npm run dev`
- Test single file: `npx vitest run path/to/test.ts`
- Test all: `npm test`
- Lint: `npm run lint`
- Format: `npm run format`
- Type check: `npm run typecheck`## Repository Structure
- `src/api/` — HTTP API layer, routes and validation
- `src/store/` — Database access, all SQL lives here
- `src/worker/` — Background job processing
- `src/types/` — Shared domain types
- `tests/` — Test files mirror source structure
- `docs/` — Architecture and design documentationarchitecture-md## Architecture Boundaries
- API layer never accesses the database directly — always goes through `src/store/`
- `src/types/` has zero dependencies on other source modules
- Workers communicate via the store interface, never import API code
- No circular dependencies between top-level modules## Coding Standards
- Strict TypeScript — no `any`, no `as` casts except in test files
- Errors: use `Result<T, E>` pattern from `src/types/result.ts`, not thrown exceptions
- Logging: always use structured logger from `src/logger.ts`, never `console.log`
- Naming: database columns are snake_case, TypeScript properties are camelCase## Testing
- Tests live next to source: `src/foo.ts` -> `src/foo.test.ts`
- Use `describe`/`it` blocks, not `test()`
- Mock external services, never hit real APIs in tests
- New features require tests — cover success, failure, and edge cases
- Run relevant tests before submitting: `npx vitest run src/path/`## Commits & PRs
- Conventional commits: `feat:`, `fix:`, `refactor:`, `test:`, `docs:`
- PR title format: `type(scope): description`
- Run `npm run lint && npm test` before committing
- Keep PRs focused — one logical change per PR## Boundaries
- **Never:** commit secrets, credentials, or tokens
- **Never:** use destructive git operations (force push, hard reset) without asking
- **Never:** edit generated files by hand when a generation workflow exists
- **Ask first:** large cross-module refactors, new dependencies, migration changes## References
- Architecture: see `ARCHITECTURE.md`
- API docs: see `docs/api-reference.md`
- Design decisions: see `docs/design-docs/`
- Deployment: see `docs/deployment.md`AGENTS.md # global: commit conventions, CI, shared tooling
packages/api/AGENTS.md # API-specific: routes, middleware, auth patterns
packages/worker/AGENTS.md # worker-specific: job patterns, retry behavior
packages/shared/AGENTS.md # shared lib: no side effects, pure functions onlyeslint