Commit Graph

299 Commits

Author SHA1 Message Date
Alex Notov
09e59d768d Fix: Revert accidental case-sensitive changes
Reverted unintended case changes that occurred during the global rename:
- GitHub Actions: Changed ANTHROPIC_API_KEY back to anthropic_api_key in workflow files
- Python function: Changed ANTHROPIC_API_KEY parameter back to anthropic_api_key in ContextualVectorDB class

These changes maintain consistency with Python naming conventions (snake_case) and
the original GitHub Actions workflow configuration.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-16 17:11:14 -06:00
Alex Notov
8d1c93365b Revert CLAUDE_API_KEY to ANTHROPIC_API_KEY throughout the repository
Reverted all instances of CLAUDE_API_KEY back to ANTHROPIC_API_KEY to maintain
compatibility with existing infrastructure and GitHub secrets. This affects:
- Environment variable examples (.env.example files)
- Python scripts and notebooks
- Documentation and README files
- Evaluation scripts and test files

Other naming changes (Claude API, Claude Console, Claude Docs, Claude Cookbook) remain intact.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-16 17:02:29 -06:00
Alex Notov
27e3c055fc Fix CI: Revert CLAUDE_API_KEY to ANTHROPIC_API_KEY in GitHub Actions
The GitHub Actions workflows were updated to use CLAUDE_API_KEY but the repository
secrets still use ANTHROPIC_API_KEY. Reverting to maintain compatibility with
existing infrastructure while keeping all other Claude branding changes.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-16 16:59:11 -06:00
Alex Notov
bfffab4523 chore: Updates all references per new branding. 2025-09-16 16:35:49 -06:00
Alex Notov
419ee5b84e Merge pull request #197 from anthropics/jiri/small_fix
Added settings.local.json to CC SDK
2025-09-15 13:18:16 -06:00
Jiri De Jonghe
0da22d751c Added settings.local.json to CC SDK 2025-09-15 19:31:21 +01:00
Jiri De Jonghe
f26aa5891c Add Claude Code SDK tutorials and examples (#195)
* Add Claude Code SDK tutorials and examples

This PR adds comprehensive tutorials and examples for the Claude Code SDK, including:
- Research agent implementation with web search capabilities
- Chief of Staff agent with multi-agent coordination
- Observability agent with Docker configuration
- Supporting utilities and documentation

The examples demonstrate key SDK features:
- Multi-turn conversations with ClaudeSDKClient
- Custom output styles and slash commands
- Hooks for automated actions and governance
- Script execution via Bash tool
- Multi-agent orchestration patterns

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: rodrigo olivares <rodrigoolivares@anthropic.com>
Co-authored-by: Alex Notov <zh@anthropic.com>
2025-09-12 15:04:34 -07:00
Alex Notov
fa326a49e0 Merge pull request #194 from anthropics/fix/expand-ci-notebook-coverage
fix(ci): expand CI coverage to all notebook directories
2025-09-11 15:00:08 -06:00
Alex Notov
cfb97d9066 fix: remove SAST workflow due to inaccessible action 2025-09-11 14:52:03 -06:00
Alex Notov
5e02d662d1 fix(ci): expand CI coverage to all notebook directories
Previously, CI workflows only monitored notebooks in the skills/ directory.
This caused PR #193 to merge without pedagogical review since its notebook
was in tool_evaluation/.

Changes:
- Update all notebook-related CI workflows to monitor **/*.ipynb
- Add SAST security monitoring workflow for code security analysis
- Update validate_notebooks.py to check all repository notebooks
- Fix notebook discovery in links.yml workflow

This ensures comprehensive CI coverage for all 9+ directories containing
notebooks (skills/, tool_evaluation/, misc/, tool_use/, third_party/, etc.)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 14:46:30 -06:00
ant-ken
0164f4b5b5 Merge pull request #193 from anthropics/kenaizawa/writing_effective_tools
feat: writing effective tools blog post
2025-09-11 00:50:38 -04:00
Ken Aizawa
e205ca8903 fix: more illustrative run 2025-09-11 04:23:33 +00:00
Ken Aizawa
e9bb3e1008 feat: writing effective tools 2025-09-10 23:43:39 +00:00
Alex Notov
afb6dad5dc Merge pull request #191 from anthropics/zh/add-notebook-ci-validation
ci: add notebook CI/CD with validation and testing
2025-09-08 18:01:58 -06:00
Alex Notov
1653c3b47a fix(ci): specify PR number explicitly in gh pr comment commands
Update all slash commands to include the PR number from GitHub Actions
context variable when posting comments. This ensures Claude knows which
PR to comment on when running in CI.
2025-09-08 09:13:52 -06:00
Alex Notov
0db9450b22 fix(ci): explicitly instruct Claude to post PR comments
Add explicit instruction to use 'gh pr comment' command to post
reviews to the PR. Claude was performing reviews but not posting
them without this explicit direction.
2025-09-08 08:59:04 -06:00
Alex Notov
230133989a fix(ci): correct YAML key format to allowed-tools
Change from allowed_tools to allowed-tools (hyphen not underscore)
to match the correct YAML frontmatter format
2025-09-08 08:47:39 -06:00
Alex Notov
4cb0d11969 fix(ci): add allowed_tools to slash commands for PR commenting
Based on maintainer feedback, slash commands need allowed_tools
specified to enable PR commenting. Added gh pr tools for:
- gh pr comment: Post comments to PR
- gh pr diff: View PR diff
- gh pr view: View PR details
2025-09-08 08:43:35 -06:00
Alex Notov
46c5717029 fix(ci): simplify to v1 with built-in slash command support
Based on maintainer feedback:
- Move commands directly to .claude/commands/ (no symlinks needed)
- Use v1 with minimal configuration (auto mode detection)
- Remove unnecessary parameters (mode, use_sticky_comment, etc.)
- v1 automatically finds commands in .claude/commands/
2025-09-08 08:35:10 -06:00
Alex Notov
6cc0be8971 fix(ci): set mode to agent for automatic execution
The beta version defaults to 'tag' mode which requires manual triggering.
Set mode to 'agent' to run automatically on PR events.
2025-09-08 08:21:36 -06:00
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