agentleFS
aspenkitaspenkit/aspens/.github/copilot-instructions.md

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

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
  1. Very specific:

    No build step. No test runner configured yet — tests/ is empty.

    line 22
  2. Very specific:

    Check prerequisites (git repo, .claude/skills/ exists)

    line 60
  3. Distinctive:

    Write updated files (force mode — sync is meant to be automated)

    line 65
  4. Very specific:

    Always resolve to absolute paths with path.resolve() / path.join().

    line 73
  5. Very specific:

    Use @clack/prompts for all user-facing interaction (spinners, confirms, selects, multiselects).

    line 85

≈ “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.

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

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 commit

Project Setup

npm install   # installs commander, @clack/prompts, picocolors
npm link      # makes `aspens` available globally for testing

No 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.md

doc init Pipeline

  1. scanRepo() — detect languages, frameworks, structure, domains, entry points
  2. User picks mode: all-at-once / chunked / pick domains / base-only
  3. User picks strategy for existing docs: improve / rewrite / skip
  4. loadPrompt() — resolve {{partial-name}} and {{varName}} in the template
  5. runClaude() — spawn claude -p with --allowedTools Read,Glob,Grep — Claude explores the repo itself
  6. parseFileOutput() — extract <file path="...">content</file> blocks from Claude's response
  7. writeSkillFiles() — mkdir + write, respecting --force / --dry-run

doc sync Pipeline

  1. Check prerequisites (git repo, .claude/skills/ exists)
  2. Get git diff for last N commits
  3. Map changed files → affected skills (via activation pattern matching, generic segments filtered)
  4. Send diff + existing skills to Claude with Read/Glob/Grep tools
  5. Claude updates only affected skills, outputs nothing if no changes needed
  6. 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 Rules

Skills 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

PhaseStatus
1: Scanner + Skill FormatDone
2: Doc Init (3 modes, improve/rewrite/skip, verbose, chunked)Done
3: Doc Sync (git diff, skill mapping, hook installer)Done
4: À La Carte ComponentsPlanned
5: API Mode (Anthropic SDK)Planned
6: Docs Site (Astro Starlight)Planned
7: Launch (npm publish)Planned

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.