dg
npx skills add https://github.com/dagster-io/dagster-claude-plugins --skill dg
Agent 安装分布
Skill 文档
Dagster CLI (dg) Skill
This skill helps users interact with the Dagster CLI (dg) for all project management, component
scaffolding, asset execution, definition discovery, log retrieval, and troubleshooting operations.
When to Use This Skill
Auto-invoke when users mention:
- “create a project” / “new dagster project” / “initialize project”
- “create workspace” / “new workspace” / “multi-project setup”
- “scaffold” / “generate” / “create component” / “add asset”
- “launch asset” / “run asset” / “materialize” / “execute”
- “list assets” / “show definitions” / “what assets exist”
- “view logs” / “check logs” / “show run output”
- “prototype” / “implement asset” / “full implementation”
- “troubleshoot” / “debug” / “why did it fail” / “what went wrong”
- Any other
dgCLI operation
Workflow Decision Tree
Choose the right dg workflow based on what the user needs:
What do you need to do?
ââ Setting up a new project?
â ââ Single project â /dg create project
â ââ Multiple projects â /dg create workspace
â
ââ Creating or adding components?
â ââ Assets, schedules, sensors â /dg scaffold defs
â ââ Integrations (dbt, Fivetran, dlt) â /dg scaffold defs <integration>
â ââ Custom inline component â /dg scaffold defs inline-component
â ââ Reusable component type â /dg scaffold component
â
ââ Running or executing assets?
â ââ Single asset â /dg launch --assets <name>
â ââ Multiple assets â /dg launch --assets <name1>,<name2>
â ââ Assets by tag/group/kind â /dg launch --assets "tag:x" / "group:y" / "kind:z"
â ââ Specific partition â /dg launch --assets <name> --partition <key>
â ââ Partition range (backfill) â /dg launch --assets <name> --partition-range <start...end>
â ââ Predefined job â /dg launch --job <name>
â
ââ Discovering what exists?
â ââ All definitions â /dg list defs
â ââ Available component types â /dg list components
â ââ Environment variables â /dg list envs
â ââ Projects in workspace â /dg list projects
â ââ Component tree â /dg list component-tree
â
ââ Viewing logs or output?
â ââ Recent runs â /dg logs
â ââ Specific run â /dg logs <run_id>
â ââ Follow live logs â /dg logs --follow
â ââ Filter logs â /dg logs --log-level <level>
â
ââ Implementing with full code?
â ââ Production-ready asset â /dg prototype
â ââ With best practices â /dg prototype + /dagster-best-practices
â ââ Integration-specific â /dg prototype + /dagster-integrations
â
ââ Debugging or troubleshooting?
ââ Failed run analysis â /dg troubleshoot <run_id>
ââ Component issues â /dg list defs to verify
ââ Environment issues â /dg list envs to check
ââ Definition loading â /dg check defs
How It Works
When this skill is invoked:
- Identify the user’s intent from their natural language request
- Map to appropriate
dgworkflow using the decision tree above - Access relevant reference documentation from
references/directory - Provide clear command examples with copy-pasteable syntax
- Explain expected output and next steps
- Cross-reference related workflows when helpful
Core Workflows
Project Creation
Create new Dagster projects or workspaces:
- Single project:
dg create project <name>– For standalone applications - Workspace:
dg create workspace <name>– For multiple related projects
See references/create-project.md and
references/create-workspace.md for detailed guidance.
Component Scaffolding
Generate Dagster components, assets, and integrations:
- Assets:
dg scaffold defs dagster.asset <path> - Schedules:
dg scaffold defs dagster.schedule <name> - Sensors:
dg scaffold defs dagster.sensor <name> - dbt:
dg scaffold defs dagster_dbt.DbtProjectComponent <name> - Fivetran:
dg scaffold defs fivetran.FivetranComponent <name> - dlt:
dg scaffold defs dagster_dlt.DltResource <name> - Sling:
dg scaffold defs sling.SlingReplicationComponent <name> - Inline components:
dg scaffold defs inline-component <path> --typename <Name> - Component types:
dg scaffold component <name>
Discovery-first workflow: Always use dg list components before scaffolding to see available
types.
See references/scaffold.md for comprehensive scaffolding
documentation.
Asset Execution
Launch (materialize) Dagster assets:
- Single asset:
dg launch --assets my_asset - Multiple assets:
dg launch --assets asset1,asset2 - All assets:
dg launch --assets "*" - By tag:
dg launch --assets "tag:priority=high" - By group:
dg launch --assets "group:sales" - By kind:
dg launch --assets "kind:dbt" - With partition:
dg launch --assets my_asset --partition 2024-01-15 - Partition range:
dg launch --assets my_asset --partition-range "2024-01-01...2024-01-31" - Specific job:
dg launch --job my_daily_job
Environment setup: Use .env files with uv run dg launch or
set -a; source .env; set +a; dg launch
See references/launch.md for execution details.
Definition Discovery
Inspect your Dagster project definitions:
- All definitions:
dg list defs - As JSON:
dg list defs --json - Filter assets:
dg list defs --assets "tag:x" - Component types:
dg list components - By package:
dg list components --package dagster_dbt - Environment vars:
dg list envs - Projects:
dg list projects(workspace only) - Component tree:
dg list component-tree
See references/list.md for discovery operations.
Log Retrieval
View run logs and execution output:
- Recent runs:
dg logs - Specific run:
dg logs <run_id> - Follow live:
dg logs --follow - Log level filter:
dg logs --log-level ERROR - Step logs:
dg logs <run_id> --step <step_name> - Compute logs:
dg logs <run_id> --compute-logs
See references/logs.md for log viewing.
Prototyping
Generate production-ready asset implementations:
- Guided implementation:
dg prototype– Interactive workflow - Direct creation: Implement assets with full logic, not just scaffolds
- Best practices: Combine with
/dagster-best-practicesfor patterns
See references/prototype.md for implementation guidance.
Troubleshooting
Debug failed runs and issues:
- Analyze failure:
dg troubleshoot <run_id> - Recent failures:
dg troubleshoot(analyzes most recent) - Failure patterns: Identifies common issues and solutions
- Component validation:
dg check defs
See references/troubleshoot.md for debugging.
When to Use This Skill vs. Others
| User Need | Use This Skill (/dg) | Alternative Skill |
|---|---|---|
| “create an asset” | â
Yes – /dg â scaffold reference |
|
| “launch my assets” | â
Yes – /dg â launch reference |
|
| “list definitions” | â
Yes – /dg â list reference |
|
| “best practices for assets” | â No | /dagster-best-practices |
| “which integration to use” | â No | /dagster-integrations |
| “Python code standards” | â No | /dignified-python |
| “create project + best practices” | â Yes, then cross-reference | /dagster-best-practices |
| “scaffold dbt + learn patterns” | â Yes, then cross-reference | /dagster-integrations |
Cross-Skill References
Use /dagster-best-practices for:
- Deciding how to structure assets
- Choosing automation patterns (schedules vs sensors vs automation conditions)
- Understanding when to use resources
- Learning testing strategies
- ETL pattern guidance
- Project architecture decisions
Use /dagster-integrations for:
- Discovering available integration libraries
- Understanding integration-specific patterns
- Choosing between similar integrations
- Learning integration best practices
Use /dignified-python for:
- Python type annotation standards
- Exception handling patterns
- CLI implementation guidelines
- Pathlib best practices
- Modern Python syntax (3.10-3.13)
Common Usage Patterns
New Project Setup
# 1. Create project
dg create project my_analytics
cd my_analytics
# 2. List available components
dg list components --package dagster_dbt
dg list components --package fivetran
# 3. Scaffold integrations
dg scaffold defs dagster_dbt.DbtProjectComponent dbt_project
dg scaffold defs fivetran.FivetranComponent salesforce --json-params '{...}'
# 4. Scaffold downstream assets
dg scaffold defs dagster.asset analytics/revenue --format python
# 5. Scaffold automation
dg scaffold defs dagster.schedule daily_refresh --format python
# 6. Verify structure
dg list defs
# 7. Test execution
dg launch --assets revenue
Development Workflow
# 1. Check what exists
dg list defs
# 2. Scaffold new asset
dg scaffold defs dagster.asset sales/customers --format python
# 3. Edit the asset (implement logic)
vim defs/sales/customers/defs.py
# 4. Verify it loads
dg list defs
# 5. Test execution
dg launch --assets customers
# 6. View logs if needed
dg logs --follow
# 7. Debug if failed
dg troubleshoot
Discovery Workflow
# 1. What assets exist?
dg list defs
# 2. What component types can I scaffold?
dg list components
# 3. Are my environment variables set?
dg list envs
# 4. What's the project structure?
dg list component-tree
Implementation Notes
- This skill delegates to comprehensive reference documentation in
references/ - All
dgCLI operations are covered (create, scaffold, launch, list, logs, prototype, troubleshoot) - Dynamic command generation: Some subcommands (like
scaffold defs) are dynamically generated based on installed packages - Always encourage discovery-first workflows:
dg list componentsbeforedg scaffold - Provide working examples with realistic parameters
- Guide users through interactive disambiguation when component names are ambiguous
- Cross-reference other skills (
/dagster-best-practices,/dagster-integrations) when architectural guidance is needed
Reference Documentation
Full detailed documentation for each workflow:
create-project.md– Creating new Dagster projectscreate-workspace.md– Creating multi-project workspacesscaffold.md– Scaffolding components, assets, and integrationslaunch.md– Materializing assets and executing jobslist.md– Discovering definitions and componentslogs.md– Viewing run logs and outputprototype.md– Implementing production-ready assetstroubleshoot.md– Debugging failed runs and issues
See Also
- Architectural guidance:
/dagster-best-practices– Learn patterns for assets, automation, testing, project structure - Integration discovery:
/dagster-integrations– Find and understand integration libraries - Python standards:
/dignified-python– Production Python code quality patterns