agentleFS
theyoungastronautstheyoungastronauts/polaris/skills/intel/SKILL.md

intel

Skill4 starsChanged 3 months agoMITView on GitHub

Generate or refresh the project context scaffold in .claude/context/ (architecture, decisions, conventions, patterns).

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

31 rules. About 0 are common, 14 are distinctive, and 17 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 17

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After major refactors, dependency upgrades, or architectural shifts

    line 16
  2. Distinctive:

    When onboarding a new stack or sub-project

    line 18
  3. Distinctive:

    Do NOT use for: small bug fixes, routine feature work where context files already exist and are current.

    line 20
  4. Very specific:

    Check the state of .claude/context/:

    line 26
  5. Very specific:

    If user passed --full → Full Refresh mode

    line 31
  6. Very specific:

    Backwards compatibility: If .claude/architecture.md exists but .claude/context/ does not, treat as First Run mode.

    line 34
  7. Very specific:

    Run axon_list_repos to check if the current repo is indexed.

    line 38
  8. Very specific:

    Read package manifests (requirements.txt, package.json, pubspec.yaml, go.mod) for stack and decision data

    line 51
  9. Distinctive:

    Read CLAUDE.md and any existing project documentation for documented conventions

    line 54
  10. Distinctive:

    Read package manifests to identify stack and key dependencies

    line 55
  11. Distinctive:

    Read entry point files to understand the top-level structure

    line 57
  12. Distinctive:

    Read 2-3 representative examples of each discovered pattern

    line 59
  13. Very specific:

    Run git log --since="[last-updated-date]" --stat --pretty=format:"%H %s" to identify what changed

    line 63
  14. Very specific:

    If Axon available, run axon_detect_changes on the range for structural impact

    line 64
  15. Very specific:

    When a recurring structural pattern is discovered, create a pattern file following the format in patterns/README.md.

    line 106
  16. Very specific:

    Create architecture.md with extracted Stack, Architecture Overview, Constraints, Key Entry Points

    line 122
  17. Very specific:

    Create any patterns/*.md files for significant patterns discovered

    line 125
  18. Very specific:

    Write .claude/architecture.md as a slimmed summary — same Stack/Overview/Constraints/Entry Points sections plus a pointer to context/ — …

    line 128
  19. Very specific:

    Read all existing context files in .claude/context/

    line 139
  20. Distinctive:

    Update only the files identified in Step 3 as affected by recent changes

    line 140
  21. Distinctive:

    Do NOT rewrite files whose underlying code hasn't changed

    line 141
  22. Very specific:

    NEVER modify ## Manual Notes sections or anything below them

    line 142
  23. Very specific:

    If a new pattern is discovered, create a new patterns/*.md file and regenerate ROUTER.md

    line 143
  24. Very specific:

    Update Last updated dates only on files that were modified

    line 144
  25. Very specific:

    Update .claude/architecture.md if the architecture summary changed

    line 145
  26. Distinctive:

    After writing or updating context files, rebuild ROUTER.md:

    line 149
  27. Very specific:

    Read the current ROUTER.md (or use the template for first run)

    line 151
  28. Distinctive:

    Update the Context Files table:

    line 152
  29. Distinctive:

    Update the Task Routing table if new pattern files warrant specific routing (e.g., a "Testing Pattern" file should be listed under …

    line 156
  30. Distinctive:

    Keep ROUTER.md under 50 lines — it's a dispatch table, not a knowledge base

    line 157
  31. Distinctive:

    After writing/updating the files:

    line 161

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: Architecture Intel

Overview

Extract and maintain a persistent architectural context scaffold in .claude/context/. Eliminates cold-start context loss across sessions by documenting stack, decisions, patterns, constraints, and conventions — each in its own file so agents load only what's relevant per task.

For backwards compatibility, .claude/architecture.md is maintained as a slimmed summary pointing to the full scaffold.

When to Use

  • First session on a new-to-you project
  • After major refactors, dependency upgrades, or architectural shifts
  • Periodically (every few weeks) to keep context files current
  • When onboarding a new stack or sub-project

Do NOT use for: small bug fixes, routine feature work where context files already exist and are current.

Process

Step 1: Detect Mode

Check the state of .claude/context/:

  • .claude/context/ROUTER.md does not exist → First Run mode (full analysis, generate entire scaffold)
  • ROUTER.md exists but is still an unfilled template → also First Run mode. The installer pre-seeds .claude/context/ with blank templates, so existence alone doesn't mean the scaffold is populated. Telltales: the Last updated header comment still reads YYYY-MM-DD, or the Context Files table shows Status "Template" for every file.
  • ROUTER.md is populated → read the Last updated date from each context file's header comment
    • If user passed --full → Full Refresh mode
    • Otherwise → Incremental mode

Backwards compatibility: If .claude/architecture.md exists but .claude/context/ does not, treat as First Run mode. The monolithic file will be preserved as a reference during migration.

Step 2: Check Axon Availability

Run axon_list_repos to check if the current repo is indexed.

  • Axon available → use the Axon analysis path (faster, more structural)
  • Axon unavailable → use the file-read analysis path (still effective, just more manual)

Inform the user which path you're taking.

Step 3: Analyze the Codebase

With Axon:

  1. axon_query with broad concept terms — "authentication", "error handling", "data models", "routing", "middleware" — to identify the major patterns in use
  2. axon_context on key entry points (main URL conf, root app component, main router, etc.) to map the layer structure
  3. axon_cypher for structural queries when needed — find all classes following a pattern, identify service layers, locate middleware chains
  4. Read package manifests (requirements.txt, package.json, pubspec.yaml, go.mod) for stack and decision data

Without Axon:

  1. Read CLAUDE.md and any existing project documentation for documented conventions
  2. Read package manifests to identify stack and key dependencies
  3. Identify entry points — glob for urls.py, app/layout.tsx, main.dart, main.go, index.ts, etc.
  4. Read entry point files to understand the top-level structure
  5. Glob for structural patterns: **/services.py, **/repositories.py, **/middleware.*, **/serializers.py, **/hooks/use*.ts
  6. Read 2-3 representative examples of each discovered pattern
  7. Infer decisions from dependency choices and configuration files

Incremental mode — both paths:

  1. Run git log --since="[last-updated-date]" --stat --pretty=format:"%H %s" to identify what changed
  2. If Axon available, run axon_detect_changes on the range for structural impact
  3. Classify changed files to determine which context files need updating:
    • Config/manifest changes → architecture.md + decisions.md
    • New directories or apps → architecture.md + conventions.md
    • New service/pattern files → suggest adding a pattern to patterns/
    • New middleware, validators, exception handlers → architecture.md (constraints) + suggest pattern
    • Dependency additions/removals → decisions.md
  4. Re-analyze only the code relevant to affected files
  5. Skip context files whose underlying code did not change

Step 4: Extract Architecture

For each category, extract concrete, specific findings — not generic descriptions. Every bullet should be grounded in what the code actually does.

For architecture.md (.claude/context/architecture.md):

CategoryWhat to captureExample
StackTechnology, version, directoryDjango 5.2 + DRF (server/)
Architecture OverviewLayer map, boundaries, data flow"Three-layer: views → services → models. All external API calls isolated in clients/"
ConstraintsNon-negotiable rules"All list endpoints paginated (PageNumberPagination, default 20)"
Key Entry Points3-5 files to understand firstserver/config/urls.py, web/app/layout.tsx

For decisions.md (.claude/context/decisions.md):

What to captureExample
Technology/pattern choice + rationale + date"JWT over sessions: stateless auth for mobile client support"
Status: Active or SupersededIf superseded, link to the replacement decision

For conventions.md (.claude/context/conventions.md):

CategoryWhat to captureExample
NamingNaming conventions with examples"Tests: apps/[domain]/tests/test_[module].py"
File OrganizationDirectory structure rules"One service file per Django app"
Error HandlingError handling norms"All API errors go through custom exception handler"
TestingTesting conventions"Integration tests use factory_boy, unit tests use mocks"
Project-Specific RulesAnything else specific to this project"Never import from another app's models directly"

For patterns/ (.claude/context/patterns/):

When a recurring structural pattern is discovered, create a pattern file following the format in patterns/README.md. Only create pattern files for significant, reusable patterns — not every code convention.

Multi-stack projects: Detect multiple sub-projects (look for multiple package manifests at different directory levels, or sub-project directories in CLAUDE.md). Keep Decisions flat (project-wide). Give Conventions and Patterns per-stack subsections:

## Naming
### Backend (server/)
- ...
### Frontend (web/)
- ...

Step 5: Write or Update Context Files

First Run:

  1. Ensure the .claude/context/ structure exists. The installer usually pre-seeds it with blank templates (ROUTER.md, decisions.md, conventions.md, patterns/README.md) — fill those in place. If a file is missing, create it using the formats in Step 4 with a <!-- Generated by /intel. Last updated: YYYY-MM-DD --> header comment and a ## Manual Notes section at the bottom.
    • Create architecture.md with extracted Stack, Architecture Overview, Constraints, Key Entry Points
    • Fill decisions.md with extracted decisions (replace placeholder entries)
    • Fill conventions.md with extracted conventions by category
    • Create any patterns/*.md files for significant patterns discovered
  2. Set the Last updated date to today in each file's header comment
  3. Generate ROUTER.md (see Step 5b)
  4. Write .claude/architecture.md as a slimmed summary — same Stack/Overview/Constraints/Entry Points sections plus a pointer to context/ — this maintains backwards compatibility

Full Refresh (--full):

  1. Re-analyze the entire codebase (same as First Run analysis)
  2. Rewrite all context files with fresh findings
  3. Preserve the ## Manual Notes section and everything below it in each file that has one
  4. Regenerate ROUTER.md (see Step 5b)
  5. Update .claude/architecture.md summary
  6. Update Last updated dates

Incremental:

  1. Read all existing context files in .claude/context/
  2. Update only the files identified in Step 3 as affected by recent changes
  3. Do NOT rewrite files whose underlying code hasn't changed
  4. NEVER modify ## Manual Notes sections or anything below them
  5. If a new pattern is discovered, create a new patterns/*.md file and regenerate ROUTER.md
  6. Update Last updated dates only on files that were modified
  7. Update .claude/architecture.md if the architecture summary changed

Step 5b: Generate ROUTER.md

After writing or updating context files, rebuild ROUTER.md:

  1. Read the current ROUTER.md (or use the template for first run)
  2. Update the Context Files table:
    • List every file in .claude/context/ (except ROUTER.md itself)
    • List every patterns/*.md file individually
    • Set Status to "Populated" for files with content, "Template" for empty ones
  3. Update the Task Routing table if new pattern files warrant specific routing (e.g., a "Testing Pattern" file should be listed under Debugging/Fixing tasks)
  4. Keep ROUTER.md under 50 lines — it's a dispatch table, not a knowledge base

Step 6: Wrap Up

After writing/updating the files:

  1. Summarize what was found or changed, listing which context files were created/updated
  2. Note if anything looks unusual or worth the user's attention
  3. Mention the drift detector: "You can check recent changes against these conventions by loading agents/drift-detector.md as a subagent."
  4. Mention memory commands: "Use /remember to capture additional decisions, conventions, or patterns. Use /recall at the start of future sessions to load relevant context."

Quick Reference

ModeTriggerScopeManual Notes
First RunScaffold missing, or only unfilled templatesFull analysis, all context filesN/A
IncrementalContext exists (default)Changed files onlyPreserved
Full RefreshUser passes --fullFull re-analysis, all filesPreserved
Axon AvailableAnalysis Approach
Yesaxon_query → axon_context → axon_cypher + manifest reads
NoEntry point reads → glob for patterns → representative file reads
Context FileContainsSize Target
architecture.mdStack, overview, constraints, entry pointsUnder 80 lines
decisions.mdLightweight ADRs with rationaleUnder 60 lines
conventions.mdNaming, file org, error handling, testing normsUnder 60 lines
patterns/*.mdOne file per significant reusable patternUnder 40 lines each
ROUTER.mdNavigation hub — dispatch tableUnder 50 lines

Total token budget: The scaffold should be smaller in aggregate than the old monolithic architecture.md when only relevant files are loaded per task. ROUTER.md + one context file should be under 100 lines.

Common Mistakes

  • Overwriting Manual Notes — never modify content after the ## Manual Notes heading in any context file
  • Rewriting unchanged files — in incremental mode, only touch files affected by recent changes
  • Generic descriptions — "uses a service layer" is useless. "Business logic in apps/*/services.py, views call service functions, never access ORM directly" is useful
  • Too long — if any single context file exceeds its size target, trim aggressively. The point of the scaffold is to load less, not more
  • Missing rationale in Decisions — "uses JWT" isn't a decision. "JWT over sessions: needed stateless auth for mobile clients" is
  • Forgetting backwards compat — always update .claude/architecture.md alongside the scaffold so projects that haven't migrated still get a useful summary
  • Bloated ROUTER.md — the router is a dispatch table. If it exceeds 50 lines, you're putting content in it that belongs in the context files

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.