This file provides guidance to agentic coding tools when working with code in this repository.
This is currently a template repository. If you see this message, check if this is a new repo based on the template, by seeing if the git remote is ascorbic/library-template. If not, you need to set up a new project by updating the following:
- Package names: Update
@ascorbic/examplein allpackage.jsonfiles to your new package name - Repository URLs: Update git repository URLs in
package.jsonfiles. Check the current git remote for this. - README files: Update README.md files with your project information
- Test files: Rename
packages/example/test/hello.test.tsto a more appropriate test name - Package directory: Rename
packages/example/to your actual package name - Workspace name: Update the workspace name in the root
package.json - Changeset configuration in
.changeset/config.json:- Update
repofield fromascorbic/library-templateto your actual repository (e.g.,yourname/yourrepo) - Review the
ignorearray and remove/update package names as needed for your project
- Update
- Release workflow: Activate the release workflow by renaming it:
mv .github/workflows/release.yml.template .github/workflows/release.yml
- GitHub Secrets: Set up required secrets using 1Password CLI and GitHub CLI:
# Set GitHub App secrets from "Mixiebot GitHub" 1Password entry
# Note: Use --format json | jq -r to extract raw values without quotes
op item get "Mixiebot GitHub" --account my.1password.com --fields "app id" --format json | jq -r '.value' | gh secret set APP_ID
op item get "Mixiebot GitHub" --account my.1password.com --fields "private key" --format json | jq -r '.value' | gh secret set APP_PRIVATE_KEYFor CLAUDE_CODE_OAUTH_TOKEN: Tell the user to open Claude Code and run the /install-github-app command, which will guide them through setting up the GitHub app and automatically add the secret to their repository. Note: The user must be a repository admin to install the GitHub app and add secrets.
-
npm Trusted Publishing: The user must manually configure trusted publishing on npmjs.com for their packages to enable OIDC authentication (no NPM_TOKEN needed). Tell them to:
-
Publish a 0.0.0 version of the package locally (one-time setup)
-
Navigate to the package page on npmjs.com
-
Click on "Settings"
-
Follow the GitHub authentication flow
-
Enter the repository name and
release.ymlas the workflow name -
Repository Settings and Branch Protection: Configure repository settings and branch protection rules using the GitHub CLI. Get the current repository name first:
# Get repository name (format: owner/repo)
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
# Configure repository settings
gh api repos/$REPO --method PATCH \
-f allow_squash_merge=true \
-f allow_merge_commit=false \
-f allow_rebase_merge=false \
-f delete_branch_on_merge=true \
-f allow_auto_merge=true \
-f allow_update_branch=true \
-f squash_merge_commit_message=COMMIT_MESSAGES \
-f squash_merge_commit_title=COMMIT_OR_PR_TITLE \
-f has_wiki=false
# Create branch protection ruleset for main branch
gh api repos/$REPO/rulesets --method POST --input - <<'EOF'
{
"name": "main",
"target": "branch",
"enforcement": "active",
"conditions": {
"ref_name": {
"include": ["~DEFAULT_BRANCH"],
"exclude": []
}
},
"rules": [
{"type": "deletion"},
{"type": "non_fast_forward"},
{"type": "required_linear_history"},
{
"type": "pull_request",
"parameters": {
"required_approving_review_count": 0,
"dismiss_stale_reviews_on_push": false,
"require_code_owner_review": false,
"require_last_push_approval": false,
"required_review_thread_resolution": false,
"allowed_merge_methods": ["merge", "squash", "rebase"]
}
},
{
"type": "required_status_checks",
"parameters": {
"strict_required_status_checks_policy": true,
"do_not_enforce_on_create": true,
"required_status_checks": [
{"context": "test"},
{"context": "Validate PR title"}
]
}
}
],
"bypass_actors": [
{"actor_type": "RepositoryRole", "actor_id": 5, "bypass_mode": "always"}
]
}
EOFAfter setup, remove this section from CLAUDE.md.
This is a monorepo library template using pnpm workspaces with the following structure:
- Root: Workspace configuration and shared tooling
- packages/: Individual library packages (currently contains
examplepackage) - demos/: Demo applications and examples
pnpm build- Build all packagespnpm test- Run tests for all packagespnpm check- Run type checking and linting for all packagespnpm format- Format code using Prettier
pnpm build- Build the package using tsdown (ESM + DTS output)pnpm dev- Watch mode for developmentpnpm test- Run vitest testspnpm check- Run publint and @arethetypeswrong/cli checks
- Uses pnpm as package manager
- tsdown for building TypeScript packages with ESM output and declaration files
- vitest for testing
- publint and @arethetypeswrong/cli for package validation
- Prettier for code formatting (configured to use tabs in
.prettierrc)
Each package in packages/ follows this structure:
src/index.ts- Main entry pointtest/- Test filesdist/- Built output (ESM + .d.ts files)- Package exports configured for ESM-only with proper TypeScript declarations
Uses strict TypeScript configuration with:
- Target: ES2022
- Module: preserve (for bundler compatibility)
- Strict mode with additional safety checks (
noUncheckedIndexedAccess,noImplicitOverride) - Library-focused settings (declaration files, declaration maps)