Skip to content

Instantly share code, notes, and snippets.

Claude Opus 4.7 × Claude Code で押さえておくこと

Claude Opus 4.7 は、Anthropic の公式発表では「難しいソフトウェア工学タスクでの改善」「長時間タスクの厳密さと一貫性」「指示追従の精度向上」「報告前の自己検証」が主な売りです。あわせて視覚性能も強化され、UI・スライド・文書生成の品質も上がっています。Claude Code 側でも、この“長く走れる・自分で確かめる・より自律的”という性格に合わせた機能が増えています。 ([Anthropic][1])

1. まず最初にやること: 本当に Opus 4.7 を選ぶ

  • 2026年4月16日時点で Claude Code の default モデルは、Max / Team Premium は Opus 4.7Pro / Team Standard / Enterprise / Anthropic API は Sonnet 4.6 です。さらに、Opus の使用量しきい値に達すると Sonnet にフォールバックすることがあります。Opus 4.7 を確実に使いたいなら、/model opus/model claude-opus-4-7 で明示的に切り替えるのが安全です。なお、Enterprise pay-as-you-go と Anthropic API の既定モデルは 2026年4月23日に Opus 4.7 へ変更予定です。 ([Claude][2])
  • 大きなリポジトリや長時間セッションでは 1M context を使う価値があります。Claude Code では opus[1m]claude-opus-4-7[1m] を選べます。Max / Team / Enterprise では Opus の 1M context がサブスク内Pro は extra usage です。 ([Claude][2])
  • コストと知能のバランスを取りたいなら opusplan も有力です。これは Plan Mode では Opus、実行時は Sonnet に切り替えるハイブリッド設定です。長い設計検討だけ Opus に任せたいときに向いています。 ([Claude][2])

Foundation Models

At WWDC 25 Apple opened up the on-device large-language model that powers Apple Intelligence to every iOS, iPadOS, macOS and visionOS app via a new “Foundation Models” framework. The model is a compact ~3 billion-parameter LLM that has been quantized to just 2 bits per weight, so it runs fast, offline and entirely on the user’s device, keeping data private while still handling tasks such as summarization, extraction, short-form generation and structured reasoning. ([developer.apple.com][1], [machinelearning.apple.com][2]) Below is a developer-focused English-language overview—based mainly on Apple’s own announcements, docs and WWDC sessions—followed by ready-to-paste Swift code samples.

1. What Are Apple’s On-Device Foundation Models?

Apple ships two sibling LLMs: a device-scale model (~3 B params) embedded in Apple silicon and a server-scale mixture-of-experts model that runs inside Private Cloud Compute when more heft is required. ([machinelearning.apple.com][2]) The

import SwiftUI
import Foundation
import FoundationModels
import AudioToolbox
enum Role: Hashable {
case user
case assistant
}
// https://twitter.com/koher/status/1627284858493075463
for n in 2 ... 1000000 {
var a = n * n - 1
while a.isMultiple(of: 2) {
a /= 2
}
while a.isMultiple(of: 5) {
a /= 5
}
guard a == 1 else { continue }
import Foundation
actor UUIDSerialNumberGenerator {
static let shared: UUIDSerialNumberGenerator = .init()
private var nextSerialNumber: Int = 0
private var uuidToSerialNumber: [UUID: Int] = [:]
private init() {}

標準入力で1以上の整数が一つ与えられます。このとき、1から与えられた整数までの合計を計算して出力するプログラムを、Swiftで書いて下さい。


次のようなSwiftプログラムを書くことで、1から与えられた整数までの合計を計算して出力できます。

import Foundation

// 入力
import CoreGraphics
let vectors: [CGVector] = [CGVector(dx: 2, dy: 1), CGVector(dx: -3, dy: 0)]
// ∞ノルムの平均の計算
// extension なし
vectors.lazy
.map { max($0.dx.magnitude, $0.dy.magnitude) }
.reduce(0, +) / CGFloat(vectors.count)
@koher
koher / JSON.swift
Created October 23, 2021 00:32
Codable JSON type in Swift
enum JSON {
case number(Double)
case boolean(Bool)
case string(String)
case array([JSON])
case object([String: JSON])
case null
}
extension JSON: Codable {
// https://algo-method.com/tasks/302
func readInt3(line: Int = #line, file: String = #file) -> (Int, Int, Int) {
let values = readLine()!.split(separator: " ").map { Int(String($0))! }
precondition(values.count == 3)
return (values[0], values[1], values[2])
}
var (n, x, y) = readInt3()
for _ in 2 ..< n {
let aa = (1...100).shuffled().dropFirst(50).sorted()
print(aa.count, 100)
print(aa.map(\.description).joined(separator: " "))
let aaSet = Set(aa)
var count = 0
var ans: [Int] = []
for i in 1 ... 1000 {
if aaSet.contains(i) { continue }