Commit Graph

279 Commits

Author SHA1 Message Date
Alex Notov
d68ef5ae51 fix(ci): use beta version for slash commands support
Switch from @v1 to @beta to enable experimental_slash_commands_dir
parameter which is required for slash commands to work properly
2025-09-08 08:17:42 -06:00
Alex Notov
bbf6a17a85 feat(ci): convert Claude prompts to reusable slash commands
- Create .github/slash-commands/ with link-review, model-check, notebook-review
- Update GitHub Actions to use slash commands instead of inline prompts
- Add symlinks in .claude/commands/ for local development
- Document slash commands in CONTRIBUTING.md
- Use claude-code-action@v1 instead of beta

This allows developers to run the same CI validations locally using
Claude Code slash commands before pushing changes.
2025-09-08 08:03:45 -06:00
Alex Notov
7938498146 refactor: simplify model validation to use Claude AI
Major simplification of CI/CD:
- Remove complex Python model validation scripts (400+ lines)
- Let Claude handle model validation intelligently via GitHub Actions
- Claude fetches latest models from docs.anthropic.com/en/docs/about-claude/models/overview.md
- Add comprehensive notebook validation script for local testing
  - Interactive dashboard with progress tracking
  - Auto-fix for deprecated models
  - GitHub issue export format
  - Idempotent with state persistence
- Simplify CI to use single Python version (3.11)
- Update workflows to use Claude for all intelligent validation

Benefits:
- No more hardcoded model lists to maintain
- Claude understands context (e.g., educational examples)
- 50% faster CI (removed matrix strategy)
- Single source of truth for models (docs site)
2025-09-07 17:27:34 -06:00
Alex Notov
27cb34cabd fix: remove hardcoded Haiku model recommendation
- Brittle check that will break with new model versions
- Claude already provides intelligent model recommendations
- Not all notebooks should use Haiku (some need more capability)
2025-09-07 16:59:22 -06:00
Alex Notov
0cbf8bdee0 perf: remove unnecessary Python matrix strategy
- Use Python 3.11 only (no version-specific code in notebooks)
- Reduces CI runtime by 50%
- Reduces API costs by 50% for notebook execution
- Simplifies PR checks (one instead of two identical)
2025-09-07 16:57:14 -06:00
Alex Notov
72faf94f92 fix: align lychee config with docs repo best practices
- Add skip_code_blocks=true (important for notebooks with example code)
- Add require_https=false for development flexibility
- Simplify accept codes to just 403 and 429 (like docs)
- Add www.claude.ai to exclusions
- Exclude .github/ and scripts/ paths from checking
- Better comments explaining each setting
2025-09-07 16:54:27 -06:00
Alex Notov
97647e97e2 refactor: let Claude handle security checks intelligently
- Remove brittle hardcoded API key checks from validate_notebooks.py
- Enhance Claude review to check for any secrets (not just Anthropic)
- Claude understands context (e.g., educational 'bad examples' are OK)
2025-09-07 16:50:53 -06:00
Alex Notov
027216e0d6 feat: enhance notebook review to validate cookbook usability
- Check for clear introduction explaining the notebook's purpose
- Validate configuration instructions are present
- Ensure connecting explanations between cells for better flow
2025-09-07 16:47:05 -06:00
Alex Notov
3ab4f7d735 feat: add Claude-powered PR review workflows
- Add claude-notebook-review.yml for intelligent code review
- Add claude-link-review.yml for link quality checks
- Update notebook-quality.yml to properly capture test outputs
- Use anthropics/claude-code-action@beta like docs repo
2025-09-07 16:36:41 -06:00
Alex Notov
13111dc0d3 fix: correct nbformat validator command in CI
The correct command is 'python -m nbformat.validator' not
'python -m nbformat.validator.validate'
2025-09-07 16:09:47 -06:00
Alex Notov
d7db210bd4 fix: remove nbstripout and preserve notebook outputs
Notebook outputs are educational content in cookbook repositories.
They show users what to expect when running the code.

- Remove nbstripout from all dependencies and configurations
- Remove nbstripout check from CI workflow
- Update documentation to explain outputs are intentional
- Make validation scripts non-blocking for POC
- Fix lychee configuration conflict

The CI now validates notebooks without removing demonstration outputs.
2025-09-07 16:07:13 -06:00
Alex Notov
dad3a564bd Revert "fix: remove redundant security scan and strip notebook outputs"
This reverts commit fc1c9d183e.
2025-09-07 16:04:45 -06:00
Alex Notov
dd1ce0a3f2 fix: make CI non-blocking for POC demonstration
- Make ruff checks non-blocking (|| true) for notebooks
- Make model validation report issues but not fail
- This allows the POC to demonstrate issue detection without blocking

The CI now shows what issues exist without preventing the PR from
being merged, which is appropriate for a proof of concept.
2025-09-07 15:58:44 -06:00
Alex Notov
fc1c9d183e fix: remove redundant security scan and strip notebook outputs
- Remove security-scan.yml since GitHub secret scanning is already enabled
- Strip outputs from all notebooks to pass nbstripout validation
- GitHub's built-in secret scanning provides:
  - Automatic detection of exposed secrets
  - Push protection to block commits with secrets
  - Validity checks for detected secrets
2025-09-07 15:55:18 -06:00
Alex Notov
dd8ef7dca4 fix: configure uv to use public PyPI
Add uv.toml to force public PyPI usage instead of internal artifactory.
Regenerate uv.lock with public registry for CI compatibility.
2025-09-07 15:47:39 -06:00
Alex Notov
c1494a2073 fix: add uv.lock for reproducible CI builds
The CI workflows expect uv.lock for caching dependencies.
2025-09-07 15:44:12 -06:00
Alex Notov
4c1f9af8c6 refactor: simplify notebook CI/CD by removing nbqa and papermill
Remove nbqa in favor of ruff's native Jupyter support (v0.6.0+).
Replace papermill with nbconvert due to uv dependency resolution issues.
Also remove S105/S106 ignores to enforce better security practices.

- Update pyproject.toml to use ruff v0.12.12 with native notebook support
- Replace papermill with nbconvert for notebook execution
- Remove nbqa from all dependencies and pre-commit hooks
- Update GitHub Actions workflows to use ruff directly
- Remove hardcoded password ignores for better security
- Update documentation to reflect simplified setup
- Add dummy package structure for hatchling build system

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-07 15:37:36 -06:00
Alex Notov
e5a91f0e26 fix(deps): adjust dependency versions for Python 3.11 compatibility
- Use nbqa>=1.8.0 for Python 3.11 support
- Use ruff>=0.7.0 for compatibility
2025-09-05 19:03:45 -06:00
Alex Notov
1968c6c807 chore(config): add .env.example for local development
- Provide template for API key configuration
- Include recommended test settings
- Document optional environment variables
2025-09-05 19:01:50 -06:00
Alex Notov
1242e44298 docs(contributing): add comprehensive contribution guide
- Document development setup with uv
- Explain notebook quality standards
- Add git workflow and conventional commits guide
- Include testing instructions
- Document pre-commit hooks usage
2025-09-05 19:01:25 -06:00
Alex Notov
e0d22d077e ci(links): add link checking with lychee
- Configure lychee for notebook link validation
- Set up GitHub workflow for PR and scheduled checks
- Exclude API endpoints and localhost from checks
- Add PR comment integration for broken links
2025-09-05 19:00:20 -06:00
Alex Notov
3b522f033b chore(git): configure pre-commit hooks
- Add nbstripout to clean notebook outputs
- Configure nbqa with ruff for notebook linting
- Add ruff for Python file formatting
- Add custom hooks for model and notebook validation
2025-09-05 18:59:37 -06:00
Alex Notov
60d3273707 ci(github): add notebook validation workflows
- Add notebook-quality.yml with papermill execution testing
- Add claude-model-check.yml for model validation
- Add security-scan.yml for secret detection
- Implement tiered testing (full for maintainers, mock for external)
2025-09-05 18:58:22 -06:00
Alex Notov
5024724f83 feat(scripts): add model validation with dynamic fetching from docs
- Add allowed_models.py that fetches latest models from Anthropic docs
- Implement 24-hour cache to avoid excessive requests
- Fall back to hardcoded list if fetch fails
- Add check_models.py to validate model usage in notebooks
- Add validate_notebooks.py for security and structure checks
- Update .gitignore for cache files
2025-09-05 18:57:13 -06:00
Alex Notov
723c23dbfc ci(deps): add uv package manager with pyproject.toml
- Configure project dependencies and dev tools
- Set up ruff linting configuration
- Configure nbstripout for clean notebooks
2025-09-05 18:54:32 -06:00
Jason Kim
3e74f6cd96 Merge pull request #189 from anthropics/jkim/fix-timestamp-bucket-alignment
Align timestamps to bucket boundaries in Usage & Cost API cookbook
2025-08-18 13:59:10 -04:00
Jason Kim MacBook
a029bcc389 Align timestamps to bucket boundaries in Usage & Cost API cookbook
Update timestamp generation to snap to bucket boundaries to ensure
consistent data retrieval, as partial dates may not return data.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 13:56:13 -04:00
Eric Harmeling
e8641d103e Merge pull request #188 from anthropics/jkim/add-usage-cost-api-cookbook
Add Usage & Cost Admin API cookbook
2025-08-18 13:04:48 -04:00
Jason Kim MacBook
874b3ca2bb Add Usage & Cost Admin API cookbook
Comprehensive guide to programmatically accessing Claude API usage and cost data for custom dashboards, cost monitoring, and usage analysis.

Features:
- Basic usage and cost tracking
- Time granularity and filtering options
- Grouping and breakdowns
- Priority Tier analysis
- Pagination for large datasets
- Error handling best practices
- Practical alerting examples
2025-08-18 12:06:07 -04:00
Jeremy Hadfield
46f21f9598 Merge pull request #159 from anthropics/jh/open_source_prompts
Add open-source prompts
2025-06-13 12:28:20 -07:00
jerhadf
b6034e05ee Add prompts 2025-06-13 12:14:53 -07:00
Ethan Dixon
66ee346c51 Merge pull request #154 from anthropics/alexander/memory-cookbook-suggestions
Memory cookbook suggestions
2025-05-29 23:07:52 -07:00
Ethan Dixon
b98b8e73e0 updated run, pending agents update 2025-05-28 21:57:00 -07:00
Eric Harmeling
fb261fd69f Merge pull request #152 from anthropics/speculative-prompt-caching
Speculative prompt caching
2025-05-28 10:09:19 -04:00
Alexander Bricken
022bcc2d06 update wording 2025-05-27 14:50:33 -04:00
Alexander Bricken
d6a05bf2d7 remove downloads folder pdf 2025-05-26 22:49:43 -04:00
Alexander Bricken
68101cbaf3 add more about context limits 2025-05-26 22:42:50 -04:00
Alexander Bricken
740073e41c suggested changes to memory introduction and agents tmp handling 2025-05-23 17:23:18 -07:00
etd-23
25cc8b82a2 Merge pull request #153 from anthropics/tools/memory-cookbook
Memory Cookbook
2025-05-22 09:34:34 -07:00
Ethan Dixon
176aa000a2 push cookbook 2025-05-22 09:18:41 -07:00
Eric Harmeling
25232bb014 Speculative prompt caching
This commit introduces a new cookbook demonstrating how to use the
speculative prompt caching pattern to reduce time-to-first-token (TTFT).
2025-05-15 17:10:48 -04:00
Elie Schoppik
eaacd9cddf Merge pull request #151 from anthropics/elie/quick-fix
format for wolfram alpha
2025-05-13 21:45:47 -04:00
Elie Schoppik
83d4c3e3e9 format for wolfram alpha 2025-05-13 13:37:26 -04:00
Elie Schoppik
5c6da07ca6 Merge pull request #148 from GiangHLe/main
Updated basic_workflows.ipynb
2025-05-13 13:35:41 -04:00
Elie Schoppik
d7288bd660 Merge pull request #150 from anthropics/elie/remove-brave
removing Brave
2025-05-13 10:03:28 -04:00
Elie Schoppik
a5c26e329a removing Brave 2025-05-12 21:36:12 -04:00
GiangHLe
310322cafa Add separation between tickets to make it easier for readers to distinguish 2025-05-02 15:39:06 +09:00
GiangHLe
1272842150 remove duplicate print 2025-05-02 15:38:55 +09:00
Ben Komalo
4a7be656bd Merge pull request #139 from anthropics/benkomalo/claude-3-7-batch-tool
Recipe for parallel tool use in Claude 3.7 Sonnet
2025-03-07 09:43:36 -08:00
Ben Komalo
fd56f9eaed Recipe for parallel tool use in Claude 3.7 Sonnet
Claude 3.7 Sonnet has a tendency to make tool calls serially, instead of
in parallel. This provides a potential workaround for users.
2025-03-06 12:11:56 -08:00