Table of Contents
A Claude Code routine is a saved automation containing a prompt, repository context, connectors, and one or more triggers. It runs on Anthropic-managed cloud infrastructure, or a configured self-hosted environment, so a scheduled run does not depend on your laptop remaining open.
This tutorial creates a read-only weekday routine that finds stale Linear issues assigned to you and writes a concise morning summary. Claude Code Routines are in research preview, so availability, labels, limits, and configuration options may change. Check Anthropic's current Routines documentation if your interface differs.
What the finished routine will do
- Run at 9:00 AM on weekdays in the selected time zone.
- Use the Linear connector and no unrelated connectors.
- Find assigned issues that match explicit status, age, and priority filters.
- Produce a predictable Markdown summary without changing any issues.
- Show a clear message when no matching issue exists.
Start with read-only work. After the routine is reliable, you can consider a separate write-enabled routine with narrower permissions and approval controls.
Before you begin
You need access to Claude Code Routines and a working Linear connector, or an equivalent issue-tracking connector such as Jira or GitHub. Confirm that your account can read the relevant project and that the connector does not have unnecessary administrative privileges.
A routine can include repository context. Select only the repository relevant to the task, and review its routine environment and permissions. Do not expose secrets through committed files, environment output, prompts, or connector results.
Step 1: Create a routine
Open the Routines area in a supported Claude Code interface and choose the option to create a routine. Give it a name that describes its result, such as Weekday stale-issue summary.
Review every configuration section before saving. A routine is more than a recurring prompt: its repositories, connectors, environment, and triggers determine what it can access and when it runs.
Step 2: Add a schedule trigger
Add a scheduled trigger for Monday through Friday at 9:00 AM. Select the intended time zone explicitly and confirm how daylight-saving changes will be handled. If the interface displays a cron expression, verify the preview rather than assuming the server uses your computer's local time.
| Setting | Value for this example |
|---|---|
| Trigger | Schedule |
| Days | Monday to Friday |
| Time | 9:00 AM |
| Time zone | Your working time zone, selected explicitly |
Routines can also support other trigger types, including API calls or events, depending on the current product. A schedule is the simplest choice for a daily report.
Step 3: Limit repositories and connectors
Enable only the issue tracker required for this task. Remove Gmail, Slack, Notion, databases, cloud consoles, or other connectors that the routine does not need. If the routine only reports on Linear, it should not have a tool that sends email or modifies source code.
This improves three things:
- Security: a compromised or misunderstood instruction has fewer places to read from or act on.
- Reliability: Claude has a smaller, clearer tool set.
- Debugging: failures are easier to trace to one data source.
Connectors inherit the authenticated person's permissions in the connected service. Product-level access control still matters: Claude cannot create least privilege if the underlying account is overprivileged. Review Anthropic's connector guidance and the source application's access settings.
Step 4: Use a bounded prompt
Paste and adapt this prompt. Replace status and priority names with the exact values used in your workspace:
You create my weekday stale-issue summary.
Use Linear in read-only mode. Do not update, comment on, assign,
close, or otherwise modify any issue.
1. Find issues assigned to me that match all of these filters:
- status: In Progress
- last updated: more than 3 business days ago
- priority: Medium or higher
2. For each matching issue, report:
- issue ID and title
- last update date
- a possible blocker, clearly labeled as an inference
- one concrete next step
3. Use exactly this output format:
## Stale issues today: {count}
### {issue-id}: {title}
- Last updated: {date}
- Possible blocker: {one sentence}
- Next step: {one sentence}
4. If there are no matching issues, output exactly:
No stale issues matched the filters.
Keep the complete report under 300 words.
Do not invent missing fields. If Linear cannot be reached, report the
connector error instead of claiming there are no issues.
Why the prompt is dependable
- Narrow query: assignment, status, age, and priority are explicit.
- Read-only boundary: the routine is told not to change tickets.
- Fixed output: the template reduces formatting drift.
- Empty state: no results are distinguishable from an error.
- Uncertainty label: a guessed blocker is not presented as a fact.
- Length bound: the summary remains scannable and limits unnecessary output.
A word limit controls response length, not total input cost. Large connector results can still consume substantial context. Use filters at the source whenever the connector supports them.
Step 5: Review the complete configuration
- Name: Weekday stale-issue summary
- Trigger: weekdays at 9:00 AM in the correct time zone
- Repository: only relevant project context, if required
- Connector: Linear only
- Action scope: read-only
- Prompt: exact filters, output template, empty state, and error behavior
- Environment: no unnecessary secrets or network access
Save the routine only after confirming these settings. If a team administrator manages connectors or environments, verify that the configuration complies with the organization's policy.
Step 6: Run it manually
Use the available manual-run control before relying on the schedule. Inspect the run log and output:
- Did the Linear connector authenticate successfully?
- Did the query return only issues assigned to you?
- Are status, age, and priority filters correct?
- Does the report use the requested headings and bullets?
- Are inferred blockers labeled as possibilities rather than facts?
- Were any issues changed? This example should make no changes.
- Does a connector failure look different from an empty result?
Compare several listed issues with Linear directly. A formatted result is not proof that the query was correct.
Common setup problems
The routine runs at the wrong time
Open the trigger and check its saved time zone and schedule preview. Do not infer the time zone from your device clock.
The result is empty
First distinguish “zero matching issues” from connector or permission failure. Temporarily relax one filter at a time, inspect the exact status and priority names, and verify the connected account can see the project.
The output changes format
Keep a literal output template in the prompt. If downstream software reads the result, prefer a supported structured output or deterministic validation rather than relying only on Markdown.
Too much data is retrieved
Move filters into the connector query when possible, reduce the time range, select fewer fields, and cap the number of results. A short final answer does not undo the cost of retrieving an unnecessarily large backlog.
The routine changes issues unexpectedly
Pause the routine, inspect its tools and log, revoke unneeded write permissions, and restore affected records. Prompt instructions are not a security boundary; tool permissions and approval gates must enforce the restriction.
When to use a routine instead of another scheduler
Routines are useful when the job benefits from Claude Code's repository understanding and reasoning. For a deterministic build, deployment, or fixed data transformation, a conventional scheduler or CI workflow may be easier to test and audit. See our comparison of Claude Code Routines, GitHub Actions, Zapier, n8n, and cron.
Before allowing a routine to edit code or use powerful tools, follow this Claude Code risk-management guide. Start with one job, one source, one output, and the least authority that can complete the task.
-
Question 1:
A routine produces a table on one run and paragraphs on the next. What should you change first?
EXPLAIN:
A literal template gives Claude a stable structure to follow. Frequency does not correct formatting.
-
Question 2:
What is the safest useful first routine?
EXPLAIN:
A bounded read-only task is easier to verify and limits the effect of an error.
-
Question 3:
Why remove connectors that a routine does not need?
EXPLAIN:
Fewer unnecessary tools make behavior easier to reason about and reduce what a compromised instruction can reach.
Training results
You have completed 0 questions.
-- / --
Reader Comments 0
Sign in with email or Google to join the discussion.