Imported from danwald/cc (
AGENTS.md). Install upstream withnpx skills add danwald/cc. Copyright stays with the author.
Golden rule: When unsure about implementation details or requirements, ALWAYS consult the developer rather than making assumptions.
Non-negotiable golden rules
| #: | AI may do | AI must NOT do |
|---|---|---|
| G-0 | Whenever unsure about something that's related to the project, ask the developer for clarification before making changes. | ❌ Write changes or use tools when you are not sure about something project specific, or if you don't have context for a particular feature/decision. |
| G-1 | Generate code and tests inside relevant source and test directories | ❌ Modify SPEC.md without explicit approval (humans own product specs). |
| G-2 | Add/update AIDEV-NOTE: anchor comments near non-trivial edited code. |
❌ Delete or mangle existing AIDEV- comments. |
| G-3 | Follow lint/style configs (pyproject.toml, .ruff.toml, .pre-commit-config.yaml). Use the project's configured linter, if available, instead of manually re-formatting code. |
❌ Re-format code to any other style. |
| G-4 | For changes >300 LOC or >3 files, ask for confirmation. | ❌ Refactor large modules without human guidance. |
| G-5 | Stay within the current task context. Inform the dev if it'd be better to start afresh. | ❌ Continue work from a prior prompt after "new task" – start a fresh session. |
Project setup & coding standards
Python and TypeScript/frontend conventions, tooling, and commands are documented in ~/.claude/skills/setup-project/references/:
- Python — uv, ruff, mypy, pytest, Ward, error handling, agents-api expressions
- TypeScript / Frontend — Node.js, ESLint, Prettier, Vitest, Next.js/React patterns
- Common patterns — git, CI/CD, versioning, environment variables, security
Claude Code users can also pull these in via the setup-project skill; other harnesses should read the files at that path directly.
Anchor comments
Add specially formatted comments throughout the codebase, where appropriate, for yourself as inline knowledge that can be easily grepped for.
Guidelines
- Use
AIDEV-NOTE:,AIDEV-TODO:, orAIDEV-QUESTION:(all-caps prefix) for comments aimed at AI and developers. - Keep them concise (≤ 120 chars).
- Important: Before scanning files, always first try to locate existing anchors
AIDEV-*in relevant subdirectories. - Update relevant anchors when modifying associated code.
- Do not remove
AIDEV-NOTEs without explicit human instruction. - Make sure to add relevant anchor comments, whenever a file or piece of code is:
- too long, or
- too complex, or
- very important, or
- confusing, or
- could have a bug unrelated to the task you are currently working on.
Example:
# AIDEV-NOTE: perf-hot-path; avoid extra allocations (see ADR-24)
async def render_feed(...):
...
Commit discipline
- Granular commits: One logical change per commit.
- Tag AI-generated commits: e.g.,
feat: optimise feed query [AI]. - Clear commit messages: Explain the why; link to issues/ADRs if architectural.
- Default to a
git worktreefor AI-driven changes rather than working directly on the checked-out branch (e.g.,git worktree add ../wip-foo -b wip-foo). Skip this only for trivial, single-line fixes applied at the user's explicit request. - Review AI-generated code: Never merge code you don't understand.
- Make atomic commits for each change to code where atomic commits are one commit per logical change, no more, no less and each commit should be a self-contained unit that could be reverted independently without breaking anything else.
Directory-Specific AGENTS.md Files
- Always check for
AGENTS.mdfiles in specific directories before working on code within them. These files contain targeted context. - If a directory's
AGENTS.mdis outdated or incorrect, update it. - If you make significant changes to a directory's structure, patterns, or critical implementation details, document these in its
AGENTS.md. - If a directory lacks a
AGENTS.mdbut contains complex logic or patterns worth documenting for AI/humans, suggest creating one.
Common pitfalls
- Large AI refactors in a single commit (makes
git bisectdifficult). - Fully delegating test or spec authorship to AI without human review (can lead to false confidence).
Language-specific pitfalls (wrong CWD, src/ layout, pytest vs ward syntax, etc.) are documented in the setup-project skill references.
Meta: Guidelines for updating AGENTS.md files
Elements that would be helpful to add
- Decision flowchart: A simple decision tree for "when to use X vs Y" for key architectural choices would guide my recommendations.
- Reference links: Links to key files or implementation examples that demonstrate best practices.
- Domain-specific terminology: A small glossary of project-specific terms would help me understand domain language correctly.
- Versioning conventions: How the project handles versioning, both for APIs and internal components.
Format preferences
- Consistent syntax highlighting: Ensure all code blocks have proper language tags (
python,bash, etc.). - Hierarchical organization: Consider using hierarchical numbering for subsections to make referencing easier.
- Tabular format for key facts: The tables are very helpful - more structured data in tabular format would be valuable.
- Keywords or tags: Adding semantic markers (like
#performanceor#security) to certain sections would help me quickly locate relevant guidance.
AI Assistant Workflow: Step-by-Step Methodology
When responding to user instructions, the AI assistant (Claude, Cursor, GPT, etc.) should follow this process to ensure clarity, correctness, and maintainability:
- Consult Relevant Guidance: When the user gives an instruction, consult the relevant instructions from
AGENTS.mdfiles (both root and directory-specific) for the request. - Clarify Ambiguities: Based on what you could gather, see if there's any need for clarifications. If so, ask the user targeted questions before proceeding.
- Break Down & Plan: Break down the task at hand and chalk out a rough plan for carrying it out, referencing project conventions and best practices.
- Trivial Tasks: If the plan/request is trivial, go ahead and get started immediately.
- Non-Trivial Tasks: Otherwise, present the plan to the user for review and iterate based on their feedback.
- Track Progress: Use a to-do list (internally, or optionally in a
TODOS.mdfile) to keep track of your progress on multi-step or complex tasks. - If Stuck, Re-plan: If you get stuck or blocked, return to step 3 to re-evaluate and adjust your plan.
- Update Documentation: Once the user's request is fulfilled, update relevant anchor comments (
AIDEV-NOTE, etc.) andAGENTS.mdfiles in the files and directories you touched. - User Review: After completing the task, ask the user to review what you've done, and repeat the process as needed.
- Session Boundaries: If the user's request isn't directly related to the current context and can be safely started in a fresh session, suggest starting from scratch to avoid context confusion.
See also: RTK.md for additional repo-specific reference material, if present.