aspens
Copilot instructions101 starsChanged 7 months agoMITView on GitHub
aspens is a CLI tool that generates and maintains AI-ready documentation (skills and guidelines) for any codebase. It scans a repo's tech stack, then uses Claude to produce structured markdown "skill files" that Claude Code loads automatically when working in that codebase. No build step. No test runner configured yet — tests/ is empty.
- Installs packages
In this repository27 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-customizationSkill
- architectureSkill
- baseSkill
- claude-runnerSkill
- cli-shellSkill
- codex-supportSkill
- doc-impactSkill
- doc-syncSkill
- import-graphSkill
- repo-scanningSkill
- save-tokensSkill
- skill-generationSkill
- template-librarySkill
- agent-customizationSkill
- baseSkill
- claude-runnerSkill
- cli-shellSkill
- codex-supportSkill
- doc-impactSkill
- doc-syncSkill
- import-graphSkill
- repo-scanningSkill
- save-tokensSkill
- skill-generationSkill
- template-librarySkill
The file
We split this copilot-instructions.md into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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
- Very specific: line 22
No build step. No test runner configured yet — tests/ is empty.
- Very specific: line 60
Check prerequisites (git repo, .claude/skills/ exists)
- Distinctive: line 65
Write updated files (force mode — sync is meant to be automated)
- Very specific: line 73
Always resolve to absolute paths with path.resolve() / path.join().
- Very specific: line 85
Use @clack/prompts for all user-facing interaction (spinners, confirms, selects, multiselects).
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions 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
Copilot Instructions
What This Project Does
aspens is a CLI tool that generates and maintains AI-ready documentation (skills and guidelines) for any codebase. It scans a repo's tech stack, then uses Claude to produce structured markdown "skill files" that Claude Code loads automatically when working in that codebase.
aspens scan # detect tech stack (current dir)
aspens doc init --dry-run # preview generated skills
aspens doc init --mode chunked # generate one domain at a time
aspens doc sync --commits 3 # update skills from last 3 commits
aspens doc sync --install-hook # auto-sync on every commitProject Setup
npm install # installs commander, @clack/prompts, picocolors
npm link # makes `aspens` available globally for testingNo build step. No test runner configured yet — tests/ is empty.
Architecture
bin/cli.js # entrypoint — welcome screen + subcommands via commander
src/
index.js # barrel exports
commands/
scan.js # pretty/JSON output of scanner results
doc-init.js # full pipeline: scan → mode select → Claude → write
doc-sync.js # diff-based skill updates + git hook installer
add.js # placeholder (Phase 4)
lib/
scanner.js # deterministic tech stack detection (no LLM)
context-builder.js # assembles repo context (used by doc-sync, available for API mode)
runner.js # wraps `claude -p` CLI; prompt loading; output parsing; path sanitization
skill-writer.js # writes parsed {path, content} files to disk
prompts/
doc-init.md # all-at-once init prompt (tool-first: "read before writing")
doc-init-domain.md # single domain skill prompt (for chunked mode)
doc-init-claudemd.md # CLAUDE.md generation prompt
doc-sync.md # sync prompt (diff → skill updates)
partials/ # skill-format.md, guideline-format.md, examples.mddoc init Pipeline
scanRepo()— detect languages, frameworks, structure, domains, entry points- User picks mode: all-at-once / chunked / pick domains / base-only
- User picks strategy for existing docs: improve / rewrite / skip
loadPrompt()— resolve{{partial-name}}and{{varName}}in the templaterunClaude()— spawnclaude -pwith--allowedTools Read,Glob,Grep— Claude explores the repo itselfparseFileOutput()— extract<file path="...">content</file>blocks from Claude's responsewriteSkillFiles()— mkdir + write, respecting--force/--dry-run
doc sync Pipeline
- Check prerequisites (git repo, .claude/skills/ exists)
- Get git diff for last N commits
- Map changed files → affected skills (via activation pattern matching, generic segments filtered)
- Send diff + existing skills to Claude with Read/Glob/Grep tools
- Claude updates only affected skills, outputs nothing if no changes needed
- Write updated files (force mode — sync is meant to be automated)
Key Conventions
ES Modules
The project uses "type": "module" — all files use import/export, no require().
Path Handling
Always resolve to absolute paths with path.resolve() / path.join(). Use path.relative() for display and stored paths. Never pass raw user-provided paths without resolving first.
Output Parsing
Claude emits files as <file path="...">content</file>. parseFileOutput() handles this (primary) and an HTML comment fallback. Paths are validated by sanitizePath(): no .., no leading /, must be exactly CLAUDE.md or start with .claude/.
Prompt Templates
Templates live in src/prompts/. {{skill-format}} in a template resolves to the full content of src/prompts/partials/skill-format.md. Other {{varName}} tokens are substituted from the vars object passed to loadPrompt(). Partials are resolved before variables.
Claude CLI Invocation
runner.js spawns claude -p with --allowedTools Read,Glob,Grep — read-only tools so Claude can explore the codebase. For --verbose mode, uses --output-format stream-json to show real-time activity. Handles timeout (manual timer + SIGTERM), rate-limit detection, and non-zero exits.
Interactive UI
Use @clack/prompts for all user-facing interaction (spinners, confirms, selects, multiselects). Use picocolors for inline color. --mode and --strategy flags allow non-interactive/CI usage.
Error Handling
Throw descriptive errors with remediation hints. Commands call process.exit(1) on unrecoverable failures. File reads use try/catch and return null on failure. Doc init falls back to chunked mode on timeout.
Skill File Format
Generated skills use YAML frontmatter followed by structured markdown:
---
name: domain-name
description: One-line description
---
## Activation
Triggers when editing these files:
- `**/pattern*.js`
---
You are working on **description**.
## Key Files
## Key Concepts
## Critical RulesSkills are written to .claude/skills/<name>/skill.md in the target repo. The full spec is in src/prompts/partials/skill-format.md.
Phase Status
| Phase | Status |
| 1: Scanner + Skill Format | Done |
| 2: Doc Init (3 modes, improve/rewrite/skip, verbose, chunked) | Done |
| 3: Doc Sync (git diff, skill mapping, hook installer) | Done |
| 4: À La Carte Components | Planned |
| 5: API Mode (Anthropic SDK) | Planned |
| 6: Docs Site (Astro Starlight) | Planned |
| 7: Launch (npm publish) | Planned |
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.

