Coding with AI tools

Stage 2 · Lesson 4 of 6

Rules that apply to some files

Setup and project context

Some guidance only matters for part of the codebase, such as "API handlers validate input with zod" or "tests use the factory helpers". Rather than loading it in every session, put it in a scoped rule that loads only when the tool works on matching files, described with a , a file pattern with wildcards that can match, say, every TypeScript file under src/api.

uses files in .claude/rules/ with a paths list in the . Cursor uses .mdc rules with globs. Copilot in uses .instructions.md files in .github/instructions/ with applyTo. Scoped rules keep the main file short and put guidance next to the code it governs.

Common trapa pattern that matches nothing, so the rule silently never loads; test it by asking the tool which rules it is following.

A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it

Resources for this stage

Start with

  • CourseFree
    Claude Code 101

    Anthropic · Beginner

    The installation, first prompt and CLAUDE.md lessons match this stage

Keep handy

  • The memory, settings and permissions pages cover every file named in this stage

  • The shared format your tool can read, with examples of what to put in it

Also worth your time

Mark this stage as not done?