todoist-cli
AGENTS.md316 starsChanged 8 months agoMITView on GitHub
For repo structure, where things live, and shared utilities, read CODEBASE.md first. This file covers the rules; CODEBASE.md is the map. TypeScript CLI for Todoist. Binary name: td. Two-tsconfig setup: tsconfig.json includes both source and test files — used by type-check and IDEs. tsconfig.build.json extends it but excludes colocated *.test.ts files plus src/test-support/ — used by build and dev to keep test-only code out of dist/. Run the CLI directly (no linking needed): Use this to verify changes work before…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository4 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- add-commandSkill
- add-commandSkill
- todoist-cliSkill
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
Use this to verify changes work before committing.
- Distinctive: line 45
When adding features, add corresponding tests.
- Very specific: line 61
Run npm run sync:skill to regenerate skills/todoist-cli/SKILL.md (builds automatically)
- Very specific: line 62
Run td skill update claude-code (and any other installed agents) to propagate changes to installed skill files
- Very specific: line 68
All add/create/update commands support --json to output the created or updated entity as machine-readable JSON instead of the default …
- Very specific: line 89
Delete, complete, uncomplete, archive, and unarchive commands do not support --json as they return no meaningful entity data.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Todoist CLI
For repo structure, where things live, and shared utilities, read CODEBASE.md first. This file covers the rules; CODEBASE.md is the map.
TypeScript CLI for Todoist. Binary name: td.
Build & Run
npm run build # compile TypeScript (uses tsconfig.build.json, excludes tests)
npm run dev # watch mode (uses tsconfig.build.json)
npm run type-check # type check source + tests (uses tsconfig.json)
npm run check # lint + format check
npm run fix # auto-fix lint + format
npm test # run testsTwo-tsconfig setup: tsconfig.json includes both source and test files — used by type-check and IDEs. tsconfig.build.json extends it but excludes colocated *.test.ts files plus src/test-support/ — used by build and dev to keep test-only code out of dist/.
Run the CLI directly (no linking needed):
node dist/index.js --help # show commands
node dist/index.js today # run 'today' command
node dist/index.js <command> ... # run any commandUse this to verify changes work before committing.
Rules when changing code
- Named flag aliases: where commands accept positional args for context (project, task, workspace), named flags (
--project,--task,--workspace) are also accepted. Error if both positional and flag are provided. - Implicit
viewsubcommand edge case:td project <ref>defaults totd project view <ref>. If a project/task name matches a subcommand name (e.g.,"list"), the subcommand wins — users must usetd project view list. - API response shape: client returns
{ results: T[], nextCursor? }— always destructure. - Priority mapping: CLI uses
"p1"–"p4"strings; API uses 4=p1 (highest), 1=p4 (lowest). UseparsePriorityfromsrc/lib/task-list.ts, never hand-roll. - Errors: throw
CliError(code, message, hints?)fromsrc/lib/errors.tsfor anything user-facing. The globalparseAsync().catchinsrc/index.tsrenders it correctly in JSON and pretty modes. The same handler also matchesBaseCliError(re-exported fromsrc/lib/errors.ts) so errors thrown by@doist/cli-corehelpers route through the same formatter.
Testing
Tests use vitest with mocked API. Run npm test before committing.
- Co-locate tests next to the command or lib module they cover.
- When adding features, add corresponding tests.
- See CODEBASE.md for the mock-api + fixtures setup.
Skill Content (Agent Command Reference)
The file src/lib/skills/content.ts exports SKILL_CONTENT — a comprehensive command reference that gets installed into AI agent skill directories via td skill install. This is the source of truth that agents use to understand available CLI commands.
Whenever commands, subcommands, flags, or options are added, updated, or removed in src/commands/, the SKILL_CONTENT in src/lib/skills/content.ts must be updated to match. This includes:
- Adding new commands or subcommands with usage examples
- Adding, removing, or renaming flags and options
- Updating the Quick Reference section when new top-level commands are introduced
- Keeping examples accurate and consistent with actual CLI behavior
After updating SKILL_CONTENT:
- Run
npm run sync:skillto regenerateskills/todoist-cli/SKILL.md(builds automatically) - Run
td skill update claude-code(and any other installed agents) to propagate changes to installed skill files
A CI check (npm run check:skill-sync) runs on pull requests and will fail if skills/todoist-cli/SKILL.md is out of sync with content.ts.
JSON Output for Mutating Commands
All add/create/update commands support --json to output the created or updated entity as machine-readable JSON instead of the default human-readable confirmation message. This applies to:
task add,task updateproject create,project updatecomment add,comment updatelabel create,label updatefilter createsection create,section updatereminder add
When adding new add/create/update commands, always include a --json flag that outputs the resulting entity using formatJson(result, entityType) from src/lib/output.ts. The pattern is:
const result = await api.addXxx(args)
if (options.json) {
console.log(formatJson(result, 'entityType'))
return
}
// normal human-readable outputDelete, complete, uncomplete, archive, and unarchive commands do not support --json as they return no meaningful entity data.
Keeping CODEBASE.md accurate
CODEBASE.md is a structural map, not a file index. Update it when structure changes — not on every new file. Triggers:
- new top-level dir under
src/, or a new command-group folder - a new broadly-reusable helper in
src/lib/(the "don't reimplement" catalog) - changes to command registration, auth/token storage, or build/test/release tooling
Adding a single subcommand to an existing group, or a narrowly-scoped helper used by one caller, does not require an update.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

